[SCM] Samba Shared Repository - branch v4-4-test updated

Karolin Seeger kseeger at samba.org
Tue Feb 28 12:14:02 UTC 2017


The branch, v4-4-test has been updated
       via  7d2d7dc s3:winbindd: allow a fallback to NTLMSSP for LDAP connections
       via  fa1846c s3:libads: add more debugging to ads_sasl_spnego_bind()
       via  ba39080 s3:winbindd: rely on the kerberos_state from pdb_get_trust_credentials()
       via  c07f071 s3:winbindd: add more debugging to cm_prepare_connection()
       via  91e5a7c s3:passdb: use cli_credentials_set_kerberos_state() for trusts in pdb_get_trust_credentials()
       via  ad3da42 s3:winbindd: fix the valid usage anonymous smb authentication
       via  36da5cc auth/credentials: try to use kerberos with the machine account unless we're in an AD domain
       via  7984693 s3:winbindd: try a NETLOGON connection with noauth over NCACN_NP against trusted domains.
       via  a605f6c s3:winbindd: make sure cm_prepare_connection() only returns OK with a valid tree connect
      from  3526615 vfs_streams_xattr: use fsp, not base_fsp

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-4-test


- Log -----------------------------------------------------------------
commit 7d2d7dcf386bc6ac523c38179074fb677bd9efa0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 22 21:18:32 2017 +0100

    s3:winbindd: allow a fallback to NTLMSSP for LDAP connections
    
    This matches the behaviour of pdb_get_trust_credentials() for
    our machine account and allows us to fallback to NTLMSSP
    when contacting trusted domains.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12598
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 4e9a0894cd977585ccc94e7c1811de1b0293382d)
    
    Autobuild-User(v4-4-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-4-test): Tue Feb 28 13:13:04 CET 2017 on sn-devel-144

commit fa1846cb67b8d7373fd19af3722abd3ebf806696
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 23 11:54:21 2017 +0100

    s3:libads: add more debugging to ads_sasl_spnego_bind()
    
    Any fallbacks to other authentication methods should be logged.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12598
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (similar to commit ea0bc12ba52166032d5112ee22ab53d831c13e86)

commit ba39080cbe3443ff08d231e30a99bb754f83edc2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 22 20:07:25 2017 +0100

    s3:winbindd: rely on the kerberos_state from pdb_get_trust_credentials()
    
    The implementation of pdb_get_trust_credentials() should have all
    the details to set the kerberos_state to a useful value.
    
    This should enable the fallback to NTLMSSP again, when using our
    machine account against trusted domains.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12598
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 51caeb7c538b7546e5feccf27a735bb803c78a0b)

commit c07f071e86067a90ec36643287470c7ec8cc0fda
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 23 11:54:21 2017 +0100

    s3:winbindd: add more debugging to cm_prepare_connection()
    
    Any fallbacks to other authentication methods should be logged.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12598
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (similar to commit ba9d139ec3d71af184a24daf24356304c2e49144)

commit 91e5a7c9269648d75172ccd57be9fc2c947b3b66
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 22 20:07:25 2017 +0100

    s3:passdb: use cli_credentials_set_kerberos_state() for trusts in pdb_get_trust_credentials()
    
    Trust accounts can only use kerberos when contacting other AD domains,
    using NTLMSSP will fail.
    
    At the same time it doesn't make sense to try kerberos for NT4 domains,
    still NTLMSSP will fail, but the callers has to deal with that
    case and just fallback to an anonymous SMB connection.
    
    In all cases we should be able to use NETLOGON SCHANNEL
    over any anonymous smb or tcp transport.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12598
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit d961ae9d14b46708d2693ca91ace04f9f1a53ca2)

commit ad3da42c92b2c16f836087364b19ef350ec26424
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 22 19:18:04 2017 +0100

    s3:winbindd: fix the valid usage anonymous smb authentication
    
    If we are in a situation where we don't have credentials to contact the
    remote domain or against an NT4 with the following settings:
    
      workgroup = NT4DOM
      security = domain
      require strong key = no
      client use spnego = no
      client ipc signing = auto
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12587
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (similar to commit c97a29bdfdc0020ec0113073580da56f2d35edc1)

commit 36da5cc94355173dfa9e69ee685deb42e0ea2086
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 24 16:02:50 2017 +0100

    auth/credentials: try to use kerberos with the machine account unless we're in an AD domain
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12587
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit b845f16d3ca02dd27cc40bbf722426d6f81bb4b7)

