From 05212658baef695448a22f43250c1268fe3310e3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 25 Oct 2018 15:59:48 +0200 Subject: [PATCH] tdb: Do early RDONLY error check for tdb_delete Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/tdb/common/tdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c index 4e433c89e1e..2a6d8977002 100644 --- a/lib/tdb/common/tdb.c +++ b/lib/tdb/common/tdb.c @@ -463,6 +463,11 @@ static int tdb_delete_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash) struct tdb_record rec; int ret; + if (tdb->read_only || tdb->traverse_read) { + tdb->ecode = TDB_ERR_RDONLY; + return -1; + } + rec_ptr = tdb_find_lock_hash(tdb, key, hash, F_WRLCK, &rec); if (rec_ptr == 0) { return -1;