]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: avoid dereferencing client->connections
authorStefan Metzmacher <metze@samba.org>
Wed, 8 Jul 2020 08:15:56 +0000 (10:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 8 Jul 2020 15:54:40 +0000 (15:54 +0000)
There're typically better ways to get the same information.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source3/locking/leases_util.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/smb2_sesssetup.c

index d307f420c7c0ca2b44f68f07e7cd342f62d16321..cb62bffbd7d66835e997c58bf1fc2e5a62955e23 100644 (file)
@@ -90,5 +90,5 @@ bool fsp_lease_type_is_exclusive(struct files_struct *fsp)
 
 const struct GUID *fsp_client_guid(const files_struct *fsp)
 {
-       return &fsp->conn->sconn->client->connections->smb2.client.guid;
+       return &fsp->conn->sconn->client->global->client_guid;
 }
index fa3d21fe38e805868ad07db9a1096516167e9821..79b72784249774e1d4d9814baddbbb65e9dee39e 100644 (file)
@@ -5444,7 +5444,7 @@ static NTSTATUS lease_match(connection_struct *conn,
                state.id = vfs_file_id_from_sbuf(conn, &fname->st);
        }
 
-       status = leases_db_parse(&sconn->client->connections->smb2.client.guid,
+       status = leases_db_parse(&sconn->client->global->client_guid,
                                 lease_key, lease_match_parser, &state);
        if (!NT_STATUS_IS_OK(status)) {
                /*
index 97fe343a88b5b0ed3220e715c9de655e74290f1e..a83a076152de383301b0e79e7fe93fce18a19412 100644 (file)
@@ -480,8 +480,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
                         const struct smb2_lease_key *key,
                         uint32_t lease_state)
 {
-       struct smbXsrv_connection *xconn = client->connections;
-       struct smbd_server_connection *sconn = xconn->client->sconn;
+       struct smbd_server_connection *sconn = client->sconn;
        const struct GUID *client_guid = NULL;
        struct share_mode_lock *lck;
        const struct file_id id = ids[0];
@@ -501,7 +500,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
-       client_guid = &sconn->client->connections->smb2.client.guid;
+       client_guid = &sconn->client->global->client_guid;
 
        status = leases_db_get(client_guid,
                               key,
@@ -607,8 +606,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
                                NTSTATUS set_status;
 
                                set_status = leases_db_set(
-                                       &sconn->client->connections->
-                                       smb2.client.guid,
+                                       &sconn->client->global->client_guid,
                                        key,
                                        current_state,
                                        breaking,
@@ -626,7 +624,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
                }
 
                tevent_schedule_immediate(state->im,
-                                         xconn->client->raw_ev_ctx,
+                                         client->raw_ev_ctx,
                                          downgrade_lease_additional_trigger,
                                          state);
 
index f9c8819327c054ca1814698a20327c8553c1000e..2b6b3a820d4d5e5ad56795da104043de06d39e27 100644 (file)
@@ -1436,7 +1436,7 @@ static void smbd_smb2_logoff_shutdown_done(struct tevent_req *subreq)
        NTSTATUS status;
        bool ok;
        const struct GUID *client_guid =
-               &state->smb2req->session->client->connections->smb2.client.guid;
+               &state->smb2req->session->client->global->client_guid;
 
        status = smb2srv_session_shutdown_recv(subreq);
        if (tevent_req_nterror(req, status)) {