167d4b
From dc6b86b93c8f059b0cc96c364ffad05c88b7d92e Mon Sep 17 00:00:00 2001
167d4b
From: Christof Schmitt <cs@samba.org>
167d4b
Date: Fri, 22 Aug 2014 09:15:59 -0700
167d4b
Subject: [PATCH] s3-winbindd: Use correct realm for trusted domains in idmap child
167d4b
167d4b
When authenticating users in a trusted domain, the idmap_ad module
167d4b
always connects to a local DC instead of one in the trusted domain.
167d4b
167d4b
Fix this by passing the correct realm to connect to.
167d4b
167d4b
Also Comment parameters passed to ads_cached_connection_connect
167d4b
167d4b
Signed-off-by: Christof Schmitt <cs@samba.org>
167d4b
Reviewed-by: Jeremy Allison <jra@samba.org>
167d4b
(cherry picked from commit c203c722e7e22f9146f2ecf6f42452c0e82042e4)
167d4b
---
167d4b
 source3/winbindd/winbindd_ads.c |   11 +++++++++--
167d4b
 1 files changed, 9 insertions(+), 2 deletions(-)
167d4b
167d4b
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
167d4b
index 4c26389..e47613e 100644
167d4b
--- a/source3/winbindd/winbindd_ads.c
167d4b
+++ b/source3/winbindd/winbindd_ads.c
167d4b
@@ -187,8 +187,15 @@ ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp, const char *dom_name)
167d4b
 		}
167d4b
 	}
167d4b
 
167d4b
-	status = ads_cached_connection_connect(adsp, realm, dom_name, ldap_server,
167d4b
-					       password, realm, 0);
167d4b
+	status = ads_cached_connection_connect(
167d4b
+		adsp,			/* Returns ads struct. */
167d4b
+		wb_dom->alt_name,	/* realm to connect to. */
167d4b
+		dom_name,		/* 'workgroup' name for ads_init */
167d4b
+		ldap_server,		/* DNS name to connect to. */
167d4b
+		password,		/* password for auth realm. */
167d4b
+		realm,			/* realm used for krb5 ticket. */
167d4b
+		0);			/* renewable ticket time. */
167d4b
+
167d4b
 	SAFE_FREE(realm);
167d4b
 
167d4b
 	return status;
167d4b
-- 
167d4b
1.7.1
167d4b