From a1e5b8c77c1e409e22d72086853ba4a5331e279c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 5 Jun 2020 20:12:57 +0200 Subject: s3:smbd: pass down session_id to smbd_smb2_send_break() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oplock break should contain a valid session id of the open file handle, as file handles are relative to a session. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher Reviewed-by: Günther Deschner --- source3/smbd/smb2_server.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 5e05b232851..42805ab9760 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -3494,6 +3494,7 @@ struct smbd_smb2_send_break_state { }; static NTSTATUS smbd_smb2_send_break(struct smbXsrv_connection *xconn, + uint64_t session_id, const uint8_t *body, size_t body_len) { @@ -3520,9 +3521,9 @@ static NTSTATUS smbd_smb2_send_break(struct smbXsrv_connection *xconn, SIVAL(state->hdr, SMB2_HDR_FLAGS, SMB2_HDR_FLAG_REDIRECT); SIVAL(state->hdr, SMB2_HDR_NEXT_COMMAND, 0); SBVAL(state->hdr, SMB2_HDR_MESSAGE_ID, UINT64_MAX); - SIVAL(state->hdr, SMB2_HDR_PID, 0); - SIVAL(state->hdr, SMB2_HDR_TID, 0); - SBVAL(state->hdr, SMB2_HDR_SESSION_ID, 0); + SIVAL(state->hdr, SMB2_HDR_PID, 0); + SIVAL(state->hdr, SMB2_HDR_TID, 0); + SBVAL(state->hdr, SMB2_HDR_SESSION_ID, session_id); memset(state->hdr+SMB2_HDR_SIGNATURE, 0, 16); state->vector[0] = (struct iovec) { @@ -3586,7 +3587,10 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn, SBVAL(body, 0x08, op->global->open_persistent_id); SBVAL(body, 0x10, op->global->open_volatile_id); - return smbd_smb2_send_break(xconn, body, sizeof(body)); + return smbd_smb2_send_break(xconn, + op->compat->vuid, + body, + sizeof(body)); } NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn, @@ -3609,7 +3613,10 @@ NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn, SIVAL(body, 0x24, 0); /* AccessMaskHint, MUST be 0 */ SIVAL(body, 0x28, 0); /* ShareMaskHint, MUST be 0 */ - return smbd_smb2_send_break(xconn, body, sizeof(body)); + return smbd_smb2_send_break(xconn, + 0, /* no session_id */ + body, + sizeof(body)); } static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state) -- cgit v1.2.1