1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:passdb: fix logic in pdb_set_pw_history()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10940

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan  5 16:51:30 CET 2015 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2014-12-24 13:58:12 +01:00 committed by Volker Lendecke
parent eda9742e3f
commit c594804080

View File

@ -872,19 +872,20 @@ 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_t historyLen, enum pdb_value_state flag)
{
DATA_BLOB new_nt_pw_his = {};
if (historyLen && pwd){
DATA_BLOB *old_nt_pw_his = &(sampass->nt_pw_his);
sampass->nt_pw_his = data_blob_talloc(sampass,
pwd, historyLen*PW_HISTORY_ENTRY_LEN);
data_blob_free(old_nt_pw_his);
if (!sampass->nt_pw_his.length) {
new_nt_pw_his = data_blob_talloc(sampass,
pwd, historyLen*PW_HISTORY_ENTRY_LEN);
if (new_nt_pw_his.length == 0) {
DEBUG(0, ("pdb_set_pw_history: data_blob_talloc() failed!\n"));
return False;
}
} else {
sampass->nt_pw_his = data_blob_talloc(sampass, NULL, 0);
}
data_blob_free(&sampass->nt_pw_his);
sampass->nt_pw_his = new_nt_pw_his;
return pdb_set_init_flags(sampass, PDB_PWHISTORY, flag);
}