diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 65 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 14 | ||||
-rw-r--r-- | source3/rpc_parse/parse_rpc.c | 31 |
3 files changed, 105 insertions, 5 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a84469f8f9..4927886fc8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -519,6 +519,71 @@ void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, in } /******************************************************************* +initialise a BUFFER5 structure. +********************************************************************/ +void init_buffer5(BUFFER5 **str) +{ + BUFFER5 *buf5; + + buf5=(BUFFER5 *)malloc( sizeof(BUFFER5) ); + + buf5->buf_len=0; + buf5->buffer=NULL; + *str=buf5; +} + +/******************************************************************* +clear a BUFFER5 structure. +********************************************************************/ +void clear_buffer5(BUFFER5 **str) +{ + BUFFER5 *buf5; + + buf5=*str; + if (buf5->buffer != NULL ) + { + free(buf5->buffer); + } + free(buf5); + *str=NULL; +} + +/******************************************************************* +creates a BUFFER5 structure. +********************************************************************/ +void make_buffer5(BUFFER5 *str, char *buf, int len) +{ + + /* max buffer size (allocated size) */ + str->buf_len = len; + str->buffer = (uint16 *)malloc( sizeof(uint16) * len ); + ascii_to_unistr(str->buffer, buf, len); +} + +/******************************************************************* +reads or writes a BUFFER5 structure. +the buf_len member tells you how large the buffer is. +********************************************************************/ +void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_buffer4"); + depth++; + + if (buf5 == NULL) return; + + prs_align(ps); + prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); + + /* reading: alloc the buffer first */ + if ( ps->io ) + { + buf5->buffer=(uint16 *)malloc( sizeof(uint16)*buf5->buf_len ); + } + + prs_uint16s(True, "buffer ", ps, depth, buf5->buffer, buf5->buf_len); +} + +/******************************************************************* creates a BUFFER2 structure. ********************************************************************/ void make_buffer2(BUFFER2 *str, const char *buf, int len) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 23a9d5bfdf..a231fb57cf 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -158,6 +158,20 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat } /****************************************************************** + stream an array of uint16s. length is number of uint16s + ********************************************************************/ +BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) + ps->offset += len * sizeof(uint16); + + return True; +} + +/****************************************************************** stream an array of uint32s. length is number of uint32s ********************************************************************/ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 81e7ffa116..2f47f06e36 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -132,6 +132,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } \ +#define SYNT_SPOOLSS_V1 \ +{ \ + { \ + 0x78, 0x56, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab \ + }, 0x01 \ +} \ + #define SYNT_NONE_V0 \ { \ { \ @@ -153,6 +163,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; @@ -212,13 +223,22 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de /******************************************************************* creates an RPC_ADDR_STR structure. + +The name can be null (RPC Alter-Context) ********************************************************************/ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { - if (str == NULL || name == NULL) return; - - str->len = strlen(name) + 1; - fstrcpy(str->str, name); + if (str == NULL ) return; + if (name == NULL) + { + str->len = 1; + fstrcpy(str->str, ""); + } + else + { + str->len = strlen(name) + 1; + fstrcpy(str->str, name); + } } /******************************************************************* @@ -349,6 +369,7 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in creates an RPC_HDR_BA structure. lkclXXXX only one reason at the moment! +jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, @@ -357,7 +378,7 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL || pipe_addr == NULL) return; + if (rpc == NULL || transfer == NULL) return; make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); make_rpc_addr_str(&(rpc->addr), pipe_addr); |