s3:smb2_sesssetup: check that the connection belongs to the session in sess.setup
authorMichael Adam <obnox@samba.org>
Wed, 29 Jul 2015 09:19:55 +0000 (11:19 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 29 Jul 2015 16:26:07 +0000 (18:26 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/smbd/smb2_sesssetup.c

index 11d381fcdb46f188f0f57e32bf137d3a4d22a59d..3233846295a5da687fe50d5e32a4911a36ca7ffe 100644 (file)
@@ -561,6 +561,7 @@ static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
        NTSTATUS status;
        NTTIME now = timeval_to_nttime(&smb2req->request_time);
        struct tevent_req *subreq;
+       struct smbXsrv_channel_global0 *c = NULL;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smbd_smb2_session_setup_state);
@@ -618,6 +619,13 @@ static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
                }
        }
 
+       status = smbXsrv_session_find_channel(smb2req->session,
+                                             smb2req->xconn, &c);
+       if (!NT_STATUS_IS_OK(status)) {
+               tevent_req_nterror(req, status);
+               return tevent_req_post(req, ev);
+       }
+
        if (state->session->gensec == NULL) {
                status = auth_generic_prepare(state->session,
                                              state->smb2req->xconn->remote_address,