summaryrefslogtreecommitdiff
path: root/lib/dbwrap
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2021-10-29 22:03:42 +0200
committerJeremy Allison <jra@samba.org>2021-11-04 19:49:47 +0000
commit8082e2eb7e33c0993135791c03823886f5aa8496 (patch)
treee1d681f1fad30f0b5ab0c0c238136356f76ca161 /lib/dbwrap
parent1fa006f1f71cce03d92e76efda3ff055aae4eb91 (diff)
downloadsamba-8082e2eb7e33c0993135791c03823886f5aa8496.tar.gz
lib/dbwrap: reset deleted record to tdb_null
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
Diffstat (limited to 'lib/dbwrap')
-rw-r--r--lib/dbwrap/dbwrap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c
index cc685a2fa69..7555efaa3ab 100644
--- a/lib/dbwrap/dbwrap.c
+++ b/lib/dbwrap/dbwrap.c
@@ -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;
}