]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:dbwrap_open: protect db_open() against recursive calls
authorStefan Metzmacher <metze@samba.org>
Sat, 18 Jul 2026 11:36:03 +0000 (13:36 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 4 Aug 2026 09:51:32 +0000 (09:51 +0000)
Callers need to use db_open_ex() instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/lib/dbwrap/dbwrap_open.c

index 7630b5965ede36f0509a3bf4304262a9f6295a19..eaf909281f16d892f5c3a1b1b5197e29d412a79d 100644 (file)
@@ -251,7 +251,11 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           uint64_t dbwrap_flags)
 {
        struct db_context *db = NULL;
+       static bool busy;
 
+       SMB_ASSERT(!busy);
+
+       busy = true;
        db = db_open_ex(mem_ctx,
                        NULL, /* ev_ctx_ex */
                        NULL, /* msg_ctx_ex */
@@ -263,6 +267,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                        mode,
                        lock_order,
                        dbwrap_flags);
+       busy = false;
 
        return db;
 }