diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_misc.h | 42 | ||||
-rw-r--r-- | source3/include/rpc_netlogon.h | 14 | ||||
-rw-r--r-- | source3/include/rpc_reg.h | 29 | ||||
-rw-r--r-- | source3/registry/reg_db.c | 7 | ||||
-rw-r--r-- | source3/rpc_client/cli_reg.c | 16 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 93 | ||||
-rw-r--r-- | source3/rpc_parse/parse_net.c | 21 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 25 | ||||
-rw-r--r-- | source3/rpc_server/srv_reg_nt.c | 10 | ||||
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 20 |
10 files changed, 129 insertions, 148 deletions
diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index e93d6610ba..dcc0ecc554 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -147,20 +147,12 @@ typedef struct { /********************************************************************** - * Buffers use by winreg + * Buffers **********************************************************************/ -/* - OLD COMMENT: - BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer - pathetic. some stupid team of \PIPE\winreg writers got the concept - of a unicode string different from the other \PIPE\ writers - - NEW COMMENT: - buffer used by \winreg\ calls to fill in arbitrary REG_XXX values. - It *may* look like a UNISTR2 but it is *not*. This is not a goof - by the winreg developers. It is a generic buffer -*/ +/* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values. + It *may* look like a UNISTR2 but it is *not*. This is not a goof + by the winreg developers. It is a generic buffer */ typedef struct { uint32 buf_max_len; @@ -169,34 +161,22 @@ typedef struct { uint16 *buffer; } REGVAL_BUFFER; -typedef struct buffer3_info { - uint32 buf_max_len; - uint8 *buffer; /* Data */ - uint32 buf_len; -} BUFFER3; - - - -/********************************************************************** - * Buffers use by spoolss - **********************************************************************/ +/* generic rpc version of the DATA_BLOB. Just a length and uint8 array */ typedef struct { uint32 buf_len; - uint16 *buffer; /* data */ -} BUFFER5; - - + uint8 *buffer; +} RPC_DATA_BLOB; /********************************************************************** - * Buffers use by netlogon + * Buffers use by spoolss (i might be able to replace it with + * an RPC_DATA_BLOB) **********************************************************************/ typedef struct { uint32 buf_len; - uint8 *buffer; -} BUFFER4; - + uint16 *buffer; /* data */ +} BUFFER5; /********************************************************************** diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index 3ba1ce6465..6812358575 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -643,7 +643,7 @@ typedef struct sam_domain_info_info UNISTR2 uni_dom_name; UNISTR2 buf_oem_info; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; LOCKOUT_STRING account_lockout; @@ -670,7 +670,7 @@ typedef struct sam_group_info_info UNISTR2 uni_grp_name; UNISTR2 uni_grp_desc; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_GROUP_INFO; @@ -748,11 +748,11 @@ typedef struct sam_account_info_info uint32 unknown1; /* 0x4EC */ uint32 unknown2; /* 0 */ - BUFFER4 buf_logon_hrs; + RPC_DATA_BLOB buf_logon_hrs; UNISTR2 uni_comment; UNISTR2 uni_parameters; SAM_PWD pass; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_profile; } SAM_ACCOUNT_INFO; @@ -783,7 +783,7 @@ typedef struct sam_alias_info_info uint8 reserved[40]; UNISTR2 uni_als_name; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_als_desc; } SAM_ALIAS_INFO; @@ -829,7 +829,7 @@ typedef struct UNISTR2 domain_name; DOM_SID2 domain_sid; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_DELTA_POLICY; /* SAM_DELTA_TRUST_DOMS */ @@ -881,7 +881,7 @@ typedef struct UNIHDR *hdr_privslist; UNISTR2 *uni_privslist; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_DELTA_PRIVS; /* SAM_DELTA_SECRET */ diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index 51f8ff8d96..f70fb5f03c 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -45,7 +45,7 @@ #define REG_RESTORE_KEY 0x13 #define REG_SAVE_KEY 0x14 #define REG_SET_KEY_SEC 0x15 -#define REG_CREATE_VALUE 0x16 +#define REG_SET_VALUE 0x16 #define REG_SHUTDOWN 0x18 #define REG_ABORT_SHUTDOWN 0x19 #define REG_GETVERSION 0x1a @@ -209,12 +209,13 @@ typedef struct { POLICY_HND pol; UNISTR4 name; uint32 type; - BUFFER3 *value; -} REG_Q_CREATE_VALUE; + RPC_DATA_BLOB value; + uint32 size; +} REG_Q_SET_VALUE; typedef struct { WERROR status; -} REG_R_CREATE_VALUE; +} REG_R_SET_VALUE; /***********************************************/ @@ -331,13 +332,29 @@ typedef struct { /***********************************************/ + +/* I have no idea if this is correct since I + have not seen the full structure on the wire + as of yet */ + +typedef struct { + uint32 max_len; + uint32 len; + SEC_DESC *secdesc; +} REG_SEC_DESC_BUF; + +typedef struct { + uint32 size; /* size in bytes of security descriptor */ + REG_SEC_DESC_BUF secdesc; + uint8 inherit; /* see MSDN for a description */ +} SECURITY_ATTRIBUTE; + typedef struct { POLICY_HND pol; UNISTR4 filename; - uint32 unknown; /* I'm pretty sure this is a pointer to a SEC_DESC as per MSDN */ + SECURITY_ATTRIBUTE *sec_attr; } REG_Q_SAVE_KEY; - typedef struct { WERROR status; /* return status */ } REG_R_SAVE_KEY; diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 5ac8329309..f93b7e1ffb 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -65,6 +65,13 @@ static BOOL init_registry_data( void ) return False; regsubkey_ctr_destroy( &subkeys ); +#ifdef REG_TEST_CODE + pstrcpy( keyname, KEY_HKLM ); + pstrcat( keyname, "/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Print" ); + if ( !regdb_store_reg_keys( keyname, &subkeys )) + return False; +#endif + regsubkey_ctr_init( &subkeys ); pstrcpy( keyname, KEY_HKLM ); pstrcat( keyname, "/SYSTEM/CurrentControlSet/Control" ); diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index 773144742b..0d7d194850 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -651,14 +651,14 @@ done: /**************************************************************************** do a REG Create Value ****************************************************************************/ -WERROR cli_reg_create_val(struct cli_state *cli, TALLOC_CTX *mem_ctx, +WERROR cli_reg_set_val(struct cli_state *cli, TALLOC_CTX *mem_ctx, POLICY_HND *hnd, char *val_name, uint32 type, - BUFFER3 *data) + RPC_DATA_BLOB *data) { prs_struct rbuf; prs_struct qbuf; - REG_Q_CREATE_VALUE q_o; - REG_R_CREATE_VALUE r_o; + REG_Q_SET_VALUE q_o; + REG_R_SET_VALUE r_o; WERROR result = WERR_GENERAL_FAILURE; prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); @@ -666,17 +666,17 @@ WERROR cli_reg_create_val(struct cli_state *cli, TALLOC_CTX *mem_ctx, /* Marshall data and send request */ - init_reg_q_create_val(&q_o, hnd, val_name, type, data); + init_reg_q_set_val(&q_o, hnd, val_name, type, data); - if (!reg_io_q_create_val("", &q_o, &qbuf, 0) || - !rpc_api_pipe_req(cli, PI_WINREG, REG_CREATE_VALUE, &qbuf, &rbuf)) + if (!reg_io_q_set_val("", &q_o, &qbuf, 0) || + !rpc_api_pipe_req(cli, PI_WINREG, REG_SET_VALUE, &qbuf, &rbuf)) goto done; ZERO_STRUCT(r_o); /* Unmarshal response */ - if (reg_io_r_create_val("", &r_o, &rbuf, 0)) + if (reg_io_r_set_val("", &r_o, &rbuf, 0)) result = r_o.status; done: diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 858366d4ad..faa00d1862 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -554,105 +554,69 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) } /******************************************************************* - Allocate the BUFFER3 memory. + Allocate the RPC_DATA_BLOB memory. ********************************************************************/ -static size_t create_buffer3(BUFFER3 *str, size_t len) +static size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("create_buffer3: talloc fail\n"); + smb_panic("create_rpc_blob: talloc fail\n"); return len; } /******************************************************************* - Inits a BUFFER3 structure from a uint32 + Inits a RPC_DATA_BLOB structure from a uint32 ********************************************************************/ -void init_buffer3_uint32(BUFFER3 *str, uint32 val) +void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val) { ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = str->buf_len = create_buffer3(str, sizeof(uint32)); + str->buf_len = create_rpc_blob(str, sizeof(uint32)); SIVAL(str->buffer, 0, val); } /******************************************************************* - Inits a BUFFER3 structure. + Inits a RPC_DATA_BLOB structure. ********************************************************************/ -void init_buffer3_str(BUFFER3 *str, const char *buf, int len) +void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len) { ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = str->buf_len = create_buffer3(str, len*2); - rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE); + str->buf_len = create_rpc_blob(str, len*2); + rpcstr_push(str->buffer, buf, str->buf_len, STR_TERMINATE); } /******************************************************************* - Inits a BUFFER3 structure from a hex string. + Inits a RPC_DATA_BLOB structure from a hex string. ********************************************************************/ -void init_buffer3_hex(BUFFER3 *str, const char *buf) +void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf) { ZERO_STRUCTP(str); - str->buf_max_len = str->buf_len = create_buffer3(str, strlen(buf)); - str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); + str->buf_len = create_rpc_blob(str, strlen(buf)); + str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); } /******************************************************************* - Inits a BUFFER3 structure. + Inits a RPC_DATA_BLOB structure. ********************************************************************/ -void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, size_t len) +void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len) { ZERO_STRUCTP(str); /* max buffer size (allocated size) */ if (buf != NULL) { - len = create_buffer3(str, len); + len = create_rpc_blob(str, len); memcpy(str->buffer, buf, len); } - str->buf_max_len = len; - str->buf_len = buf != NULL ? len : 0; -} - -/******************************************************************* - Reads or writes a BUFFER3 structure. - the uni_max_len member tells you how large the buffer is. - the uni_str_len member tells you how much of the buffer is really used. -********************************************************************/ - -BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) -{ - if (buf3 == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_buffer3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("uni_max_len", ps, depth, &buf3->buf_max_len)) - return False; - - if (UNMARSHALLING(ps)) { - buf3->buffer = PRS_ALLOC_MEM(ps, unsigned char, buf3->buf_max_len); - if (buf3->buffer == NULL) - return False; - } - - if(!prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len)) - return False; - - if(!prs_uint32("buf_len ", ps, depth, &buf3->buf_len)) - return False; - - return True; + str->buf_len = len; } /******************************************************************* @@ -1816,23 +1780,30 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) } /******************************************************************* -reads or writes a BUFFER4 structure. +reads or writes a RPC_DATA_BLOB structure. ********************************************************************/ -BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "smb_io_buffer4"); + prs_debug(ps, depth, desc, "smb_io_rpc_blob"); depth++; prs_align(ps); - prs_uint32("buf_len", ps, depth, &buf4->buf_len); + if ( !prs_uint32("buf_len", ps, depth, &blob->buf_len) ) + return False; + + if ( blob->buf_len == 0 ) + return True; + if (UNMARSHALLING(ps)) { - buf4->buffer = PRS_ALLOC_MEM(ps, uint8, buf4->buf_len); - if (!buf4->buffer) { + blob->buffer = PRS_ALLOC_MEM(ps, uint8, blob->buf_len); + if (!blob->buffer) { return False; } } - prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); + + if ( !prs_uint8s(True, "buffer", ps, depth, blob->buffer, blob->buf_len) ) + return False; return True; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d7bdca4df9..ed95656fda 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1972,8 +1972,7 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, info->hdr_oem_info.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; if (!smb_io_account_lockout_str("account_lockout", &info->account_lockout, @@ -2021,8 +2020,7 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_unistr2("uni_grp_desc", &info->uni_grp_desc, info->hdr_grp_desc.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; return True; @@ -2274,8 +2272,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) return False; - if (!smb_io_buffer4("buf_logon_hrs", &info->buf_logon_hrs, - info->ptr_logon_hrs, ps, depth)) + if (!smb_io_rpc_blob("buf_logon_hrs", &info->buf_logon_hrs, ps, depth)) return False; prs_align(ps); if (!smb_io_unistr2("uni_comment", &info->uni_comment, @@ -2316,8 +2313,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], return False; ps->data_offset = old_offset + len; } - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; prs_align(ps); if (!smb_io_unistr2("uni_profile", &info->uni_profile, @@ -2436,8 +2432,7 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, @@ -2596,8 +2591,7 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; @@ -2831,8 +2825,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; return True; diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e76c536cee..a51b4269e3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -639,8 +639,10 @@ BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, i if(!prs_unistr4("filename", ps, depth, &q_u->filename)) return False; +#if 0 /* reg_io_sec_attr() */ if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) return False; +#endif return True; } @@ -1203,9 +1205,9 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, makes a structure. ********************************************************************/ -void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol, +void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol, char *val_name, uint32 type, - BUFFER3 *val) + RPC_DATA_BLOB *val) { ZERO_STRUCTP(q_u); @@ -1214,19 +1216,20 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol, init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); q_u->type = type; - q_u->value = val; + q_u->value = *val; + q_u->size = val->buf_len; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_create_val"); + prs_debug(ps, depth, desc, "reg_io_q_set_val"); depth++; if(!prs_align(ps)) @@ -1242,11 +1245,15 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct if(!prs_uint32("type", ps, depth, &q_u->type)) return False; - if(!smb_io_buffer3("value", q_u->value, ps, depth)) + + if(!smb_io_rpc_blob("value", &q_u->value, ps, depth )) return False; if(!prs_align(ps)) return False; + if(!prs_uint32("size", ps, depth, &q_u->size)) + return False; + return True; } @@ -1254,12 +1261,12 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_r_set_val(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_create_val"); + prs_debug(ps, depth, desc, "reg_io_r_set_val"); depth++; if(!prs_align(ps)) @@ -1451,7 +1458,7 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *p if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_entry"); + prs_debug(ps, depth, desc, "reg_io_q_open_entry"); depth++; if(!prs_align(ps)) diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c index ad7aaa4469..f031a3213f 100644 --- a/source3/rpc_server/srv_reg_nt.c +++ b/source3/rpc_server/srv_reg_nt.c @@ -720,6 +720,7 @@ WERROR _reg_abort_shutdown(pipes_struct *p, REG_Q_ABORT_SHUTDOWN *q_u, REG_R_ABO WERROR _reg_restore_key(pipes_struct *p, REG_Q_RESTORE_KEY *q_u, REG_R_RESTORE_KEY *r_u) { REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol ); + pstring filename; DEBUG(5,("_reg_restore_key: Enter\n")); @@ -731,7 +732,9 @@ WERROR _reg_restore_key(pipes_struct *p, REG_Q_RESTORE_KEY *q_u, REG_R_RESTORE_ if ( !regkey ) return WERR_BADFID; - DEBUG(8,("_reg_restore_key: verifying backup of key [%s]\n", regkey->name)); + rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE); + + DEBUG(8,("_reg_restore_key: verifying restore of key [%s] from \"%s\"\n", regkey->name, filename)); #if 0 validate_reg_filemame( filename ); @@ -747,6 +750,7 @@ WERROR _reg_restore_key(pipes_struct *p, REG_Q_RESTORE_KEY *q_u, REG_R_RESTORE_ WERROR _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_u) { REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol ); + pstring filename; DEBUG(5,("_reg_save_key: Enter\n")); @@ -758,7 +762,9 @@ WERROR _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_u) if ( !regkey ) return WERR_BADFID; - DEBUG(8,("_reg_save_key: verifying backup of key [%s]\n", regkey->name)); + rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE); + + DEBUG(8,("_reg_save_key: verifying backup of key [%s] to \"%s\"\n", regkey->name, filename)); #if 0 validate_reg_filemame( filename ); diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 7eb3a1052b..fcc18cd9f5 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -320,7 +320,7 @@ static void cmd_reg_query_key(struct client_info *info) /**************************************************************************** nt registry create value ****************************************************************************/ -static void cmd_reg_create_val(struct client_info *info) +static void cmd_reg_set_val(struct client_info *info) { BOOL res = True; BOOL res3 = True; @@ -333,7 +333,7 @@ static void cmd_reg_create_val(struct client_info *info) fstring val_name; fstring tmp; uint32 val_type; - BUFFER3 value; + RPC_DATA_BLOB value; #if 0 uint32 unk_0; @@ -343,7 +343,7 @@ static void cmd_reg_create_val(struct client_info *info) val_name, *val_type) : False; #endif - DEBUG(5, ("cmd_reg_create_val: smb_cli->fd:%d\n", smb_cli->fd)); + DEBUG(5, ("cmd_reg_set_val: smb_cli->fd:%d\n", smb_cli->fd)); if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname))) { @@ -383,12 +383,12 @@ static void cmd_reg_create_val(struct client_info *info) { case 0x01: /* UNISTR */ { - init_buffer3_str(&value, tmp, strlen(tmp)+1); + init_rpc_blob_str(&value, tmp, strlen(tmp)+1); break; } case 0x03: /* BYTES */ { - init_buffer3_hex(&value, tmp); + init_rpc_blob_hex(&value, tmp); break; } case 0x04: /* DWORD */ @@ -402,7 +402,7 @@ static void cmd_reg_create_val(struct client_info *info) { tmp_val = strtol(tmp, (char**)NULL, 10); } - init_buffer3_uint32(&value, tmp_val); + init_rpc_blob_uint32(&value, tmp_val); break; } default: @@ -434,7 +434,7 @@ static void cmd_reg_create_val(struct client_info *info) } /* create an entry */ - res4 = res3 ? do_reg_create_val(smb_cli, &parent_pol, + res4 = res3 ? do_reg_set_val(smb_cli, &parent_pol, val_name, val_type, &value) : False; /* flush the modified key */ @@ -454,12 +454,12 @@ static void cmd_reg_create_val(struct client_info *info) if (res && res3 && res4) { - DEBUG(5,("cmd_reg_create_val: query succeeded\n")); + DEBUG(5,("cmd_reg_set_val: query succeeded\n")); fprintf(out_hnd,"OK\n"); } else { - DEBUG(5,("cmd_reg_create_val: query failed\n")); + DEBUG(5,("cmd_reg_set_val: query failed\n")); } } @@ -988,7 +988,7 @@ struct cmd_set reg_commands[] = { { "regqueryval", cmd_reg_query_info, "Registry Value Query", "<valname>" }, { "regquerykey", cmd_reg_query_key, "Registry Key Query", "<keyname>" }, { "regdeleteval", cmd_reg_delete_val, "Registry Value Delete", "<valname>" }, - { "regcreateval", cmd_reg_create_val, "Registry Key Create", "<valname> <valtype> <value>" }, + { "regsetval", cmd_reg_set_val, "Registry Key Create", "<valname> <valtype> <value>" }, { "reggetsec", cmd_reg_get_key_sec, "Registry Key Security", "<keyname>" }, { "regtestsec", cmd_reg_test_key_sec, "Test Registry Key Security", "<keyname>" }, #endif |