summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-10 00:46:28 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-10 00:46:28 +0000
commit827a9d862ebe3d5ce1853999d16bd121fddcc796 (patch)
tree90f001fc27b4c65b9104cc910a3525eb7ca04941
parent78c1fd054f25ae2d0fa57669a0db102bc916577c (diff)
downloadsamba-827a9d862ebe3d5ce1853999d16bd121fddcc796.tar.gz
samba-827a9d862ebe3d5ce1853999d16bd121fddcc796.tar.bz2
samba-827a9d862ebe3d5ce1853999d16bd121fddcc796.zip
dce/rpc
(This used to be commit dfb48aab6153e53a5efd1f8ee518375cc584b101)
-rw-r--r--source3/include/proto.h6
-rw-r--r--source3/libsmb/clientgen.c2
-rw-r--r--source3/libsmb/smbencrypt.c18
-rw-r--r--source3/rpcclient/cmd_samr.c6
4 files changed, 21 insertions, 11 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c473aeb38e..9e2d4d33b0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 72d7ca935b..64e67c5522 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -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;
}
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 27c19d5836..7caf417ea1 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -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);
}
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 5cf6e61245..86a5619540 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -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);