summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-12-14 19:18:09 +0100
committerMichael Adam <obnox@samba.org>2010-01-07 11:07:54 +0100
commit5e2fc28b639a3944c272bbc5664e3da209c81365 (patch)
treecc7781c48c56d04ab6df6c063c8ccacf3ac53738
parent2a11f3b3d7b4a009ddfa70511ad2ce3b84aa0539 (diff)
downloadsamba-5e2fc28b639a3944c272bbc5664e3da209c81365.tar.gz
samba-5e2fc28b639a3944c272bbc5664e3da209c81365.tar.bz2
samba-5e2fc28b639a3944c272bbc5664e3da209c81365.zip
s3: Simplify pdb_set_plaintext_passwd: pwhistory==NULL can not happen anymore
-rw-r--r--source3/passdb/pdb_get_set.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index eed3591fd6..005cf46a62 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1061,32 +1061,27 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
pwhistory = new_history;
}
- if (pwhistory != NULL) {
- /*
- * Make room for the new password in the history list.
- */
- if (pwHistLen > 1) {
- memmove(&pwhistory[PW_HISTORY_ENTRY_LEN], pwhistory,
- (pwHistLen-1)*PW_HISTORY_ENTRY_LEN );
- }
- /*
- * Create the new salt as the first part of the
- * history entry.
- */
- generate_random_buffer(pwhistory, PW_HISTORY_SALT_LEN);
+ /*
+ * Make room for the new password in the history list.
+ */
+ if (pwHistLen > 1) {
+ memmove(&pwhistory[PW_HISTORY_ENTRY_LEN], pwhistory,
+ (pwHistLen-1)*PW_HISTORY_ENTRY_LEN );
+ }
- /*
- * Generate the md5 hash of the salt+new password as
- * the second part of the history entry.
- */
+ /*
+ * Create the new salt as the first part of the history entry.
+ */
+ generate_random_buffer(pwhistory, PW_HISTORY_SALT_LEN);
+
+ /*
+ * Generate the md5 hash of the salt+new password as the
+ * second part of the history entry.
+ */
+ E_md5hash(pwhistory, new_nt_p16, &pwhistory[PW_HISTORY_SALT_LEN]);
+
+ pdb_set_pw_history(sampass, pwhistory, pwHistLen, PDB_CHANGED);
- E_md5hash(pwhistory, new_nt_p16,
- &pwhistory[PW_HISTORY_SALT_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"));
- }
return True;
}