commit 79846937b6b08931ef60b61a8ad3317c80bb9147
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 24 10:37:32 2017 +0000

    s3:winbindd: try a NETLOGON connection with noauth over NCACN_NP against trusted domains.
    
    We're using only NCACN_NP here as we rely on the smb signing restrictions
    of cm_prepare_connection().
    
    This should fix SMB authentication with a user of a domain
    behind a transitive trust.
    
    With this change winbindd is able to call
    dcerpc_netr_DsrEnumerateDomainTrusts against the
    dc of a trusted domain again. This only works
    for two-way trusts.
    
    The main problem is the usage of is_trusted_domain()
    which doesn't know about the domain, if winbindd can't
    enumerate the domains in the other forest.
    
    is_trusted_domain() is used in make_user_info_map(),
    which is called in auth3_check_password() before
    auth_check_ntlm_password().
    
    That means we're mapping the user of such a domain
    to our own local sam, before calling our auth modules.
    
    A much better fix, which removes the usage of is_trusted_domain()
    in planed for master, but this should do the job for current releases.
    
    We should avoid talking to DCs of other domains and always
    go via our primary domain. As we should code with one-way trusts
    also, we need to avoid relying on a complete list of
    domains in future.
    
    For now "wbinfo -m" lists domains behind a two-way transitive
    trust again, but that is likely to change in future again!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11830
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit fffefe72fcc62d9688b45f53a5327667dc0b2fe6)

commit a605f6c5044a1277d5575b0a6df4280eb1feba16
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 31 15:19:00 2017 +0100

    s3:winbindd: make sure cm_prepare_connection() only returns OK with a valid tree connect
    
    If cm_get_ipc_credentials() returned anonymous creds and signing is required
    we were returning the result of cm_get_ipc_credentials() instead of
    the original error.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12588
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (similar to commit cebcc2adc7e568d492466bb69f21ba2a9630a0d2)

-----------------------------------------------------------------------

Summary of changes:
 auth/credentials/credentials_secrets.c | 17 +++++-
 source3/libads/sasl.c                  | 25 ++++++++-
 source3/passdb/passdb.c                | 17 ++++++
 source3/winbindd/winbindd_ads.c        |  2 +
 source3/winbindd/winbindd_cm.c         | 99 +++++++++++++++++++++++-----------
 5 files changed, 128 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials_secrets.c b/auth/credentials/credentials_secrets.c
index 784e345..d36913a 100644
--- a/auth/credentials/credentials_secrets.c
+++ b/auth/credentials/credentials_secrets.c
@@ -39,7 +39,7 @@
 #include "dbwrap/dbwrap.h"
 #include "dbwrap/dbwrap_open.h"
 #include "lib/util/util_tdb.h"
-
+#include "libds/common/roles.h"
 
 /**
  * Fill in credentials for the machine trust account, from the secrets database.
@@ -277,6 +277,8 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account_db_ctx(struct cli_credenti
 	char *secrets_tdb_password = NULL;
 	char *secrets_tdb_old_password = NULL;
 	uint32_t secrets_tdb_secure_channel_type = SEC_CHAN_NULL;
+	int server_role = lpcfg_server_role(lp_ctx);
+	int security = lpcfg_security(lp_ctx);
 	char *keystr;
 	char *keystr_upper = NULL;
 	TALLOC_CTX *tmp_ctx = talloc_named(cred, 0, "cli_credentials_set_secrets from ldb");
@@ -355,13 +357,26 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account_db_ctx(struct cli_credenti
 	}
 
 	if (secrets_tdb_password_more_recent) {
+		enum credentials_use_kerberos use_kerberos = CRED_DONT_USE_KERBEROS;
 		char *machine_account = talloc_asprintf(tmp_ctx, "%s$", lpcfg_netbios_name(lp_ctx));
 		cli_credentials_set_password(cred, secrets_tdb_password, CRED_SPECIFIED);
 		cli_credentials_set_old_password(cred, secrets_tdb_old_password, CRED_SPECIFIED);
 		cli_credentials_set_domain(cred, domain, CRED_SPECIFIED);
 		if (strequal(domain, lpcfg_workgroup(lp_ctx))) {
 			cli_credentials_set_realm(cred, lpcfg_realm(lp_ctx), CRED_SPECIFIED);
+
+			switch (server_role) {
+			case ROLE_DOMAIN_MEMBER:
+				if (security != SEC_ADS) {
+					break;
+				}
+				/* fall through */
+			case ROLE_ACTIVE_DIRECTORY_DC:
+				use_kerberos = CRED_AUTO_USE_KERBEROS;
+				break;
+			}
 		}
