summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-06-25 17:41:05 +0000
committerGerald Carter <jerry@samba.org>2003-06-25 17:41:05 +0000
commitf51d769dd303027a3dbf46fc89a482933988e866 (patch)
tree5bb400a9df1f6fb27f2b045a6521e2995de8c686 /source3/utils
parenteb61c8238298e97644202139e6d7f55e46eb9c26 (diff)
downloadsamba-f51d769dd303027a3dbf46fc89a482933988e866.tar.gz
samba-f51d769dd303027a3dbf46fc89a482933988e866.tar.bz2
samba-f51d769dd303027a3dbf46fc89a482933988e866.zip
large change:
*) consolidates the dc location routines again (dns and netbios) get_dc_list() or get_sorted_dc_list() is the authoritative means of locating DC's again. (also inludes a flag to get_dc_list() to define if this should be a DNS only lookup or not) (however, if you set "name resolve order = hosts wins" you could still get DNS queries for domain name IFF ldap_domain2hostlist() fails. The answer? Fix your DNS setup) *) enabled DOMAIN<0x1c> lookups to be funneled through resolve_hosts resulting in a call to ldap_domain2hostlist() if lp_security() == SEC_ADS *) enables name cache for winbind ADS backend *) enable the negative connection cache for winbind ADS backend *) removes some old dead code *) consolidates some duplicate code *) moves the internal_name_resolve() to use an IP/port pair to deal with SRV RR dns replies. The namecache code also supports the IP:port syntax now as well. *) removes 'ads server' and moves the functionality back into 'password server' (which can support "hostname:port" syntax now but works fine with defaults depending on the value of lp_security()) (This used to be commit d7f7fcda425bef380441509734eca33da943c091)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c14
-rw-r--r--source3/utils/net_lookup.c8
-rw-r--r--source3/utils/net_rpc.c2
3 files changed, 11 insertions, 13 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index da83886364..25a752179f 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -206,7 +206,7 @@ BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_na
if (is_zero_ip(pdc_ip))
return False;
- if (!lookup_dc_name(global_myname(), opt_target_workgroup, &pdc_ip, dc_name))
+ if ( !name_status_find(opt_target_workgroup, 0x1b, 0x20, pdc_ip, dc_name) )
return False;
*server_name = strdup(dc_name);
@@ -248,20 +248,18 @@ BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_na
}
-BOOL net_find_dc(struct in_addr *server_ip, fstring server_name, const char *domain_name)
+BOOL net_find_pdc(struct in_addr *server_ip, fstring server_name, const char *domain_name)
{
if (get_pdc_ip(domain_name, server_ip)) {
- fstring dc_name;
-
if (is_zero_ip(*server_ip))
return False;
- if (!lookup_dc_name(global_myname(), domain_name, server_ip, dc_name))
+ if (!name_status_find(domain_name, 0x1b, 0x20, *server_ip, server_name))
return False;
- fstrcpy(server_name, dc_name);
- return True;
- } else
+ return True;
+ }
+ else
return False;
}
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 271094480c..8456da4e0c 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -124,11 +124,11 @@ static int net_lookup_ldap(int argc, const char **argv)
static int net_lookup_dc(int argc, const char **argv)
{
- struct in_addr *ip_list, addr;
+ struct ip_service *ip_list;
+ struct in_addr addr;
char *pdc_str = NULL;
const char *domain=opt_target_workgroup;
int count, i;
- BOOL list_ordered;
if (argc > 0)
domain=argv[0];
@@ -140,12 +140,12 @@ static int net_lookup_dc(int argc, const char **argv)
asprintf(&pdc_str, "%s", inet_ntoa(addr));
d_printf("%s\n", pdc_str);
- if (!get_dc_list(domain, &ip_list, &count, &list_ordered)) {
+ if (!get_sorted_dc_list(domain, &ip_list, &count, False)) {
SAFE_FREE(pdc_str);
return 0;
}
for (i=0;i<count;i++) {
- char *dc_str = inet_ntoa(ip_list[i]);
+ char *dc_str = inet_ntoa(ip_list[i].ip);
if (!strequal(pdc_str, dc_str))
d_printf("%s\n", dc_str);
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 6cb00cad9b..552aacebbd 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -1781,7 +1781,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
opt_user_name = acct_name;
/* find the domain controller */
- if (!net_find_dc(&server_ip, pdc_name, domain_name)) {
+ if (!net_find_pdc(&server_ip, pdc_name, domain_name)) {
DEBUG(0, ("Coulnd find domain controller for domain %s\n", domain_name));
return -1;
}