diff options
author | Jean-François Micouleau <jfm@samba.org> | 2000-10-07 15:56:36 +0000 |
---|---|---|
committer | Jean-François Micouleau <jfm@samba.org> | 2000-10-07 15:56:36 +0000 |
commit | 75c346e70c83f7386ecd2f10fe155c4a4dfd47de (patch) | |
tree | 23a7a2fe9a9c3c571bae50760d54518885455d5f /source3/libsmb | |
parent | 8582d426467e715a912ef06c13bdbbdeb9000739 (diff) | |
download | samba-75c346e70c83f7386ecd2f10fe155c4a4dfd47de.tar.gz samba-75c346e70c83f7386ecd2f10fe155c4a4dfd47de.tar.bz2 samba-75c346e70c83f7386ecd2f10fe155c4a4dfd47de.zip |
added samr_set_user_info and info_2.
cleanup of create_user
cleanup of rid/sid mix in samr. now we only have sid.
some prs_align() missing in parse_samr.c
a small debug change in srv_pipe.c
You still can't change a user's password in this commit.
Will be availble in the next one.
J.F.
(This used to be commit b655bc281fa183b1827a946ada1fcf500fb93aea)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/smbencrypt.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index b927e193dd..16f2493947 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -228,3 +228,47 @@ BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[ return True; } +/*********************************************************** + decode a password buffer +************************************************************/ +BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd, + int new_pwrd_size, uint32 *new_pw_len) +{ + int uni_pw_len=0; + char *pw; + /* + Warning !!! : This function is called from some rpc call. + The password IN the buffer is a UNICODE string. + The password IN new_pwrd is an ASCII string + If you reuse that code somewhere else check first. + */ + + + /* + * The length of the new password is in the last 4 bytes of + * the data buffer. + */ + + *new_pw_len = IVAL(buffer, 512); + +#ifdef DEBUG_PASSWORD + dump_data(100, buffer, 516); +#endif + + if ((*new_pw_len) < 0 || (*new_pw_len) > new_pwrd_size - 1) { + DEBUG(0, ("decode_pw_buffer: incorrect password length (%d).\n", (*new_pw_len))); + return False; + } + + uni_pw_len = *new_pw_len; + *new_pw_len /= 2; + pw = dos_unistrn2((uint16 *)(&buffer[512 - uni_pw_len]), uni_pw_len); + memcpy(new_pwrd, pw, *new_pw_len + 1); + +#ifdef DEBUG_PASSWORD + dump_data(100, new_pwrd, (*new_pw_len)); +#endif + + return True; +} + |