From 24a60d9b9a72d248a209ee6a9ee322004d8936b2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sun, 28 Jun 2015 20:48:36 -0400 Subject: [PATCH] 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 Date: Mon, 9 Dec 2013 09:35:17 +0000 Subject: Fix typo ("then" instead of "than") From: christos Date: Tue, 16 Sep 2014 01:30:00 +0000 Subject: close on exec hostaliases From: christos 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 Date: Tue, 24 Feb 2015 17:57:08 +0000 Subject: belated removal of the advertising clause. --- src/kits/network/netresolv/resolv/herror.c | 8 ++------ src/kits/network/netresolv/resolv/res_comp.c | 8 ++------ src/kits/network/netresolv/resolv/res_debug.c | 8 ++------ src/kits/network/netresolv/resolv/res_init.c | 4 ++-- src/kits/network/netresolv/resolv/res_mkquery.c | 12 +++++------- src/kits/network/netresolv/resolv/res_query.c | 10 +++------- src/kits/network/netresolv/resolv/res_send.c | 6 +----- 7 files changed, 17 insertions(+), 39 deletions(-) diff --git a/src/kits/network/netresolv/resolv/herror.c b/src/kits/network/netresolv/resolv/herror.c index bd6255d5f2..58c2b8a42c 100644 --- a/src/kits/network/netresolv/resolv/herror.c +++ b/src/kits/network/netresolv/resolv/herror.c @@ -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. * diff --git a/src/kits/network/netresolv/resolv/res_comp.c b/src/kits/network/netresolv/resolv/res_comp.c index 4557ac15fa..9c32acf92f 100644 --- a/src/kits/network/netresolv/resolv/res_comp.c +++ b/src/kits/network/netresolv/resolv/res_comp.c @@ -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. * diff --git a/src/kits/network/netresolv/resolv/res_debug.c b/src/kits/network/netresolv/resolv/res_debug.c index 7d096bcf70..63a14c1ebc 100644 --- a/src/kits/network/netresolv/resolv/res_debug.c +++ b/src/kits/network/netresolv/resolv/res_debug.c @@ -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. * diff --git a/src/kits/network/netresolv/resolv/res_init.c b/src/kits/network/netresolv/resolv/res_init.c index 0e218f6009..74c665a8f2 100644 --- a/src/kits/network/netresolv/resolv/res_init.c +++ b/src/kits/network/netresolv/resolv/res_init.c @@ -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 diff --git a/src/kits/network/netresolv/resolv/res_mkquery.c b/src/kits/network/netresolv/resolv/res_mkquery.c index 6e7b394433..743a22bb3f 100644 --- a/src/kits/network/netresolv/resolv/res_mkquery.c +++ b/src/kits/network/netresolv/resolv/res_mkquery.c @@ -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 */ diff --git a/src/kits/network/netresolv/resolv/res_query.c b/src/kits/network/netresolv/resolv/res_query.c index 0590b937ab..b60bc4cab9 100644 --- a/src/kits/network/netresolv/resolv/res_query.c +++ b/src/kits/network/netresolv/resolv/res_query.c @@ -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)) { diff --git a/src/kits/network/netresolv/resolv/res_send.c b/src/kits/network/netresolv/resolv/res_send.c index 5c591c0bb7..2109413378 100644 --- a/src/kits/network/netresolv/resolv/res_send.c +++ b/src/kits/network/netresolv/resolv/res_send.c @@ -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. *