summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/namequery.c127
-rw-r--r--source4/libcli/namequery_dc.c77
2 files changed, 0 insertions, 204 deletions
diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c
index 76fffe0d92..c440a604c7 100644
--- a/source4/libcli/namequery.c
+++ b/source4/libcli/namequery.c
@@ -1102,130 +1102,3 @@ BOOL get_pdc_ip(TALLOC_CTX *mem_ctx, const char *domain, struct ipv4_addr *ip)
return True;
}
-/********************************************************
- Get the IP address list of the domain controllers for
- a domain.
-*********************************************************/
-
-BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct ipv4_addr **ip_list, int *count, int *ordered)
-{
-
- *ordered = False;
-
- /* If it's our domain then use the 'password server' parameter. */
-
- if (strequal(domain, lp_workgroup())) {
- const char *p;
- const char *pserver = lp_passwordserver(); /* UNIX charset. */
- fstring name;
- int num_addresses = 0;
- int local_count, i, j;
- struct ipv4_addr *return_iplist = NULL;
- struct ipv4_addr *auto_ip_list = NULL;
- BOOL done_auto_lookup = False;
- int auto_count = 0;
-
-
- if (!*pserver)
- return internal_resolve_name(mem_ctx,
- domain, 0x1C, ip_list, count);
-
- p = pserver;
-
- /*
- * if '*' appears in the "password server" list then add
- * an auto lookup to the list of manually configured
- * DC's. If any DC is listed by name, then the list should be
- * considered to be ordered
- */
-
- while (next_token(&p,name,LIST_SEP,sizeof(name))) {
- if (strequal(name, "*")) {
- if ( internal_resolve_name(mem_ctx, domain, 0x1C, &auto_ip_list, &auto_count) )
- num_addresses += auto_count;
- done_auto_lookup = True;
- DEBUG(8,("Adding %d DC's from auto lookup\n", auto_count));
- }
- else
- num_addresses++;
- }
-
- /* if we have no addresses and haven't done the auto lookup, then
- just return the list of DC's */
-
- if ( (num_addresses == 0) && !done_auto_lookup )
- return internal_resolve_name(mem_ctx, domain, 0x1C, ip_list, count);
-
- return_iplist = malloc_array_p(struct ipv4_addr, num_addresses);
-
- if (return_iplist == NULL) {
- DEBUG(3,("get_dc_list: malloc fail !\n"));
- return False;
- }
-
- p = pserver;
- local_count = 0;
-
- /* fill in the return list now with real IP's */
-
- while ( (local_count<num_addresses) && next_token(&p,name,LIST_SEP,sizeof(name)) ) {
- struct ipv4_addr name_ip;
-
- /* copy any addersses from the auto lookup */
-
- if ( strequal(name, "*") ) {
- for ( j=0; j<auto_count; j++ )
- return_iplist[local_count++] = auto_ip_list[j];
- continue;
- }
-
- /* explicit lookup; resolve_name() will handle names & IP addresses */
-
- if ( resolve_name( mem_ctx, name, &name_ip, 0x20) ) {
- return_iplist[local_count++] = name_ip;
- *ordered = True;
- }
-
- }
-
- SAFE_FREE(auto_ip_list);
-
- /* need to remove duplicates in the list if we have
- any explicit password servers */
-
- if ( *ordered ) {
- /* one loop to remove duplicates */
- for ( i=0; i<local_count; i++ ) {
- if ( is_zero_ip(return_iplist[i]) )
- continue;
-
- for ( j=i+1; j<local_count; j++ ) {
- if ( ipv4_equal( return_iplist[i], return_iplist[j]) )
- zero_ip(&return_iplist[j]);
- }
- }
-
- /* one loop to clean up any holes we left */
- /* first ip should never be a zero_ip() */
- for (i = 0; i<local_count; ) {
- if ( is_zero_ip(return_iplist[i]) ) {
- if (i != local_count-1 )
- memmove(&return_iplist[i], &return_iplist[i+1],
- (local_count - i - 1)*sizeof(return_iplist[i]));
- local_count--;
- continue;
- }
- i++;
- }
- }
-
- *ip_list = return_iplist;
- *count = local_count;
-
- DEBUG(8,("get_dc_list: return %d ip addresses\n", *count));
-
- return (*count != 0);
- }
-
- return internal_resolve_name(mem_ctx, domain, 0x1C, ip_list, count);
-}
diff --git a/source4/libcli/namequery_dc.c b/source4/libcli/namequery_dc.c
index 130a924b0e..49aa42a744 100644
--- a/source4/libcli/namequery_dc.c
+++ b/source4/libcli/namequery_dc.c
@@ -25,80 +25,3 @@
#include "includes.h"
-/*
- find the DC for a domain using methods appropriate for a RPC domain
-*/
-BOOL rpc_find_dc(const char *domain, fstring srv_name, struct ipv4_addr *ip_out)
-{
- struct ipv4_addr *ip_list = NULL, dc_ip, exclude_ip;
- int count, i;
- BOOL list_ordered;
- BOOL use_pdc_only;
-
- zero_ip(&exclude_ip);
-
- use_pdc_only = must_use_pdc(domain);
-
- /* Lookup domain controller name */
-
- if ( use_pdc_only && get_pdc_ip(domain, &dc_ip) ) {
- DEBUG(10,("rpc_find_dc: Atempting to lookup PDC to avoid sam sync delays\n"));
-
- if (name_status_find(domain, 0x1c, 0x20, dc_ip, srv_name)) {
- goto done;
- }
- /* Didn't get name, remember not to talk to this DC. */
- exclude_ip = dc_ip;
- }
-
- /* get a list of all domain controllers */
-
- if (!get_dc_list( domain, &ip_list, &count, &list_ordered) ) {
- DEBUG(3, ("Could not look up dc's for domain %s\n", domain));
- return False;
- }
-
- /* Remove the entry we've already failed with (should be the PDC). */
-
- if ( use_pdc_only ) {
- for (i = 0; i < count; i++) {
- if (ipv4_equal( exclude_ip, ip_list[i]))
- zero_ip(&ip_list[i]);
- }
- }
-
- /* Pick a nice close server, but only if the list was not ordered */
- if (!list_ordered && (count > 1) ) {
- qsort(ip_list, count, sizeof(struct ipv4_addr), QSORT_CAST ip_compare);
- }
-
- for (i = 0; i < count; i++) {
- if (is_zero_ip(ip_list[i]))
- continue;
-
- if (name_status_find(domain, 0x1c, 0x20, ip_list[i], srv_name)) {
- dc_ip = ip_list[i];
- goto done;
- }
- }
-
-
- SAFE_FREE(ip_list);
-
- return False;
-done:
- /* We have the netbios name and IP address of a domain controller.
- Ideally we should sent a SAMLOGON request to determine whether
- the DC is alive and kicking. If we can catch a dead DC before
- performing a smbcli_connect() we can avoid a 30-second timeout. */
-
- DEBUG(3, ("rpc_find_dc: Returning DC %s (%s) for domain %s\n", srv_name,
- inet_ntoa(dc_ip), domain));
-
- *ip_out = dc_ip;
-
- SAFE_FREE(ip_list);
-
- return True;
-}
-