summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-04 00:09:15 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-04 00:09:15 +0000
commitcae821d45926157a250e9fa047e0c8aa8c0c2c54 (patch)
treee495f7062f29938d87a3bfe7aa9aad42cd462e07 /source3/smbd
parent83f2465f0f1432bc0aba76b83f3a781fb7c3a071 (diff)
downloadsamba-cae821d45926157a250e9fa047e0c8aa8c0c2c54.tar.gz
samba-cae821d45926157a250e9fa047e0c8aa8c0c2c54.tar.bz2
samba-cae821d45926157a250e9fa047e0c8aa8c0c2c54.zip
adding experimental set user password command to rpcclient, it returns
error wrong password against nt. ???? (This used to be commit b3f16e6b5aa5ba1b6afa38ad698646c8e765ec90)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index f84ae0ccb5..fa208acdc8 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -642,6 +642,37 @@ BOOL decode_pw_buffer(const char buffer[516], char *new_passwd,
}
/***********************************************************
+ encode a password buffer
+************************************************************/
+BOOL encode_pw_buffer(char buffer[516], const char *new_passwd,
+ int new_pw_len, BOOL nt_pass_set)
+{
+ if (nt_pass_set)
+ {
+ /*
+ * nt passwords are in unicode. last char overwrites NULL
+ * in ascii_to_unibuf, so use SIVAL *afterwards*.
+ */
+ int uni_pw_len = new_pw_len;
+ new_pw_len /= 2;
+ ascii_to_unibuf(&buffer[512-uni_pw_len], new_passwd, new_pw_len);
+ }
+ else
+ {
+ memcpy(&buffer[512-new_pw_len], new_passwd, new_pw_len);
+ }
+
+ /*
+ * The length of the new password is in the last 4 bytes of
+ * the data buffer.
+ */
+
+ SIVAL(buffer, 512, new_passwd_size);
+
+ return True;
+}
+
+/***********************************************************
Code to check the OEM hashed password.
this function ignores the 516 byte nt OEM hashed password