summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h16
-rw-r--r--source3/rpc_parse/parse_prs.c318
2 files changed, 0 insertions, 334 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 740cc4198b..d68aa4b619 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5676,32 +5676,16 @@ void prs_switch_type(prs_struct *ps, bool io);
void prs_force_dynamic(prs_struct *ps);
void prs_set_session_key(prs_struct *ps, const char sess_key[16]);
bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
-bool prs_pointer( const char *name, prs_struct *ps, int depth,
- void *dta, size_t data_size,
- bool (*prs_fn)(const char*, prs_struct*, int, void*) );
bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32);
bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64);
-bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
-bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status);
bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
-bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len);
bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str);
bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size);
-bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str);
-bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset);
-bool prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16,
- uint32 ptr_uint16, uint32 start_offset);
-bool prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset);
-bool prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32,
- uint32 ptr_uint32, uint32 data_size);
-int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps);
-int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx);
-bool prs_hash1(prs_struct *ps, uint32 offset, int len);
void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level,
enum schannel_direction direction,
RPC_AUTH_SCHANNEL_CHK * verf,
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 0f4829dec3..621ccf4bc9 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -637,42 +637,6 @@ bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
}
/*******************************************************************
- Stream a uint16* (allocate memory if unmarshalling)
- ********************************************************************/
-
-bool prs_pointer( const char *name, prs_struct *ps, int depth,
- void *dta, size_t data_size,
- bool (*prs_fn)(const char*, prs_struct*, int, void*) )
-{
- void ** data = (void **)dta;
- uint32 data_p;
-
- /* output f000baaa to stream if the pointer is non-zero. */
-
- data_p = *data ? 0xf000baaa : 0;
-
- if ( !prs_uint32("ptr", ps, depth, &data_p ))
- return False;
-
- /* we're done if there is no data */
-
- if ( !data_p )
- return True;
-
- if (UNMARSHALLING(ps)) {
- if (data_size) {
- if ( !(*data = PRS_ALLOC_MEM(ps, char, data_size)) )
- return False;
- } else {
- *data = NULL;
- }
- }
-
- return prs_fn(name, ps, depth, *data);
-}
-
-
-/*******************************************************************
Stream a uint16.
********************************************************************/
@@ -784,36 +748,6 @@ bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64)
}
/*******************************************************************
- Stream a NTSTATUS
- ********************************************************************/
-
-bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
-{
- char *q = prs_mem_get(ps, sizeof(uint32));
- if (q == NULL)
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (ps->bigendian_data)
- *status = NT_STATUS(RIVAL(q,0));
- else
- *status = NT_STATUS(IVAL(q,0));
- } else {
- if (ps->bigendian_data)
- RSIVAL(q,0,NT_STATUS_V(*status));
- else
- SIVAL(q,0,NT_STATUS_V(*status));
- }
-
- DEBUGADD(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
- nt_errstr(*status)));
-
- ps->data_offset += sizeof(uint32);
-
- return True;
-}
-
-/*******************************************************************
Stream a DCE error code
********************************************************************/
@@ -843,38 +777,6 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st
return True;
}
-
-/*******************************************************************
- Stream a WERROR
- ********************************************************************/
-
-bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status)
-{
- char *q = prs_mem_get(ps, sizeof(uint32));
- if (q == NULL)
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (ps->bigendian_data)
- *status = W_ERROR(RIVAL(q,0));
- else
- *status = W_ERROR(IVAL(q,0));
- } else {
- if (ps->bigendian_data)
- RSIVAL(q,0,W_ERROR_V(*status));
- else
- SIVAL(q,0,W_ERROR_V(*status));
- }
-
- DEBUGADD(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
- win_errstr(*status)));
-
- ps->data_offset += sizeof(uint32);
-
- return True;
-}
-
-
/******************************************************************
Stream an array of uint8s. Length is number of uint8s.
********************************************************************/
@@ -952,60 +854,6 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin
}
/******************************************************************
- Start using a function for streaming unicode chars. If unmarshalling,
- output must be little-endian, if marshalling, input must be little-endian.
- ********************************************************************/
-
-static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struct *ps,
- char *in_buf, char *out_buf, int len)
-{
- int i;
-
- if (UNMARSHALLING(ps)) {
- if (ps->bigendian_data) {
- for (i = 0; i < len; i++)
- SSVAL(out_buf,2*i,RSVAL(in_buf, 2*i));
- } else {
- for (i = 0; i < len; i++)
- SSVAL(out_buf, 2*i, SVAL(in_buf, 2*i));
- }
- } else {
- if (ps->bigendian_data) {
- for (i = 0; i < len; i++)
- RSSVAL(in_buf, 2*i, SVAL(out_buf,2*i));
- } else {
- for (i = 0; i < len; i++)
- SSVAL(in_buf, 2*i, SVAL(out_buf,2*i));
- }
- }
-
- DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
- if (charmode)
- print_asc(5, (unsigned char*)out_buf, 2*len);
- else {
- for (i = 0; i < len; i++)
- DEBUGADD(5,("%04x ", out_buf[i]));
- }
- DEBUGADD(5,("\n"));
-}
-
-/******************************************************************
- Stream a unistr. Always little endian.
- ********************************************************************/
-
-bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len)
-{
- char *q = prs_mem_get(ps, len * sizeof(uint16));
- if (q == NULL)
- return False;
-
- dbg_rw_punival(charmode, name, depth, ps, q, (char *)data16s, len);
- ps->data_offset += (len * sizeof(uint16));
-
- return True;
-}
-
-/******************************************************************
Stream an array of uint32s. Length is number of uint32s.
********************************************************************/
@@ -1216,172 +1064,6 @@ bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_
return True;
}
-bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str)
-{
- size_t len;
- char *tmp_str;
-
- if (UNMARSHALLING(ps)) {
- len = strlen(&ps->data_p[ps->data_offset]);
- } else {
- len = strlen(*str);
- }
-
- tmp_str = PRS_ALLOC_MEM(ps, char, len+1);
-
- if (tmp_str == NULL) {
- return False;
- }
-
- if (MARSHALLING(ps)) {
- strncpy(tmp_str, *str, len);
- }
-
- if (!prs_string(name, ps, depth, tmp_str, len+1)) {
- return False;
- }
-
- *str = tmp_str;
- return True;
-}
-
-/*******************************************************************
- prs_uint16 wrapper. Call this and it sets up a pointer to where the
- uint16 should be stored, or gets the size if reading.
- ********************************************************************/
-
-bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset)
-{
- *offset = ps->data_offset;
- if (UNMARSHALLING(ps)) {
- /* reading. */
- return prs_uint16(name, ps, depth, data16);
- } else {
- char *q = prs_mem_get(ps, sizeof(uint16));
- if(q ==NULL)
- return False;
- ps->data_offset += sizeof(uint16);
- }
- return True;
-}
-
-/*******************************************************************
- prs_uint16 wrapper. call this and it retrospectively stores the size.
- does nothing on reading, as that is already handled by ...._pre()
- ********************************************************************/
-
-bool prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16,
- uint32 ptr_uint16, uint32 start_offset)
-{
- if (MARSHALLING(ps)) {
- /*
- * Writing - temporarily move the offset pointer.
- */
- uint16 data_size = ps->data_offset - start_offset;
- uint32 old_offset = ps->data_offset;
-
- ps->data_offset = ptr_uint16;
- if(!prs_uint16(name, ps, depth, &data_size)) {
- ps->data_offset = old_offset;
- return False;
- }
- ps->data_offset = old_offset;
- } else {
- ps->data_offset = start_offset + (uint32)(*data16);
- }
- return True;
-}
-
-/*******************************************************************
- prs_uint32 wrapper. Call this and it sets up a pointer to where the
- uint32 should be stored, or gets the size if reading.
- ********************************************************************/
-
-bool prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset)
-{
- *offset = ps->data_offset;
- if (UNMARSHALLING(ps) && (data32 != NULL)) {
- /* reading. */
- return prs_uint32(name, ps, depth, data32);
- } else {
- ps->data_offset += sizeof(uint32);
- }
- return True;
-}
-
-/*******************************************************************
- prs_uint32 wrapper. call this and it retrospectively stores the size.
- does nothing on reading, as that is already handled by ...._pre()
- ********************************************************************/
-
-bool prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32,
- uint32 ptr_uint32, uint32 data_size)
-{
- if (MARSHALLING(ps)) {
- /*
- * Writing - temporarily move the offset pointer.
- */
- uint32 old_offset = ps->data_offset;
- ps->data_offset = ptr_uint32;
- if(!prs_uint32(name, ps, depth, &data_size)) {
- ps->data_offset = old_offset;
- return False;
- }
- ps->data_offset = old_offset;
- }
- return True;
-}
-
-/* useful function to store a structure in rpc wire format */
-int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps)
-{
- TDB_DATA dbuf;
- dbuf.dptr = (uint8 *)ps->data_p;
- dbuf.dsize = prs_offset(ps);
- return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE);
-}
-
-/* useful function to fetch a structure into rpc wire format */
-int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx)
-{
- TDB_DATA dbuf;
-
- prs_init_empty(ps, mem_ctx, UNMARSHALL);
-
- dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr)
- return -1;
-
- prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True);
-
- return 0;
-}
-
-/*******************************************************************
- hash a stream.
- ********************************************************************/
-
-bool prs_hash1(prs_struct *ps, uint32 offset, int len)
-{
- char *q;
-
- q = ps->data_p;
- q = &q[offset];
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100, ("prs_hash1\n"));
- dump_data(100, (uint8 *)ps->sess_key, 16);
- dump_data(100, (uint8 *)q, len);
-#endif
- arcfour_crypt((uchar *) q, (const unsigned char *)ps->sess_key, len);
-
-#ifdef DEBUG_PASSWORD
- dump_data(100, (uint8 *)q, len);
-#endif
-
- return True;
-}
-
/*******************************************************************
Create a digest over the entire packet (including the data), and
MD5 it with the session key.