Author: gd Date: 2007-01-17 19:20:11 +0000 (Wed, 17 Jan 2007) New Revision: 20862
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20862 Log: 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 Modified: branches/SAMBA_3_0/source/libads/dns.c branches/SAMBA_3_0_24/source/libads/dns.c Changeset: Modified: branches/SAMBA_3_0/source/libads/dns.c =================================================================== --- branches/SAMBA_3_0/source/libads/dns.c 2007-01-17 19:14:34 UTC (rev 20861) +++ branches/SAMBA_3_0/source/libads/dns.c 2007-01-17 19:20:11 UTC (rev 20862) @@ -291,6 +291,12 @@ 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 @@ 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 @@ 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, Modified: branches/SAMBA_3_0_24/source/libads/dns.c =================================================================== --- branches/SAMBA_3_0_24/source/libads/dns.c 2007-01-17 19:14:34 UTC (rev 20861) +++ branches/SAMBA_3_0_24/source/libads/dns.c 2007-01-17 19:20:11 UTC (rev 20862) @@ -291,6 +291,12 @@ 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 @@ 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 @@ 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,