summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-01-17 19:20:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:14 -0500
commita99840e59ee4bd27fd4f2cf8b465dd0f215ea067 (patch)
treecb0f74998ec6ac3f4d8211e9e2ec6dde14f8771b /source3
parente65d9b45986dd659b96ed022a739b08dd45799e6 (diff)
downloadsamba-a99840e59ee4bd27fd4f2cf8b465dd0f215ea067.tar.gz
samba-a99840e59ee4bd27fd4f2cf8b465dd0f215ea067.tar.bz2
samba-a99840e59ee4bd27fd4f2cf8b465dd0f215ea067.zip
r20862: When in disconnected mode there is no need to try a fallback to a site
less DNS query. This speeds up offline detection slightly. Guenther (This used to be commit eda76ecf07a4d2f9bb5544e2c031cfad14d93e85)
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/dns.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/libads/dns.c b/source3/libads/dns.c
index b67d802bdc..bd280fea62 100644
--- a/source3/libads/dns.c
+++ b/source3/libads/dns.c
@@ -291,6 +291,12 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
if ( (resp_len = res_query(name, C_IN, q_type, buffer, buf_len)) < 0 ) {
DEBUG(3,("ads_dns_lookup_srv: Failed to resolve %s (%s)\n", name, strerror(errno)));
TALLOC_FREE( buffer );
+ if (errno == ETIMEDOUT) {
+ return NT_STATUS_IO_TIMEOUT;
+ }
+ if (errno == ECONNREFUSED) {
+ return NT_STATUS_CONNECTION_REFUSED;
+ }
return NT_STATUS_UNSUCCESSFUL;
}
} while ( buf_len < resp_len && resp_len < MAX_DNS_PACKET_SIZE );
@@ -686,6 +692,12 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
status = ads_dns_query_internal(ctx, "_ldap", realm, sitename,
dclist, numdcs);
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_REFUSED)) {
+ return status;
+ }
+
if (sitename && !NT_STATUS_IS_OK(status)) {
/* Sitename DNS query may have failed. Try without. */
status = ads_dns_query_internal(ctx, "_ldap", realm, NULL,
@@ -710,6 +722,12 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
status = ads_dns_query_internal(ctx, "_kerberos", realm, sitename,
dclist, numdcs);
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_REFUSED)) {
+ return status;
+ }
+
if (sitename && !NT_STATUS_IS_OK(status)) {
/* Sitename DNS query may have failed. Try without. */
status = ads_dns_query_internal(ctx, "_kerberos", realm, NULL,