diff options
author | Stefan Metzmacher <metze@samba.org> | 2020-06-02 16:50:22 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-07-08 15:54:40 +0000 |
commit | 66c0888d2e9a76d59fd29cc7be3597e60235e503 (patch) | |
tree | c38add848f7a7202f1cfcbb17ce30aecd1c9ebe3 | |
parent | 42497b8639965de7b800b25ce20052ef7b44fb05 (diff) | |
download | samba-66c0888d2e9a76d59fd29cc7be3597e60235e503.tar.gz |
s3:smbd: pass down smbXsrv_client to smbd_smb2_send_{oplock,lease}_break()
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>
-rw-r--r-- | source3/smbd/globals.h | 4 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 3 | ||||
-rw-r--r-- | source3/smbd/smb2_break.c | 18 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 6 |
4 files changed, 13 insertions, 18 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 7e0f11d5d15..e749d5e954e 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -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, diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index fce604ded06..97fe343a88b 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -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, diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c index 02ccac972e2..e8f6b996101 100644 --- a/source3/smbd/smb2_break.c +++ b/source3/smbd/smb2_break.c @@ -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; } } diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 7d990a0ca43..6eb95cb93b2 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -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)); |