From a3f522202ddc09d444e800ad1da2078975de01c1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 14 Dec 2009 18:50:38 +0100 Subject: 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 --- source3/passdb/pdb_get_set.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'source3') 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, ¤t_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) { -- cgit