summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-01-06 00:13:56 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-01-06 00:13:56 +0000
commiteb1aa6a2cc0331cbbbc5ea466e5695e4df39e6ee (patch)
treef469a55452e23482ec6c14a40c1fe8dced40b370 /source3/libsmb
parenta9598d2e88fcd5384640baa963000e4f02679985 (diff)
downloadsamba-eb1aa6a2cc0331cbbbc5ea466e5695e4df39e6ee.tar.gz
samba-eb1aa6a2cc0331cbbbc5ea466e5695e4df39e6ee.tar.bz2
samba-eb1aa6a2cc0331cbbbc5ea466e5695e4df39e6ee.zip
(merge from 3.0)
Change our Domain controller lookup routines to more carefully seperate DNS names (realms) from NetBIOS domain names. Until now, we would experience delays as we broadcast lookups for DNS names onto the local network segments. Now if DNS comes back negative, we fall straight back to looking up the short name. Andrew Bartlett (This used to be commit 4c3bd0a99e464198d243da302ff1868189b4dcff)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery_dc.c27
-rw-r--r--source3/libsmb/trusts_util.c2
2 files changed, 12 insertions, 17 deletions
diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c
index df7f856cd7..31d759e0d2 100644
--- a/source3/libsmb/namequery_dc.c
+++ b/source3/libsmb/namequery_dc.c
@@ -29,27 +29,23 @@
Find the name and IP address for a server in he realm/domain
*************************************************************************/
-static BOOL ads_dc_name(const char *domain, struct in_addr *dc_ip, fstring srv_name)
+static BOOL ads_dc_name(const char *domain, const char *realm, struct in_addr *dc_ip, fstring srv_name)
{
ADS_STRUCT *ads;
- const char *realm = domain;
- if (strequal(realm, lp_workgroup()))
+ if (!realm && strequal(domain, lp_workgroup()))
realm = lp_realm();
ads = ads_init(realm, domain, NULL);
if (!ads)
return False;
- /* we don't need to bind, just connect */
- ads->auth.flags |= ADS_AUTH_NO_BIND;
-
DEBUG(4,("ads_dc_name: domain=%s\n", domain));
#ifdef HAVE_ADS
- /* a full ads_connect() is actually overkill, as we don't srictly need
- to do the SASL auth in order to get the info we need, but libads
- doesn't offer a better way right now */
+ /* we don't need to bind, just connect */
+ ads->auth.flags |= ADS_AUTH_NO_BIND;
+
ads_connect(ads);
#endif
@@ -157,7 +153,7 @@ static BOOL rpc_dc_name(const char *domain, fstring srv_name, struct in_addr *ip
wrapper around ads and rpc methods of finds DC's
**********************************************************************/
-BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out)
+BOOL get_dc_name(const char *domain, const char *realm, fstring srv_name, struct in_addr *ip_out)
{
struct in_addr dc_ip;
BOOL ret;
@@ -167,15 +163,14 @@ BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out)
ret = False;
- if ( strequal(lp_workgroup(), domain) || strequal(lp_realm(), domain) )
+ if ( strequal(lp_workgroup(), domain) || strequal(lp_realm(), realm) )
our_domain = True;
- /* always try to obey what the admin specified in smb.conf.
- If it is not our domain, assume that domain names with periods
- in them are realm names */
+ /* always try to obey what the admin specified in smb.conf
+ (for the local domain) */
- if ( (our_domain && lp_security()==SEC_ADS) || strchr_m(domain, '.') ) {
- ret = ads_dc_name(domain, &dc_ip, srv_name);
+ if ( (our_domain && lp_security()==SEC_ADS) || realm ) {
+ ret = ads_dc_name(domain, realm, &dc_ip, srv_name);
}
if (!ret) {
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 7c1000b9a5..b420e4fa08 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -144,7 +144,7 @@ BOOL enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
/* lookup a DC first */
- if ( !get_dc_name(domain, dc_name, &dc_ip) ) {
+ if ( !get_dc_name(domain, NULL, dc_name, &dc_ip) ) {
DEBUG(3,("enumerate_domain_trusts: can't locate a DC for domain %s\n",
domain));
return False;