+		cli_credentials_set_kerberos_state(cred, use_kerberos);
 		cli_credentials_set_username(cred, machine_account, CRED_SPECIFIED);
 		cli_credentials_set_password_last_changed_time(cred, secrets_tdb_lct);
 		cli_credentials_set_secure_channel_type(cred, secrets_tdb_secure_channel_type);
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index 39c60c3..c2564cb 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -703,6 +703,7 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
 #ifdef HAVE_KRB5
 	bool got_kerberos_mechanism = False;
 #endif
+	const char *mech = NULL;
 
 	rc = ldap_sasl_bind_s(ads->ldap.ld, NULL, "GSS-SPNEGO", NULL, NULL, NULL, &scred);
 
@@ -749,6 +750,8 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
 	if (!(ads->auth.flags & ADS_AUTH_DISABLE_KERBEROS) &&
 	    got_kerberos_mechanism) 
 	{
+		mech = "KRB5";
+
 		if (ads->auth.password == NULL ||
 		    ads->auth.password[0] == '\0')
 		{
@@ -775,7 +778,11 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
 							blob);
 			if (!ADS_ERR_OK(status)) {
 				DEBUG(0,("kinit succeeded but "
-					"ads_sasl_spnego_gensec_bind(KRB5) failed: %s\n",
+					"ads_sasl_spnego_gensec_bind(KRB5) failed: "
+					"for %s/%s user[%s] realm[%s]: %s\n",
+					p.service, p.hostname,
+					ads->auth.user_name,
+					ads->auth.realm,
 					ads_errstr(status)));
 			}
 		}
@@ -785,17 +792,33 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
 		    !(ads->auth.flags & ADS_AUTH_ALLOW_NTLMSSP)) {
 			goto done;
 		}
+
+		DEBUG(1,("ads_sasl_spnego_gensec_bind(KRB5) failed for %s/%s "
+			 "with user[%s] realm[%s]: %s, fallback to NTLMSSP\n",
+			 p.service, p.hostname,
+			 ads->auth.user_name,
+			 ads->auth.realm,
+			 ads_errstr(status)));
 	}
 #endif
 
 	/* lets do NTLMSSP ... this has the big advantage that we don't need
 	   to sync clocks, and we don't rely on special versions of the krb5 
 	   library for HMAC_MD4 encryption */
+	mech = "NTLMSSP";
 	status = ads_sasl_spnego_gensec_bind(ads, "GSS-SPNEGO",
 					     CRED_DONT_USE_KERBEROS,
 					     p.service, p.hostname,
 					     data_blob_null);
 done:
+	if (!ADS_ERR_OK(status)) {
+		DEBUG(1,("ads_sasl_spnego_gensec_bind(%s) failed for %s/%s "
+			 "with user[%s] realm=[%s]: %s\n", mech,
+			  p.service, p.hostname,
+			  ads->auth.user_name,
+			  ads->auth.realm,
+			  ads_errstr(status)));
+	}
 	ads_free_service_principal(&p);
 	TALLOC_FREE(frame);
 	if (blob.data != NULL) {
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index f48c317..e7a9b43 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -2621,6 +2621,19 @@ NTSTATUS pdb_get_trust_credentials(const char *netbios_domain,
 			status = NT_STATUS_NO_MEMORY;
 			goto fail;
 		}
+
+		/*
+		 * It's not possible to use NTLMSSP with a domain trust account.
+		 */
+		cli_credentials_set_kerberos_state(creds, CRED_MUST_USE_KERBEROS);
+	} else {
+		/*
+		 * We can't use kerberos against an NT4 domain.
+		 *
+		 * We should have a mode that also disallows NTLMSSP here,
+		 * as only NETLOGON SCHANNEL is possible.
+		 */
+		cli_credentials_set_kerberos_state(creds, CRED_DONT_USE_KERBEROS);
 	}
 
 	ok = cli_credentials_set_username(creds, account_name, CRED_SPECIFIED);
