diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/pdb_get_set.c | 33 |
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, ¤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) { |