diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-18 00:26:11 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-18 00:26:11 +0000 |
commit | ccc8585567804d6a7e6f684a97d58871e2fd9f8a (patch) | |
tree | 00bc58c6cd0870a53fc5fb98648054c3ad9013e4 /source3/rpcclient | |
parent | cc8df5ce4955fc721e11ff08de052554894d963a (diff) | |
download | samba-ccc8585567804d6a7e6f684a97d58871e2fd9f8a.tar.gz samba-ccc8585567804d6a7e6f684a97d58871e2fd9f8a.tar.bz2 samba-ccc8585567804d6a7e6f684a97d58871e2fd9f8a.zip |
added regqueryval command (experimental) to get reg_io_q_info() and
reg_io_r_info() working properly. previously they weren't well
understood (well, they were the first of the registry functions i did,
back in december 97, ok??? :-)
set ntversion to 0x1 in SAMQUERY, so that we reply same as NT4 srv.
(This used to be commit 98ddeaf442cb30972cb281bf0489a6e5f7eb2883)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 86 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 6 |
2 files changed, 92 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 31ef8f082b..316b5f6bc1 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -306,6 +306,92 @@ void cmd_reg_enum(struct client_info *info) } /**************************************************************************** +nt registry query value info +****************************************************************************/ +void cmd_reg_query_info(struct client_info *info) +{ + uint16 fnum; + BOOL res = True; + BOOL res1 = True; + + POLICY_HND key_pol; + POLICY_HND pol_con; + fstring full_keyname; + fstring key_name; + fstring keyname; + fstring val_name; + + /* + * query value info + */ + + fstring type; + + type[0] = 0; + DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd)); + + if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname))) + { + report(out_hnd, "regvalinfo value_name\n"); + return; + } + + reg_get_subkey(full_keyname, keyname, val_name); + + if (keyname[0] == 0 || val_name[0] == 0) + { + report(out_hnd, "invalid value name\n"); + return; + } + + /* open WINREG session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; + + /* open registry receive a policy handle */ + res = res ? do_reg_connect(smb_cli, fnum, keyname, key_name, + &pol_con) : False; + + if ((*key_name) != 0) + { + /* open an entry */ + res1 = res ? do_reg_open_entry(smb_cli, fnum, &pol_con, + key_name, 0x02000000, &key_pol) : False; + } + else + { + memcpy(&key_pol, &pol_con, sizeof(key_pol)); + } + + /* query it */ + res1 = res1 ? do_reg_query_info(smb_cli, fnum, &key_pol, + val_name, type) : False; + + if (res1) + { + report(out_hnd, "type:\t%s\n", type); + } + + /* close the handles */ + if ((*key_name) != 0) + { + res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False; + } + res = res ? do_reg_close(smb_cli, fnum, &pol_con) : False; + + /* close the session */ + cli_nt_session_close(smb_cli, fnum); + + if (res && res1) + { + DEBUG(5,("cmd_reg_query: query succeeded\n")); + } + else + { + DEBUG(5,("cmd_reg_query: query failed\n")); + } +} + +/**************************************************************************** nt registry query key ****************************************************************************/ void cmd_reg_query_key(struct client_info *info) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index b1637a3249..6caefa06b2 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -202,6 +202,12 @@ commands[] = {COMPL_NONE, COMPL_NONE} }, { + "regqueryval", + cmd_reg_query_info, + "<valname> Registry Value Query", + {COMPL_REGKEY, COMPL_NONE} + }, + { "regquerykey", cmd_reg_query_key, "<keyname> Registry Key Query", |