netresolv/resolv: Merge remaining patches from 2013 to current HEAD.

Commits merged from the semi-official Git mirror of NetBSD
trunk (https://github.com/IIJ-NetBSD/netbsd-src/ - NetResolv
is in the tree at lib/libc/netresolv/).

Commit authors/messages in chronological order follow:
---------------------------------------
From: wiz <[email protected]>
Date: Mon, 9 Dec 2013 09:35:17 +0000
Subject: Fix typo ("then" instead of "than")

From: christos <[email protected]>
Date: Tue, 16 Sep 2014 01:30:00 +0000
Subject: close on exec hostaliases

From: christos <[email protected]>
Date: Tue, 11 Nov 2014 03:29:24 +0000
Subject: PR/48475: YAMAGUCHI Takanori: EDNS option broken with
 unbound. struct querybuf in net/gethnamaddr.c defines MAXPACKET to 64K. This
 in turn gets passed down until it reached res_nopt(..., answer, anslen), where
 the size of the buffer must fit in 16 bits. Unfortunately we end up
 being one more than the max so we end up sending a 0 as the size and
 unbound does not like that. Instead we clip now to 64K - 1, and everyone
 is happy.
 XXX: Pullup to 7.

From: christos <[email protected]>
Date: Tue, 24 Feb 2015 17:57:08 +0000
Subject: belated removal of the advertising clause.
This commit is contained in:
Augustin Cavalier
2015-06-29 11:37:26 -04:00
parent f1b36c9050
commit 24a60d9b9a
7 changed files with 17 additions and 39 deletions
+2 -6
View File
@@ -1,4 +1,4 @@
/* $NetBSD: herror.c,v 1.9 2012/03/13 21:13:43 christos Exp $ */
/* $NetBSD: herror.c,v 1.10 2015/02/24 17:56:20 christos Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -12,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
+2 -6
View File
@@ -1,4 +1,4 @@
/* $NetBSD: res_comp.c,v 1.12 2012/03/13 21:13:43 christos Exp $ */
/* $NetBSD: res_comp.c,v 1.13 2015/02/24 17:56:20 christos Exp $ */
/*
* Copyright (c) 1985, 1993
@@ -12,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -1,4 +1,4 @@
/* $NetBSD: res_debug.c,v 1.13 2012/06/25 22:32:45 abs Exp $ */
/* $NetBSD: res_debug.c,v 1.14 2015/02/24 17:56:20 christos Exp $ */
/*
* Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
@@ -29,11 +29,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
+2 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: res_init.c,v 1.26 2012/09/09 18:04:26 christos Exp $ */
/* $NetBSD: res_init.c,v 1.30 2015/02/24 17:56:20 christos Exp $ */
/*
* Copyright (c) 1985, 1989, 1993
@@ -240,7 +240,7 @@ __res_vinit(res_state statp, int preinit) {
* Examples and applications exist which do not check
* our return code. Furthermore several applications
* simply call us to get the systems domainname. So
* rather then immediately fail here we store the
* rather than immediately fail here we store the
* failure, which is returned later, in h_errno. And
* prevent the collection of 'nameserver' information
* by setting maxns to 0. Thus applications that fail
@@ -1,4 +1,4 @@
/* $NetBSD: res_mkquery.c,v 1.13 2012/03/13 21:13:43 christos Exp $ */
/* $NetBSD: res_mkquery.c,v 1.15 2015/02/24 17:56:20 christos Exp $ */
/*
* Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
@@ -29,11 +29,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -235,7 +231,9 @@ res_nopt(res_state statp,
*cp++ = 0; /*%< "." */
ns_put16(ns_t_opt, cp); /*%< TYPE */
cp += INT16SZ;
ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */
if (anslen > 0xffff)
anslen = 0xffff;
ns_put16(anslen, cp); /*%< CLASS = UDP payload size */
cp += INT16SZ;
*cp++ = NOERROR; /*%< extended RCODE */
*cp++ = 0; /*%< EDNS version */
@@ -1,4 +1,4 @@
/* $NetBSD: res_query.c,v 1.14 2012/03/13 21:13:44 christos Exp $ */
/* $NetBSD: res_query.c,v 1.16 2015/02/24 17:56:20 christos Exp $ */
/*
* Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
@@ -29,11 +29,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -410,7 +406,7 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
return (NULL);
file = getenv("HOSTALIASES");
if (file == NULL || (fp = fopen(file, "r")) == NULL)
if (file == NULL || (fp = fopen(file, "re")) == NULL)
return (NULL);
buf[sizeof(buf) - 1] = '\0';
while (fgets(buf, (int)sizeof(buf), fp)) {
+1 -5
View File
@@ -27,11 +27,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*