From 4c4af2ba5ec3c1496576fe88331346cc631699e5 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Nov 1999 18:56:26 +0000 Subject: shuffling msrpc code around so that it can be used independently of rpcclient (This used to be commit e88e7d529b5bdf32ac3bc71fa8e18f6f2a98c695) --- source3/rpcclient/cmd_lsarpc.c | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) (limited to 'source3/rpcclient/cmd_lsarpc.c') 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++) { -- cgit