]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Remove smbXsrv_open_global0->db_rec
authorVolker Lendecke <vl@samba.org>
Wed, 11 Jan 2023 10:02:11 +0000 (11:02 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 13 Feb 2023 10:49:43 +0000 (10:49 +0000)
The only user by now was net serverid wipedbs, and there it was easy to replace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Feb 13 10:49:43 UTC 2023 on atb-devel-224

source3/librpc/idl/smbXsrv.idl
source3/smbd/smbXsrv_open.c
source3/smbd/smbXsrv_open.h
source3/utils/net_serverid.c

index e0a751f32de4bab0b3bf8deb6e3d3cdca2b28b89..173bc64db77a19bff72555c916f6b58b6300d4e6 100644 (file)
@@ -459,7 +459,6 @@ interface smbXsrv
        } smbXsrv_open_flags;
 
        typedef struct {
-               [ignore] db_record                      *db_rec;
                server_id                               server_id;
                uint32                                  open_global_id;
                hyper                                   open_persistent_id;
index 18a544b55874320ef1a2e17ee153709d13409dc7..3975a7e6cffe8843bd134b1f4965445a03bcc772 100644 (file)
@@ -747,13 +747,6 @@ NTSTATUS smbXsrv_open_update(struct smbXsrv_open *op)
                op->global->open_global_id, &key_buf);
        NTSTATUS status;
 
-       if (op->global->db_rec != NULL) {
-               DEBUG(0, ("smbXsrv_open_update(0x%08x): "
-                         "Called with db_rec != NULL'\n",
-                         op->global->open_global_id));
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
        status = dbwrap_do_locked(
                table->global.db_ctx, key, smbXsrv_open_update_fn, &state);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1365,7 +1358,7 @@ fail:
 }
 
 struct smbXsrv_open_global_traverse_state {
-       int (*fn)(struct smbXsrv_open_global0 *, void *);
+       int (*fn)(struct db_record *rec, struct smbXsrv_open_global0 *, void *);
        void *private_data;
 };
 
@@ -1385,15 +1378,14 @@ static int smbXsrv_open_global_traverse_fn(struct db_record *rec, void *data)
                return -1;
        }
 
-       global->db_rec = rec;
-       ret = state->fn(global, state->private_data);
+       ret = state->fn(rec, global, state->private_data);
        talloc_free(global);
        return ret;
 }
 
 NTSTATUS smbXsrv_open_global_traverse(
-                       int (*fn)(struct smbXsrv_open_global0 *, void *),
-                       void *private_data)
+       int (*fn)(struct db_record *rec, struct smbXsrv_open_global0 *, void *),
+       void *private_data)
 {
 
        NTSTATUS status;
index 39905506b95c6f1ff8889ae9adf9593c9e9a744b..0257650123792bad05f3857784c3a5fa16ecdf1e 100644 (file)
@@ -64,8 +64,10 @@ NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn,
                               const struct GUID *create_guid,
                               NTTIME now,
                               struct smbXsrv_open **_open);
+
+struct db_record;
 NTSTATUS smbXsrv_open_global_traverse(
-       int (*fn)(struct smbXsrv_open_global0 *, void *),
+       int (*fn)(struct db_record *rec, struct smbXsrv_open_global0 *, void *),
        void *private_data);
 
 NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id);
index b98a17329833a9962030963469af633378a5d2f3..a01c0d5d0217908a204c9a20eb4c825aea40f490 100644 (file)
@@ -232,7 +232,8 @@ done:
        return ret;
 }
 
-static int wipedbs_traverse_open(struct smbXsrv_open_global0 *open,
+static int wipedbs_traverse_open(struct db_record *db_rec,
+                                struct smbXsrv_open_global0 *open,
                                 void *wipedbs_state)
 {
        struct wipedbs_state *state =
@@ -300,9 +301,9 @@ static int wipedbs_traverse_open(struct smbXsrv_open_global0 *open,
                goto done;
        }
 
-       tmp = dbwrap_record_get_key(open->db_rec);
+       tmp = dbwrap_record_get_key(db_rec);
        rec->key = tdb_data_talloc_copy(rec, tmp);
-       tmp = dbwrap_record_get_value(open->db_rec);
+       tmp = dbwrap_record_get_value(db_rec);
        rec->val = tdb_data_talloc_copy(rec, tmp);
 
        rec->desc = talloc_asprintf(
@@ -318,7 +319,7 @@ static int wipedbs_traverse_open(struct smbXsrv_open_global0 *open,
                goto done;
        }
 
-       state->open_db = dbwrap_record_get_db(open->db_rec);
+       state->open_db = dbwrap_record_get_db(db_rec);
 
        DLIST_ADD(sd->open_records, rec);
        ret = 0;