diff options
author | Matthew Chapman <matty@samba.org> | 1999-03-19 15:11:07 +0000 |
---|---|---|
committer | Matthew Chapman <matty@samba.org> | 1999-03-19 15:11:07 +0000 |
commit | 55bce9e30e410e7c6e1209493a59238ff462e996 (patch) | |
tree | 741a3160853ee69cb68e7f20a5f8dff695f61612 /source3/rpcclient | |
parent | b5a5236f207867d52acb8573d69c92a7691b2d3f (diff) | |
download | samba-55bce9e30e410e7c6e1209493a59238ff462e996.tar.gz samba-55bce9e30e410e7c6e1209493a59238ff462e996.tar.bz2 samba-55bce9e30e410e7c6e1209493a59238ff462e996.zip |
querysecret now shows the real, fairdinkum, decrypted secret :-)
(This used to be commit 5951e16a1134a559abefdd400e7a17627338f368)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 7542faceaf..101100e66d 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -318,11 +318,13 @@ void cmd_lsa_query_secret(struct client_info *info) fstring srv_name; BOOL res = True; BOOL res1; + BOOL res2; int i; POLICY_HND hnd_secret; fstring secret_name; - unsigned char enc_secret[24]; + STRING2 enc_secret; + STRING2 secret; NTTIME last_update; if (!next_token(NULL, secret_name, NULL, sizeof(secret_name))) @@ -350,8 +352,8 @@ void cmd_lsa_query_secret(struct client_info *info) &info->dom.lsa_info_pol, secret_name, 0x20003, &hnd_secret) : False; - res1 = res1 ? lsa_query_secret(smb_cli, nt_pipe_fnum, - &hnd_secret, enc_secret, &last_update) : 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; @@ -360,15 +362,15 @@ void cmd_lsa_query_secret(struct client_info *info) /* close the session */ cli_nt_session_close(smb_cli, nt_pipe_fnum); - if (res1) + if (res2 && nt_decrypt_string2(&secret, &enc_secret, smb_cli->pwd.smb_nt_pwd)) { - fprintf(out_hnd, "\tValue (encrypted): "); - for (i = 0; i < 24; i++) + fprintf(out_hnd, "\tValue : "); + for (i = 0; i < secret.str_str_len; i++) { - fprintf(out_hnd, "%02X", enc_secret[i]); + fprintf(out_hnd, "%02X", secret.buffer[i]); } - fprintf(out_hnd, "\n\tLast Updated : %s\n\n", + fprintf(out_hnd, "\n\tLast Updated: %s\n\n", http_timestring(nt_time_to_unix(&last_update))); } else |