summaryrefslogtreecommitdiff
path: root/source3/libsmb/namequery_dc.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-21 00:43:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:39 -0500
commiteeb14fcc94ef4c1452e7842c7c2e2532d0915556 (patch)
tree7c08a5c4f477793858774131e27c47347a7d2cb7 /source3/libsmb/namequery_dc.c
parentc127486a84605fa9df22d790b9f41e7d883d6c21 (diff)
downloadsamba-eeb14fcc94ef4c1452e7842c7c2e2532d0915556.tar.gz
samba-eeb14fcc94ef4c1452e7842c7c2e2532d0915556.tar.bz2
samba-eeb14fcc94ef4c1452e7842c7c2e2532d0915556.zip
r20296: If we're going to overwrite krb5.conf
only do it for our primary domain. Jeremy. (This used to be commit 61d31ce0089fe906d052c971321ce99fede0e240)
Diffstat (limited to 'source3/libsmb/namequery_dc.c')
-rw-r--r--source3/libsmb/namequery_dc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c
index ceb8bbd7e6..375d39a5fd 100644
--- a/source3/libsmb/namequery_dc.c
+++ b/source3/libsmb/namequery_dc.c
@@ -25,6 +25,24 @@
#include "includes.h"
+/**********************************************************************
+ Is this our primary domain ?
+**********************************************************************/
+
+#ifdef HAVE_KRB5
+static BOOL is_our_primary_domain(const char *domain)
+{
+ int role = lp_server_role();
+
+ if ((role == ROLE_DOMAIN_MEMBER) && strequal(lp_workgroup(), domain)) {
+ return True;
+ } else if (strequal(get_global_sam_name(), domain)) {
+ return True;
+ }
+ return False;
+}
+#endif
+
/**************************************************************************
Find the name and IP address for a server in the realm/domain
*************************************************************************/
@@ -79,7 +97,7 @@ static BOOL ads_dc_name(const char *domain,
}
#ifdef HAVE_KRB5
- if ((ads->config.flags & ADS_KDC) && ads_closest_dc(ads)) {
+ if (is_our_primary_domain(domain) && (ads->config.flags & ADS_KDC) && ads_closest_dc(ads)) {
/* We're going to use this KDC for this realm/domain.
If we are using sites, then force the krb5 libs
to use this KDC. */