From: Ralph Boehme Date: Mon, 4 Nov 2024 06:45:59 +0000 (+0100) Subject: dbwrap: convert dbwrap_record_store() from TDB to DBWRAP flags X-Git-Tag: talloc-2.5.0~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d28c14f1aee7ad1fa9652ebbfc69a410b4b9b48;p=thirdparty%2Fsamba.git dbwrap: convert dbwrap_record_store() from TDB to DBWRAP flags Signed-off-by: Ralph Boehme Reviewed-by: Martin Schwenke --- diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index 312fb418754..5fe0b36f959 100644 --- a/lib/dbwrap/dbwrap_util.c +++ b/lib/dbwrap/dbwrap_util.c @@ -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, diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c index 7d5ef64e8f4..cbdde7babb4 100644 --- a/source3/libnet/libnet_dssync_passdb.c +++ b/source3/libnet/libnet_dssync_passdb.c @@ -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; diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 207f3757989..bcc221d7615 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -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"); diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 7d166113ef9..5bd9f662c1f 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -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); diff --git a/source3/smbd/smbXsrv_client.c b/source3/smbd/smbXsrv_client.c index fc79672e9c4..c0afcdb8475 100644 --- a/source3/smbd/smbXsrv_client.c +++ b/source3/smbd/smbXsrv_client.c @@ -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), diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c index 329332eb56f..289faff25e1 100644 --- a/source3/smbd/smbXsrv_open.c +++ b/source3/smbd/smbXsrv_open.c @@ -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", diff --git a/source3/smbd/smbXsrv_session.c b/source3/smbd/smbXsrv_session.c index a268c3ff102..cf1b923103d 100644 --- a/source3/smbd/smbXsrv_session.c +++ b/source3/smbd/smbXsrv_session.c @@ -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); diff --git a/source3/smbd/smbXsrv_tcon.c b/source3/smbd/smbXsrv_tcon.c index 2f25246d6b4..c451d9121c1 100644 --- a/source3/smbd/smbXsrv_tcon.c +++ b/source3/smbd/smbXsrv_tcon.c @@ -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); diff --git a/source3/smbd/smbXsrv_version.c b/source3/smbd/smbXsrv_version.c index 538f70dd146..02111126c44 100644 --- a/source3/smbd/smbXsrv_version.c +++ b/source3/smbd/smbXsrv_version.c @@ -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)); diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c index ec33853720a..798703516d4 100644 --- a/source3/utils/dbwrap_torture.c +++ b/source3/utils/dbwrap_torture.c @@ -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) { diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index c4cd76bbe20..a8fa81ad99e 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -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); diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 9fe0b2627ee..9787a3d2a40 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -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; }