Date: Thu, 10 Sep 1998 03:55:12 +0200 (CEST) From: Tor Egge <tegge@not.fast.no> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/7876: gethostbyname flags temporary failure as unknown host Message-ID: <199809100155.DAA13840@not.fast.no>
next in thread | raw e-mail | index | archive | help
>Number: 7876 >Category: bin >Synopsis: gethostbyname flags temporary failure as unknown host >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 9 19:00:00 PDT 1998 >Last-Modified: >Originator: Tor Egge >Organization: Fast Search & Transfer ASA >Release: FreeBSD 3.0-CURRENT i386 >Environment: FreeBSD 3.0-current from Jul 30 1998 FreeBSD not.fast.no 3.0-CURRENT FreeBSD 3.0-CURRENT #15: Sat Sep 5 18:24:21 CEST 1998 root@not.fast.no:/usr/src/sys/compile/NOT_SMP i386 >Description: If hosts is after bind in /etc/host.conf, the error code from the DNS lookup is overwritten by the error code from the /etc/hosts lookup. This means that temporary lookup failures are incorrectly flagged as permanent lookup failures. >How-To-Repeat: Add rules to sendmail 8.9.1 to reject mail from hosts not registered in DNS. Be a victim of routing problems, cutting you off from all root name servers. Wait for cached entries to time out in your local name server. Discover that sendmail has bounced email from a machine properly registered in DNS. >Fix: Index: lib/libc/net/gethostnamadr.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/gethostnamadr.c,v retrieving revision 1.13 diff -u -r1.13 gethostnamadr.c --- gethostnamadr.c 1997/12/25 04:21:08 1.13 +++ gethostnamadr.c 1998/09/10 01:23:36 @@ -136,6 +136,7 @@ { struct hostent *hp = 0; int nserv = 0; + int tempfail = NETDB_SUCCESS; if (!service_done) init_services(); @@ -143,12 +144,17 @@ while (!hp) { switch (service_order[nserv]) { case SERVICE_NONE: + if (tempfail != NETDB_SUCCESS && + h_errno == HOST_NOT_FOUND) + h_errno = tempfail; return NULL; case SERVICE_HOSTS: hp = _gethostbyhtname(name, type); break; case SERVICE_BIND: hp = _gethostbydnsname(name, type); + if (hp == NULL) + tempfail = h_errno; break; case SERVICE_NIS: hp = _gethostbynisname(name, type); @@ -164,6 +170,7 @@ { struct hostent *hp = 0; int nserv = 0; + int tempfail = NETDB_SUCCESS; if (!service_done) init_services(); @@ -171,12 +178,17 @@ while (!hp) { switch (service_order[nserv]) { case SERVICE_NONE: - return 0; + if (tempfail != NETDB_SUCCESS && + h_errno == HOST_NOT_FOUND) + h_errno = tempfail; + return NULL; case SERVICE_HOSTS: hp = _gethostbyhtaddr(addr, len, type); break; case SERVICE_BIND: hp = _gethostbydnsaddr(addr, len, type); + if (hp == NULL) + tempfail = h_errno; break; case SERVICE_NIS: hp = _gethostbynisaddr(addr, len, type); >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809100155.DAA13840>