s3-dcerps: check auth_type msrpc
authorSimo Sorce <idra@samba.org>
Sat, 11 Sep 2010 13:52:42 +0000 (09:52 -0400)
committerSimo Sorce <idra@samba.org>
Fri, 17 Sep 2010 14:59:51 +0000 (10:59 -0400)
make sure the auth type used throught the auth operation is consistent.

source3/rpc_server/srv_pipe.c

index 3595e324ba7b9e89d24b137ae761fc37010e3671..3b9251805a4bde2bbb954fc94c4eb2cd37b6ec0f 100644 (file)
@@ -1201,6 +1201,13 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
         * as zero. JRA.
         */
 
+       if (auth_info.auth_type != p->auth.auth_type) {
+               DEBUG(0, ("Auth type mismatch! Client sent %d, "
+                         "but auth was started as type %d!\n",
+                         auth_info.auth_type, p->auth.auth_type));
+               goto err;
+       }
+
        switch (auth_info.auth_type) {
        case DCERPC_AUTH_TYPE_NTLMSSP:
                ntlmssp_ctx = talloc_get_type_abort(p->auth.auth_ctx,
@@ -1344,6 +1351,14 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
                        goto err_exit;
                }
 
+               if (auth_info.auth_type != p->auth.auth_type) {
+                       DEBUG(0, ("Auth type mismatch! Client sent %d, "
+                                 "but auth was started as type %d!\n",
+                                 auth_info.auth_type, p->auth.auth_type));
+                       goto err_exit;
+               }
+
+
                switch (auth_info.auth_type) {
                case DCERPC_AUTH_TYPE_SPNEGO:
                        spnego_ctx = talloc_get_type_abort(p->auth.auth_ctx,