summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-09 23:31:50 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-09 23:31:50 +0000
commit78c1fd054f25ae2d0fa57669a0db102bc916577c (patch)
treebf83af82967874093ba0384be021064f2389e9cd /source3/libsmb
parentabb67ee6deac030c4bc38e166cd3e3ab086ae285 (diff)
downloadsamba-78c1fd054f25ae2d0fa57669a0db102bc916577c.tar.gz
samba-78c1fd054f25ae2d0fa57669a0db102bc916577c.tar.bz2
samba-78c1fd054f25ae2d0fa57669a0db102bc916577c.zip
dce/rpc
(This used to be commit 8a7ac4a25d177235a98c0f84f97ee50432fb6359)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c23
-rw-r--r--source3/libsmb/smbencrypt.c23
2 files changed, 28 insertions, 18 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 025ec5e73f..72d7ca935b 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -2021,7 +2021,6 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
unsigned char new_pw_hash[16];
int data_len;
int param_len = 0;
- int new_pw_len = strlen(new_password);
char *rparam = NULL;
char *rdata = NULL;
int rprcnt, rdrcnt;
@@ -2031,11 +2030,6 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
return False;
}
- if (new_pw_len > 512) {
- DEBUG(0,("cli_oem_change_password: new password for user %s is too long.\n", user));
- return False;
- }
-
SSVAL(p,0,214); /* SamOEMChangePassword command. */
p += 2;
pstrcpy(p, "zsT");
@@ -2050,25 +2044,18 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
param_len = PTR_DIFF(p,param);
/*
- * Now setup the data area.
- * We need to generate a random fill
- * for this area to make it harder to
- * decrypt. JRA.
- */
- generate_random_buffer((unsigned char *)data, sizeof(data), False);
- fstrcpy( &data[512 - new_pw_len], new_password);
- SIVAL(data, 512, new_pw_len);
-
- /*
* Get the Lanman hash of the old password, we
- * use this as the key to SamOEMHash().
+ * use this as the key to make_oem_passwd_hash().
*/
memset(upper_case_old_pw, '\0', sizeof(upper_case_old_pw));
fstrcpy(upper_case_old_pw, old_password);
strupper(upper_case_old_pw);
E_P16((uchar *)upper_case_old_pw, old_pw_hash);
- SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
+ if (!make_oem_passwd_hash( data, new_password, old_pw_hash))
+ {
+ return False;
+ }
/*
* Now place the old password hash in the data.
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index a9e680ccdd..27c19d5836 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -191,3 +191,26 @@ void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
}
+BOOL make_oem_passwd_hash(char data[516], char *passwd, char old_pw_hash[16])
+{
+ int new_pw_len = strlen(passwd);
+
+ if (new_pw_len > 512)
+ {
+ DEBUG(0,("make_oem_passwd_hash: new password is too long.\n"));
+ return False;
+ }
+
+ /*
+ * Now setup the data area.
+ * We need to generate a random fill
+ * for this area to make it harder to
+ * decrypt. JRA.
+ */
+ generate_random_buffer((unsigned char *)data, 516, False);
+ fstrcpy( &data[512 - new_pw_len], passwd);
+ SIVAL(data, 512, new_pw_len);
+
+ SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
+}
+