]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: pass down session_id to smbd_smb2_send_break()
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Jun 2020 18:12:57 +0000 (20:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 8 Jul 2020 15:54:39 +0000 (15:54 +0000)
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>
source3/smbd/smb2_server.c

index 5e05b232851effc17007d7fbf5240f92ddaf8b7d..42805ab9760f6179518531ca7743798f2e1defe0 100644 (file)
@@ -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)