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)
committerMichael Adam <obnox@samba.org>
Thu, 7 Jan 2010 10:07:54 +0000 (11:07 +0100)
source3/passdb/pdb_get_set.c

index ba19b6bd4380fe9cab41a9e00ba3f42e7ab2ef00..eed3591fd68c6ea3f6044682bb8a92dcba1c9b61 100644 (file)
@@ -1043,7 +1043,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,
@@ -1059,7 +1061,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.
                 */