The branch, master has been updated
       via  c594804 s3:passdb: fix logic in pdb_set_pw_history()
      from  eda9742 Happy New Year 2015!

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c5948040805f2585dd9da3a6955f605d8d9fa70c
Author: Stefan Metzmacher <[email protected]>
Date:   Wed Dec 24 13:58:12 2014 +0100

    s3:passdb: fix logic in pdb_set_pw_history()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10940
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Mon Jan  5 16:51:30 CET 2015 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/passdb/pdb_get_set.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 1b716f4..5e162db 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -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);
 }
 


-- 
Samba Shared Repository

Reply via email to