s3:smb2_tcon: pass down in_flags to smbd_smb2_tree_connect_send()
authorStefan Metzmacher <metze@samba.org>
Mon, 3 Sep 2018 13:28:21 +0000 (15:28 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 28 Jan 2020 12:26:51 +0000 (13:26 +0100)
SMB 3.1.1 converted the reserved field to a flags field.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smb2_tcon.c

index bf709d8686e8a0115ff0f14c43a5c0f300f6994c..76112d04889576677898917d13dd080523bf3fc0 100644 (file)
@@ -33,6 +33,7 @@
 static struct tevent_req *smbd_smb2_tree_connect_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct smbd_smb2_request *smb2req,
+                                       uint16_t in_flags,
                                        const char *in_path);
 static NTSTATUS smbd_smb2_tree_connect_recv(struct tevent_req *req,
                                            uint8_t *out_share_type,
@@ -46,7 +47,9 @@ static void smbd_smb2_request_tcon_done(struct tevent_req *subreq);
 
 NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
 {
+       struct smbXsrv_connection *xconn = req->xconn;
        const uint8_t *inbody;
+       uint16_t in_flags;
        uint16_t in_path_offset;
        uint16_t in_path_length;
        DATA_BLOB in_path_buffer;
@@ -62,6 +65,11 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
        }
        inbody = SMBD_SMB2_IN_BODY_PTR(req);
 
+       if (xconn->protocol >= PROTOCOL_SMB3_11) {
+               in_flags = SVAL(inbody, 0x02);
+       } else {
+               in_flags = 0;
+       }
        in_path_offset = SVAL(inbody, 0x04);
        in_path_length = SVAL(inbody, 0x06);
 
@@ -96,6 +104,7 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
        subreq = smbd_smb2_tree_connect_send(req,
                                             req->sconn->ev_ctx,
                                             req,
+                                            in_flags,
                                             in_path_string);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
@@ -425,6 +434,7 @@ struct smbd_smb2_tree_connect_state {
 static struct tevent_req *smbd_smb2_tree_connect_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct smbd_smb2_request *smb2req,
+                                       uint16_t in_flags,
                                        const char *in_path)
 {
        struct tevent_req *req;