STEP01: allow_newcall/allow_ignore TODO ???
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Mar 2014 12:58:09 +0000 (13:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 10:58:04 +0000 (12:58 +0200)
librpc/rpc/dcerpc_connection.c

index 29f3048910c7dec9d76623685b853241fdf74155..90b0fc15983a5f283a59191745b875f573a94159 100644 (file)
@@ -957,6 +957,8 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
        struct dcerpc_call *call;
        bool valid_type = false;
        bool allow_fragments = false;
+       bool allow_newcall = false;
+       bool allow_ignore = false;
 
        conn->loop.subreq = NULL;
 
@@ -976,6 +978,7 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
                /* Ordinary request. */
                valid_type = true;
                allow_fragments = true;
+               allow_newcall = true;
                break;
 
        case DCERPC_PKT_PING:
@@ -1021,6 +1024,7 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
        case DCERPC_PKT_BIND:
                /* Bind to interface. */
                valid_type = true;
+               allow_newcall = true;
                break;
 
        case DCERPC_PKT_BIND_ACK:
@@ -1036,6 +1040,7 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
        case DCERPC_PKT_ALTER:
                /* Alter auth. */
                valid_type = true;
+               allow_newcall = true;
                break;
 
        case DCERPC_PKT_ALTER_RESP:
@@ -1044,8 +1049,9 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
                break;
 
        case DCERPC_PKT_AUTH3:
-               /* not the real name!  this is undocumented! */
+               /* Auth3 request */
                valid_type = true;
+               allow_newcall = true;
                break;
 
        case DCERPC_PKT_SHUTDOWN:
@@ -1056,11 +1062,16 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
        case DCERPC_PKT_CO_CANCEL:
                /* Connection-oriented cancel request. */
                valid_type = true;
+               allow_ignore = true;
                break;
 
        case DCERPC_PKT_ORPHANED:
-               /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
+               /*
+                * Client telling server it's aborting a partially sent request
+                * or telling server to stop sending replies.
+                */
                valid_type = true;
+               allow_ignore = true;
                break;
 
        case DCERPC_PKT_RTS:
@@ -1117,10 +1128,15 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
                }
        }
 
-       if (call == NULL) {
+       if (call == NULL && allow_newcall) {
                call = conn->calls.new_call;
        }
 
+       if (call == NULL && allow_ignore) {
+               TALLOC_FREE(subreq);
+               goto may_restart;
+       }
+
        if (call == NULL) {
                TALLOC_FREE(subreq);
                dcerpc_connection_dead(conn, NT_STATUS_RPC_PROTOCOL_ERROR);
@@ -1148,6 +1164,7 @@ static void dcerpc_connection_loop(struct tevent_req *subreq)
                return;
        }
 
+may_restart:
        if (conn->calls.new_call == NULL) {
                conn->loop.ev = NULL;
                return;