diff options
author | Gerald Carter <jerry@samba.org> | 2004-01-13 19:43:50 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-01-13 19:43:50 +0000 |
commit | 14fa51cfe5cb723850e7fa29fbcb3db5a8762d46 (patch) | |
tree | 1f044d211fc2c7c5fac20d88f7aa674085a52ce1 | |
parent | 0c9adb69858c7572320d18c0fd187dd6e885f17d (diff) | |
download | samba-14fa51cfe5cb723850e7fa29fbcb3db5a8762d46.tar.gz samba-14fa51cfe5cb723850e7fa29fbcb3db5a8762d46.tar.bz2 samba-14fa51cfe5cb723850e7fa29fbcb3db5a8762d46.zip |
* allow dns lookups to be disabled for DOMAIN#1c (and #1b)
names
* fix some a mispelled variable name
(This used to be commit 93fed3074f4384dc658cd0ec81ba2afbe8192417)
-rw-r--r-- | source3/libsmb/namequery.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 83902971b0..dcbd11048e 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1036,6 +1036,11 @@ static BOOL internal_resolve_name(const char *name, int name_type, } /* set the name resolution order */ + + if ( strcmp( resolve_order, "NULL") == 0 ) { + DEBUG(8,("internal_resolve_name: all lookups disabled\n")); + return False; + } if ( !resolve_order ) pstrcpy(name_resolve_list, lp_name_resolve_order()); @@ -1252,9 +1257,23 @@ BOOL get_sorted_dc_list( const char *domain, struct ip_service **ip_list, int *c BOOL get_dc_list(const char *domain, struct ip_service **ip_list, int *count, BOOL ads_only, int *ordered) { - /* defined the name resolve order to internal_name_resolve() - only used for looking up 0x1c names */ - const char *resolve_oder = (ads_only ? "ads" : lp_name_resolve_order()); + fstring resolve_order; + + /* if we are restricted to solely using DNS for looking + up a domain controller, make sure that host lookups + are enabled for the 'name resolve order'. If host lookups + are disabled and ads_only is True, then set the string to + NULL. */ + + fstrcpy( resolve_order, lp_name_resolve_order() ); + strlower_m( resolve_order ); + if ( ads_only ) { + if ( strstr( resolve_order, "host" ) ) + fstrcpy( resolve_order, "ads" ); + else + fstrcpy( resolve_order, "NULL" ); + } + *ordered = False; @@ -1275,7 +1294,7 @@ BOOL get_dc_list(const char *domain, struct ip_service **ip_list, if (!*pserver) - return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_oder); + return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_order); p = pserver; @@ -1288,7 +1307,7 @@ BOOL get_dc_list(const char *domain, struct ip_service **ip_list, while (next_token(&p,name,LIST_SEP,sizeof(name))) { if (strequal(name, "*")) { - if ( internal_resolve_name(domain, 0x1C, &auto_ip_list, &auto_count, resolve_oder) ) + if ( internal_resolve_name(domain, 0x1C, &auto_ip_list, &auto_count, resolve_order) ) num_addresses += auto_count; done_auto_lookup = True; DEBUG(8,("Adding %d DC's from auto lookup\n", auto_count)); @@ -1301,7 +1320,7 @@ BOOL get_dc_list(const char *domain, struct ip_service **ip_list, just return the list of DC's */ if ( (num_addresses == 0) && !done_auto_lookup ) - return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_oder); + return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_order); /* maybe we just failed? */ @@ -1382,5 +1401,5 @@ BOOL get_dc_list(const char *domain, struct ip_service **ip_list, DEBUG(10,("get_dc_list: defaulting to internal auto lookup for domain %s\n", domain)); - return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_oder); + return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_order); } |