diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 20 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 94 |
2 files changed, 49 insertions, 65 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index faa00d1862..ccb3e75ac8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -133,6 +133,15 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) } /******************************************************************* + Reads or writes an NTTIME structure. +********************************************************************/ + +BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) +{ + return smb_io_time( desc, nttime, ps, depth ); +} + +/******************************************************************* Gets an enumeration handle from an ENUM_HND structure. ********************************************************************/ @@ -680,7 +689,7 @@ BOOL smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BU if(!prs_align(ps)) return False; - if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) + if(!prs_uint32("buf_max_len", ps, depth, &buf2->buf_max_len)) return False; if(!prs_uint32("offset ", ps, depth, &buf2->offset)) return False; @@ -1081,6 +1090,9 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { + prs_debug(ps, depth, desc, "prs_unistr4"); + depth++; + if ( !prs_uint16("length", ps, depth, &uni4->length )) return False; if ( !prs_uint16("size", ps, depth, &uni4->size )) @@ -1728,6 +1740,11 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) if(!prs_uint32("uni_str_len", ps, depth, &name->uni_str_len)) return False; + + /* we're done if there is no string */ + + if ( name->uni_str_len == 0 ) + return True; /* don't know if len is specified by uni_str_len member... */ /* assume unicode string is unicode-null-terminated, instead */ @@ -1738,7 +1755,6 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) return True; } - /******************************************************************* Stream a uint64_struct ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a51b4269e3..ce23d15a11 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -75,6 +75,8 @@ BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if(!prs_align(ps)) + return False; if(!prs_uint32("access", ps, depth, &q_u->access)) return False; @@ -1056,8 +1058,8 @@ makes a structure. ********************************************************************/ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, - uint32 val_idx, char *name, - uint32 max_buf_len) + uint32 val_idx, + uint32 max_name_len, uint32 max_buf_len) { ZERO_STRUCTP(q_u); @@ -1065,19 +1067,21 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, q_u->val_index = val_idx; - init_unistr4( &q_u->name, name, UNI_STR_TERMINATE ); + q_u->name.size = max_name_len*2; + q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 ); + q_u->name.string->uni_max_len = max_name_len; q_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); *q_u->type = 0x0; - q_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER ); q_u->value->buf_max_len = max_buf_len; - q_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); - *q_u->len_value1 = max_buf_len; + q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->buffer_len = max_buf_len; - q_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); - *q_u->len_value2 = max_buf_len; + q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->name_len = 0x0; } /******************************************************************* @@ -1088,8 +1092,6 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) { uint32 real_size; - DEBUG(8,("init_reg_r_enum_val: Enter\n")); - ZERO_STRUCTP(r_u); /* value name */ @@ -1110,13 +1112,10 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) /* lengths */ - r_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); - *r_u->len_value1 = real_size; - - r_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); - *r_u->len_value2 = real_size; - - DEBUG(8,("init_reg_r_enum_val: Exit\n")); + r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buffer_len1 = real_size; + r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buffer_len2 = real_size; } /******************************************************************* @@ -1153,9 +1152,9 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("len_value1", ps, depth, (void**)&q_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("len_value2", ps, depth, (void**)&q_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1189,12 +1188,11 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("len_value1", ps, depth, (void**)&r_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("len_value2", ps, depth, (void**)&r_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_werror("status", ps, depth, &r_u->status)) return False; @@ -1305,23 +1303,14 @@ void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx) makes a reply structure. ********************************************************************/ -void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, - uint32 unknown_2) +void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey ) { if ( !r_u ) return; - r_u->unknown_1 = unknown_1; - r_u->unknown_2 = unknown_2; - r_u->unknown_3 = 0x0; - - r_u->key_name_len = (strlen(subkey)+1) * 2; - if (r_u->key_name_len) - r_u->ptr1 = 0x1; - init_unistr3( &r_u->key_name, subkey ); - - r_u->ptr2 = 0x1; - r_u->ptr3 = 0x1; + init_unistr4( &r_u->keyname, subkey, STR_TERMINATE ); + r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); } /******************************************************************* @@ -1392,42 +1381,21 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, i if(!prs_align(ps)) return False; + if ( !prs_unistr4( "keyname", ps, depth, &q_u->keyname ) ) + return False; - if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len)) + if(!prs_align(ps)) return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; - if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1)) + if(!prs_align(ps)) return False; - - if (q_u->ptr1 != 0) { - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) - return False; - if(!prs_uint32("unknown_3", ps, depth, &q_u->unknown_3)) - return False; - if(!smb_io_unistr3("key_name", &q_u->key_name, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) + if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) return False; - if (q_u->ptr2 != 0) { - if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2))) - return False; - } - - if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3)) + if(!prs_align(ps)) return False; - - if (q_u->ptr3 != 0) { - if(!smb_io_time("", &q_u->time, ps, depth)) - return False; - } - if(!prs_werror("status", ps, depth, &q_u->status)) return False; |