@@ -2635,6 +2648,10 @@ NTSTATUS pdb_get_trust_credentials(const char *netbios_domain,
 			status = NT_STATUS_NO_MEMORY;
 			goto fail;
 		}
+		/*
+		 * We currently can't do kerberos just with an NTHASH.
+		 */
+		cli_credentials_set_kerberos_state(creds, CRED_DONT_USE_KERBEROS);
 		goto done;
 	}
 
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index a9a23db..808986d 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -119,6 +119,8 @@ static ADS_STATUS ads_cached_connection_connect(ADS_STRUCT **adsp,
 	ads->auth.renewable = renewable;
 	ads->auth.password = password;
 
+	ads->auth.flags |= ADS_AUTH_ALLOW_NTLMSSP;
+
 	ads->auth.realm = SMB_STRDUP(auth_realm);
 	if (!strupper_m(ads->auth.realm)) {
 		ads_destroy(&ads);
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 45e3fad..b83b5c9 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -936,17 +936,6 @@ static NTSTATUS get_trust_credentials(struct winbindd_domain *domain,
 		goto ipc_fallback;
 	}
 
-	if (domain->primary && lp_security() == SEC_ADS) {
-		cli_credentials_set_kerberos_state(creds,
-						   CRED_AUTO_USE_KERBEROS);
-	} else if (domain->active_directory) {
-		cli_credentials_set_kerberos_state(creds,
-						   CRED_MUST_USE_KERBEROS);
-	} else {
-		cli_credentials_set_kerberos_state(creds,
-						   CRED_DONT_USE_KERBEROS);
-	}
-
 	if (creds_domain != domain) {
 		/*
 		 * We can only use schannel against a direct trust
@@ -995,6 +984,8 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 	struct named_mutex *mutex;
 
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+	NTSTATUS tmp_status;
+	NTSTATUS tcon_status = NT_STATUS_NETWORK_NAME_DELETED;
 
 	enum smb_signing_setting smb_sign_client_connections = lp_client_ipc_signing();
 
@@ -1094,6 +1085,10 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 		}
 	}
 
+	if (cli_credentials_is_anonymous(creds)) {
+		goto anon_fallback;
+	}
+
 	krb5_state = cli_credentials_get_kerberos_state(creds);
 
 	machine_krb5_principal = cli_credentials_get_principal(creds,
@@ -1129,8 +1124,10 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 			goto session_setup_done;
 		}
 
-		DEBUG(4,("failed kerberos session setup with %s\n",
-			 nt_errstr(result)));
+		DEBUG(1, ("Failed to use kerberos connecting to %s from %s "
+			  "with kerberos principal [%s]\n",
+			  controller, lp_netbios_name(),
+			  machine_krb5_principal));
 	}
 
 	if (krb5_state != CRED_MUST_USE_KERBEROS) {
@@ -1148,10 +1145,15 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 					   machine_password,
 					   strlen(machine_password)+1,
 					   machine_domain);
-	}
 
-	if (NT_STATUS_IS_OK(result)) {
-		goto session_setup_done;
+		if (NT_STATUS_IS_OK(result)) {
+			goto session_setup_done;
+		}
+
+		DEBUG(1, ("Failed to use NTLMSSP connecting to %s from %s "
+			  "with username [%s]\\[%s]\n",
+			  controller, lp_netbios_name(),
+			  machine_domain, machine_account));
 	}
 
 	/*
@@ -1165,10 +1167,6 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 	    || NT_STATUS_EQUAL(result, NT_STATUS_NO_LOGON_SERVERS)
 	    || NT_STATUS_EQUAL(result, NT_STATUS_LOGON_FAILURE))
 	{
-		if (cli_credentials_is_anonymous(creds)) {
-			goto done;
-		}
-
 		if (!cm_is_ipc_credentials(creds)) {
 			goto ipc_fallback;
 		}
@@ -1180,19 +1178,22 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 		goto anon_fallback;
 	}
 
-	DEBUG(4, ("authenticated session setup failed with %s\n",
-		nt_errstr(result)));
+	DEBUG(1, ("authenticated session setup to %s using %s failed with %s\n",
+		  controller,
+		  cli_credentials_get_unparsed_name(creds, talloc_tos()),
+		  nt_errstr(result)));
 
 	goto done;
 
  ipc_fallback:
-	result = cm_get_ipc_credentials(talloc_tos(), &creds);
-	if (!NT_STATUS_IS_OK(result)) {
+	TALLOC_FREE(creds);
+	tmp_status = cm_get_ipc_credentials(talloc_tos(), &creds);
+	if (!NT_STATUS_IS_OK(tmp_status)) {
+		result = tmp_status;
 		goto done;
 	}
 
 	if (cli_credentials_is_anonymous(creds)) {
-		TALLOC_FREE(creds);
 		goto anon_fallback;
 	}
 
@@ -1219,6 +1220,11 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 		goto session_setup_done;
 	}
 
+	DEBUG(1, ("Failed to use NTLMSSP connecting to %s from %s "
+		  "with username "
+		  "[%s]\\[%s]\n",  controller, lp_netbios_name(),
+		  machine_domain, machine_account));
+
 	/*
 	 * If we are not going to validiate the conneciton
 	 * with SMB signing, then allow us to fall back to
@@ -1233,19 +1239,22 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 		goto anon_fallback;
 	}
 
-	DEBUG(4, ("authenticated session setup failed with %s\n",
-		nt_errstr(result)));
+	DEBUG(1, ("authenticated session setup to %s using %s failed with %s\n",
+		  controller,
+		  cli_credentials_get_unparsed_name(creds, talloc_tos()),
+		  nt_errstr(result)));
 
 	goto done;
 
  anon_fallback:
+	TALLOC_FREE(creds);
 
 	if (smb_sign_client_connections == SMB_SIGNING_REQUIRED) {
 		goto done;
 	}
 
 	/* Fall back to anonymous connection, this might fail later */
-	DEBUG(10,("cm_prepare_connection: falling back to anonymous "
+	DEBUG(5,("cm_prepare_connection: falling back to anonymous "
 		"connection for DC %s\n",
 		controller ));
 
@@ -1257,6 +1266,9 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 		goto session_setup_done;
 	}
 
+	DEBUG(1, ("anonymous session setup to %s failed with %s\n",
+		  controller, nt_errstr(result)));
+
 	/* We can't session setup */
 	goto done;
 
@@ -1274,11 +1286,11 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
 	}
 
 	result = cli_tree_connect(*cli, "IPC$", "IPC", "", 0);
-
 	if (!NT_STATUS_IS_OK(result)) {
 		DEBUG(1,("failed tcon_X with %s\n", nt_errstr(result)));
 		goto done;
 	}
+	tcon_status = result;
 
 	/* cache the server name for later connections */
 
@@ -1297,7 +1309,13 @@ static NTSTATUS cm_prepare_connection(struct winbindd_domain *domain,
  done:
 	TALLOC_FREE(mutex);
 
+	if (NT_STATUS_IS_OK(result)) {
+		result = tcon_status;
+	}
+
 	if (!NT_STATUS_IS_OK(result)) {
+		DEBUG(1, ("Failed to prepare SMB connection to %s: %s\n",
+			  controller, nt_errstr(result)));
 		winbind_add_failed_connection_entry(domain, controller, result);
 		if ((*cli) != NULL) {
 			cli_shutdown(*cli);
@@ -3284,7 +3302,28 @@ static NTSTATUS cm_connect_netlogon_transport(struct winbindd_domain *domain,
 
 	sec_chan_type = cli_credentials_get_secure_channel_type(creds);
 	if (sec_chan_type == SEC_CHAN_NULL) {
-		return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+		if (transport == NCACN_IP_TCP) {
+			DBG_NOTICE("get_secure_channel_type gave SEC_CHAN_NULL for %s, "
+				   " deny NCACN_IP_TCP and let the caller fallback to NCACN_NP.\n",
+				   domain->name);
+			return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+		}
+
+		DBG_NOTICE("get_secure_channel_type gave SEC_CHAN_NULL for %s, "
+			   "fallback to noauth on NCACN_NP.\n",
+			   domain->name);
+
+		result = cli_rpc_pipe_open_noauth_transport(conn->cli,
+							    transport,
+							    &ndr_table_netlogon,
+							    &conn->netlogon_pipe);
+		if (!NT_STATUS_IS_OK(result)) {
+			invalidate_cm_connection(domain);
+			return result;
+		}
+
+		*cli = conn->netlogon_pipe;
+		return NT_STATUS_OK;
 	}
 
 	result = rpccli_create_netlogon_creds_with_creds(creds,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list