From eb70607c864d3d7d03a01fa39c3716a75db2c3db Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 10 Oct 1998 00:58:12 +0000 Subject: dce/rpc (This used to be commit b0af7cfd9dea8d286f430c51456b5f67d5e0658a) --- source3/rpcclient/cmd_samr.c | 60 +++++++++++++++++++++++++++++++++++-------- source3/rpcclient/rpcclient.c | 1 + 2 files changed, 51 insertions(+), 10 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 86a5619540..81fd373613 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -39,9 +39,9 @@ extern FILE* out_hnd; /**************************************************************************** -experimental SAM encryted rpc test connection +SAM password change ****************************************************************************/ -void cmd_sam_test(struct client_info *info) +void cmd_sam_ntchange_pwd(struct client_info *info) { fstring srv_name; fstring domain; @@ -60,23 +60,17 @@ void cmd_sam_test(struct client_info *info) fstrcpy(sid , info->dom.level5_sid); fstrcpy(domain, info->dom.level5_dom); - if (strlen(sid) == 0) - { - fprintf(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); - return; - } - fstrcpy(srv_name, "\\\\"); fstrcat(srv_name, info->dest_host); strupper(srv_name); - fprintf(out_hnd, "SAM Encryption Test\n"); + fprintf(out_hnd, "SAM NT Password Change\n"); #if 0 struct pwd_info new_pwd; pwd_read(&new_pwd, "New Password (ONCE: this is test code!):", True); #endif - new_passwd = (char*)getpass("New Password (ONCE: this is test code!):"); + new_passwd = (char*)getpass("New Password (ONCE ONLY - get it right :-)"); nt_lm_owf_gen(new_passwd, lm_newhash, nt_newhash); pwd_get_lm_nt_16(&(smb_cli->pwd), lm_oldhash, nt_oldhash ); @@ -100,6 +94,52 @@ void cmd_sam_test(struct client_info *info) /* close the session */ cli_nt_session_close(smb_cli); + if (res) + { + DEBUG(5,("cmd_sam_ntpasswd_chg: succeeded\n")); + } + else + { + DEBUG(5,("cmd_sam_ntpasswd_chg: failed\n")); + } +} + + +/**************************************************************************** +experimental SAM encryted rpc test connection +****************************************************************************/ +void cmd_sam_test(struct client_info *info) +{ + fstring srv_name; + fstring domain; + fstring sid; + char *new_passwd; + BOOL res = True; + + fstrcpy(sid , info->dom.level5_sid); + fstrcpy(domain, info->dom.level5_dom); + + if (strlen(sid) == 0) + { + fprintf(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); + return; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, info->dest_host); + strupper(srv_name); + + fprintf(out_hnd, "SAM Encryption Test\n"); + + /* open SAMR session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, True) : False; + + /* establish a connection. */ + res = res ? do_samr_unknown_38(smb_cli, srv_name) : False; + + /* close the session */ + cli_nt_session_close(smb_cli); + if (res) { DEBUG(5,("cmd_sam_test: succeeded\n")); diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 9d657e923d..a31fd60b0c 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -117,6 +117,7 @@ struct {"lsaquery", cmd_lsa_query_info, "Query Info Policy (domain member or server)"}, {"lookupsids", cmd_lsa_lookup_sids, "Resolve names from SIDs"}, {"enumusers", cmd_sam_enum_users, "SAM User Database Query (experimental!)"}, + {"ntpass", cmd_sam_ntchange_pwd, "NT SAM Password Change"}, {"samuser", cmd_sam_query_user, " SAM User Query (experimental!)"}, {"samtest", cmd_sam_test , "SAM User Encrypted RPC test (experimental!)"}, {"enumaliases",cmd_sam_enum_aliases, "SAM Aliases Database Query (experimental!)"}, -- cgit