r4691: Make the DCE-RPC bind code compleatly generic to the number of passes
authorAndrew Bartlett <abartlet@samba.org>
Tue, 11 Jan 2005 20:09:59 +0000 (20:09 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:08:44 +0000 (13:08 -0500)
that the GENSEC mechanism wishes to select.  It is of course up to the
GENSEC mech and the remote server to actually support this however...

Andrew Bartlett
(This used to be commit 7200a01545e14a8b0c90fadf3c27933dd1f4359f)

source4/librpc/rpc/dcerpc_auth.c

index c506c8fd4ce9b4d238ae059203d3e979516d436b..c0b72b68423b248f67a9a154ec47ba700a23731e 100644 (file)
@@ -75,14 +75,21 @@ NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p, uint8_t auth_type, uint8_t auth
        status = gensec_update(p->conn->security_state.generic_state, tmp_ctx,
                               null_data_blob,
                               &credentials);
-       if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               goto done;
-       }
 
        p->conn->security_state.auth_info->credentials = credentials;
 
-       status = dcerpc_bind_byuuid(p, tmp_ctx, uuid, version);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+               /* We are demanding a reply, so use a request that will get us one */
+               status = dcerpc_bind_byuuid(p, tmp_ctx, uuid, version);
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto done;
+               }
+       } else if (NT_STATUS_IS_OK(status)) {
+               /* We don't care for the reply, so jump to the end */
+               status = dcerpc_bind_byuuid(p, tmp_ctx, uuid, version);
+               goto done;
+       } else {
+               /* Something broke in GENSEC - bail */
                goto done;
        }
 
@@ -90,7 +97,8 @@ NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p, uint8_t auth_type, uint8_t auth
                status = gensec_update(p->conn->security_state.generic_state, tmp_ctx,
                                       p->conn->security_state.auth_info->credentials,
                                       &credentials);
-               if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+               if (!NT_STATUS_IS_OK(status) 
+                   && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                        break;
                }