From: Andrew Bartlett Date: Thu, 31 Mar 2022 08:22:08 +0000 (+1300) Subject: dsdb: Do not reuse "ret" variable as return code and for memcmp() comparison X-Git-Tag: talloc-2.3.4~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a36b01888995031d00dbdba208fc9f522658f86;p=thirdparty%2Fsamba.git dsdb: Do not reuse "ret" variable as return code and for memcmp() comparison Signed-off-by: Andrew Bartlett Reviewed-by: Joseph Sutton Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu May 5 01:19:54 UTC 2022 on sn-devel-184 --- diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index f9eccd9c10b..faf8a35818f 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -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,