From 191dff2d279dd8315f093e313d8c149e786eb19f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 23 Nov 2002 14:27:56 +0000 Subject: [merge from APP_HEAD] 90% fix for CR 1076. The password server parameter will no take things like password server = DC1 * which means to contact DC1 first and the go to auto lookup if it fails. jerry (This used to be commit c31a17889e3e4daf7c1e807038efc2c0fba78be3) --- source3/auth/auth_domain.c | 5 +- source3/libads/ldap.c | 3 +- source3/libsmb/namequery.c | 126 ++++++++++++++++++++++++++++++++++------- source3/nsswitch/winbindd_cm.c | 7 ++- source3/utils/net_lookup.c | 3 +- 5 files changed, 115 insertions(+), 29 deletions(-) diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 2a6614e28e..eebe647ec0 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -275,6 +275,7 @@ static NTSTATUS find_connect_pdc(struct cli_state **cli, NTSTATUS nt_status = NT_STATUS_NO_LOGON_SERVERS; time_t time_now = time(NULL); BOOL use_pdc_only = False; + BOOL list_ordered; /* * If the time the machine password has changed @@ -301,7 +302,7 @@ static NTSTATUS find_connect_pdc(struct cli_state **cli, count = 1; } else { - if (!get_dc_list(domain, &ip_list, &count)) + if (!get_dc_list(domain, &ip_list, &count, &list_ordered)) return NT_STATUS_NO_LOGON_SERVERS; } @@ -310,7 +311,7 @@ static NTSTATUS find_connect_pdc(struct cli_state **cli, * network address as any of our interfaces. */ for(i = 0; i < count; i++) { - if(!is_local_net(ip_list[i])) + if( !list_ordered && !is_local_net(ip_list[i]) ) continue; if(NT_STATUS_IS_OK(nt_status = diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 60427323b0..fcb96dd174 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -186,6 +186,7 @@ static BOOL ads_try_netbios(ADS_STRUCT *ads) int count; int i; const char *workgroup = ads->server.workgroup; + BOOL list_ordered; if (!workgroup) { workgroup = lp_workgroup(); @@ -202,7 +203,7 @@ static BOOL ads_try_netbios(ADS_STRUCT *ads) } /* now any DC, including backups */ - if (get_dc_list(workgroup, &ip_list, &count)) { + if (get_dc_list(workgroup, &ip_list, &count, &list_ordered)) { for (i=0;i 1) { + /* 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); } diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 32921de620..271094480c 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -128,6 +128,7 @@ static int net_lookup_dc(int argc, const char **argv) char *pdc_str = NULL; const char *domain=opt_target_workgroup; int count, i; + BOOL list_ordered; if (argc > 0) domain=argv[0]; @@ -139,7 +140,7 @@ 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)) { + if (!get_dc_list(domain, &ip_list, &count, &list_ordered)) { SAFE_FREE(pdc_str); return 0; } -- cgit