]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: open smbXsrv_open_global.tdb db with per-record persistency support
authorRalph Boehme <slow@samba.org>
Wed, 19 Sep 2018 22:21:43 +0000 (15:21 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:37 +0000 (10:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/smbXsrv_open.c

index aa0e3f4c347c888ac2783b7318d481dff89ac1f2..2567ce385da7e0ff557b22dc64d9118e2426b865 100644 (file)
@@ -56,6 +56,7 @@ NTSTATUS smbXsrv_open_global_init(void)
 {
        char *global_path = NULL;
        struct db_context *db_ctx = NULL;
+       uint64_t dbwrap_flags = DBWRAP_FLAG_NONE;
 
        if (smbXsrv_open_global_db_ctx != NULL) {
                return NT_STATUS_OK;
@@ -66,12 +67,16 @@ NTSTATUS smbXsrv_open_global_init(void)
                return NT_STATUS_NO_MEMORY;
        }
 
+       if (lp_persistent_handles()) {
+               dbwrap_flags = DBWRAP_FLAG_PER_REC_PERSISTENT;
+       }
+
        db_ctx = db_open(NULL, global_path,
                         SMBD_VOLATILE_TDB_HASH_SIZE,
                         SMBD_VOLATILE_TDB_FLAGS,
                         O_RDWR | O_CREAT, 0600,
                         DBWRAP_LOCK_ORDER_1,
-                        DBWRAP_FLAG_NONE);
+                        dbwrap_flags);
        TALLOC_FREE(global_path);
        if (db_ctx == NULL) {
                NTSTATUS status = map_nt_error_from_unix_common(errno);