diff options
author | Gerald Carter <jerry@samba.org> | 2004-01-13 19:42:53 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-01-13 19:42:53 +0000 |
commit | b085f0f08eb66fd5741b6cb221fbfa67504514f2 (patch) | |
tree | baddd77daa9cbcb27ec5a56b2f7cca933622b6dc /source3 | |
parent | f203358fdb456c6b4626324ef47698d0ccdc08a5 (diff) | |
download | samba-b085f0f08eb66fd5741b6cb221fbfa67504514f2.tar.gz samba-b085f0f08eb66fd5741b6cb221fbfa67504514f2.tar.bz2 samba-b085f0f08eb66fd5741b6cb221fbfa67504514f2.zip |
* allow dns lookups to be disabled for DOMAIN#1c (and #1b)
names
* fix some a mispelled variable name
(This used to be commit bca702c97620ad8f66015d6e4b41abd4adf22076)
Diffstat (limited to 'source3')
-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); } |