]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: pass down smbXsrv_client to smbd_smb2_send_{oplock,lease}_break()
authorStefan Metzmacher <metze@samba.org>
Tue, 2 Jun 2020 14:50:22 +0000 (16:50 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 8 Jul 2020 15:54:40 +0000 (15:54 +0000)
Which connection is actually used should not matter to the main logic.

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/smbd/globals.h
source3/smbd/oplock.c
source3/smbd/smb2_break.c
source3/smbd/smb2_server.c

index 7e0f11d5d150020835bcd0e87d1e2820b9c94d3c..e749d5e954ec51594c50575e77ea81b81b412d5c 100644 (file)
@@ -263,10 +263,10 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
 #define smbd_smb2_request_done(req, body, dyn) \
        smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn, __location__)
 
-NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
+NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_client *client,
                                     struct smbXsrv_open *op,
                                     uint8_t oplock_level);
-NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
+NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_client *client,
                                    uint16_t new_epoch,
                                    uint32_t lease_flags,
                                    struct smb2_lease_key *lease_key,
index fce604ded0674f64bb0911b4df7f8b65b94a51d3..97fe343a88b5b0ed3220e715c9de655e74290f1e 100644 (file)
@@ -424,10 +424,9 @@ static void downgrade_lease_additional_trigger(struct tevent_context *ev,
        struct downgrade_lease_additional_state *state =
                talloc_get_type_abort(private_data,
                struct downgrade_lease_additional_state);
-       struct smbXsrv_connection *xconn = state->client->connections;
        NTSTATUS status;
 
-       status = smbd_smb2_send_lease_break(xconn,
+       status = smbd_smb2_send_lease_break(state->client,
                                            state->new_epoch,
                                            state->break_flags,
                                            &state->lease_key,
index 02ccac972e2763202054f2b7db49c92f306caa5e..e8f6b99610108c9510b7a6cd9839c6f63c34f29b 100644 (file)
@@ -442,15 +442,9 @@ void send_break_message_smb2(files_struct *fsp,
                             uint32_t break_from,
                             uint32_t break_to)
 {
+       struct smbXsrv_client *client =
+               fsp->conn->sconn->client;
        NTSTATUS status;
-       struct smbXsrv_connection *xconn = NULL;
-
-       /*
-        * TODO: in future we should have a better algorithm
-        * to find the correct connection for a break message.
-        * Then we also need some retries if a channel gets disconnected.
-        */
-       xconn = fsp->conn->sconn->client->connections;
 
        if (!NT_STATUS_IS_OK(fsp->op->status)) {
                DBG_DEBUG("skip oplock break for file %s, %s, "
@@ -482,20 +476,20 @@ void send_break_message_smb2(files_struct *fsp,
                        new_epoch = 0;
                }
 
-               status = smbd_smb2_send_lease_break(xconn, new_epoch, break_flags,
+               status = smbd_smb2_send_lease_break(client, new_epoch, break_flags,
                                                    &fsp->lease->lease.lease_key,
                                                    break_from, break_to);
        } else {
                uint8_t smb2_oplock_level;
                smb2_oplock_level = (break_to & SMB2_LEASE_READ) ?
                        SMB2_OPLOCK_LEVEL_II : SMB2_OPLOCK_LEVEL_NONE;
-               status = smbd_smb2_send_oplock_break(xconn,
+               status = smbd_smb2_send_oplock_break(client,
                                                     fsp->op,
                                                     smb2_oplock_level);
        }
        if (!NT_STATUS_IS_OK(status)) {
-               smbd_server_connection_terminate(xconn,
-                                                nt_errstr(status));
+               smbd_server_disconnect_client(client,
+                                             nt_errstr(status));
                return;
        }
 }
index 7d990a0ca43cf6c701568c6aa82616b33345e1ba..6eb95cb93b2ef0087524b4d444c227c6774c93ef 100644 (file)
@@ -3590,10 +3590,11 @@ static NTSTATUS smbd_smb2_send_break(struct smbXsrv_connection *xconn,
        return NT_STATUS_OK;
 }
 
-NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
+NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_client *client,
                                     struct smbXsrv_open *op,
                                     uint8_t oplock_level)
 {
+       struct smbXsrv_connection *xconn = client->connections;
        uint8_t body[0x18];
 
        SSVAL(body, 0x00, sizeof(body));
@@ -3609,13 +3610,14 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
                                    sizeof(body));
 }
 
-NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
+NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_client *client,
                                    uint16_t new_epoch,
                                    uint32_t lease_flags,
                                    struct smb2_lease_key *lease_key,
                                    uint32_t current_lease_state,
                                    uint32_t new_lease_state)
 {
+       struct smbXsrv_connection *xconn = client->connections;
        uint8_t body[0x2c];
 
        SSVAL(body, 0x00, sizeof(body));