summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-12-14 18:50:38 +0100
committerMichael Adam <obnox@samba.org>2010-01-07 11:07:54 +0100
commita3f522202ddc09d444e800ad1da2078975de01c1 (patch)
treeca139daf43ac7a74e2aa36404d1aee632a111d11 /source3
parent7633837026d56ee723ffb603c9bd884ff6c69ef3 (diff)
downloadsamba-a3f522202ddc09d444e800ad1da2078975de01c1.tar.gz
samba-a3f522202ddc09d444e800ad1da2078975de01c1.tar.bz2
samba-a3f522202ddc09d444e800ad1da2078975de01c1.zip
s3: Simplify pdb_set_plaintext_passwd() by removing a redundant condition
if (current_history_len != pwHistLen) { if (current_history_len < pwHistLen) { } } The second "if" is a bit pointless here
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_get_set.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 968da9d8d1..f0c3fb193a 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1036,33 +1036,22 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
*/
pwhistory = (uchar *)pdb_get_pw_history(sampass, &current_history_len);
- if (current_history_len != pwHistLen) {
+ if (current_history_len < pwHistLen) {
/*
- * After closing and reopening struct samu the history
- * values will sync up. We can't do this here.
+ * Ensure we have space for the needed history.
*/
+ uchar *new_history = talloc_zero_array(
+ sampass, uchar,
+ pwHistLen*PW_HISTORY_ENTRY_LEN);
- /*
- * current_history_len > pwHistLen is not a problem -
- * we have more history than we need.
- */
-
- if (current_history_len < pwHistLen) {
- /*
- * Ensure we have space for the needed history.
- */
- uchar *new_history = talloc_zero_array(
- sampass, uchar,
- pwHistLen*PW_HISTORY_ENTRY_LEN);
- if (!new_history) {
- return False;
- }
+ if (!new_history) {
+ return False;
+ }
- memcpy(new_history, pwhistory,
- current_history_len*PW_HISTORY_ENTRY_LEN);
+ memcpy(new_history, pwhistory,
+ current_history_len*PW_HISTORY_ENTRY_LEN);
- pwhistory = new_history;
- }
+ pwhistory = new_history;
}
if (pwhistory && pwHistLen) {