diff options
author | Gerald Carter <jerry@samba.org> | 2003-06-23 19:05:23 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-06-23 19:05:23 +0000 |
commit | f36c96d59c79a51610bb5a1fc42ac62bd8d08401 (patch) | |
tree | 69560bd452906389aab36ac7eb8109de7ff32ccc /source3/libsmb | |
parent | d21358308a2a2c86b4e9d23922c7c940b5d1b012 (diff) | |
download | samba-f36c96d59c79a51610bb5a1fc42ac62bd8d08401.tar.gz samba-f36c96d59c79a51610bb5a1fc42ac62bd8d08401.tar.bz2 samba-f36c96d59c79a51610bb5a1fc42ac62bd8d08401.zip |
* s/get_dc_name/rpc_dc_name/g (revert a previous change)
* move back to qsort() for sorting IP address in get_dc_list()
* remove dc_name_cache in cm_get_dc_name() since it slowed
things down more than it helped. I've made a note of where
to add in the negative connection cache in the ads code.
Will come back to that.
* fix rpcclient to use PRINTER_ALL_ACCESS for set printer (instead
of MAX_ALLOWED)
* only enumerate domain local groups in our domain
* simplify ldap search for seqnum in winbindd's rpc backend
(This used to be commit f8cab8635b02b205b4031279cedd804c1fb22c5b)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/namequery.c | 11 | ||||
-rw-r--r-- | source3/libsmb/namequery_dc.c | 76 |
2 files changed, 18 insertions, 69 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 7f343033d6..3797f03979 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1379,10 +1379,17 @@ BOOL get_dc_list(const char *domain, struct in_addr **ip_list, int *count, int * } } + if ( DEBUGLEVEL >= 4 ) { + DEBUG(4,("get_dc_list: returning %d ip addresses in an %sordered list\n", local_count, + *ordered ? "":"un")); + DEBUG(4,("get_dc_list: ")); + for ( i=0; i<local_count; i++ ) + DEBUGADD(4,("%s ", inet_ntoa(return_iplist[i]))); + DEBUGADD(4,("\n")); + } + *ip_list = return_iplist; *count = local_count; - - DEBUG(8,("get_dc_list: return %d ip addresses\n", *count)); return (*count != 0); } diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c index c162e34027..ac1f9a54de 100644 --- a/source3/libsmb/namequery_dc.c +++ b/source3/libsmb/namequery_dc.c @@ -160,7 +160,7 @@ void flush_negative_conn_cache( void ) valid since we have already done a name_status_find on it ***************************************************************************/ -BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) +BOOL rpc_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) { struct in_addr *ip_list = NULL, dc_ip, exclude_ip; int count, i; @@ -176,7 +176,7 @@ BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) if ( use_pdc_only && get_pdc_ip(domain, &dc_ip) ) { - DEBUG(10,("get_dc_name: Atempting to lookup PDC to avoid sam sync delays\n")); + DEBUG(10,("rpc_dc_name: Atempting to lookup PDC to avoid sam sync delays\n")); /* check the connection cache and perform the node status lookup only if the IP is not found to be bad */ @@ -206,71 +206,12 @@ BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) } } - if ( !list_ordered ) - { - /* - * Pick a nice close server. Look for DC on local net - * (assuming we don't have a list of preferred DC's) - */ - - for (i = 0; i < count; i++) { - if (is_zero_ip(ip_list[i])) - continue; - - if ( !is_local_net(ip_list[i]) ) - continue; - - if (name_status_find(domain, 0x1c, 0x20, ip_list[i], srv_name)) { - result = check_negative_conn_cache( domain, srv_name ); - if ( NT_STATUS_IS_OK(result) ) { - dc_ip = ip_list[i]; - goto done; - } - } - - zero_ip(&ip_list[i]); - } - - /* - * Try looking in the name status cache for an - * entry we already have. We know that already - * resolved ok. - */ - - for (i = 0; i < count; i++) { - if (is_zero_ip(ip_list[i])) - continue; - - if (namecache_status_fetch(domain, 0x1c, 0x20, - ip_list[i], srv_name)) { - result = check_negative_conn_cache( domain, srv_name ); - if ( NT_STATUS_IS_OK(result) ) { - dc_ip = ip_list[i]; - goto done; - } - } - } - - /* - * Secondly try and contact a random PDC/BDC. - */ - - i = (sys_random() % count); - - if ( !is_zero_ip(ip_list[i]) ) { - if ( name_status_find(domain, 0x1c, 0x20, ip_list[i], srv_name)) { - result = check_negative_conn_cache( domain, srv_name ); - if ( NT_STATUS_IS_OK(result) ) { - dc_ip = ip_list[i]; - goto done; - } - } - zero_ip(&ip_list[i]); /* Tried and failed. */ - } + /* Pick a nice close server, but only if the list was not ordered */ + + if (!list_ordered && (count > 1) ) { + qsort(ip_list, count, sizeof(struct in_addr), QSORT_CAST ip_compare); } - /* Finally return first DC that we can contact */ - for (i = 0; i < count; i++) { if (is_zero_ip(ip_list[i])) continue; @@ -281,8 +222,9 @@ BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) dc_ip = ip_list[i]; goto done; } - } + } } + SAFE_FREE(ip_list); @@ -295,7 +237,7 @@ BOOL get_dc_name(const char *domain, fstring srv_name, struct in_addr *ip_out) the DC is alive and kicking. If we can catch a dead DC before performing a cli_connect() we can avoid a 30-second timeout. */ - DEBUG(3, ("get_dc_name: Returning DC %s (%s) for domain %s\n", srv_name, + DEBUG(3, ("rpc_dc_name: Returning DC %s (%s) for domain %s\n", srv_name, inet_ntoa(dc_ip), domain)); *ip_out = dc_ip; |