smbd: Remove smbXsrv_open->db_rec
authorVolker Lendecke <vl@samba.org>
Wed, 4 Jan 2023 10:29:51 +0000 (11:29 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 10 Jan 2023 00:28:37 +0000 (00:28 +0000)
This was only referenced in smbXsrv_open_close, but it was never
assigned anything but NULL.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/librpc/idl/smbXsrv.idl
source3/smbd/smbXsrv_open.c

index ec65a5c1a6136ef56fd3aff5743627e6f7597cf3..e0a751f32de4bab0b3bf8deb6e3d3cdca2b28b89 100644 (file)
@@ -514,7 +514,6 @@ interface smbXsrv
         */
        typedef struct {
                [ignore] smbXsrv_open_table             *table;
-               [ignore] db_record                      *db_rec;
                uint32                                  local_id;
                [ref] smbXsrv_open_global0              *global;
                NTSTATUS                                status;
index 3b78026769474afa98489883f161383d331a2414..46e8b810e59fce8c7663b3d740658c12fa1f5a23 100644 (file)
@@ -1163,34 +1163,27 @@ NTSTATUS smbXsrv_open_close(struct smbXsrv_open *op, NTTIME now)
        }
        TALLOC_FREE(global_rec);
 
-       local_rec = op->db_rec;
+       local_rec = smbXsrv_open_local_fetch_locked(table->local.db_ctx,
+                                                   op->local_id,
+                                                   op /* TALLOC_CTX*/);
        if (local_rec == NULL) {
-               local_rec = smbXsrv_open_local_fetch_locked(table->local.db_ctx,
-                                                           op->local_id,
-                                                           op /* TALLOC_CTX*/);
-               if (local_rec == NULL) {
-                       error = NT_STATUS_INTERNAL_ERROR;
-               }
+               error = NT_STATUS_INTERNAL_ERROR;
        }
 
-       if (local_rec != NULL) {
-               status = dbwrap_record_delete(local_rec);
-               if (!NT_STATUS_IS_OK(status)) {
-                       TDB_DATA key = dbwrap_record_get_key(local_rec);
+       status = dbwrap_record_delete(local_rec);
+       if (!NT_STATUS_IS_OK(status)) {
+               TDB_DATA key = dbwrap_record_get_key(local_rec);
 
-                       DEBUG(0, ("smbXsrv_open_close(0x%08x): "
-                                 "failed to delete local key '%s': %s\n",
-                                 op->global->open_global_id,
-                                 tdb_data_dbg(key),
-                                 nt_errstr(status)));
-                       error = status;
-               }
-               table->local.num_opens -= 1;
-       }
-       if (op->db_rec == NULL) {
-               TALLOC_FREE(local_rec);
+               DEBUG(0, ("smbXsrv_open_close(0x%08x): "
+                         "failed to delete local key '%s': %s\n",
+                         op->global->open_global_id,
+                         tdb_data_dbg(key),
+                         nt_errstr(status)));
+               error = status;
        }
-       op->db_rec = NULL;
+       table->local.num_opens -= 1;
+
+       TALLOC_FREE(local_rec);
 
        if (op->compat) {
                op->compat->op = NULL;