]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dbwrap: convert dbwrap_record_store() from TDB to DBWRAP flags
authorRalph Boehme <slow@samba.org>
Mon, 4 Nov 2024 06:45:59 +0000 (07:45 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:35 +0000 (10:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 files changed:
lib/dbwrap/dbwrap_util.c
source3/libnet/libnet_dssync_passdb.c
source3/locking/brlock.c
source3/passdb/pdb_tdb.c
source3/smbd/smbXsrv_client.c
source3/smbd/smbXsrv_open.c
source3/smbd/smbXsrv_session.c
source3/smbd/smbXsrv_tcon.c
source3/smbd/smbXsrv_version.c
source3/utils/dbwrap_torture.c
source4/ntvfs/common/brlock_tdb.c
source4/ntvfs/common/opendb_tdb.c

index 312fb4187542a1eab22db7340ddcfa22ea24afd2..5fe0b36f959c6cab654cc3e0fa467b1ddf139c6a 100644 (file)
@@ -184,7 +184,7 @@ static void dbwrap_change_uint32_atomic_action_fn(struct db_record *rec,
        val += state->change_val;
        PUSH_LE_U32(v_store, 0, val);
 
-       state->status = dbwrap_record_store(rec, data, TDB_REPLACE);
+       state->status = dbwrap_record_store(rec, data, DBWRAP_REPLACE);
 }
 
 static NTSTATUS dbwrap_change_uint32_atomic_action(struct db_context *db,
@@ -285,7 +285,7 @@ static void dbwrap_change_int32_atomic_action_fn(struct db_record *rec,
        val += state->change_val;
        PUSH_LE_U32(v_store, 0, val);
 
-       state->status = dbwrap_record_store(rec, data, TDB_REPLACE);
+       state->status = dbwrap_record_store(rec, data, DBWRAP_REPLACE);
 }
 
 static NTSTATUS dbwrap_change_int32_atomic_action(struct db_context *db,
index 7d5ef64e8f414f867837fa136690fd440ce3ac25..cbdde7babb4fe69a773bfd60c47445b2f1b66b43 100644 (file)
@@ -77,7 +77,7 @@ static NTSTATUS dssync_insert_obj(struct dssync_passdb *pctx,
                abort();
        }
 
-       status = dbwrap_record_store(rec, obj->data, TDB_INSERT);
+       status = dbwrap_record_store(rec, obj->data, DBWRAP_INSERT);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(rec);
                return status;
@@ -177,7 +177,7 @@ static NTSTATUS dssync_insert_mem(struct dssync_passdb *pctx,
                abort();
        }
 
-       status = dbwrap_record_store(rec, mem->data, TDB_INSERT);
+       status = dbwrap_record_store(rec, mem->data, DBWRAP_INSERT);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(rec);
                return status;
index 207f3757989849953b0c8595a545a83b32d46197..bcc221d7615abf31a3bf826097bbd0beede0a21d 100644 (file)
@@ -1619,7 +1619,9 @@ static void byte_range_lock_flush(struct byte_range_lock *br_lck)
                };
                NTSTATUS status;
 
-               status = dbwrap_record_store(br_lck->record, data, TDB_REPLACE);
+               status = dbwrap_record_store(br_lck->record,
+                                            data,
+                                            DBWRAP_REPLACE);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("store returned %s\n", nt_errstr(status)));
                        smb_panic("Could not store byte range mode entry");
index 7d166113ef9516eaeb997ffdae4a7639a96cb3e7..5bd9f662c1f9da734e6f06aeee8551ff579083af 100644 (file)
@@ -150,7 +150,7 @@ static int tdbsam_convert_one(struct db_record *rec, void *priv)
                return -1;
        }
 
-       status = dbwrap_record_store(rec, data, TDB_MODIFY);
+       status = dbwrap_record_store(rec, data, DBWRAP_MODIFY);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Could not store the new record: %s\n",
                          nt_errstr(status)));
@@ -188,7 +188,7 @@ static int backup_copy_fn(struct db_record *orig_rec, void *state)
 
        value = dbwrap_record_get_value(orig_rec);
 
-       status = dbwrap_record_store(new_rec, value, TDB_INSERT);
+       status = dbwrap_record_store(new_rec, value, DBWRAP_INSERT);
 
        TALLOC_FREE(new_rec);
 
index fc79672e9c43144cf449650516d8268d9ed6e8a0..c0afcdb8475386903558af0482c330aae86f14fe 100644 (file)
@@ -449,7 +449,7 @@ static NTSTATUS smbXsrv_client_global_store(struct smbXsrv_client_global0 *globa
        }
 
        val = make_tdb_data(blob.data, blob.length);
