Author: lmuelle
Date: 2007-09-08 14:56:11 +0000 (Sat, 08 Sep 2007)
New Revision: 25032

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25032

Log:
Contact an off site DC if non is available on site.

Modified:
   branches/SAMBA_3_0_25/source/libsmb/namequery_dc.c
   branches/SAMBA_3_0_25/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_2/source/libsmb/namequery_dc.c
   branches/SAMBA_3_2/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_2_0/source/libsmb/namequery_dc.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_cm.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/libsmb/namequery_dc.c
===================================================================
--- branches/SAMBA_3_0_25/source/libsmb/namequery_dc.c  2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_0_25/source/libsmb/namequery_dc.c  2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -99,15 +99,23 @@
                }
 
 #ifdef HAVE_KRB5
-               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. */
+               if (is_our_primary_domain(domain) && (ads->config.flags & 
ADS_KDC)) {
+                       if (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. */
 
-                       create_local_private_krb5_conf_for_domain(realm,
-                                                               domain,
-                                                               sitename,
-                                                               ads->ldap_ip);
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       
sitename,
+                                                                       
ads->ldap_ip);
+                       } else {
+                               /* use an off site KDC */
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       NULL,
+                                                                       
ads->ldap_ip);
+                       }
                }
 #endif
                break;

Modified: branches/SAMBA_3_0_25/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0_25/source/nsswitch/winbindd_cm.c 2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_0_25/source/nsswitch/winbindd_cm.c 2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -1032,19 +1032,27 @@
 
                        DEBUG(10,("dcip_to_name: flags = 0x%x\n", (unsigned 
int)ads->config.flags));
 
-                       if (domain->primary && (ads->config.flags & ADS_KDC) && 
ads_closest_dc(ads)) {
-                               char *sitename = 
sitename_fetch(ads->config.realm);
+                       if (domain->primary && (ads->config.flags & ADS_KDC)) {
+                               if (ads_closest_dc(ads)) {
+                                       char *sitename = 
sitename_fetch(ads->config.realm);
 
-                               /* 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. */
+                                       /* 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. */
 
-                               
create_local_private_krb5_conf_for_domain(domain->alt_name,
-                                                               domain->name,
-                                                               sitename,
-                                                               ip);
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       
sitename,
+                                                                       ip);
 
-                               SAFE_FREE(sitename);
+                                       SAFE_FREE(sitename);
+                               } else {
+                                       /* use an off site KDC */
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       NULL,
+                                                                       ip);
+                               }
                                /* Ensure we contact this DC also. */
                                saf_store( domain->name, name);
                                saf_store( domain->alt_name, name);

Modified: branches/SAMBA_3_2/source/libsmb/namequery_dc.c
===================================================================
--- branches/SAMBA_3_2/source/libsmb/namequery_dc.c     2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_2/source/libsmb/namequery_dc.c     2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -98,15 +98,22 @@
                }
 
 #ifdef HAVE_KRB5
-               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. */
+               if (is_our_primary_domain(domain) && (ads->config.flags & 
ADS_KDC)) {
+                       if (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. */
 
-                       create_local_private_krb5_conf_for_domain(realm,
-                                                               domain,
-                                                               sitename,
-                                                               ads->ldap.ip);
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       
sitename,
+                                                                       
ads->ldap.ip);
+                       } else {
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       NULL,
+                                                                       
ads->ldap.ip);
+                       }
                }
 #endif
                break;

Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_2/source/nsswitch/winbindd_cm.c    2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_cm.c    2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -1084,21 +1084,29 @@
 
                        DEBUG(10,("dcip_to_name: flags = 0x%x\n", (unsigned 
int)ads->config.flags));
 
-                       if (domain->primary && (ads->config.flags & ADS_KDC) && 
ads_closest_dc(ads)) {
-                               char *sitename = 
sitename_fetch(ads->config.realm);
+                       if (domain->primary && (ads->config.flags & ADS_KDC)) {
+                               if (ads_closest_dc(ads)) {
+                                       char *sitename = 
sitename_fetch(ads->config.realm);
 
-                               /* 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. */
+                                       /* 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. */
 
-                               
create_local_private_krb5_conf_for_domain(domain->alt_name,
-                                                               domain->name,
-                                                               sitename,
-                                                               ip);
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       
sitename,
+                                                                       ip);
 
+                                       SAFE_FREE(sitename);
+                               } else {
+                                       /* use an off site KDC */
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       NULL,
+                                                                       ip);
+                               }
                                winbindd_set_locator_kdc_envs(domain);
 
-                               SAFE_FREE(sitename);
                                /* Ensure we contact this DC also. */
                                saf_store( domain->name, name);
                                saf_store( domain->alt_name, name);

Modified: branches/SAMBA_3_2_0/source/libsmb/namequery_dc.c
===================================================================
--- branches/SAMBA_3_2_0/source/libsmb/namequery_dc.c   2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_2_0/source/libsmb/namequery_dc.c   2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -98,15 +98,22 @@
                }
 
 #ifdef HAVE_KRB5
-               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. */
+               if (is_our_primary_domain(domain) && (ads->config.flags & 
ADS_KDC)) {
+                       if (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. */
 
-                       create_local_private_krb5_conf_for_domain(realm,
-                                                               domain,
-                                                               sitename,
-                                                               ads->ldap.ip);
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       
sitename,
+                                                                       
ads->ldap.ip);
+                       } else {
+                               create_local_private_krb5_conf_for_domain(realm,
+                                                                       domain,
+                                                                       NULL,
+                                                                       
ads->ldap.ip);
+                       }
                }
 #endif
                break;

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_cm.c  2007-09-08 14:12:45 UTC 
(rev 25031)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_cm.c  2007-09-08 14:56:11 UTC 
(rev 25032)
@@ -1084,21 +1084,29 @@
 
                        DEBUG(10,("dcip_to_name: flags = 0x%x\n", (unsigned 
int)ads->config.flags));
 
-                       if (domain->primary && (ads->config.flags & ADS_KDC) && 
ads_closest_dc(ads)) {
-                               char *sitename = 
sitename_fetch(ads->config.realm);
+                       if (domain->primary && (ads->config.flags & ADS_KDC)) {
+                               if (ads_closest_dc(ads)) {
+                                       char *sitename = 
sitename_fetch(ads->config.realm);
 
-                               /* 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. */
+                                       /* 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. */
 
-                               
create_local_private_krb5_conf_for_domain(domain->alt_name,
-                                                               domain->name,
-                                                               sitename,
-                                                               ip);
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       
sitename,
+                                                                       ip);
 
+                                       SAFE_FREE(sitename);
+                               } else {
+                                       /* use an off site KDC */
+                                       
create_local_private_krb5_conf_for_domain(domain->alt_name,
+                                                                       
domain->name,
+                                                                       NULL,
+                                                                       ip);
+                               }
                                winbindd_set_locator_kdc_envs(domain);
 
-                               SAFE_FREE(sitename);
                                /* Ensure we contact this DC also. */
                                saf_store( domain->name, name);
                                saf_store( domain->alt_name, name);

Reply via email to