summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-23 18:56:26 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-23 18:56:26 +0000
commit4c4af2ba5ec3c1496576fe88331346cc631699e5 (patch)
tree171138987d6f316f710a874704da9c04789cc971 /source3/rpcclient
parentc5a6d0c84de27e1c849a0ec45fcf718e52346b13 (diff)
downloadsamba-4c4af2ba5ec3c1496576fe88331346cc631699e5.tar.gz
samba-4c4af2ba5ec3c1496576fe88331346cc631699e5.tar.bz2
samba-4c4af2ba5ec3c1496576fe88331346cc631699e5.zip
shuffling msrpc code around so that it can be used independently of rpcclient
(This used to be commit e88e7d529b5bdf32ac3bc71fa8e18f6f2a98c695)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c41
1 files changed, 2 insertions, 39 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index a95b8c077c..3f7cee2add 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -378,16 +378,7 @@ nt lsa query
****************************************************************************/
void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[])
{
- uint16 nt_pipe_fnum;
- fstring srv_name;
- BOOL res = True;
- BOOL res1;
- BOOL res2;
- uint32 i;
-
- POLICY_HND hnd_secret;
char *secret_name;
- STRING2 enc_secret;
STRING2 secret;
NTTIME last_update;
@@ -399,37 +390,9 @@ void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[])
secret_name = argv[1];
- fstrcpy(srv_name, "\\\\");
- fstrcat(srv_name, info->dest_host);
- strupper(srv_name);
-
- DEBUG(4,("cmd_lsa_query_info: server:%s\n", srv_name));
-
- /* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False;
-
- /* lookup domain controller; receive a policy handle */
- res = res ? lsa_open_policy2(smb_cli, nt_pipe_fnum,
- srv_name,
- &info->dom.lsa_info_pol, False) : False;
-
- /* lookup domain controller; receive a policy handle */
- res1 = res ? lsa_open_secret(smb_cli, nt_pipe_fnum,
- &info->dom.lsa_info_pol,
- secret_name, 0x02000000, &hnd_secret) : False;
-
- res2 = res1 ? lsa_query_secret(smb_cli, nt_pipe_fnum,
- &hnd_secret, &enc_secret, &last_update) : False;
-
- res1 = res1 ? lsa_close(smb_cli, nt_pipe_fnum, &hnd_secret) : False;
-
- res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;
-
- /* close the session */
- cli_nt_session_close(smb_cli, nt_pipe_fnum);
-
- if (res2 && nt_decrypt_string2(&secret, &enc_secret, (char*)(smb_cli->pwd.smb_nt_pwd)))
+ if (msrpc_lsa_query_secret(smb_cli, secret_name, &secret, &last_update))
{
+ int i;
report(out_hnd, "\tValue : ");
for (i = 0; i < secret.str_str_len; i++)
{