summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2020-06-05 20:12:57 +0200
committerStefan Metzmacher <metze@samba.org>2020-07-08 15:54:39 +0000
commita1e5b8c77c1e409e22d72086853ba4a5331e279c (patch)
tree842b467b559be5010af9807d020efcc2d32ed8d3
parentacf80fd94374644e26b6bdef7f39a63f62ba57ba (diff)
downloadsamba-a1e5b8c77c1e409e22d72086853ba4a5331e279c.tar.gz
s3:smbd: pass down session_id to smbd_smb2_send_break()
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 <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
-rw-r--r--source3/smbd/smb2_server.c17
1 files 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)