r14143: Replace old function with equivalent based on new async code.
authorRafal Szczesniak <mimir@samba.org>
Fri, 10 Mar 2006 12:59:05 +0000 (12:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:56:55 +0000 (13:56 -0500)
rafal
(This used to be commit 036d35ff175b26dc1f55e6813f9a014a444d9af4)

source4/librpc/rpc/dcerpc_util.c

index d0676d5f6da6c80c3cf7f69eea3999a4386d8e14..a1e2c47b0f55305d2c992a9f97c421503804c8a3 100644 (file)
@@ -1205,80 +1205,17 @@ NTSTATUS dcerpc_pipe_auth_recv(struct composite_context *c)
 
 
 /* 
-   perform an authenticated bind if needed
+   perform an authenticated bind if needed - sync version
 */
 NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p, 
                          struct dcerpc_binding *binding,
                          const struct dcerpc_interface_table *table,
                          struct cli_credentials *credentials)
 {
-       NTSTATUS status;
-       TALLOC_CTX *tmp_ctx;
-       tmp_ctx = talloc_new(p);
-
-       p->conn->flags = binding->flags;
-
-       /* remember the binding string for possible secondary connections */
-       p->conn->binding_string = dcerpc_binding_string(p, binding);
-
-       if (!cli_credentials_is_anonymous(credentials) &&
-               (binding->flags & DCERPC_SCHANNEL) && 
-               !cli_credentials_get_netlogon_creds(credentials)) {
-               
-               /* If we don't already have netlogon credentials for
-                * the schannel bind, then we have to get these
-                * first */
-               status = dcerpc_bind_auth_schannel(tmp_ctx, p, table, credentials,
-                                                  dcerpc_auth_level(p->conn));
-       } else if (!cli_credentials_is_anonymous(credentials) &&
-               !(p->conn->transport.transport == NCACN_NP &&
-                 !(binding->flags & DCERPC_SIGN) &&
-                 !(binding->flags & DCERPC_SEAL))) {   
-       
-               /* Perform an authenticated DCE-RPC bind, except where
-                * we ask for a connection on NCACN_NP, and that
-                * connection is not signed or sealed.  For that case
-                * we rely on the already authenicated CIFS connection
-                */
-
-               uint8_t auth_type;
-               
-               if ((p->conn->flags & (DCERPC_SIGN|DCERPC_SEAL)) == 0) {
-                       /*
-                         we are doing an authenticated connection,
-                         but not using sign or seal. We must force
-                         the CONNECT dcerpc auth type as a NONE auth
-                         type doesn't allow authentication
-                         information to be passed.
-                       */
-                       p->conn->flags |= DCERPC_CONNECT;
-               }
-
-               if (binding->flags & DCERPC_AUTH_SPNEGO) {
-                       auth_type = DCERPC_AUTH_TYPE_SPNEGO;
-               } else if (binding->flags & DCERPC_AUTH_KRB5) {
-                       auth_type = DCERPC_AUTH_TYPE_KRB5;
-               } else if (binding->flags & DCERPC_SCHANNEL) {
-                       auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
-               } else {
-                       auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
-               }
-
-               status = dcerpc_bind_auth(p, table,
-                                         credentials, auth_type, 
-                                         dcerpc_auth_level(p->conn),
-                                         table->authservices->names[0]);
-       } else {
-               status = dcerpc_bind_auth_none(p, table);
-       }
+       struct composite_context *c;
 
-       if (!NT_STATUS_IS_OK(status)) {
-               char *uuid_str = GUID_string(p, &table->uuid);
-               DEBUG(0,("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
-               talloc_free(uuid_str);
-       }
-       talloc_free(tmp_ctx);
-       return status;
+       c = dcerpc_pipe_auth_send(p, binding, table, credentials);
+       return dcerpc_pipe_auth_recv(c);
 }