s3:pdb_set_pw_history: free the old history before setting the new.
authorMichael Adam <obnox@samba.org>
Tue, 5 Jan 2010 16:24:17 +0000 (17:24 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 7 Jan 2010 10:07:51 +0000 (11:07 +0100)
This is not strictly necessary, since this only leaks into the
struct samu, and this is not so long-lived in the code path that
changes the password, but it definitely correct and does not harm.

Michael

source3/passdb/pdb_get_set.c

index 30775e49fe541684f8cbc35db32b3d651a2becc6..da65440b06339c4d5685f84e2b09438b482a752d 100644 (file)
@@ -876,6 +876,7 @@ bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e
 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag)
 {
        if (historyLen && pwd){
+               data_blob_free(&(sampass->nt_pw_his));
                sampass->nt_pw_his = data_blob_talloc(sampass,
                                                pwd, historyLen*PW_HISTORY_ENTRY_LEN);
                if (!sampass->nt_pw_his.length) {