1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
This commit is contained in:
Luke Leighton 0001-01-01 00:00:00 +00:00
parent dfb48aab61
commit b0af7cfd9d
3 changed files with 54 additions and 12 deletions

View File

@ -1732,8 +1732,8 @@ void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]);
void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth);
void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
char *dest_host, char *user_name,
char lm_newpass[516], char nt_oldhash[16],
char nt_newpass[516], char lm_oldhash[16]);
char nt_newpass[516], char nt_oldhash[16],
char lm_newpass[516], char lm_oldhash[16]);
void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth);
void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth);
@ -1904,6 +1904,7 @@ void cmd_lsa_lookup_sids(struct client_info *info);
/*The following definitions come from rpcclient/cmd_samr.c */
void cmd_sam_ntchange_pwd(struct client_info *info);
void cmd_sam_test(struct client_info *info);
void cmd_sam_enum_users(struct client_info *info);
void cmd_sam_query_user(struct client_info *info);

View File

@ -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"));

View File

@ -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, "<username> SAM User Query (experimental!)"},
{"samtest", cmd_sam_test , "SAM User Encrypted RPC test (experimental!)"},
{"enumaliases",cmd_sam_enum_aliases, "SAM Aliases Database Query (experimental!)"},