mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
registry API moved over to new format. reg_connect() is the top-level
function, which takes \\server_name. tested a _few_ functions. found that regcreatekey receives a Fault PDU.
This commit is contained in:
@ -1909,55 +1909,58 @@ void cli_nt_session_close(struct cli_state *cli, uint16 fnum);
|
|||||||
|
|
||||||
/*The following definitions come from rpc_client/cli_reg.c */
|
/*The following definitions come from rpc_client/cli_reg.c */
|
||||||
|
|
||||||
BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
BOOL reg_connect( const char* srv_name,
|
||||||
const char *full_keyname,
|
const char *full_keyname,
|
||||||
char *key_name,
|
char *key_name,
|
||||||
POLICY_HND *reg_hnd);
|
POLICY_HND *reg_hnd);
|
||||||
BOOL do_reg_open_hkcr(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd);
|
POLICY_HND *hnd);
|
||||||
BOOL do_reg_open_hklm(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd);
|
POLICY_HND *hnd);
|
||||||
BOOL do_reg_open_hku(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hku( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd);
|
POLICY_HND *hnd);
|
||||||
BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
|
BOOL reg_flush_key( POLICY_HND *hnd);
|
||||||
BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_query_key( POLICY_HND *hnd,
|
||||||
char *key_class, uint32 *class_len,
|
char *key_class, uint32 *class_len,
|
||||||
uint32 *num_subkeys, uint32 *max_subkeylen,
|
uint32 *num_subkeys, uint32 *max_subkeylen,
|
||||||
uint32 *max_subkeysize, uint32 *num_values,
|
uint32 *max_subkeysize, uint32 *num_values,
|
||||||
uint32 *max_valnamelen, uint32 *max_valbufsize,
|
uint32 *max_valnamelen, uint32 *max_valbufsize,
|
||||||
uint32 *sec_desc, NTTIME *mod_time);
|
uint32 *sec_desc, NTTIME *mod_time);
|
||||||
BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 *unk);
|
BOOL reg_unknown_1a( POLICY_HND *hnd, uint32 *unk);
|
||||||
BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_query_info( POLICY_HND *hnd,
|
||||||
const char* val_name,
|
const char* val_name,
|
||||||
uint32 *type, BUFFER2 *buffer);
|
uint32 *type, BUFFER2 *buffer);
|
||||||
BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_set_key_sec( POLICY_HND *hnd,
|
||||||
uint32 sec_info,
|
uint32 sec_info,
|
||||||
uint32 sec_buf_size, SEC_DESC *sec_buf);
|
uint32 sec_buf_size, SEC_DESC *sec_buf);
|
||||||
BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_get_key_sec( POLICY_HND *hnd,
|
||||||
uint32 sec_info,
|
uint32 sec_info,
|
||||||
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf);
|
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf);
|
||||||
BOOL do_reg_delete_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *val_name);
|
BOOL reg_delete_val( POLICY_HND *hnd, char *val_name);
|
||||||
BOOL do_reg_delete_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *key_name);
|
BOOL reg_delete_key( POLICY_HND *hnd, char *key_name);
|
||||||
BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_create_key( POLICY_HND *hnd,
|
||||||
char *key_name, char *key_class,
|
char *key_name, char *key_class,
|
||||||
SEC_ACCESS *sam_access,
|
SEC_ACCESS *sam_access,
|
||||||
POLICY_HND *key);
|
POLICY_HND *key);
|
||||||
BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_enum_key( POLICY_HND *hnd,
|
||||||
int key_index, char *key_name,
|
int key_index, char *key_name,
|
||||||
uint32 *unk_1, uint32 *unk_2,
|
uint32 *unk_1, uint32 *unk_2,
|
||||||
time_t *mod_time);
|
time_t *mod_time);
|
||||||
BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_create_val( POLICY_HND *hnd,
|
||||||
char *val_name, uint32 type, BUFFER3 *data);
|
char *val_name, uint32 type, BUFFER3 *data);
|
||||||
BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_enum_val( POLICY_HND *hnd,
|
||||||
int val_index, int max_valnamelen, int max_valbufsize,
|
int val_index, int max_valnamelen, int max_valbufsize,
|
||||||
fstring val_name,
|
fstring val_name,
|
||||||
uint32 *val_type, BUFFER2 *value);
|
uint32 *val_type, BUFFER2 *value);
|
||||||
BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_open_entry( POLICY_HND *hnd,
|
||||||
char *key_name, uint32 unk_0,
|
char *key_name, uint32 unk_0,
|
||||||
POLICY_HND *key_hnd);
|
POLICY_HND *key_hnd);
|
||||||
BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
|
BOOL reg_close( POLICY_HND *hnd);
|
||||||
BOOL do_reg_shutdown(struct cli_state *cli, uint16 fnum,
|
BOOL reg_shutdown(const char *srv_name,
|
||||||
char *msg, uint32 timeout, uint16 flags);
|
const char *msg, uint32 timeout, uint16 flags);
|
||||||
|
|
||||||
/*The following definitions come from rpc_client/cli_samr.c */
|
/*The following definitions come from rpc_client/cli_samr.c */
|
||||||
|
|
||||||
@ -2709,7 +2712,7 @@ BOOL make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
|
|||||||
POLICY_HND *pol, uint32 status);
|
POLICY_HND *pol, uint32 status);
|
||||||
BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth);
|
BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth);
|
||||||
BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i,
|
BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i,
|
||||||
char *msg, uint32 timeout, uint16 flags);
|
const char *msg, uint32 timeout, uint16 flags);
|
||||||
BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth);
|
BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth);
|
||||||
BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth);
|
BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth);
|
||||||
|
|
||||||
@ -3602,7 +3605,7 @@ void cmd_sam_sync(struct client_info *info, int argc, char *argv[]);
|
|||||||
|
|
||||||
/*The following definitions come from rpcclient/cmd_reg.c */
|
/*The following definitions come from rpcclient/cmd_reg.c */
|
||||||
|
|
||||||
BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
|
||||||
REG_FN(reg_fn),
|
REG_FN(reg_fn),
|
||||||
REG_KEY_FN(reg_key_fn),
|
REG_KEY_FN(reg_key_fn),
|
||||||
REG_VAL_FN(reg_val_fn));
|
REG_VAL_FN(reg_val_fn));
|
||||||
|
@ -34,7 +34,7 @@ extern int DEBUGLEVEL;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Open Policy
|
do a REG Open Policy
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
BOOL reg_connect( const char* srv_name,
|
||||||
const char *full_keyname,
|
const char *full_keyname,
|
||||||
char *key_name,
|
char *key_name,
|
||||||
POLICY_HND *reg_hnd)
|
POLICY_HND *reg_hnd)
|
||||||
@ -42,20 +42,29 @@ BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
|||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
uint32 reg_type = 0;
|
uint32 reg_type = 0;
|
||||||
|
|
||||||
if (full_keyname == NULL)
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_init(srv_name, PIPE_WINREG, &cli, &fnum))
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZERO_STRUCTP(reg_hnd);
|
ZERO_STRUCTP(reg_hnd);
|
||||||
|
|
||||||
|
if (full_keyname == NULL)
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open registry receive a policy handle
|
* open registry receive a policy handle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!reg_split_key(full_keyname, ®_type, key_name))
|
if (!reg_split_key(full_keyname, ®_type, key_name))
|
||||||
{
|
{
|
||||||
DEBUG(0,("do_reg_connect: unrecognised key name %s\n", full_keyname));
|
DEBUG(0,("reg_connect: unrecognised key name %s\n",
|
||||||
|
full_keyname));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +72,7 @@ BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
|||||||
{
|
{
|
||||||
case HKEY_CLASSES_ROOT:
|
case HKEY_CLASSES_ROOT:
|
||||||
{
|
{
|
||||||
res = res ? do_reg_open_hkcr(cli, fnum,
|
res = res ? reg_open_hkcr(cli, fnum,
|
||||||
0x5428, 0x02000000,
|
0x5428, 0x02000000,
|
||||||
reg_hnd) : False;
|
reg_hnd) : False;
|
||||||
break;
|
break;
|
||||||
@ -71,7 +80,7 @@ BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
|||||||
|
|
||||||
case HKEY_LOCAL_MACHINE:
|
case HKEY_LOCAL_MACHINE:
|
||||||
{
|
{
|
||||||
res = res ? do_reg_open_hklm(cli, fnum,
|
res = res ? reg_open_hklm(cli, fnum,
|
||||||
0x84E0, 0x02000000,
|
0x84E0, 0x02000000,
|
||||||
reg_hnd) : False;
|
reg_hnd) : False;
|
||||||
break;
|
break;
|
||||||
@ -79,14 +88,25 @@ BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
|||||||
|
|
||||||
case HKEY_USERS:
|
case HKEY_USERS:
|
||||||
{
|
{
|
||||||
res = res ? do_reg_open_hku(cli, fnum,
|
res = res ? reg_open_hku(cli, fnum,
|
||||||
0x84E0, 0x02000000,
|
0x84E0, 0x02000000,
|
||||||
reg_hnd) : False;
|
reg_hnd) : False;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
DEBUG(0,("do_reg_connect: unrecognised hive key\n"));
|
DEBUG(0,("reg_connect: unrecognised hive key\n"));
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
if (!register_policy_hnd(reg_hnd) ||
|
||||||
|
!set_policy_cli_state(reg_hnd, cli, fnum,
|
||||||
|
cli_state_free))
|
||||||
|
{
|
||||||
|
cli_state_free(cli, fnum);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +117,8 @@ BOOL do_reg_connect(struct cli_state *cli, uint16 fnum,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Open Policy
|
do a REG Open Policy
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_open_hkcr(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd)
|
POLICY_HND *hnd)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
@ -154,7 +175,8 @@ BOOL do_reg_open_hkcr(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Open Policy
|
do a REG Open Policy
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_open_hklm(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd)
|
POLICY_HND *hnd)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
@ -211,7 +233,8 @@ BOOL do_reg_open_hklm(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Open HKU
|
do a REG Open HKU
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_open_hku(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
|
BOOL reg_open_hku( struct cli_state *cli, uint16 fnum,
|
||||||
|
uint16 unknown_0, uint32 level,
|
||||||
POLICY_HND *hnd)
|
POLICY_HND *hnd)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
@ -270,13 +293,21 @@ do a REG Unknown 0xB command. sent after a create key or create value.
|
|||||||
this might be some sort of "sync" or "refresh" command, sent after
|
this might be some sort of "sync" or "refresh" command, sent after
|
||||||
modification of the registry...
|
modification of the registry...
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
|
BOOL reg_flush_key( POLICY_HND *hnd)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_FLUSH_KEY q_o;
|
REG_Q_FLUSH_KEY q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -324,7 +355,7 @@ BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Query Key
|
do a REG Query Key
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_query_key( POLICY_HND *hnd,
|
||||||
char *key_class, uint32 *class_len,
|
char *key_class, uint32 *class_len,
|
||||||
uint32 *num_subkeys, uint32 *max_subkeylen,
|
uint32 *num_subkeys, uint32 *max_subkeylen,
|
||||||
uint32 *max_subkeysize, uint32 *num_values,
|
uint32 *max_subkeysize, uint32 *num_values,
|
||||||
@ -336,6 +367,14 @@ BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_QUERY_KEY q_o;
|
REG_Q_QUERY_KEY q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -394,13 +433,21 @@ BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Unknown 1A
|
do a REG Unknown 1A
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 *unk)
|
BOOL reg_unknown_1a( POLICY_HND *hnd, uint32 *unk)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_UNK_1A q_o;
|
REG_Q_UNK_1A q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -449,7 +496,7 @@ BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Query Info
|
do a REG Query Info
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_query_info( POLICY_HND *hnd,
|
||||||
const char* val_name,
|
const char* val_name,
|
||||||
uint32 *type, BUFFER2 *buffer)
|
uint32 *type, BUFFER2 *buffer)
|
||||||
{
|
{
|
||||||
@ -458,6 +505,14 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_INFO q_o;
|
REG_Q_INFO q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -508,7 +563,7 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Set Key Security
|
do a REG Set Key Security
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_set_key_sec( POLICY_HND *hnd,
|
||||||
uint32 sec_info,
|
uint32 sec_info,
|
||||||
uint32 sec_buf_size, SEC_DESC *sec_buf)
|
uint32 sec_buf_size, SEC_DESC *sec_buf)
|
||||||
{
|
{
|
||||||
@ -517,6 +572,14 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_SET_KEY_SEC q_o;
|
REG_Q_SET_KEY_SEC q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -558,7 +621,7 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Query Key Security
|
do a REG Query Key Security
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_get_key_sec( POLICY_HND *hnd,
|
||||||
uint32 sec_info,
|
uint32 sec_info,
|
||||||
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf)
|
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf)
|
||||||
{
|
{
|
||||||
@ -567,6 +630,14 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_GET_KEY_SEC q_o;
|
REG_Q_GET_KEY_SEC q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -628,13 +699,21 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Delete Value
|
do a REG Delete Value
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_delete_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *val_name)
|
BOOL reg_delete_val( POLICY_HND *hnd, char *val_name)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_DELETE_VALUE q_o;
|
REG_Q_DELETE_VALUE q_o;
|
||||||
BOOL valid_delete = False;
|
BOOL valid_delete = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -682,13 +761,21 @@ BOOL do_reg_delete_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Delete Key
|
do a REG Delete Key
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_delete_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *key_name)
|
BOOL reg_delete_key( POLICY_HND *hnd, char *key_name)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_DELETE_KEY q_o;
|
REG_Q_DELETE_KEY q_o;
|
||||||
BOOL valid_delete = False;
|
BOOL valid_delete = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -736,7 +823,7 @@ BOOL do_reg_delete_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Create Key
|
do a REG Create Key
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_create_key( POLICY_HND *hnd,
|
||||||
char *key_name, char *key_class,
|
char *key_name, char *key_class,
|
||||||
SEC_ACCESS *sam_access,
|
SEC_ACCESS *sam_access,
|
||||||
POLICY_HND *key)
|
POLICY_HND *key)
|
||||||
@ -749,6 +836,14 @@ BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
SEC_DESC_BUF sec_buf;
|
SEC_DESC_BUF sec_buf;
|
||||||
int sec_len;
|
int sec_len;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
ZERO_STRUCT(sec);
|
ZERO_STRUCT(sec);
|
||||||
ZERO_STRUCT(sec_buf);
|
ZERO_STRUCT(sec_buf);
|
||||||
ZERO_STRUCT(q_o);
|
ZERO_STRUCT(q_o);
|
||||||
@ -810,7 +905,7 @@ BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Enum Key
|
do a REG Enum Key
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_enum_key( POLICY_HND *hnd,
|
||||||
int key_index, char *key_name,
|
int key_index, char *key_name,
|
||||||
uint32 *unk_1, uint32 *unk_2,
|
uint32 *unk_1, uint32 *unk_2,
|
||||||
time_t *mod_time)
|
time_t *mod_time)
|
||||||
@ -820,6 +915,14 @@ BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_ENUM_KEY q_o;
|
REG_Q_ENUM_KEY q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -872,7 +975,7 @@ BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Create Value
|
do a REG Create Value
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_create_val( POLICY_HND *hnd,
|
||||||
char *val_name, uint32 type, BUFFER3 *data)
|
char *val_name, uint32 type, BUFFER3 *data)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
@ -880,6 +983,14 @@ BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_CREATE_VALUE q_o;
|
REG_Q_CREATE_VALUE q_o;
|
||||||
BOOL valid_create = False;
|
BOOL valid_create = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -927,7 +1038,7 @@ BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Enum Value
|
do a REG Enum Value
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_enum_val( POLICY_HND *hnd,
|
||||||
int val_index, int max_valnamelen, int max_valbufsize,
|
int val_index, int max_valnamelen, int max_valbufsize,
|
||||||
fstring val_name,
|
fstring val_name,
|
||||||
uint32 *val_type, BUFFER2 *value)
|
uint32 *val_type, BUFFER2 *value)
|
||||||
@ -937,6 +1048,14 @@ BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_ENUM_VALUE q_o;
|
REG_Q_ENUM_VALUE q_o;
|
||||||
BOOL valid_query = False;
|
BOOL valid_query = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -987,7 +1106,7 @@ BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Open Key
|
do a REG Open Key
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
BOOL reg_open_entry( POLICY_HND *hnd,
|
||||||
char *key_name, uint32 unk_0,
|
char *key_name, uint32 unk_0,
|
||||||
POLICY_HND *key_hnd)
|
POLICY_HND *key_hnd)
|
||||||
{
|
{
|
||||||
@ -996,6 +1115,14 @@ BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
REG_Q_OPEN_ENTRY q_o;
|
REG_Q_OPEN_ENTRY q_o;
|
||||||
BOOL valid_pol = False;
|
BOOL valid_pol = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -1030,8 +1157,9 @@ BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
valid_pol = True;
|
|
||||||
memcpy(key_hnd, r_o.pol.data, sizeof(key_hnd->data));
|
memcpy(key_hnd, r_o.pol.data, sizeof(key_hnd->data));
|
||||||
|
valid_pol = register_policy_hnd(key_hnd) &&
|
||||||
|
set_policy_cli_state(key_hnd, cli, fnum, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1044,13 +1172,21 @@ BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Close
|
do a REG Close
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
|
BOOL reg_close( POLICY_HND *hnd)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_CLOSE q_c;
|
REG_Q_CLOSE q_c;
|
||||||
BOOL valid_close = False;
|
BOOL valid_close = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_get(hnd, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (hnd == NULL) return False;
|
if (hnd == NULL) return False;
|
||||||
|
|
||||||
/* create and send a MSRPC command with api REG_CLOSE */
|
/* create and send a MSRPC command with api REG_CLOSE */
|
||||||
@ -1108,20 +1244,30 @@ BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
|
|||||||
prs_mem_free(&rbuf);
|
prs_mem_free(&rbuf);
|
||||||
prs_mem_free(&buf );
|
prs_mem_free(&buf );
|
||||||
|
|
||||||
|
close_policy_hnd(hnd);
|
||||||
|
|
||||||
return valid_close;
|
return valid_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
do a REG Shutdown Server
|
do a REG Shutdown Server
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL do_reg_shutdown(struct cli_state *cli, uint16 fnum,
|
BOOL reg_shutdown(const char *srv_name,
|
||||||
char *msg, uint32 timeout, uint16 flags)
|
const char *msg, uint32 timeout, uint16 flags)
|
||||||
{
|
{
|
||||||
prs_struct rbuf;
|
prs_struct rbuf;
|
||||||
prs_struct buf;
|
prs_struct buf;
|
||||||
REG_Q_SHUTDOWN q_o;
|
REG_Q_SHUTDOWN q_o;
|
||||||
BOOL valid_shutdown = False;
|
BOOL valid_shutdown = False;
|
||||||
|
|
||||||
|
struct cli_state *cli = NULL;
|
||||||
|
uint16 fnum = 0xffff;
|
||||||
|
|
||||||
|
if (!cli_state_init(srv_name, PIPE_WINREG, &cli, &fnum))
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg == NULL) return False;
|
if (msg == NULL) return False;
|
||||||
|
|
||||||
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
|
||||||
@ -1163,6 +1309,8 @@ BOOL do_reg_shutdown(struct cli_state *cli, uint16 fnum,
|
|||||||
prs_mem_free(&rbuf);
|
prs_mem_free(&rbuf);
|
||||||
prs_mem_free(&buf );
|
prs_mem_free(&buf );
|
||||||
|
|
||||||
|
cli_state_free(cli, fnum);
|
||||||
|
|
||||||
return valid_shutdown;
|
return valid_shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1350,7 +1350,7 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int
|
|||||||
makes a structure.
|
makes a structure.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i,
|
BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i,
|
||||||
char *msg, uint32 timeout, uint16 flags)
|
const char *msg, uint32 timeout, uint16 flags)
|
||||||
{
|
{
|
||||||
int len = strlen(msg) + 1;
|
int len = strlen(msg) + 1;
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
|
|
||||||
extern int DEBUGLEVEL;
|
extern int DEBUGLEVEL;
|
||||||
|
|
||||||
extern struct cli_state *smb_cli;
|
|
||||||
extern int smb_tidx;
|
|
||||||
|
|
||||||
extern FILE* out_hnd;
|
extern FILE* out_hnd;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -45,7 +42,7 @@ extern FILE* out_hnd;
|
|||||||
* reg_getsubkey() splits this down into:
|
* reg_getsubkey() splits this down into:
|
||||||
* [HKLM]|[HKU]\[parent_keyname_components] and [subkey]|[value]
|
* [HKLM]|[HKU]\[parent_keyname_components] and [subkey]|[value]
|
||||||
*
|
*
|
||||||
* do_reg_connect() splits the left side down further into:
|
* reg_connect() splits the left side down further into:
|
||||||
* [HKLM]|[HKU] and [parent_keyname_components].
|
* [HKLM]|[HKU] and [parent_keyname_components].
|
||||||
*
|
*
|
||||||
* HKLM is short for HKEY_LOCAL_MACHINE
|
* HKLM is short for HKEY_LOCAL_MACHINE
|
||||||
@ -101,12 +98,11 @@ static void reg_display_key(int val, const char *full_keyname, int num)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
nt registry enum
|
nt registry enum
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
|
||||||
REG_FN(reg_fn),
|
REG_FN(reg_fn),
|
||||||
REG_KEY_FN(reg_key_fn),
|
REG_KEY_FN(reg_key_fn),
|
||||||
REG_VAL_FN(reg_val_fn))
|
REG_VAL_FN(reg_val_fn))
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res1 = True;
|
BOOL res1 = True;
|
||||||
BOOL res2 = True;
|
BOOL res2 = True;
|
||||||
@ -139,17 +135,14 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
|
|
||||||
DEBUG(5, ("reg_enum_key: %s\n", full_keyname));
|
DEBUG(5, ("reg_enum_key: %s\n", full_keyname));
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(cli, fnum, full_keyname, key_name,
|
res = res ? reg_connect(srv_name, full_keyname, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res1 = res ? do_reg_open_entry(cli, fnum, &pol_con,
|
res1 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -157,7 +150,7 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
memcpy(&key_pol, &pol_con, sizeof(key_pol));
|
memcpy(&key_pol, &pol_con, sizeof(key_pol));
|
||||||
}
|
}
|
||||||
|
|
||||||
res1 = res1 ? do_reg_query_key(cli, fnum,
|
res1 = res1 ? reg_query_key(
|
||||||
&key_pol,
|
&key_pol,
|
||||||
key_class, &max_class_len,
|
key_class, &max_class_len,
|
||||||
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
||||||
@ -182,7 +175,7 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
time_t key_mod_time;
|
time_t key_mod_time;
|
||||||
|
|
||||||
/* unknown 1a it */
|
/* unknown 1a it */
|
||||||
res2 = res1 ? do_reg_unknown_1a(cli, fnum, &key_pol,
|
res2 = res1 ? reg_unknown_1a(&key_pol,
|
||||||
&unk_1a_response) : False;
|
&unk_1a_response) : False;
|
||||||
|
|
||||||
if (res2 && unk_1a_response != 5)
|
if (res2 && unk_1a_response != 5)
|
||||||
@ -191,7 +184,7 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* enum key */
|
/* enum key */
|
||||||
res2 = res2 ? do_reg_enum_key(cli, fnum, &key_pol,
|
res2 = res2 ? reg_enum_key(&key_pol,
|
||||||
i, enum_name,
|
i, enum_name,
|
||||||
&enum_unk1, &enum_unk2,
|
&enum_unk1, &enum_unk2,
|
||||||
&key_mod_time) : False;
|
&key_mod_time) : False;
|
||||||
@ -219,7 +212,7 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
fstring val_name;
|
fstring val_name;
|
||||||
|
|
||||||
/* unknown 1a it */
|
/* unknown 1a it */
|
||||||
res2 = res1 ? do_reg_unknown_1a(cli, fnum, &key_pol,
|
res2 = res1 ? reg_unknown_1a(&key_pol,
|
||||||
&unk_1a_response) : False;
|
&unk_1a_response) : False;
|
||||||
|
|
||||||
if (res2 && unk_1a_response != 5)
|
if (res2 && unk_1a_response != 5)
|
||||||
@ -228,7 +221,7 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* enum key */
|
/* enum key */
|
||||||
res2 = res2 ? do_reg_enum_val(cli, fnum, &key_pol,
|
res2 = res2 ? reg_enum_val(&key_pol,
|
||||||
i, max_valnamelen, max_valbufsize,
|
i, max_valnamelen, max_valbufsize,
|
||||||
val_name, &val_type, &value) : False;
|
val_name, &val_type, &value) : False;
|
||||||
|
|
||||||
@ -246,12 +239,9 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname,
|
|||||||
/* close the handles */
|
/* close the handles */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res1 = res1 ? do_reg_close(cli, fnum, &key_pol) : False;
|
res1 = res1 ? reg_close(&key_pol) : False;
|
||||||
}
|
}
|
||||||
res = res ? do_reg_close(cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(cli, fnum);
|
|
||||||
|
|
||||||
if (res && res1 && res2)
|
if (res && res1 && res2)
|
||||||
{
|
{
|
||||||
@ -290,6 +280,12 @@ void cmd_reg_enum(struct client_info *info, int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char *full_keyname;
|
char *full_keyname;
|
||||||
|
|
||||||
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
report(out_hnd, "regenum <key_name>\n");
|
report(out_hnd, "regenum <key_name>\n");
|
||||||
@ -298,7 +294,7 @@ void cmd_reg_enum(struct client_info *info, int argc, char *argv[])
|
|||||||
|
|
||||||
full_keyname = argv[1];
|
full_keyname = argv[1];
|
||||||
|
|
||||||
if (msrpc_reg_enum_key(smb_cli, full_keyname,
|
if (msrpc_reg_enum_key(srv_name, full_keyname,
|
||||||
reg_display_key,
|
reg_display_key,
|
||||||
reg_display_key_info,
|
reg_display_key_info,
|
||||||
reg_display_val_info))
|
reg_display_val_info))
|
||||||
@ -312,7 +308,6 @@ nt registry query value info
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res1 = True;
|
BOOL res1 = True;
|
||||||
|
|
||||||
@ -330,7 +325,11 @@ void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
|||||||
BUFFER2 buf;
|
BUFFER2 buf;
|
||||||
uint32 type;
|
uint32 type;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -348,17 +347,14 @@ void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, keyname, key_name,
|
res = res ? reg_connect(srv_name, keyname, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res1 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res1 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -367,7 +363,7 @@ void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* query it */
|
/* query it */
|
||||||
res1 = res1 ? do_reg_query_info(smb_cli, fnum, &key_pol,
|
res1 = res1 ? reg_query_info(&key_pol,
|
||||||
val_name, &type, &buf) : False;
|
val_name, &type, &buf) : False;
|
||||||
|
|
||||||
if (res1)
|
if (res1)
|
||||||
@ -378,12 +374,9 @@ void cmd_reg_query_info(struct client_info *info, int argc, char *argv[])
|
|||||||
/* close the handles */
|
/* close the handles */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
|
res1 = res1 ? reg_close(&key_pol) : False;
|
||||||
}
|
}
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res1)
|
if (res && res1)
|
||||||
{
|
{
|
||||||
@ -400,7 +393,6 @@ nt registry query key
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res1 = True;
|
BOOL res1 = True;
|
||||||
|
|
||||||
@ -424,7 +416,11 @@ void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
|||||||
uint32 sec_desc;
|
uint32 sec_desc;
|
||||||
NTTIME mod_time;
|
NTTIME mod_time;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -434,17 +430,14 @@ void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
|||||||
|
|
||||||
full_keyname = argv[1];
|
full_keyname = argv[1];
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
|
res = res ? reg_connect(srv_name, full_keyname, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res1 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res1 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -452,7 +445,7 @@ void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
|||||||
memcpy(&key_pol, &pol_con, sizeof(key_pol));
|
memcpy(&key_pol, &pol_con, sizeof(key_pol));
|
||||||
}
|
}
|
||||||
|
|
||||||
res1 = res1 ? do_reg_query_key(smb_cli, fnum,
|
res1 = res1 ? reg_query_key(
|
||||||
&key_pol,
|
&key_pol,
|
||||||
key_class, &key_class_len,
|
key_class, &key_class_len,
|
||||||
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
||||||
@ -461,7 +454,7 @@ void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
|||||||
|
|
||||||
if (res1 && key_class_len != 0)
|
if (res1 && key_class_len != 0)
|
||||||
{
|
{
|
||||||
res1 = res1 ? do_reg_query_key(smb_cli, fnum,
|
res1 = res1 ? reg_query_key(
|
||||||
&key_pol,
|
&key_pol,
|
||||||
key_class, &key_class_len,
|
key_class, &key_class_len,
|
||||||
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
&num_subkeys, &max_subkeylen, &max_subkeysize,
|
||||||
@ -482,12 +475,9 @@ void cmd_reg_query_key(struct client_info *info, int argc, char *argv[])
|
|||||||
/* close the handles */
|
/* close the handles */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
|
res1 = res1 ? reg_close(&key_pol) : False;
|
||||||
}
|
}
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res1)
|
if (res && res1)
|
||||||
{
|
{
|
||||||
@ -504,7 +494,6 @@ nt registry create value
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_create_val(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_create_val(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -522,11 +511,15 @@ void cmd_reg_create_val(struct client_info *info, int argc, char *argv[])
|
|||||||
uint32 unk_0;
|
uint32 unk_0;
|
||||||
uint32 unk_1;
|
uint32 unk_1;
|
||||||
/* query it */
|
/* query it */
|
||||||
res1 = res1 ? do_reg_query_info(smb_cli, fnum, &val_pol,
|
res1 = res1 ? reg_query_info(&val_pol,
|
||||||
type, &unk_0, &unk_1) : False;
|
type, &unk_0, &unk_1) : False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_create_val: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
@ -594,17 +587,14 @@ void cmd_reg_create_val(struct client_info *info, int argc, char *argv[])
|
|||||||
DEBUG(10,("key data:\n"));
|
DEBUG(10,("key data:\n"));
|
||||||
dump_data(10, (char *)value.buffer, value.buf_len);
|
dump_data(10, (char *)value.buffer, value.buf_len);
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name,
|
res = res ? reg_connect(srv_name, keyname, parent_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*val_name) != 0)
|
if ((*val_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
parent_name, 0x02000000, &parent_pol) : False;
|
parent_name, 0x02000000, &parent_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -613,23 +603,20 @@ void cmd_reg_create_val(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create an entry */
|
/* create an entry */
|
||||||
res4 = res3 ? do_reg_create_val(smb_cli, fnum, &parent_pol,
|
res4 = res3 ? reg_create_val(&parent_pol,
|
||||||
val_name, val_type, &value) : False;
|
val_name, val_type, &value) : False;
|
||||||
|
|
||||||
/* flush the modified key */
|
/* flush the modified key */
|
||||||
res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
|
res4 = res4 ? reg_flush_key(&parent_pol) : False;
|
||||||
|
|
||||||
/* close the val handle */
|
/* close the val handle */
|
||||||
if ((*val_name) != 0)
|
if ((*val_name) != 0)
|
||||||
{
|
{
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
|
res3 = res3 ? reg_close(&parent_pol) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -647,7 +634,6 @@ nt registry delete value
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -659,7 +645,11 @@ void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[])
|
|||||||
fstring parent_name;
|
fstring parent_name;
|
||||||
fstring val_name;
|
fstring val_name;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_delete_val: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -677,17 +667,14 @@ void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name,
|
res = res ? reg_connect(srv_name, keyname, parent_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*val_name) != 0)
|
if ((*val_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
parent_name, 0x02000000, &parent_pol) : False;
|
parent_name, 0x02000000, &parent_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -696,19 +683,16 @@ void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* delete an entry */
|
/* delete an entry */
|
||||||
res4 = res3 ? do_reg_delete_val(smb_cli, fnum, &parent_pol, val_name) : False;
|
res4 = res3 ? reg_delete_val(&parent_pol, val_name) : False;
|
||||||
|
|
||||||
/* flush the modified key */
|
/* flush the modified key */
|
||||||
res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
|
res4 = res4 ? reg_flush_key(&parent_pol) : False;
|
||||||
|
|
||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
|
res3 = res3 ? reg_close(&parent_pol) : False;
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -726,7 +710,6 @@ nt registry delete key
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -738,7 +721,11 @@ void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[])
|
|||||||
fstring key_name;
|
fstring key_name;
|
||||||
fstring subkey_name;
|
fstring subkey_name;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_delete_key: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -756,17 +743,14 @@ void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, parent_name, key_name,
|
res = res ? reg_connect(srv_name, parent_name, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &parent_pol) : False;
|
key_name, 0x02000000, &parent_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -775,22 +759,19 @@ void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create an entry */
|
/* create an entry */
|
||||||
res4 = res3 ? do_reg_delete_key(smb_cli, fnum, &parent_pol, subkey_name) : False;
|
res4 = res3 ? reg_delete_key(&parent_pol, subkey_name) : False;
|
||||||
|
|
||||||
/* flush the modified key */
|
/* flush the modified key */
|
||||||
res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
|
res4 = res4 ? reg_flush_key(&parent_pol) : False;
|
||||||
|
|
||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
|
res3 = res3 ? reg_close(&parent_pol) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -808,7 +789,6 @@ nt registry create key
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -823,7 +803,11 @@ void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
|||||||
fstring key_class;
|
fstring key_class;
|
||||||
SEC_ACCESS sam_access;
|
SEC_ACCESS sam_access;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_create_key: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -841,7 +825,7 @@ void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc > 2)
|
||||||
{
|
{
|
||||||
fstrcpy(key_class, argv[2]);
|
fstrcpy(key_class, argv[2]);
|
||||||
}
|
}
|
||||||
@ -853,17 +837,14 @@ void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
|||||||
/* set access permissions */
|
/* set access permissions */
|
||||||
sam_access.mask = SEC_RIGHTS_READ;
|
sam_access.mask = SEC_RIGHTS_READ;
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, parent_key, parent_name,
|
res = res ? reg_connect(srv_name, parent_key, parent_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*parent_name) != 0)
|
if ((*parent_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
parent_name, 0x02000000, &parent_pol) : False;
|
parent_name, 0x02000000, &parent_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -872,26 +853,23 @@ void cmd_reg_create_key(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create an entry */
|
/* create an entry */
|
||||||
res4 = res3 ? do_reg_create_key(smb_cli, fnum, &parent_pol,
|
res4 = res3 ? reg_create_key(&parent_pol,
|
||||||
key_name, key_class, &sam_access, &key_pol) : False;
|
key_name, key_class, &sam_access, &key_pol) : False;
|
||||||
|
|
||||||
/* flush the modified key */
|
/* flush the modified key */
|
||||||
res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
|
res4 = res4 ? reg_flush_key(&parent_pol) : False;
|
||||||
|
|
||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
res4 = res4 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
|
res4 = res4 ? reg_close(&key_pol) : False;
|
||||||
|
|
||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
if ((*parent_name) != 0)
|
if ((*parent_name) != 0)
|
||||||
{
|
{
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
|
res3 = res3 ? reg_close(&parent_pol) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -909,7 +887,6 @@ nt registry security info
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -927,7 +904,11 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
SEC_DESC_BUF sec_buf;
|
SEC_DESC_BUF sec_buf;
|
||||||
uint32 sec_info = 0x7;
|
uint32 sec_info = 0x7;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -937,17 +918,14 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
|
|
||||||
full_keyname = argv[1];
|
full_keyname = argv[1];
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
|
res = res ? reg_connect(srv_name, full_keyname, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -956,14 +934,14 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
|
|
||||||
/* query key sec info. first call sets sec_buf_size. */
|
/* query key sec info. first call sets sec_buf_size. */
|
||||||
sec_buf_size = 0;
|
sec_buf_size = 0;
|
||||||
ZERO_STRUCT(sec_buf);
|
ZERO_STRUCT(sec_buf);
|
||||||
|
|
||||||
res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
|
res4 = res3 ? reg_get_key_sec(&key_pol,
|
||||||
sec_info,
|
sec_info,
|
||||||
&sec_buf_size, &sec_buf) : False;
|
&sec_buf_size, &sec_buf) : False;
|
||||||
|
|
||||||
@ -972,7 +950,7 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
free_sec_desc_buf(&sec_buf);
|
free_sec_desc_buf(&sec_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
|
res4 = res4 ? reg_get_key_sec(&key_pol,
|
||||||
sec_info,
|
sec_info,
|
||||||
&sec_buf_size, &sec_buf) : False;
|
&sec_buf_size, &sec_buf) : False;
|
||||||
|
|
||||||
@ -982,7 +960,7 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec);
|
display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec);
|
||||||
display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec);
|
display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec);
|
||||||
|
|
||||||
res4 = res4 ? do_reg_set_key_sec(smb_cli, fnum, &key_pol,
|
res4 = res4 ? reg_set_key_sec(&key_pol,
|
||||||
sec_info, sec_buf_size, sec_buf.sec) : False;
|
sec_info, sec_buf_size, sec_buf.sec) : False;
|
||||||
|
|
||||||
free_sec_desc_buf(&sec_buf);
|
free_sec_desc_buf(&sec_buf);
|
||||||
@ -991,14 +969,11 @@ void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
|
res3 = res3 ? reg_close(&key_pol) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -1016,7 +991,6 @@ nt registry security info
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
BOOL res3 = True;
|
BOOL res3 = True;
|
||||||
BOOL res4 = True;
|
BOOL res4 = True;
|
||||||
@ -1034,7 +1008,11 @@ void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
SEC_DESC_BUF sec_buf;
|
SEC_DESC_BUF sec_buf;
|
||||||
uint32 sec_info = 0x7;
|
uint32 sec_info = 0x7;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -1044,17 +1022,14 @@ void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
|
|
||||||
full_keyname = argv[1];
|
full_keyname = argv[1];
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* open registry receive a policy handle */
|
/* open registry receive a policy handle */
|
||||||
res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
|
res = res ? reg_connect(srv_name, full_keyname, key_name,
|
||||||
&pol_con) : False;
|
&pol_con) : False;
|
||||||
|
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1063,14 +1038,14 @@ void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* open an entry */
|
/* open an entry */
|
||||||
res3 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con,
|
res3 = res ? reg_open_entry(&pol_con,
|
||||||
key_name, 0x02000000, &key_pol) : False;
|
key_name, 0x02000000, &key_pol) : False;
|
||||||
|
|
||||||
/* query key sec info. first call sets sec_buf_size. */
|
/* query key sec info. first call sets sec_buf_size. */
|
||||||
sec_buf_size = 0;
|
sec_buf_size = 0;
|
||||||
ZERO_STRUCT(sec_buf);
|
ZERO_STRUCT(sec_buf);
|
||||||
|
|
||||||
res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
|
res4 = res3 ? reg_get_key_sec(&key_pol,
|
||||||
sec_info,
|
sec_info,
|
||||||
&sec_buf_size, &sec_buf) : False;
|
&sec_buf_size, &sec_buf) : False;
|
||||||
|
|
||||||
@ -1079,7 +1054,7 @@ void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
free_sec_desc_buf(&sec_buf);
|
free_sec_desc_buf(&sec_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
|
res4 = res4 ? reg_get_key_sec(&key_pol,
|
||||||
sec_info,
|
sec_info,
|
||||||
&sec_buf_size, &sec_buf) : False;
|
&sec_buf_size, &sec_buf) : False;
|
||||||
|
|
||||||
@ -1095,14 +1070,11 @@ void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[])
|
|||||||
/* close the key handle */
|
/* close the key handle */
|
||||||
if ((*key_name) != 0)
|
if ((*key_name) != 0)
|
||||||
{
|
{
|
||||||
res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
|
res3 = res3 ? reg_close(&key_pol) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the registry handles */
|
/* close the registry handles */
|
||||||
res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False;
|
res = res ? reg_close(&pol_con) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res && res3 && res4)
|
if (res && res3 && res4)
|
||||||
{
|
{
|
||||||
@ -1119,7 +1091,6 @@ nt registry shutdown
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[])
|
void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uint16 fnum;
|
|
||||||
BOOL res = True;
|
BOOL res = True;
|
||||||
|
|
||||||
fstring msg;
|
fstring msg;
|
||||||
@ -1127,7 +1098,11 @@ void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[])
|
|||||||
uint16 flgs = 0;
|
uint16 flgs = 0;
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
DEBUG(5, ("cmd_reg_shutdown: smb_cli->fd:%d\n", smb_cli->fd));
|
fstring srv_name;
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, info->dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
@ -1171,14 +1146,8 @@ void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open WINREG session. */
|
|
||||||
res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
|
|
||||||
|
|
||||||
/* create an entry */
|
/* create an entry */
|
||||||
res = res ? do_reg_shutdown(smb_cli, fnum, msg, timeout, flgs) : False;
|
res = res ? reg_shutdown(srv_name, msg, timeout, flgs) : False;
|
||||||
|
|
||||||
/* close the session */
|
|
||||||
cli_nt_session_close(smb_cli, fnum);
|
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
|
@ -903,6 +903,7 @@ static char *complete_regenum(char *text, int state)
|
|||||||
|
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
{
|
{
|
||||||
|
fstring srv_name;
|
||||||
if (cmd_argc >= 2 && cmd_argv != NULL && cmd_argv[1] != NULL)
|
if (cmd_argc >= 2 && cmd_argv != NULL && cmd_argv[1] != NULL)
|
||||||
{
|
{
|
||||||
char *sep;
|
char *sep;
|
||||||
@ -914,8 +915,12 @@ static char *complete_regenum(char *text, int state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fstrcpy(srv_name, "\\\\");
|
||||||
|
fstrcat(srv_name, cli_info.dest_host);
|
||||||
|
strupper(srv_name);
|
||||||
|
|
||||||
/* Iterate all keys / values */
|
/* Iterate all keys / values */
|
||||||
if (!msrpc_reg_enum_key(smb_cli, full_keyname,
|
if (!msrpc_reg_enum_key(srv_name, full_keyname,
|
||||||
reg_init, reg_key_list, reg_val_list))
|
reg_init, reg_key_list, reg_val_list))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user