]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dsdb: Do not reuse "ret" variable as return code and for memcmp() comparison
authorAndrew Bartlett <abartlet@samba.org>
Thu, 31 Mar 2022 08:22:08 +0000 (21:22 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 5 May 2022 01:19:54 +0000 (01:19 +0000)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu May  5 01:19:54 UTC 2022 on sn-devel-184

source4/dsdb/samdb/ldb_modules/password_hash.c

index f9eccd9c10b1a29dc9a53cd5239d9c5ab14ceb8b..faf8a35818ff5be02b29a92e9799ff3083e13cac 100644 (file)
@@ -2842,8 +2842,8 @@ static int check_password_restrictions(struct setup_password_fields_io *io, WERR
 
                /* checks the NT hash password history */
                for (i = 0; i < io->o.nt_history_len; i++) {
-                       ret = memcmp(io->n.nt_hash, io->o.nt_history[i].hash, 16);
-                       if (ret == 0) {
+                       int pw_cmp = memcmp(io->n.nt_hash, io->o.nt_history[i].hash, 16);
+                       if (pw_cmp == 0) {
                                ret = LDB_ERR_CONSTRAINT_VIOLATION;
                                *werror = WERR_PASSWORD_RESTRICTION;
                                ldb_asprintf_errstring(ldb,