s3:smb2_server: defer channel/session validation to the session setup code.
authorMichael Adam <obnox@samba.org>
Mon, 27 Jul 2015 07:01:55 +0000 (09:01 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 29 Jul 2015 19:31:09 +0000 (21:31 +0200)
For session bind, and the channel is only to be bound to the given
session just now, so it is not valid. The early request validation
code can hence not check it, and hence validation is defered to the
actual session setup code, which can look at the session binding flags.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Jul 29 21:31:09 CEST 2015 on sn-devel-104

source3/smbd/smb2_server.c

index 442b361760922e130f0536060d83ccd5e0909f71..a0b1bfc8336374aaaaac58b43f8f3b32a4ef13f2 100644 (file)
@@ -1833,10 +1833,26 @@ static NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req)
 
        req->last_session_id = 0;
 
-       /* lookup an existing session */
-       status = smb2srv_session_lookup_conn(req->xconn,
-                                            in_session_id, now,
-                                            &session);
+       /* look an existing session up */
+       switch (in_opcode) {
+       case SMB2_OP_SESSSETUP:
+               /*
+                * For a session bind request, we don't have the
+                * channel set up at this point yet, so we defer
+                * the verification that the connection belongs
+                * to the session to the session setup code, which
+                * can look at the session binding flags.
+                */
+               status = smb2srv_session_lookup_client(req->xconn->client,
+                                                      in_session_id, now,
+                                                      &session);
+               break;
+       default:
+               status = smb2srv_session_lookup_conn(req->xconn,
+                                                    in_session_id, now,
+                                                    &session);
+               break;
+       }
        if (session) {
                req->session = session;
                req->last_session_id = in_session_id;