summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-07-30 02:19:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:16 -0500
commitdb4fde99d4a6ab45f6b1b1883c024420c38ccbaf (patch)
tree513a9ad49618247fef1de4b5739ec36d006a6000 /source3
parent1fed92da2f5255cd8d07ccdf528c98eb0daa087c (diff)
downloadsamba-db4fde99d4a6ab45f6b1b1883c024420c38ccbaf.tar.gz
samba-db4fde99d4a6ab45f6b1b1883c024420c38ccbaf.tar.bz2
samba-db4fde99d4a6ab45f6b1b1883c024420c38ccbaf.zip
r1610: Patch from Richard Renard <rrenard@idealx.com>. Ensure we
save the password as it is being changed into the password history list. Jeremy. (This used to be commit 4fd619d7e16b5f759e6dc8360ad192457b3c90b9)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_get_set.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 0877e8b1f4..dc8a2f68d2 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1172,18 +1172,10 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
{
uchar new_lanman_p16[LM_HASH_LEN];
uchar new_nt_p16[NT_HASH_LEN];
- uchar current_ntpw_copy[NT_HASH_LEN];
- const uchar *current_ntpw;
if (!sampass || !plaintext)
return False;
- /* Store the current password for history purposes. */
- current_ntpw = pdb_get_nt_passwd(sampass);
- if (current_ntpw) {
- memcpy (current_ntpw_copy, current_ntpw, NT_HASH_LEN);
- }
-
/* Calculate the MD4 hash (NT compatible) of the password */
E_md4hash(plaintext, new_nt_p16);
@@ -1233,11 +1225,13 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
pwHistLen = current_history_len;
}
}
- if (pwhistory && current_ntpw && pwHistLen){
+ if (pwhistory && pwHistLen){
+ /* Make room for the new password in the history list. */
if (pwHistLen > 1) {
memmove(&pwhistory[NT_HASH_LEN], pwhistory, (pwHistLen -1)*NT_HASH_LEN );
}
- memcpy(pwhistory, current_ntpw_copy, NT_HASH_LEN);
+ /* Ensure we have a copy of the new password as the first history entry. */
+ memcpy(pwhistory, new_nt_p16, NT_HASH_LEN);
pdb_set_pw_history(sampass, pwhistory, pwHistLen, PDB_CHANGED);
} else {
DEBUG (10,("pdb_get_set.c: pdb_set_plaintext_passwd: pwhistory was NULL!\n"));