diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-02-08 00:54:32 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2004-02-08 00:54:32 +0000 |
commit | e45c217a14c0c6cb2456f04138b2fd55288b1dd4 (patch) | |
tree | b7094a56cb9f6c9a483f5f2e05b8632b370955dc /source3/libsmb | |
parent | d57d2d08978e37ab771479b5f2f2f7f36d867b69 (diff) | |
download | samba-e45c217a14c0c6cb2456f04138b2fd55288b1dd4.tar.gz samba-e45c217a14c0c6cb2456f04138b2fd55288b1dd4.tar.bz2 samba-e45c217a14c0c6cb2456f04138b2fd55288b1dd4.zip |
Make get_dc_list static - we only ask for a sorted list externally.
Andrew Bartlett
(This used to be commit e10e176c83da9eda0746e0bd108c72a01a0505e8)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/namequery.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index dcbd11048e..8bde6d37ea 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -230,7 +230,7 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t comparison function used by sort_ip_list */ -int ip_compare(struct in_addr *ip1, struct in_addr *ip2) +static int ip_compare(struct in_addr *ip1, struct in_addr *ip2) { int max_bits1=0, max_bits2=0; int num_interfaces = iface_count(); @@ -292,7 +292,7 @@ static void sort_ip_list(struct in_addr *iplist, int count) qsort(iplist, count, sizeof(struct in_addr), QSORT_CAST ip_compare); } -void sort_ip_list2(struct ip_service *iplist, int count) +static void sort_ip_list2(struct ip_service *iplist, int count) { if (count <= 1) { return; @@ -1229,32 +1229,12 @@ BOOL get_pdc_ip(const char *domain, struct in_addr *ip) return True; } -/********************************************************************* - small wrapper function to get the DC list and sort it if neccessary -*********************************************************************/ -BOOL get_sorted_dc_list( const char *domain, struct ip_service **ip_list, int *count, BOOL ads_only ) -{ - BOOL ordered; - - DEBUG(8,("get_sorted_dc_list: attempting lookup using [%s]\n", - (ads_only ? "ads" : lp_name_resolve_order()))); - - if ( !get_dc_list(domain, ip_list, count, ads_only, &ordered) ) - return False; - - /* only sort if we don't already have an ordered list */ - if ( !ordered ) - sort_ip_list2( *ip_list, *count ); - - return True; -} - /******************************************************** Get the IP address list of the domain controllers for a domain. *********************************************************/ -BOOL get_dc_list(const char *domain, struct ip_service **ip_list, +static BOOL get_dc_list(const char *domain, struct ip_service **ip_list, int *count, BOOL ads_only, int *ordered) { fstring resolve_order; @@ -1403,3 +1383,24 @@ BOOL get_dc_list(const char *domain, struct ip_service **ip_list, return internal_resolve_name(domain, 0x1C, ip_list, count, resolve_order); } + +/********************************************************************* + small wrapper function to get the DC list and sort it if neccessary +*********************************************************************/ +BOOL get_sorted_dc_list( const char *domain, struct ip_service **ip_list, int *count, BOOL ads_only ) +{ + BOOL ordered; + + DEBUG(8,("get_sorted_dc_list: attempting lookup using [%s]\n", + (ads_only ? "ads" : lp_name_resolve_order()))); + + if ( !get_dc_list(domain, ip_list, count, ads_only, &ordered) ) + return False; + + /* only sort if we don't already have an ordered list */ + if ( !ordered ) + sort_ip_list2( *ip_list, *count ); + + return True; +} + |