-       status = dbwrap_record_store(global->db_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(global->db_rec, val, DBWRAP_REPLACE);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("key '%s' store - %s\n",
                        tdb_data_dbg(key),
index 329332eb56f24abdc76e2283080b4ed55d7269d3..289faff25e1a8a5f3ef4a168e2351baae8742ba3 100644 (file)
@@ -386,7 +386,7 @@ static NTSTATUS smbXsrv_open_global_store(
        }
 
        val = make_tdb_data(blob.data, blob.length);
-       status = dbwrap_record_store(rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(rec, val, DBWRAP_REPLACE);
        TALLOC_FREE(blob.data);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("key '%s' store - %s\n",
index a268c3ff102f8c73a567d2aa06be65ef50c5a54b..cf1b923103dc5c574c9b37ea5cef1dbf2056b622 100644 (file)
@@ -954,7 +954,7 @@ static NTSTATUS smbXsrv_session_global_store(struct smbXsrv_session_global0 *glo
        }
 
        val = make_tdb_data(blob.data, blob.length);
-       status = dbwrap_record_store(global->db_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(global->db_rec, val, DBWRAP_REPLACE);
        TALLOC_FREE(blob.data);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("key '%s' store - %s\n",
@@ -1367,7 +1367,7 @@ NTSTATUS smbXsrv_session_create(struct smbXsrv_connection *conn,
 
        ptr = session;
        val = make_tdb_data((uint8_t const *)&ptr, sizeof(ptr));
-       status = dbwrap_record_store(local_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(local_rec, val, DBWRAP_REPLACE);
        TALLOC_FREE(local_rec);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(session);
index 2f25246d6b443a7bcddc3c8d759eb52f530adc99..c451d9121c17e043c333d19e0b6eb7ce95dc9997 100644 (file)
@@ -694,7 +694,7 @@ static NTSTATUS smbXsrv_tcon_global_store(struct smbXsrv_tcon_global0 *global)
        }
 
        val = make_tdb_data(blob.data, blob.length);
-       status = dbwrap_record_store(global->db_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(global->db_rec, val, DBWRAP_REPLACE);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("key '%s' store - %s\n",
                            tdb_data_dbg(key),
@@ -814,7 +814,7 @@ static NTSTATUS smbXsrv_tcon_create(struct smbXsrv_tcon_table *table,
 
        ptr = tcon;
        val = make_tdb_data((uint8_t const *)&ptr, sizeof(ptr));
-       status = dbwrap_record_store(local_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(local_rec, val, DBWRAP_REPLACE);
        TALLOC_FREE(local_rec);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(tcon);
index 538f70dd146eabd839853a1adcf029ae0c77043b..02111126c44539cd7047cf3fe14e8650dc492f32 100644 (file)
@@ -233,7 +233,7 @@ NTSTATUS smbXsrv_version_global_init(const struct server_id *server_id)
        }
 
        val = make_tdb_data(blob.data, blob.length);
-       status = dbwrap_record_store(db_rec, val, TDB_REPLACE);
+       status = dbwrap_record_store(db_rec, val, DBWRAP_REPLACE);
        TALLOC_FREE(db_rec);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_ERR("dbwrap_record_store - %s\n", nt_errstr(status));
index ec33853720ade7c0ec7c0747898ccf4b2a437f66..798703516d49d6b7949a5005e128895c38163753 100644 (file)
@@ -178,7 +178,7 @@ static void test_store_records(struct db_context *db, struct tevent_context *ev)
                counters[pnn]++;
 
                if (verbose) DEBUG(1, ("storing data\n"));
-               status = dbwrap_record_store(rec, data, TDB_REPLACE);
+               status = dbwrap_record_store(rec, data, DBWRAP_REPLACE);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Failed to store record\n"));
                        if (!no_trans) {
index c4cd76bbe20c7d171d6df0e340dd5ec56db10513..a8fa81ad99ee22f24ccc69a7d723e0d39b24facf 100644 (file)
@@ -373,7 +373,7 @@ static NTSTATUS brl_tdb_lock(struct brl_context *brl,
        dbuf.dptr = (unsigned char *)locks;
        dbuf.dsize += sizeof(lock);
 
-       status = dbwrap_record_store(locked, dbuf, TDB_REPLACE);
+       status = dbwrap_record_store(locked, dbuf, DBWRAP_REPLACE);
        if (!NT_STATUS_IS_OK(status)) {
                goto fail;
        }
@@ -525,7 +525,9 @@ found:
                        
                        dbuf.dsize = count * sizeof(*locks);
 
-                       status = dbwrap_record_store(locked, dbuf, TDB_REPLACE);
+                       status = dbwrap_record_store(locked,
+                                                    dbuf,
+                                                    DBWRAP_REPLACE);
                        if (!NT_STATUS_IS_OK(status)) {
                                goto fail;
                        }
@@ -596,8 +598,9 @@ static NTSTATUS brl_tdb_remove_pending(struct brl_context *brl,
                                }
                                count--;
                                dbuf.dsize = count * sizeof(*locks);
-                               status = dbwrap_record_store(locked, dbuf,
-                                                            TDB_REPLACE);
+                               status = dbwrap_record_store(locked,
+                                                            dbuf,
+                                                            DBWRAP_REPLACE);
                                if (!NT_STATUS_IS_OK(status)) {
                                        goto fail;
                                }
@@ -727,7 +730,7 @@ static NTSTATUS brl_tdb_close(struct brl_context *brl,
 
                dbuf.dsize = count * sizeof(*locks);
 
-               status = dbwrap_record_store(locked, dbuf, TDB_REPLACE);
+               status = dbwrap_record_store(locked, dbuf, DBWRAP_REPLACE);
        }
        talloc_free(locked);
 
index 9fe0b2627ee0cd7fadf778b138e7a889a94c29d9..9787a3d2a40051a802e32d47df91d7a80db97d65 100644 (file)
@@ -267,7 +267,7 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file)
        dbuf.dptr = blob.data;
        dbuf.dsize = blob.length;
                
-       status = dbwrap_record_store(lck->locked, dbuf, TDB_REPLACE);
+       status = dbwrap_record_store(lck->locked, dbuf, DBWRAP_REPLACE);
        data_blob_free(&blob);
        return status;
 }