lib/dbwrap: reset deleted record to tdb_null
authorRalph Boehme <slow@samba.org>
Fri, 29 Oct 2021 20:03:42 +0000 (22:03 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 4 Nov 2021 19:49:47 +0000 (19:49 +0000)
This allows the calling the following sequence of dbwrap functions:

  dbwrap_delete_record(rec);
  data = dbwrap_record_get_value(rec);

without triggering the assert rec->value_valid inside dbwrap_record_get_value().

Note that dbwrap_record_storev() continues to invalidate the record, so this
change somewhat blurs our semantics.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14882

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov  4 19:49:47 UTC 2021 on sn-devel-184

lib/dbwrap/dbwrap.c
selftest/knownfail.d/samba3.blackbox.smbXsrv_client_dead_rec [deleted file]

index cc685a2fa6969f038a1933d35552a3c2cdf78ae0..7555efaa3ab19b1f9d2981601ee0dceb6f708a8d 100644 (file)
@@ -110,16 +110,13 @@ NTSTATUS dbwrap_record_delete(struct db_record *rec)
 {
        NTSTATUS status;
 
-       /*
-        * Invalidate before rec->delete_rec() is called, give
-        * rec->delete_rec() the chance to re-validate rec->value.
-        */
-       rec->value_valid = false;
-
        status = rec->delete_rec(rec);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
+
+       rec->value = tdb_null;
+
        return NT_STATUS_OK;
 }
 
diff --git a/selftest/knownfail.d/samba3.blackbox.smbXsrv_client_dead_rec b/selftest/knownfail.d/samba3.blackbox.smbXsrv_client_dead_rec
deleted file mode 100644 (file)
index 16f8446..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.blackbox.smbXsrv_client_dead_rec.check_panic\(fileserver:local\)