From 167a83e7b8733416154f871e39e86ba77eb1554d Mon Sep 17 00:00:00 2001 From: gshapiro Date: Sun, 21 Jan 2001 22:17:06 +0000 Subject: Import sendmail 8.11.2 --- contrib/sendmail/src/domain.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'contrib/sendmail/src/domain.c') diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c index 8f5c8e2..39126dd 100644 --- a/contrib/sendmail/src/domain.c +++ b/contrib/sendmail/src/domain.c @@ -15,9 +15,9 @@ #ifndef lint # if NAMED_BIND -static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.3 2000/06/13 18:00:08 gshapiro Exp $ (with name server)"; +static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (with name server)"; # else /* NAMED_BIND */ -static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.3 2000/06/13 18:00:08 gshapiro Exp $ (without name server)"; +static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (without name server)"; # endif /* NAMED_BIND */ #endif /* ! lint */ @@ -393,6 +393,10 @@ punt: host, MyHostName); return -1; } +# if _FFR_FREEHOSTENT && NETINET6 + freehostent(h); + hp = NULL; +# endif /* _FFR_FREEHOSTENT && NETINET6 */ } if (strlen(host) >= (SIZE_T) sizeof MXHostBuf) { @@ -640,6 +644,8 @@ dns_getcanonname(host, hbsize, trymx, statp) return FALSE; } + *statp = EX_OK; + /* ** Initialize domain search list. If there is at least one ** dot in the name, search the unmodified name first so we @@ -730,6 +736,7 @@ cnameloop: qtype == T_A ? "A" : qtype == T_MX ? "MX" : "???"); + errno = 0; ret = res_querydomain(host, *dp, C_IN, qtype, answer.qb2, sizeof(answer.qb2)); if (ret <= 0) @@ -740,7 +747,11 @@ cnameloop: if (errno == ECONNREFUSED || h_errno == TRY_AGAIN) { - /* the name server seems to be down */ + /* + ** the name server seems to be down or + ** broken. + */ + h_errno = TRY_AGAIN; *statp = EX_TEMPFAIL; @@ -757,8 +768,23 @@ cnameloop: ** the cache so this isn't dangerous. */ +#if _FFR_WORKAROUND_BROKEN_NAMESERVERS + /* + ** Only return if not TRY_AGAIN as an + ** attempt with a different qtype may + ** succeed (res_querydomain() calls + ** res_query() calls res_send() which + ** sets errno to ETIMEDOUT if the + ** nameservers could be contacted but + ** didn't give an answer). + */ + + if (qtype != T_ANY && errno != ETIMEDOUT) + return FALSE; +#else /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */ if (qtype != T_ANY) return FALSE; +#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */ } if (h_errno != HOST_NOT_FOUND) @@ -976,7 +1002,8 @@ cnameloop: /* if nothing was found, we are done */ if (mxmatch == NULL) { - *statp = EX_NOHOST; + if (*statp == EX_OK) + *statp = EX_NOHOST; return FALSE; } -- cgit v1.1