s3: Add a paranoia check to pdb_set_plaintext_passwd()
authorVolker Lendecke <vl@samba.org>
Mon, 14 Dec 2009 18:12:50 +0000 (19:12 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 25 Jan 2010 11:41:56 +0000 (12:41 +0100)
source3/passdb/pdb_get_set.c

index 87faf2b9ba84809d69041244071df94aa2aece1f..f2e88a17fe87a5cd772f070b1b3779dea827b276 100644 (file)
@@ -1035,6 +1035,11 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
         */
        pwhistory = (uchar *)pdb_get_pw_history(sampass, &current_history_len);
 
+       if ((current_history_len != 0) && (pwhistory == NULL)) {
+               DEBUG(1, ("pdb_set_plaintext_passwd: pwhistory == NULL!\n"));
+               return false;
+       }
+
        if (current_history_len < pwHistLen) {
                /*
                 * Ensure we have space for the needed history.