From a99840e59ee4bd27fd4f2cf8b465dd0f215ea067 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Wed, 17 Jan 2007 19:20:11 +0000 Subject: [PATCH] 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) --- source3/libads/dns.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source3/libads/dns.c b/source3/libads/dns.c index b67d802bdc7..bd280fea626 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, -- 2.11.4.GIT