summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-25 16:42:34 +0000
committerGerald Carter <jerry@samba.org>2003-07-25 16:42:34 +0000
commitc916e5e390ef3ca9577c2f1d3d58fdad6eec7748 (patch)
tree4da2ed19b9728d431175395d983fb4cabd4f4224
parent5a6661100bbd468b3cf9573d4da25618583dac90 (diff)
downloadsamba-c916e5e390ef3ca9577c2f1d3d58fdad6eec7748.tar.gz
samba-c916e5e390ef3ca9577c2f1d3d58fdad6eec7748.tar.bz2
samba-c916e5e390ef3ca9577c2f1d3d58fdad6eec7748.zip
fix case where no realm or workgroup means to use our own
(This used to be commit 6edc7e0a744a5d8c6332758b800a2646ef16dd77)
-rw-r--r--source3/libads/ldap.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index cf6f9375f8..62520d5001 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -106,12 +106,24 @@ static BOOL ads_find_dc(ADS_STRUCT *ads)
struct ip_service *ip_list;
pstring realm;
BOOL got_realm = False;
+ BOOL use_own_domain = False;
+
+ /* if the realm and workgroup are both empty, assume they are ours */
/* realm */
c_realm = ads->server.realm;
+
+ if ( !c_realm || !*c_realm ) {
+ /* special case where no realm and no workgroup means our own */
+ if ( !ads->server.workgroup || !*ads->server.workgroup ) {
+ use_own_domain = True;
+ c_realm = lp_realm();
+ }
+ }
+
if (c_realm && *c_realm)
got_realm = True;
-
+
again:
/* we need to try once with the realm name and fallback to the
netbios domain name if we fail (if netbios has not been disabled */
@@ -119,7 +131,12 @@ again:
if ( !got_realm && !lp_disable_netbios() ) {
c_realm = ads->server.workgroup;
if (!c_realm || !*c_realm) {
- DEBUG(0,("ads_find_dc: no realm or workgroup! Was the structure initialized?\n"));
+ if ( use_own_domain )
+ c_realm = lp_workgroup();
+ }
+
+ if ( !c_realm || !*c_realm ) {
+ DEBUG(0,("ads_find_dc: no realm or workgroup! Don't know what to do\n"));
return False;
}
}