]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Fix tdb_validate() for incorrect tdb entries
authorVolker Lendecke <vl@samba.org>
Wed, 29 Mar 2023 10:20:01 +0000 (06:20 -0400)
committerRalph Boehme <slow@samba.org>
Sat, 1 Apr 2023 05:25:28 +0000 (05:25 +0000)
We should not overwrite the "rc=1" initialization with the tdb_check
retval. This will lead to tdb_validate_child() returning 0 even when
validate_fn() found invalid entries.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14789
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail.d/tdb-validate [deleted file]
source3/lib/tdb_validate.c

diff --git a/selftest/knownfail.d/tdb-validate b/selftest/knownfail.d/tdb-validate
deleted file mode 100644 (file)
index bde5821..0000000
+++ /dev/null
@@ -1 +0,0 @@
-samba3.smbtorture_s3.LOCAL-TDB-VALIDATE.smbtorture
index 9db182fb0b3ceb4377bd6f43cddb390183befb67..78bd824c09d0ffb97bf89b7f1d639453d2b813ab 100644 (file)
@@ -31,6 +31,7 @@ static int tdb_validate_child(struct tdb_context *tdb,
                              tdb_validate_data_func validate_fn)
 {
        int ret = 1;
+       int check_rc;
        int num_entries = 0;
        struct tdb_validation_status v_status;
 
@@ -50,8 +51,8 @@ static int tdb_validate_child(struct tdb_context *tdb,
         * we can simplify this by passing a check function,
         * but I don't want to change all the callers...
         */
-       ret = tdb_check(tdb, NULL, NULL);
-       if (ret != 0) {
+       check_rc = tdb_check(tdb, NULL, NULL);
+       if (check_rc != 0) {
                v_status.tdb_error = True;
                v_status.success = False;
                goto out;