s3:rpc_client: require DCERPC_BIND_ACK_RESULT_ACCEPTANCE for the negotiated presentat...
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Apr 2024 23:17:46 +0000 (01:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 23 Apr 2024 16:23:38 +0000 (16:23 +0000)
We should fail if we didn't get DCERPC_BIND_ACK_RESULT_ACCEPTANCE.

It's also not needed to require a single array element.

We already checked above that we have at least one.

The next patch will all bind time feature negotiation
and that means we'll have 2 array elements...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_client/cli_pipe.c

index 4666bac6e49a446f8c2ea564fcf24cb8c3d08874..15103093224fadef42ee847a5328046491b4c26e 100644 (file)
@@ -1679,9 +1679,10 @@ static bool check_bind_response(const struct dcerpc_bind_ack *r,
                return False;
        }
 
-       if (r->num_results != 0x1 || ctx.result != 0) {
-               DEBUG(2,("bind_rpc_pipe: bind denied results: %d reason: %x\n",
-                         r->num_results, ctx.reason.value));
+       if (ctx.result != DCERPC_BIND_ACK_RESULT_ACCEPTANCE) {
+               DBG_NOTICE("bind denied result: %d reason: %x\n",
+                          ctx.result, ctx.reason.value);
+               return false;
        }
 
        DEBUG(5,("check_bind_response: accepted!\n"));