1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
This commit is contained in:
Luke Leighton 0001-01-01 00:00:00 +00:00
parent 8a7ac4a25d
commit dfb48aab61
4 changed files with 21 additions and 11 deletions

View File

@ -511,7 +511,7 @@ void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]);
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16]);
BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16], BOOL unicode);
/*The following definitions come from libsmb/smberr.c */
@ -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 nt_newpass[516], char nt_oldhash[16],
char lm_newpass[516], char lm_oldhash[16]);
char lm_newpass[516], char nt_oldhash[16],
char nt_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);

View File

@ -2052,7 +2052,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
strupper(upper_case_old_pw);
E_P16((uchar *)upper_case_old_pw, old_pw_hash);
if (!make_oem_passwd_hash( data, new_password, old_pw_hash))
if (!make_oem_passwd_hash( data, new_password, old_pw_hash, False))
{
return False;
}

View File

@ -190,10 +190,9 @@ void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
#endif
}
BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16])
BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16], BOOL unicode)
{
int new_pw_len = strlen(passwd);
int new_pw_len = strlen(passwd) * (unicode ? 2 : 1);
if (new_pw_len > 512)
{
@ -208,9 +207,20 @@ BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16])
* decrypt. JRA.
*/
generate_random_buffer((unsigned char *)data, 516, False);
fstrcpy( &data[512 - new_pw_len], passwd);
if (unicode)
{
struni2( (uint16*)(&data[512 - new_pw_len]), passwd);
}
else
{
fstrcpy( &data[512 - new_pw_len], passwd);
}
SIVAL(data, 512, new_pw_len);
#ifdef DEBUG_PASSWORD
DEBUG(100,("make_oem_passwd_hash\n"));
dump_data(100, data, 516);
#endif
SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
}

View File

@ -79,9 +79,9 @@ void cmd_sam_test(struct client_info *info)
new_passwd = (char*)getpass("New Password (ONCE: this is test code!):");
nt_lm_owf_gen(new_passwd, lm_newhash, nt_newhash);
pwd_get_lm_nt_16(&(smb_cli->pwd), lm_oldhash , nt_oldhash );
make_oem_passwd_hash(nt_newpass, new_passwd, nt_oldhash);
make_oem_passwd_hash(lm_newpass, new_passwd, lm_oldhash);
pwd_get_lm_nt_16(&(smb_cli->pwd), lm_oldhash, nt_oldhash );
make_oem_passwd_hash(nt_newpass, new_passwd, nt_oldhash, True);
make_oem_passwd_hash(lm_newpass, new_passwd, lm_oldhash, True);
E_old_pw_hash(lm_newhash, lm_oldhash, lm_hshhash);
E_old_pw_hash(lm_newhash, nt_oldhash, nt_hshhash);