s3: Simplify pdb_set_plaintext_passwd: pwHistLen==0 was checked above
authorVolker Lendecke <vl@samba.org>
Mon, 14 Dec 2009 18:16:58 +0000 (19:16 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 25 Jan 2010 11:41:56 +0000 (12:41 +0100)
source3/passdb/pdb_get_set.c

index f2e88a17fe87a5cd772f070b1b3779dea827b276..2b48bf5d3dced59fa3aa23e843b127ecfd60180a 100644 (file)
@@ -1042,7 +1042,9 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
 
        if (current_history_len < pwHistLen) {
                /*
-                * Ensure we have space for the needed history.
+                * Ensure we have space for the needed history. This
+                * also takes care of an account which did not have
+                * any history at all so far, i.e. pwhistory==NULL
                 */
                uchar *new_history = talloc_zero_array(
                        sampass, uchar,
@@ -1058,7 +1060,7 @@ bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext)
                pwhistory = new_history;
        }
 
-       if (pwhistory && pwHistLen) {
+       if (pwhistory != NULL) {
                /*
                 * Make room for the new password in the history list.
                 */