[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] haiku: hrev57256 - in src/system/libnetwork/netresolv: net irs isc include .
From:       waddlesplash <waddlesplash () gmail ! com>
Date:       2023-08-31 23:38:51
Message-ID: 20230831233851.202B53FB0D () turing ! freelists ! org
[Download RAW message or body]

hrev57256 adds 3 changesets to branch 'master'
old head: 56241aab2ff36ab09b28340384651d3b78b16620
new head: 75e1de3c2369b5acb868c2a66e526dce183c7892
overview: https://git.haiku-os.org/haiku/log/?qt=range&q=75e1de3c2369+%5E56241aab2ff3

----------------------------------------------------------------------------

4dcc1ed6540c: kernel: Synchronize inet_addr.c to remove advertising clause.
  
  Change-Id: I03665bcad679e3fddaea0d8a95663be12b003bd8
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/6877
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>

ac30bc0ef635: libnetwork: Remove lcl_sv.cpp.
  
  This has not been included in the build for years, probably since the
  initial NetResolv merge. Services are now returned via the "protocols"
  file, and getservent() has no need for these utility functions.
  
  Change-Id: If18bdd9593463b38a9aaedb7a621d0ddc15530e4
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/6878
  Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>

75e1de3c2369: libnetwork: Synchronize netresolv with NetBSD 9.3.
  
  Some of the Haiku-specific modifications that were previously unmarked
  are now clearly marked with #ifdef __HAIKU__.
  
  BIND9-specific files containing private APIs never exposed in public
  headers have been removed.
  
  Tested with wget, curl, pkgman (Network Kit), WebPositive (WebKit/curl),
  and Falkon (QtWebEngine/Chromium). All DNS-related operations seem
  to still work just fine.
  
  (One patch also imported from NetBSD trunk for GCC 12+ compatibility.)
  
  Change-Id: I4a349577b24b4df008fd9cba5d3a322cd24397f1
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/6879
  Reviewed-by: waddlesplash <waddlesplash@gmail.com>

                              [ Augustin Cavalier <waddlesplash@gmail.com> ]

----------------------------------------------------------------------------

95 files changed, 2108 insertions(+), 12600 deletions(-)
src/system/kernel/util/inet_addr.c               |   18 +-
src/system/libnetwork/Jamfile                    |    6 -
src/system/libnetwork/gethostbyname.c            |  125 ---
src/system/libnetwork/netresolv/Jamfile          |   18 +-
src/system/libnetwork/netresolv/config.h         |   72 +-
.../libnetwork/netresolv/defaults/services       |   47 -
src/system/libnetwork/netresolv/dst/dst_api.c    |  194 ++--
.../libnetwork/netresolv/dst/dst_internal.h      |   21 +-
src/system/libnetwork/netresolv/dst/hmac_link.c  |  115 +-
src/system/libnetwork/netresolv/dst/support.c    |   14 +-
.../libnetwork/netresolv/include/fd_setsize.h    |    3 +-
src/system/libnetwork/netresolv/include/irp.h    |  107 --
src/system/libnetwork/netresolv/include/irs.h    |  348 ------
.../netresolv/include/isc/assertions.h           |   11 +-
.../libnetwork/netresolv/include/isc/ctl.h       |  112 --
.../libnetwork/netresolv/include/isc/dst.h       |    4 +-
.../libnetwork/netresolv/include/isc/eventlib.h  |    6 +-
.../libnetwork/netresolv/include/isc/heap.h      |    2 +
.../netresolv/include/isc/irpmarshall.h          |  112 --
.../libnetwork/netresolv/include/isc/list.h      |   16 +-
.../libnetwork/netresolv/include/isc/logging.h   |  113 --
.../netresolv/include/isc/memcluster.h           |    2 +
.../libnetwork/netresolv/include/isc/misc.h      |   44 -
.../libnetwork/netresolv/include/isc/platform.h  |   36 -
.../netresolv/include/isc/platform.h.in          |   36 -
.../libnetwork/netresolv/include/isc/tree.h      |   59 -
.../libnetwork/netresolv/include/namespace.h     |   11 +
.../libnetwork/netresolv/include/netgroup.h      |   26 -
src/system/libnetwork/netresolv/include/resolv.h |  400 ++-----
.../libnetwork/netresolv/include/resolv_mt.h     |    2 +
src/system/libnetwork/netresolv/include/utmp.h   |    0
src/system/libnetwork/netresolv/irs/lcl_sv.cpp   |  351 ------
src/system/libnetwork/netresolv/irs/sethostent.c |   80 --
src/system/libnetwork/netresolv/isc/assertions.c |   13 +-
.../libnetwork/netresolv/isc/assertions.mdoc     |  138 ---
src/system/libnetwork/netresolv/isc/bitncmp.c    |   68 --
src/system/libnetwork/netresolv/isc/bitncmp.mdoc |   82 --
src/system/libnetwork/netresolv/isc/ctl_clnt.c   |  620 ----------
src/system/libnetwork/netresolv/isc/ctl_p.c      |  188 ----
src/system/libnetwork/netresolv/isc/ctl_p.h      |   28 -
src/system/libnetwork/netresolv/isc/ctl_srvr.c   |  787 -------------
.../libnetwork/netresolv/isc/ev_connects.c       |  369 ------
src/system/libnetwork/netresolv/isc/ev_files.c   |  277 -----
src/system/libnetwork/netresolv/isc/ev_streams.c |   15 +-
src/system/libnetwork/netresolv/isc/ev_timers.c  |   48 +-
src/system/libnetwork/netresolv/isc/ev_waits.c   |  247 ----
src/system/libnetwork/netresolv/isc/eventlib.c   |  933 ---------------
.../libnetwork/netresolv/isc/eventlib.mdoc       |  918 ---------------
src/system/libnetwork/netresolv/isc/eventlib_p.h |    4 +-
src/system/libnetwork/netresolv/isc/heap.c       |  236 ----
src/system/libnetwork/netresolv/isc/heap.mdoc    |  378 -------
src/system/libnetwork/netresolv/isc/hex.c        |  119 --
src/system/libnetwork/netresolv/isc/logging.c    |  716 ------------
src/system/libnetwork/netresolv/isc/logging.mdoc | 1056 -----------------
src/system/libnetwork/netresolv/isc/logging_p.h  |   61 -
src/system/libnetwork/netresolv/isc/memcluster.c |  588 ----------
.../libnetwork/netresolv/isc/memcluster.mdoc     |  376 -------
src/system/libnetwork/netresolv/isc/movefile.c   |   37 -
src/system/libnetwork/netresolv/isc/tree.c       |  536 ---------
src/system/libnetwork/netresolv/isc/tree.mdoc    |  154 ---
.../libnetwork/netresolv/nameser/ns_name.c       |   13 +-
.../libnetwork/netresolv/nameser/ns_print.c      |    4 +-
.../libnetwork/netresolv/{irs => net}/base64.c   |   97 +-
.../netresolv/{irs => net}/getaddrinfo.c         |  729 ++++++++++--
.../netresolv/{irs => net}/gethnamaddr.c         | 1058 ++++++++----------
.../netresolv/{irs => net}/getnameinfo.c         |   91 +-
.../netresolv/{irs => net}/getnetent.c           |    6 +
.../netresolv/{irs => net}/getnetnamadr.c        |   36 +-
.../netresolv/{irs => net}/getprotobyname.c      |    0
.../netresolv/{irs => net}/getprotobyname_r.c    |    4 +-
.../netresolv/{irs => net}/getprotobynumber.c    |    0
.../netresolv/{irs => net}/getprotobynumber_r.c  |    0
.../netresolv/{irs => net}/getprotoent.c         |    0
.../netresolv/{irs => net}/getprotoent_r.c       |    0
.../netresolv/{irs => net}/getservbyname.c       |    0
.../netresolv/{irs => net}/getservbyname_r.c     |    0
.../netresolv/{irs => net}/getservbyport.c       |    0
.../netresolv/{irs => net}/getservbyport_r.c     |    0
.../netresolv/{irs => net}/getservent.c          |    0
.../netresolv/{irs => net}/getservent_r.c        |    0
.../libnetwork/netresolv/{irs => net}/hesiod.c   |    0
src/system/libnetwork/netresolv/net/hostent.h    |  106 ++
.../netresolv/{irs => net}/nsdispatch.c          |    0
.../libnetwork/netresolv/{irs => net}/nslexer.l  |    0
.../libnetwork/netresolv/{irs => net}/nsparser.y |    0
.../libnetwork/netresolv/{irs => net}/protoent.h |    6 +-
.../libnetwork/netresolv/{irs => net}/servent.h  |    0
src/system/libnetwork/netresolv/net/sethostent.c |  299 +++++
.../libnetwork/netresolv/{irs => net}/vars6.c    |    1 +
src/system/libnetwork/netresolv/port_after.h     |  512 ---------
src/system/libnetwork/netresolv/port_before.h    |  166 +--
.../libnetwork/netresolv/resolv/res_data.c       |    7 +
.../libnetwork/netresolv/resolv/res_init.c       |   54 +-
.../libnetwork/netresolv/resolv/res_query.c      |   12 +-
.../libnetwork/netresolv/resolv/res_send.c       |    4 +-

############################################################################

Commit:      4dcc1ed6540c2a44086b97d7f6e06d7b4f3ec8ab
URL:         https://git.haiku-os.org/haiku/commit/?id=4dcc1ed6540c
Author:      Augustin Cavalier <waddlesplash@gmail.com>
Date:        Thu Aug 31 19:52:41 2023 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Thu Aug 31 23:38:47 2023 UTC

kernel: Synchronize inet_addr.c to remove advertising clause.

Change-Id: I03665bcad679e3fddaea0d8a95663be12b003bd8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6877
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

----------------------------------------------------------------------------

diff --git a/src/system/kernel/util/inet_addr.c b/src/system/kernel/util/inet_addr.c
index dca5d40cd1..29517a2914 100644
--- a/src/system/kernel/util/inet_addr.c
+++ b/src/system/kernel/util/inet_addr.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: (BSD-3-Clause AND ISC)
+ *
  * Copyright (c) 1983, 1990, 1993
  *    The Regents of the University of California.  All rights reserved.
  *
@@ -10,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.
  *
@@ -176,23 +174,23 @@ inet_aton(const char *cp, struct in_addr *addr) {
 	case 2:				/*%< a.b -- 8.24 bits */
 		if (val > 0xffffffU)
 			return (0);
-		val |= parts[0] << 24;
+		val |= (uint32_t)parts[0] << 24;
 		break;
 
 	case 3:				/*%< a.b.c -- 8.8.16 bits */
 		if (val > 0xffffU)
 			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16);
+		val |= ((uint32_t)parts[0] << 24) | (parts[1] << 16);
 		break;
 
 	case 4:				/*%< a.b.c.d -- 8.8.8.8 bits */
 		if (val > 0xffU)
 			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+		val |= ((uint32_t)parts[0] << 24) | (parts[1] << 16) |
+			(parts[2] << 8);
 		break;
 	}
 	if (addr != NULL)
 		addr->s_addr = htonl(val);
 	return (1);
 }
-

############################################################################

Commit:      ac30bc0ef6357e3fc0b2d5cff8f0aa9545989e6e
URL:         https://git.haiku-os.org/haiku/commit/?id=ac30bc0ef635
Author:      Augustin Cavalier <waddlesplash@gmail.com>
Date:        Thu Aug 31 21:09:00 2023 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Thu Aug 31 23:38:47 2023 UTC

libnetwork: Remove lcl_sv.cpp.

This has not been included in the build for years, probably since the
initial NetResolv merge. Services are now returned via the "protocols"
file, and getservent() has no need for these utility functions.

Change-Id: If18bdd9593463b38a9aaedb7a621d0ddc15530e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6878
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

----------------------------------------------------------------------------

diff --git a/src/system/libnetwork/Jamfile b/src/system/libnetwork/Jamfile
index 76d06923c4..aced5c6208 100644
--- a/src/system/libnetwork/Jamfile
+++ b/src/system/libnetwork/Jamfile
@@ -3,9 +3,6 @@ SubDir HAIKU_TOP src system libnetwork ;
 UsePrivateHeaders libroot net shared ;
 UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
 
-local services = [ FGristFiles services ] ;
-SEARCH on $(services) = [ FDirName $(SUBDIR) netresolv defaults ] ;
-
 local architectureObject ;
 for architectureObject in [ MultiArchSubDirSetup ] {
 	on $(architectureObject) {
@@ -27,8 +24,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
 			[ MultiArchDefaultGristFiles libutil.a libbsd.so ]
 			[ TargetLibsupc++ ]
 			;
-
-		AddFileDataAttribute $(libnetwork) : services : string : $(services) ;
 	}
 }
 
diff --git a/src/system/libnetwork/netresolv/defaults/services \
b/src/system/libnetwork/netresolv/defaults/services deleted file mode 100644
index 6a8cf5e480..0000000000
--- a/src/system/libnetwork/netresolv/defaults/services
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2006, Haiku, Inc. All Rights Reserved.
-# Licensed under the terms of the MIT license.
-#
-# This file only includes ports in the well known port range, and
-# is also not complete - it only includes commonly used ports
-# See RFC 1700 for a full list.
-#
-tcpmux		1/tcp
-echo		7/tcp
-echo		7/udp
-discard		9/tcp		sink null
-discard		9/udp		sink null
-daytime		13/tcp
-daytime		13/udp
-ftp-data	20/tcp
-ftp			21/tcp
-ssh			22/tcp
-telnet		23/tcp
-smtp		25/tcp		mail
-time		37/tcp		timserver
-time		37/udp		timserver
-name		42/udp		nameserver
-whois		43/tcp		nicname
-domain		53/tcp
-domain		53/udp
-bootps		67/udp		dhcps
-bootpc		68/udp		dhcpc
-tftp		69/udp
-finger		79/tcp
-http		80/tcp		www www-http
-kerberos	88/tcp		kdc
-kerberos	88/udp		kdc
-pop3		110/tcp
-nntp		119/tcp
-ntp			123/tcp
-ntp			123/udp
-netbios-ns	137/tcp
-netbios-ns	137/udp
-netbios-dgm	138/tcp
-netbios-dgm	138/udp
-netbios-ssn	139/tcp
-netbios-ssn	139/udp
-imap		143/tcp		imap2 imap4
-irc			194/tcp
-ldap		389/tcp
-ldap		389/udp
-https		443/tcp
diff --git a/src/system/libnetwork/netresolv/irs/lcl_sv.cpp \
b/src/system/libnetwork/netresolv/irs/lcl_sv.cpp deleted file mode 100644
index cece2d2690..0000000000
--- a/src/system/libnetwork/netresolv/irs/lcl_sv.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
- * Distributed under the terms of the MIT License.
- */
-
-/*
- * Copyright (c) 1989, 1993, 1995
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 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
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include "port_before.h"
-
-extern "C" {
-// libbind's internal headers aren't C++ safe
-
-#include "irs_p.h"
-#include "lcl_p.h"
-
-#define private private_data
-#include <irs.h>
-#undef private
-
-#include <isc/memcluster.h>
-
-}
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-
-#include "port_after.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <FindDirectory.h>
-#include <fs_attr.h>
-#include <image.h>
-#include <TypeConstants.h>
-
-
-#define IRS_SV_MAXALIASES	35
-
-struct service_private {
-	FILE*	file;
-	char	line[BUFSIZ + 1];
-	struct servent servent;
-	char*	aliases[IRS_SV_MAXALIASES];
-};
-
-
-static status_t
-find_own_image(image_info* _info)
-{
-	int32 cookie = 0;
-	image_info info;
-	while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
-		if (((addr_t)info.text <= (addr_t)find_own_image
-			&& (addr_t)info.text + (size_t)info.text_size
-					> (addr_t)find_own_image)) {
-			// found us
-			*_info = info;
-			return B_OK;
-		}
-	}
-
-	return B_ENTRY_NOT_FOUND;
-}
-
-
-static char*
-get_next_line(struct service_private* service)
-{
-	if (service->file == NULL)
-		return NULL;
-	return fgets(service->line, BUFSIZ, service->file);
-}
-
-
-//	#pragma mark -
-
-
-static void
-sv_close(struct irs_sv *sv)
-{
-	struct service_private *service = (struct service_private *)sv->private_data;
-
-	if (service->file)
-		fclose(service->file);
-
-	memput(service, sizeof *service);
-	memput(sv, sizeof *sv);
-}
-
-
-static void
-sv_rewind(struct irs_sv *sv)
-{
-	struct service_private *service
-		= (struct service_private *)sv->private_data;
-
-	if (service->file) {
-		if (fseek(service->file, 0L, SEEK_SET) == 0)
-			return;
-		fclose(service->file);
-		service->file = NULL;
-	}
-
-	char path[PATH_MAX];
-	if (find_directory(B_SYSTEM_DATA_DIRECTORY, -1, false, path, sizeof(path))
-			== B_OK) {
-		strlcat(path, "/network/services", sizeof(path));
-
-		if ((service->file = fopen(path, "r")) != NULL) {
-			if (fcntl(fileno(service->file), F_SETFD, FD_CLOEXEC) == 0)
-				return;
-
-			fclose(service->file);
-			service->file = NULL;
-		}
-	}
-
-	// opening the standard file has file has failed, use the attribute
-
-	// find our library image
-	image_info info;
-	if (find_own_image(&info) != B_OK)
-		return;
-
-	// open the library
-	int libraryFD = open(info.name, O_RDONLY);
-	if (libraryFD < 0)
-		return;
-
-	// open the attribute
-	int attrFD = fs_fopen_attr(libraryFD, "services", B_STRING_TYPE, O_RDONLY);
-	close(libraryFD);
-	if (attrFD < 0)
-		return;
-
-	// attach it to a FILE
-	service->file = fdopen(attrFD, "r");
-	if (service->file == NULL) {
-		close(attrFD);
-		return;
-	}
-
-	if (fcntl(fileno(service->file), F_SETFD, FD_CLOEXEC) == 0)
-		return;
-
-	fclose(service->file);
-	service->file = NULL;
-}
-
-
-static struct servent *
-sv_next(struct irs_sv *sv)
-{
-	struct service_private *service = (struct service_private *)sv->private_data;
-	char *p, *cp, **q;
-
-	if (service->file == NULL)
-		sv_rewind(sv);
-
-	if (service->file == NULL)
-		return NULL;
-
-again:
-	if ((p = get_next_line(service)) == NULL)
-		return NULL;
-
-	if (*p == '#')
-		goto again;
-
-	service->servent.s_name = p;
-	while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
-		++p;
-	if (*p == '\0' || *p == '#' || *p == '\n')
-		goto again;
-	*p++ = '\0';
-	while (*p == ' ' || *p == '\t')
-		p++;
-	if (*p == '\0' || *p == '#' || *p == '\n')
-		goto again;
-	service->servent.s_port = htons((u_short)strtol(p, &cp, 10));
-	if (cp == p || (*cp != '/' && *cp != ','))
-		goto again;
-	p = cp + 1;
-	service->servent.s_proto = p;
-
-	q = service->servent.s_aliases = service->aliases;
-
-	while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
-		++p;
-
-	while (*p == ' ' || *p == '\t') {
-		*p++ = '\0';
-		while (*p == ' ' || *p == '\t')
-			++p;
-		if (*p == '\0' || *p == '#' || *p == '\n')
-			break;
-		if (q < &service->aliases[IRS_SV_MAXALIASES - 1])
-			*q++ = p;
-		while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
-			++p;
-	}
-
-	*p = '\0';
-	*q = NULL;
-	return &service->servent;
-}
-
-
-static struct servent *
-sv_byname(struct irs_sv *sv, const char *name, const char *protocol)
-{
-	struct servent *servent;
-
-	sv_rewind(sv);
-
-	while ((servent = sv_next(sv))) {
-		char **alias;
-
-		if (!strcmp(name, servent->s_name))
-			goto gotname;
-		for (alias = servent->s_aliases; *alias; alias++) {
-			if (!strcmp(name, *alias))
-				goto gotname;
-		}
-		continue;
-gotname:
-		if (protocol == NULL || strcmp(servent->s_proto, protocol) == 0)
-			break;
-	}
-	return servent;
-}
-
-
-static struct servent *
-sv_byport(struct irs_sv *sv, int port, const char *protocol)
-{
-	struct servent *servent;
-
-	sv_rewind(sv);
-	while ((servent = sv_next(sv))) {
-		if (servent->s_port != port)
-			continue;
-		if (protocol == NULL || strcmp(servent->s_proto, protocol) == 0)
-			break;
-	}
-	return servent;
-}
-
-
-static void
-sv_minimize(struct irs_sv *sv)
-{
-	struct service_private *service = (struct service_private *)sv->private_data;
-
-	if (service->file != NULL) {
-		fclose(service->file);
-		service->file = NULL;
-	}
-}
-
-
-//	#pragma mark -
-
-
-extern "C" struct irs_sv *
-irs_lcl_sv(struct irs_acc */*acc*/)
-{
-	struct service_private *service;
-	struct irs_sv *sv;
-
-	if ((sv = (irs_sv *)memget(sizeof *sv)) == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	if ((service = (service_private *)memget(sizeof *service)) == NULL) {
-		memput(sv, sizeof *sv);
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	memset(service, 0, sizeof *service);
-
-	sv->private_data = service;
-	sv->close = sv_close;
-	sv->next = sv_next;
-	sv->byname = sv_byname;
-	sv->byport = sv_byport;
-	sv->rewind = sv_rewind;
-	sv->minimize = sv_minimize;
-	sv->res_get = NULL;
-	sv->res_set = NULL;
-
-	return sv;
-}

############################################################################

Revision:    hrev57256
Commit:      75e1de3c2369b5acb868c2a66e526dce183c7892
URL:         https://git.haiku-os.org/haiku/commit/?id=75e1de3c2369
Author:      Augustin Cavalier <waddlesplash@gmail.com>
Date:        Thu Aug 31 21:39:57 2023 UTC
Committer:   waddlesplash <waddlesplash@gmail.com>
Commit-Date: Thu Aug 31 23:38:47 2023 UTC

libnetwork: Synchronize netresolv with NetBSD 9.3.

Some of the Haiku-specific modifications that were previously unmarked
are now clearly marked with #ifdef __HAIKU__.

BIND9-specific files containing private APIs never exposed in public
headers have been removed.

Tested with wget, curl, pkgman (Network Kit), WebPositive (WebKit/curl),
and Falkon (QtWebEngine/Chromium). All DNS-related operations seem
to still work just fine.

(One patch also imported from NetBSD trunk for GCC 12+ compatibility.)

Change-Id: I4a349577b24b4df008fd9cba5d3a322cd24397f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6879
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

----------------------------------------------------------------------------

diff --git a/src/system/libnetwork/Jamfile b/src/system/libnetwork/Jamfile
index aced5c6208..06743ca266 100644
--- a/src/system/libnetwork/Jamfile
+++ b/src/system/libnetwork/Jamfile
@@ -14,7 +14,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
 		SharedLibrary $(libnetwork) :
 			init.cpp
 			interfaces.cpp
-			gethostbyname.c
 			getifaddrs.cpp
 			socket.cpp
 			r5_compatibility.cpp
diff --git a/src/system/libnetwork/gethostbyname.c \
b/src/system/libnetwork/gethostbyname.c deleted file mode 100644
index 30c96839d8..0000000000
--- a/src/system/libnetwork/gethostbyname.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1998-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include <errno.h>
-#include <netdb.h>
-#include <stdint.h>
-#include <string.h>
-
-
-#define ALIGN(p) (((uintptr_t)(p) + (sizeof(long) - 1)) & ~(sizeof(long) - 1))
-
-
-struct hostent *gethostbyname_r(const char *, struct hostent *,
-                                       char *, int, int *);
-
-struct hostent *
-gethostbyaddr_r(const char *addr, int len, int type,
-	struct hostent *hptr, char *buf, int buflen, int *h_errnop);
-
-
-static struct hostent *
-copy_hostent(struct hostent *he, struct hostent *hptr, char *buf, int buflen) {
-	char *cp;
-	char **ptr;
-	int i, n;
-	int nptr, len;
-
-	/* Find out the amount of space required to store the answer. */
-	nptr = 2; /*%< NULL ptrs */
-	len = (char *)ALIGN(buf) - buf;
-	for (i = 0; he->h_addr_list[i]; i++, nptr++) {
-		len += he->h_length;
-	}
-	for (i = 0; he->h_aliases[i]; i++, nptr++) {
-		len += strlen(he->h_aliases[i]) + 1;
-	}
-	len += strlen(he->h_name) + 1;
-	len += nptr * sizeof(char*);
-
-	if (len > buflen) {
-		errno = ERANGE;
-		return 0;
-	}
-
-	/* copy address size and type */
-	hptr->h_addrtype = he->h_addrtype;
-	n = hptr->h_length = he->h_length;
-
-	ptr = (char **)ALIGN(buf);
-	cp = (char *)ALIGN(buf) + nptr * sizeof(char *);
-
-	/* copy address list */
-	hptr->h_addr_list = ptr;
-	for (i = 0; he->h_addr_list[i]; i++ , ptr++) {
-		memcpy(cp, he->h_addr_list[i], n);
-		hptr->h_addr_list[i] = cp;
-		cp += n;
-	}
-	hptr->h_addr_list[i] = NULL;
-	ptr++;
-
-	/* copy official name */
-	n = strlen(he->h_name) + 1;
-	strcpy(cp, he->h_name);
-	hptr->h_name = cp;
-	cp += n;
-
-	/* copy aliases */
-	hptr->h_aliases = ptr;
-	for (i = 0 ; he->h_aliases[i]; i++) {
-		n = strlen(he->h_aliases[i]) + 1;
-		strcpy(cp, he->h_aliases[i]);
-		hptr->h_aliases[i] = cp;
-		cp += n;
-	}
-	hptr->h_aliases[i] = NULL;
-
-	return hptr;
-}
-
-
-struct hostent *
-gethostbyname_r(const char *name,  struct hostent *hptr,
-	char *buf, int buflen, int *h_errnop)
-{
-	struct hostent *he = gethostbyname(name);
-
-	*h_errnop = h_errno;
-
-	if (he == NULL)
-		return NULL;
-
-	return copy_hostent(he, hptr, buf, buflen);
-}
-
-
-struct hostent *
-gethostbyaddr_r(const char *addr, int len, int type,
-	struct hostent *hptr, char *buf, int buflen, int *h_errnop)
-{
-	struct hostent *he = gethostbyaddr(addr, len, type);
-
-	*h_errnop = h_errno;
-
-    if (he == NULL)
-        return NULL;
-
-    return copy_hostent(he, hptr, buf, buflen);
-}
-
diff --git a/src/system/libnetwork/netresolv/Jamfile \
b/src/system/libnetwork/netresolv/Jamfile index ee1fa6f62a..d2095f66af 100644
--- a/src/system/libnetwork/netresolv/Jamfile
+++ b/src/system/libnetwork/netresolv/Jamfile
@@ -14,7 +14,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
 		# NetResolv sources
 		SEARCH_SOURCE += [ FDirName $(SUBDIR) dst ] ;
 		SEARCH_SOURCE += [ FDirName $(SUBDIR) inet ] ;
-		SEARCH_SOURCE += [ FDirName $(SUBDIR) irs ] ;
+		SEARCH_SOURCE += [ FDirName $(SUBDIR) net ] ;
 		SEARCH_SOURCE += [ FDirName $(SUBDIR) isc ] ;
 		SEARCH_SOURCE += [ FDirName $(SUBDIR) nameser ] ;
 		SEARCH_SOURCE += [ FDirName $(SUBDIR) resolv ] ;
@@ -23,7 +23,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
 			# we want to have the xxx_r functions, IPv6, and md5 implementation
 			# we also need to use our BSD compatibility functions
 			# and enable "lint" to remove the RCSID from all the files.
-			local defines = _REENTRANT=1 USE_MD5=1 INET6 lint LINT ;
+			local defines = _LIBC _REENTRANT=1 USE_MD5=1 INET6 lint LINT ;
 			defines = [ FDefines $(defines) ] ;
 			SubDirCcFlags $(defines) -Wno-sign-compare ;
 			SubDirC++Flags $(defines) -Wno-sign-compare ;
@@ -72,22 +72,8 @@ for architectureObject in [ MultiArchSubDirSetup ] {
 
 			# isc
 			assertions.c
-			bitncmp.c
-			ctl_clnt.c
-			ctl_p.c
-			ctl_srvr.c
-			ev_connects.c
-			ev_files.c
 			ev_streams.c
 			ev_timers.c
-			ev_waits.c
-			eventlib.c
-			heap.c
-			hex.c
-			logging.c
-			memcluster.c
-			movefile.c
-			tree.c
 
 			# nameser
 			ns_name.c
diff --git a/src/system/libnetwork/netresolv/config.h \
b/src/system/libnetwork/netresolv/config.h index 0c68ffa1a1..8ff5e342ac 100644
--- a/src/system/libnetwork/netresolv/config.h
+++ b/src/system/libnetwork/netresolv/config.h
@@ -1,69 +1,5 @@
-/* config.h.  Generated from config.h.in by configure.  */
-/* #undef _SOCKADDR_LEN */
-#define HAVE_FCNTL_H 1
-#define HAVE_PATHS_H 1
-#define HAVE_INTTYPES_H 1
-/* #undef HAVE_STROPTS_H */
-/* #undef HAVE_SYS_TIMERS_H */
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_MEMORY_H 1
-/* #undef SYS_CDEFS_H */
-/* #undef _POSIX_PTHREAD_SEMANTICS */
-/* #undef POSIX_GETPWUID_R */
-/* #undef POSIX_GETPWNAM_R */
-/* #undef POSIX_GETGRGID_R */
-/* #undef POSIX_GETGRNAM_R */
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCHR 1
-/* #undef SPRINTF_CHAR */
-/* #undef VSPRINTF_CHAR */
-#define USE_SYSERROR_LIST 1
-/* #undef NEED_STRTOUL */
-/* #undef NEED_SUN4PROTOS */
-/* #undef REENABLE_SEND */
-
-#define NEED_SETGROUPENT 1
-/* #undef NEED_GETGROUPLIST */
-
-/* define if prototype for getgrnam_r() is required */
-/* #undef NEED_GETGRNAM_R */
-/* #undef NEED_GETGRGID_R */
-/* #undef NEED_GETGRENT_R */
-#define NEED_SETGRENT_R 1
-#define NEED_ENDGRENT_R 1
-
-#define NEED_INNETGR_R 1
-/* #undef NEED_SETNETGRENT_R */
-#define NEED_ENDNETGRENT_R 1
-
-/* #undef NEED_GETPWNAM_R */
-/* #undef NEED_GETPWUID_R */
-#define NEED_SETPWENT_R 1
-#define NEED_SETPASSENT_R 1
-#define NEED_SETPWENT_R 1
-/* #undef NEED_GETPWENT_R */
-#define NEED_ENDPWENT_R 1
-
-#define NEED_SETPASSENT 1
-
-/* #undef HAS_PW_CLASS */
-
-/* #undef ssize_t */
-/* #undef uintptr_t */
-
-/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
-/* #undef SHUTUP_SPUTAUX */
-#ifdef SHUTUP_SPUTAUX
-struct __sFILE;
-extern __inline int __sputaux(int _c, struct __sFILE *_p);
-#endif
-/* #undef BROKEN_IN6ADDR_INIT_MACROS */
-#define HAVE_STRLCAT 1
-/* Shut up warnings about missing braces */
-/* #undef SHUTUP_MUTEX_INITIALIZER */
-#ifdef SHUTUP_MUTEX_INITIALIZER
-#define LIBBIND_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
-#else
-#define LIBBIND_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#endif
+#define DO_PTHREADS
 
+#define HAS_INET6_STRUCTS 1
+#define HAVE_SA_LEN 1
+#define HAVE_SIN6_SCOPE_ID 1
diff --git a/src/system/libnetwork/netresolv/dst/dst_api.c \
b/src/system/libnetwork/netresolv/dst/dst_api.c index 67e9828fd4..ce54165fbb 100644
--- a/src/system/libnetwork/netresolv/dst/dst_api.c
+++ b/src/system/libnetwork/netresolv/dst/dst_api.c
@@ -1,6 +1,4 @@
-#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 \
                2007/09/24 17:18:25 each Exp $";
-#endif
+/*	$NetBSD: dst_api.c,v 1.3 2012/11/16 02:16:38 christos Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -38,6 +36,11 @@ static const char rcsid[] = "$Header: \
                /proj/cvs/prod/libbind/dst/dst_api.c,v 1.1
  * int *dst_key_to_buffer()	Writes out DST_KEY key matterial in buffer
  * void dst_free_key()       	Releases all memory referenced by key structure
  */
+#include <sys/cdefs.h>
+#if 0
+static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 \
2007/09/24 17:18:25 each Exp "; +#endif
+
 
 #include "port_before.h"
 #include <stdio.h>
@@ -62,7 +65,6 @@ static const char rcsid[] = "$Header: \
/proj/cvs/prod/libbind/dst/dst_api.c,v 1.1  /* static variables */
 static int done_init = 0;
 dst_func *dst_t_func[DST_MAX_ALGS];
-const char *key_file_fmt_str = "Private-key-format: v%s\nAlgorithm: %d (%s)\n";
 const char *dst_path = "";
 
 /* internal I/O functions */
@@ -88,10 +90,10 @@ static DST_KEY *dst_s_get_key_struct(const char *name, const int \
                alg,
  *	none
  */
 void
-dst_init()
+dst_init(void)
 {
 	char *s;
-	int len;
+	size_t len;
 
 	if (done_init != 0)
 		return;
@@ -104,10 +106,12 @@ dst_init()
 
 		len = strlen(s);
 		if (len > PATH_MAX) {
-			EREPORT(("%s is longer than %d characters, ignoring\n",
-				 s, PATH_MAX));
-		} else if (stat(s, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
-			EREPORT(("%s is not a valid directory\n", s));
+			EREPORT(("%s: %s is longer than %d characters,"
+			    " ignoring\n", __func__, s, PATH_MAX));
+		} else if (stat(s, &statbuf) != 0 ||
+		    !S_ISDIR(statbuf.st_mode)) {
+			EREPORT(("%s: %s is not a valid directory\n",
+			    __func__, s));
 		} else {
 			char *tmp;
 			tmp = (char *) malloc(len + 2);
@@ -328,17 +332,16 @@ dst_read_key(const char *in_keyname, const u_int16_t in_id,
 	DST_KEY *dg_key = NULL, *pubkey = NULL;
 
 	if (!dst_check_algorithm(in_alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_read_private_key(): Algorithm %d not suppored\n",
-			 in_alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__, in_alg));
 		return (NULL);
 	}
 	if ((type & (DST_PUBLIC | DST_PRIVATE)) == 0) 
 		return (NULL);
 	if (in_keyname == NULL) {
-		EREPORT(("dst_read_private_key(): Null key name passed in\n"));
+		EREPORT(("%s: Null key name passed in\n", __func__));
 		return (NULL);
 	} else if (strlen(in_keyname) >= sizeof(keyname)) {
-		EREPORT(("dst_read_private_key(): keyname too big\n"));
+		EREPORT(("%s: keyname too big\n", __func__));
 		return (NULL);
 	} else 
 		strcpy(keyname, in_keyname);
@@ -351,8 +354,8 @@ dst_read_key(const char *in_keyname, const u_int16_t in_id,
 		return pubkey; 
 
 	if (!(dg_key = dst_s_get_key_struct(keyname, pubkey->dk_alg,
-					    pubkey->dk_flags, pubkey->dk_proto,
-					    0)))
+					    (int)pubkey->dk_flags,
+					    pubkey->dk_proto, 0)))
 		return (dg_key);
 	/* Fill in private key and some fields in the general key structure */
 	if (dst_s_read_private_key_file(keyname, dg_key, pubkey->dk_id,
@@ -371,8 +374,8 @@ dst_write_key(const DST_KEY *key, const int type)
 	if (key == NULL) 
 		return (0);
 	if (!dst_check_algorithm(key->dk_alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_write_key(): Algorithm %d not suppored\n", 
-			 key->dk_alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__,
+		    key->dk_alg));
 		return (UNSUPPORTED_KEYALG);
 	}
 	if ((type & (DST_PRIVATE|DST_PUBLIC)) == 0)
@@ -416,12 +419,13 @@ dst_s_write_private_key(const DST_KEY *key)
 	if (key->dk_KEY_struct == NULL)
 		return (0);	/*%< null key has no private key */
 	if (key->dk_func == NULL || key->dk_func->to_file_fmt == NULL) {
-		EREPORT(("dst_write_private_key(): Unsupported operation %d\n",
-			 key->dk_alg));
+		EREPORT(("%s: Unsupported operation %d\n", __func__,
+		    key->dk_alg));
 		return (-5);
 	} else if ((len = key->dk_func->to_file_fmt(key, (char *)encoded_block,
-					     sizeof(encoded_block))) <= 0) {
-		EREPORT(("dst_write_private_key(): Failed encoding private RSA bsafe key %d\n", \
len)); +					 (int)sizeof(encoded_block))) <= 0) {
+		EREPORT(("%s: Failed encoding private RSA bsafe key %d\n",
+		    __func__, len));
 		return (-8);
 	}
 	/* Now I can create the file I want to use */
@@ -430,17 +434,19 @@ dst_s_write_private_key(const DST_KEY *key)
 
 	/* Do not overwrite an existing file */
 	if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) {
-		int nn;
-		if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
-			EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
-				 file, len, nn, errno));
+		ssize_t nn;
+		nn = fwrite(encoded_block, 1, len, fp);
+		if (nn != len) {
+			EREPORT(("%s: Write failure on %s %d != %zd"
+			    " errno=%d\n", __func__, file, len, nn, errno));
+
 			fclose(fp);
 			return (-5);
 		}
 		fclose(fp);
 	} else {
-		EREPORT(("dst_write_private_key(): Can not create file %s\n"
-			 ,file));
+		EREPORT(("%s: Can not create file %s\n", __func__,
+		    file));
 		return (-6);
 	}
 	memset(encoded_block, 0, len);
@@ -462,20 +468,21 @@ dst_s_write_private_key(const DST_KEY *key)
 static DST_KEY *
 dst_s_read_public_key(const char *in_name, const u_int16_t in_id, int in_alg)
 {
-	int flags, proto, alg, len, dlen;
+	int flags, proto, alg, dlen;
+	size_t len;
 	int c;
 	char name[PATH_MAX], enckey[RAW_KEY_SIZE], *notspace;
 	u_char deckey[RAW_KEY_SIZE];
 	FILE *fp;
 
 	if (in_name == NULL) {
-		EREPORT(("dst_read_public_key(): No key name given\n"));
+		EREPORT(("%s: No key name given\n", __func__));
 		return (NULL);
 	}
 	if (dst_s_build_filename(name, in_name, in_id, in_alg, PUBLIC_KEY,
 				 PATH_MAX) == -1) {
-		EREPORT(("dst_read_public_key(): Cannot make filename from %s, %d, and %s\n",
-			 in_name, in_id, PUBLIC_KEY));
+		EREPORT(("%s: Cannot make filename from %s, %d, and %s\n",
+		    __func__, in_name, in_id, PUBLIC_KEY));
 		return (NULL);
 	}
 	/*
@@ -486,8 +493,7 @@ dst_s_read_public_key(const char *in_name, const u_int16_t in_id, \
                int in_alg)
 	 * (FIXME: handle parentheses for line continuation.)
 	 */
 	if ((fp = dst_s_fopen(name, "r", 0)) == NULL) {
-		EREPORT(("dst_read_public_key(): Public Key not found %s\n",
-			 name));
+		EREPORT(("%s: Public Key not found %s\n", __func__, name));
 		return (NULL);
 	}
 	/* Skip domain name, which ends at first blank */
@@ -519,7 +525,8 @@ dst_s_read_public_key(const char *in_name, const u_int16_t in_id, \
int in_alg)  }
 	/* Locate and skip "KEY" */
 	if (c != 'K' && c != 'k') {
-		EREPORT(("\"KEY\" doesn't appear in file: %s", name));
+		EREPORT(("%s: \"KEY\" doesn't appear in file: %s", __func__,
+		    name));
 		return NULL;
 	}
 	while ((c = getc(fp)) != EOF)
@@ -532,24 +539,24 @@ dst_s_read_public_key(const char *in_name, const u_int16_t \
in_id, int in_alg)  /* Handle hex!! FIXME.  */
 
 	if (fscanf(fp, "%d %d %d", &flags, &proto, &alg) != 3) {
-		EREPORT(("dst_read_public_key(): Can not read flag/proto/alg field from %s\n"
-			 ,name));
+		EREPORT(("%s: Can not read flag/proto/alg field from %s\n",
+		    __func__, name));
 		return (NULL);
 	}
 	/* read in the key string */
-	fgets(enckey, sizeof(enckey), fp);
+	fgets(enckey, (int)sizeof(enckey), fp);
 
 	/* If we aren't at end-of-file, something is wrong.  */
 	while ((c = getc(fp)) != EOF)
 		if (!isspace(c))
 			break;
 	if (!feof(fp)) {
-		EREPORT(("Key too long in file: %s", name));
+		EREPORT(("%s: Key too long in file: %s", __func__, name));
 		return NULL;
 	}
 	fclose(fp);
 
-	if ((len = strlen(enckey)) <= 0)
+	if ((len = strlen(enckey)) == 0)
 		return (NULL);
 
 	/* discard \n */
@@ -561,8 +568,7 @@ dst_s_read_public_key(const char *in_name, const u_int16_t in_id, \
int in_alg)  
 	dlen = b64_pton(notspace, deckey, sizeof(deckey));
 	if (dlen < 0) {
-		EREPORT(("dst_read_public_key: bad return from b64_pton = %d",
-			 dlen));
+		EREPORT(("%s: bad return from b64_pton = %d", __func__, dlen));
 		return (NULL);
 	}
 	/* store key and info in a key structure that is returned */
@@ -593,24 +599,25 @@ dst_s_write_public_key(const DST_KEY *key)
 
 	memset(out_key, 0, sizeof(out_key));
 	if (key == NULL) {
-		EREPORT(("dst_write_public_key(): No key specified \n"));
+		EREPORT(("%s: No key specified \n", __func__));
 		return (0);
-	} else if ((len = dst_key_to_dnskey(key, out_key, sizeof(out_key)))< 0)
+	} else if ((len = dst_key_to_dnskey(key, out_key,
+	    (int)sizeof(out_key)))< 0)
 		return (0);
 
 	/* Make the filename */
 	if (dst_s_build_filename(filename, key->dk_key_name, key->dk_id,
 				 key->dk_alg, PUBLIC_KEY, PATH_MAX) == -1) {
-		EREPORT(("dst_write_public_key(): Cannot make filename from %s, %d, and %s\n",
-			 key->dk_key_name, key->dk_id, PUBLIC_KEY));
+		EREPORT(("%s: Cannot make filename from %s, %d, and %s\n",
+		    __func__, key->dk_key_name, key->dk_id, PUBLIC_KEY));
 		return (0);
 	}
 	/* XXX in general this should be a check for symmetric keys */
 	mode = (key->dk_alg == KEY_HMAC_MD5) ? 0600 : 0644;
 	/* create public key file */
 	if ((fp = dst_s_fopen(filename, "w+", mode)) == NULL) {
-		EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n",
-			 filename, errno));
+		EREPORT(("%s: open of file:%s failed (errno=%d)\n",
+		    __func__, filename, errno));
 		return (0);
 	}
 	/*write out key first base64 the key data */
@@ -650,8 +657,8 @@ dst_dnskey_to_key(const char *in_name, const u_char *rdata, const \
int len)  return (NULL);
 	alg = (u_int8_t) rdata[DST_KEY_ALG];
 	if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_dnskey_to_key(): Algorithm %d not suppored\n",
-			 alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__,
+		    alg));
 		return (NULL);
 	}
 
@@ -679,11 +686,11 @@ dst_dnskey_to_key(const char *in_name, const u_char *rdata, \
const int len)  len - start) > 0)
 			return (key_st);
 	} else
-		EREPORT(("dst_dnskey_to_public_key(): unsuppored alg %d\n",
+		EREPORT(("%s: unsuppored alg %d\n", __func__,
 			 alg));
 
 	SAFE_FREE(key_st);
-	return (key_st);
+	return (NULL);
 }
 
 /*%
@@ -709,8 +716,8 @@ dst_key_to_dnskey(const DST_KEY *key, u_char *out_storage,
 		return (-1);
 
 	if (!dst_check_algorithm(key->dk_alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_key_to_dnskey(): Algorithm %d not suppored\n",
-			 key->dk_alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__,
+		    key->dk_alg));
 		return (UNSUPPORTED_KEYALG);
 	}
 	memset(out_storage, 0, out_len);
@@ -737,8 +744,7 @@ dst_key_to_dnskey(const DST_KEY *key, u_char *out_storage,
 		else
 			return (-1);
 	} else
-		EREPORT(("dst_key_to_dnskey(): Unsupported ALG %d\n",
-			 key->dk_alg));
+		EREPORT(("%s: Unsupported ALG %d\n", __func__, key->dk_alg));
 	return (-1);
 }
 
@@ -767,7 +773,7 @@ dst_buffer_to_key(const char *key_name,		/*!< name of the key  */
 	u_char dns[2048];
 
 	if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_buffer_to_key(): Algorithm %d not suppored\n", alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__, alg));
 		return (NULL);
 	}
 
@@ -778,11 +784,11 @@ dst_buffer_to_key(const char *key_name,		/*!< name of the key  \
*/  return (dst_free_key(dkey));
 
 	if (dkey->dk_func->from_dns_key(dkey, key_buf, key_len) < 0) {
-		EREPORT(("dst_buffer_to_key(): dst_buffer_to_hmac failed\n"));
+		EREPORT(("%s: dst_buffer_to_hmac failed\n", __func__));
 		return (dst_free_key(dkey));
 	}
 
-	dnslen = dst_key_to_dnskey(dkey, dns, sizeof(dns));
+	dnslen = dst_key_to_dnskey(dkey, dns, (int)sizeof(dns));
 	dkey->dk_id = dst_s_dns_key_id(dns, dnslen);
 	return (dkey);
 }
@@ -820,7 +826,9 @@ static int
 dst_s_read_private_key_file(char *name, DST_KEY *pk_key, u_int16_t in_id,
 			    int in_alg)
 {
-	int cnt, alg, len, major, minor, file_major, file_minor;
+	int alg, major, minor, file_major, file_minor;
+	ssize_t cnt;
+	size_t len;
 	int ret, id;
 	char filename[PATH_MAX];
 	u_char in_buff[RAW_KEY_SIZE], *p;
@@ -829,53 +837,53 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, \
u_int16_t in_id,  u_char dns[2048];
 
 	if (name == NULL || pk_key == NULL) {
-		EREPORT(("dst_read_private_key_file(): No key name given\n"));
+		EREPORT(("%s: No key name given\n", __func__));
 		return (0);
 	}
 	/* Make the filename */
 	if (dst_s_build_filename(filename, name, in_id, in_alg, PRIVATE_KEY,
 				 PATH_MAX) == -1) {
-		EREPORT(("dst_read_private_key(): Cannot make filename from %s, %d, and %s\n",
-			 name, in_id, PRIVATE_KEY));
+		EREPORT(("%s: Cannot make filename from %s, %d, and %s\n",
+		    __func__, name, in_id, PRIVATE_KEY));
 		return (0);
 	}
 	/* first check if we can find the key file */
 	if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) {
-		EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n",
-			 filename, dst_path[0] ? dst_path :
-			 (char *) getcwd(NULL, PATH_MAX - 1)));
+		EREPORT(("%s: Could not open file %s in directory %s\n",
+		    __func__, filename, dst_path[0] ? dst_path :
+		    getcwd(NULL, PATH_MAX - 1)));
 		return (0);
 	}
 	/* now read the header info from the file */
 	if ((cnt = fread(in_buff, 1, sizeof(in_buff), fp)) < 5) {
 		fclose(fp);
-		EREPORT(("dst_s_read_private_key_file: error reading file %s (empty file)\n",
-			 filename));
+		EREPORT(("%s: error reading file %s (empty file)\n",
+		    __func__, filename));
 		return (0);
 	}
+	len = cnt;
 	/* decrypt key */
 	fclose(fp);
 	if (memcmp(in_buff, "Private-key-format: v", 20) != 0)
 		goto fail;
-	len = cnt;
 	p = in_buff;
 
 	if (!dst_s_verify_str((const char **) (void *)&p,
 			       "Private-key-format: v")) {
-		EREPORT(("dst_s_read_private_key_file(): Not a Key file/Decrypt failed %s\n", \
name)); +		EREPORT(("%s: Not a Key file/Decrypt failed %s\n", __func__,
+		    name));
 		goto fail;
 	}
 	/* read in file format */
 	sscanf((char *)p, "%d.%d", &file_major, &file_minor);
 	sscanf(KEY_FILE_FORMAT, "%d.%d", &major, &minor);
 	if (file_major < 1) {
-		EREPORT(("dst_s_read_private_key_file(): Unknown keyfile %d.%d version for %s\n",
-			 file_major, file_minor, name));
+		EREPORT(("%s: Unknown keyfile %d.%d version for %s\n",
+		    __func__, file_major, file_minor, name));
 		goto fail;
 	} else if (file_major > major || file_minor > minor)
-		EREPORT((
-				"dst_s_read_private_key_file(): Keyfile %s version higher than mine %d.%d MAY \
                FAIL\n",
-				name, file_major, file_minor));
+		EREPORT(("%s: Keyfile %s version higher than mine %d.%d MAY"
+		    " FAIL\n", __func__, name, file_major, file_minor));
 
 	while (*p++ != '\n') ;	/*%< skip to end of line */
 
@@ -888,32 +896,34 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, \
u_int16_t in_id,  
 	if (pk_key->dk_key_name && !strcmp(pk_key->dk_key_name, name))
 		SAFE_FREE2(pk_key->dk_key_name, strlen(pk_key->dk_key_name));
-	pk_key->dk_key_name = (char *) strdup(name);
+	pk_key->dk_key_name = strdup(name);
 
 	/* allocate and fill in key structure */
 	if (pk_key->dk_func == NULL || pk_key->dk_func->from_file_fmt == NULL)
 		goto fail;
 
-	ret = pk_key->dk_func->from_file_fmt(pk_key, (char *)p, &in_buff[len] - p);
+	ret = pk_key->dk_func->from_file_fmt(pk_key, (char *)p,
+	    (int)(&in_buff[len] - p));
 	if (ret < 0)
 		goto fail;
 
-	dnslen = dst_key_to_dnskey(pk_key, dns, sizeof(dns));
+	dnslen = dst_key_to_dnskey(pk_key, dns, (int)sizeof(dns));
 	id = dst_s_dns_key_id(dns, dnslen);
 
-	/* Make sure the actual key tag matches the input tag used in the filename
-	 */
+	/* Make sure the actual key tag matches the input tag used in the
+	 * filename */
 	if (id != in_id) {
-		EREPORT(("dst_s_read_private_key_file(): actual tag of key read %d != input tag \
used to build filename %d.\n", id, in_id)); +		EREPORT(("%s: actual tag of key read \
%d != input tag used to" +		    "build filename %d.\n", __func__, id, in_id));
 		goto fail;
 	}
 	pk_key->dk_id = (u_int16_t) id;
 	pk_key->dk_alg = alg;
-	explicit_bzero(in_buff, cnt);
+	memset(in_buff, 0, len);
 	return (1);
 
  fail:
-	explicit_bzero(in_buff, cnt);
+	memset(in_buff, 0, len);
 	return (0);
 }
 
@@ -959,7 +969,7 @@ dst_generate_key(const char *name, const int bits, const int exp,
 		return (NULL);
 
 	if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
-		EREPORT(("dst_generate_key(): Algorithm %d not suppored\n", alg));
+		EREPORT(("%s: Algorithm %d not suppored\n", __func__, alg));
 		return (NULL);
 	}
 
@@ -969,18 +979,17 @@ dst_generate_key(const char *name, const int bits, const int \
exp,  if (bits == 0) /*%< null key we are done */
 		return (new_key);
 	if (new_key->dk_func == NULL || new_key->dk_func->generate == NULL) {
-		EREPORT(("dst_generate_key_pair():Unsupported algorithm %d\n",
-			 alg));
+		EREPORT(("%s: Unsupported algorithm %d\n", __func__, alg));
 		return (dst_free_key(new_key));
 	}
 	if (new_key->dk_func->generate(new_key, exp) <= 0) {
-		EREPORT(("dst_generate_key_pair(): Key generation failure %s %d %d %d\n",
-			 new_key->dk_key_name, new_key->dk_alg,
-			 new_key->dk_key_size, exp));
+		EREPORT(("%s: Key generation failure %s %d %d %d\n", __func__,
+		    new_key->dk_key_name, new_key->dk_alg,
+		    new_key->dk_key_size, exp));
 		return (dst_free_key(new_key));
 	}
 
-	dnslen = dst_key_to_dnskey(new_key, dns, sizeof(dns));
+	dnslen = dst_key_to_dnskey(new_key, dns, (int)sizeof(dns));
 	if (dnslen != UNSUPPORTED_KEYALG)
 		new_key->dk_id = dst_s_dns_key_id(dns, dnslen);
 	else
@@ -1006,8 +1015,7 @@ dst_free_key(DST_KEY *f_key)
 		f_key->dk_KEY_struct =
 			f_key->dk_func->destroy(f_key->dk_KEY_struct);
 	else {
-		EREPORT(("dst_free_key(): Unknown key alg %d\n",
-			 f_key->dk_alg));
+		EREPORT(("%s: Unknown key alg %d\n", __func__, f_key->dk_alg));
 	}
 	if (f_key->dk_KEY_struct) {
 		free(f_key->dk_KEY_struct);
@@ -1040,7 +1048,7 @@ dst_sig_size(DST_KEY *key) {
 	    case KEY_DSA:
 		return (40);
 	    default:
-		EREPORT(("dst_sig_size(): Unknown key alg %d\n", key->dk_alg));
+		EREPORT(("%s: Unknown key alg %d\n", __func__, key->dk_alg));
 		return -1;
 	}
 }
diff --git a/src/system/libnetwork/netresolv/dst/dst_internal.h \
b/src/system/libnetwork/netresolv/dst/dst_internal.h index 614fe12d4a..efb3f854ae \
                100644
--- a/src/system/libnetwork/netresolv/dst/dst_internal.h
+++ b/src/system/libnetwork/netresolv/dst/dst_internal.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: dst_internal.h,v 1.2 2012/11/16 02:11:05 joerg Exp $	*/
+
 #ifndef DST_INTERNAL_H
 #define DST_INTERNAL_H
 
@@ -62,18 +64,26 @@ typedef struct dst_key {
 #define PUBLIC_KEY		"key"
 
 /* error handling */
-#ifdef REPORT_ERRORS
+#ifdef DEBUG
 #define EREPORT(str)		printf str
 #else
-#define EREPORT(str)		(void)0
+#define EREPORT(str)		do {} while (/*CONSTCOND*/0)
 #endif
 
 /* use our own special macro to FRRE memory */
 
+#ifndef SAFE_FREE2
+#define SAFE_FREE2(a, s) do { \
+	if ((a) != NULL) { \
+		memset((a), 0, (s)); \
+		free((a)); \
+		(a) = NULL; \
+	} \
+} while (/*CONSTCOND*/0)
+#endif
+
 #ifndef SAFE_FREE
-#define SAFE_FREE(a) \
-do{if(a != NULL){explicit_bzero(a, sizeof(*a)); free(a); a=NULL;}} while (0)
-#define SAFE_FREE2(a,s) if (a != NULL && (long)s > 0){explicit_bzero(a, s);free(a); \
a=NULL;} +#define SAFE_FREE(a) SAFE_FREE2((a), sizeof(*(a)))
 #endif
 
 typedef struct dst_func {
@@ -149,6 +159,7 @@ void
 dst_s_dump(const int mode, const u_char *data, const int size,
             const char *msg);
 
+#define  KEY_FILE_FMT_STR "Private-key-format: v%s\nAlgorithm: %d (%s)\n"
 
 
 #endif /* DST_INTERNAL_H */
diff --git a/src/system/libnetwork/netresolv/dst/hmac_link.c \
b/src/system/libnetwork/netresolv/dst/hmac_link.c index a77d7f7000..eebc3edf34 100644
--- a/src/system/libnetwork/netresolv/dst/hmac_link.c
+++ b/src/system/libnetwork/netresolv/dst/hmac_link.c
@@ -1,7 +1,5 @@
-#ifdef HMAC_MD5
-#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 \
                2007/09/24 17:18:25 each Exp $";
-#endif
+/*	$NetBSD: hmac_link.c,v 1.3 2016/03/07 14:35:39 christos Exp $	*/
+
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
  *
@@ -18,6 +16,10 @@ static const char rcsid[] = "$Header: \
                /proj/cvs/prod/libbind/dst/hmac_link.c,v 1
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
  */
+#include <sys/cdefs.h>
+#if 0
+static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 \
2007/09/24 17:18:25 each Exp "; +#endif
 
 /*%
  * This file contains an implementation of the HMAC-MD5 algorithm.
@@ -37,19 +39,7 @@ static const char rcsid[] = "$Header: \
/proj/cvs/prod/libbind/dst/hmac_link.c,v 1  
 #include "dst_internal.h"
 
-#ifdef USE_MD5
-# ifndef HAVE_MD5
-#  include "md5.h"
-# else
-#  ifdef SOLARIS2
-#   include <sys/md5.h>
-#  endif
-# endif
-# ifndef _MD5_H_
-#  define _MD5_H_ 1	/*%< make sure we do not include rsaref md5.h file */
-# endif
-#endif
-
+#include "md5.h"
 #include "port_after.h"
 
 
@@ -111,7 +101,7 @@ dst_hmac_md5_sign(const int mode, DST_KEY *d_key, void **context,
 	}
 
 	if ((mode & SIG_MODE_UPDATE) && (data && len > 0))
-		MD5Update(ctx, data, len);
+		MD5Update(ctx, data, (unsigned int)len);
 
 	if (mode & SIG_MODE_FINAL) {
 		if (signature == NULL || sig_len < MD5_LEN)
@@ -177,7 +167,7 @@ dst_hmac_md5_verify(const int mode, DST_KEY *d_key, void \
**context,  MD5Update(ctx, key->hk_ipad, HMAC_LEN);
 	}
 	if ((mode & SIG_MODE_UPDATE) && (data && len > 0))
-		MD5Update(ctx, data, len);
+		MD5Update(ctx, data, (unsigned int)len);
 
 	if (mode & SIG_MODE_FINAL) {
 		u_char digest[MD5_LEN];
@@ -237,7 +227,7 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const \
int keylen)  /* if key is longer than HMAC_LEN bytes reset it to key=MD5(key) */
 	if (keylen > HMAC_LEN) {
 		MD5Init(&ctx);
-		MD5Update(&ctx, key, keylen);
+		MD5Update(&ctx, key, (unsigned int)keylen);
 		MD5Final(tk, &ctx);
 		memset((void *) &ctx, 0, sizeof(ctx));
 		key = tk;
@@ -276,49 +266,50 @@ dst_hmac_md5_key_to_file_format(const DST_KEY *dkey, char \
*buff,  const int buff_len)
 {
 	char *bp;
-	int len, i, key_len;
+#define BUF_LEFT (size_t)(buff_len - (bp - buff))
+	int len, key_len;
 	u_char key[HMAC_LEN];
 	HMAC_Key *hkey;
+	static const char keystr[] = "Key: ";
 
-	if (dkey == NULL || dkey->dk_KEY_struct == NULL)
-		return (0);
-	/*
-	 * Using snprintf() would be so much simpler here.
-	 */
-	if (buff == NULL ||
-	    buff_len <= (int)(strlen(key_file_fmt_str) +
-			      strlen(KEY_FILE_FORMAT) + 4))
-		return (-1);	/*%< no OR not enough space in output area */
-	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
-	memset(buff, 0, buff_len);	/*%< just in case */
-	/* write file header */
-	sprintf(buff, key_file_fmt_str, KEY_FILE_FORMAT, KEY_HMAC_MD5, "HMAC");
+	if (buff == NULL)
+		return -1;	/*%< no output area */
 
-	bp = buff + strlen(buff);
+	if (dkey == NULL || dkey->dk_KEY_struct == NULL)
+		return 0;
 
-	memset(key, 0, HMAC_LEN);
-	for (i = 0; i < HMAC_LEN; i++)
-		key[i] = hkey->hk_ipad[i] ^ HMAC_IPAD;
-	for (i = HMAC_LEN - 1; i >= 0; i--)
-		if (key[i] != 0)
+	/* write file header */
+	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
+	len = snprintf(buff, buff_len, KEY_FILE_FMT_STR, KEY_FILE_FORMAT,
+	    KEY_HMAC_MD5, "HMAC");
+	if (len < 0 || len >= buff_len)
+		return -1; 	/*%< not enough space in output area */
+	bp = buff + len;
+	if (BUF_LEFT < sizeof(keystr))
+		return -1;
+
+	memcpy(bp, keystr, sizeof(keystr) - 1);
+	bp += sizeof(keystr) - 1;
+
+	for (key_len = 0; key_len < HMAC_LEN; key_len++)
+		key[key_len] = hkey->hk_ipad[key_len] ^ HMAC_IPAD;
+	for (key_len = HMAC_LEN - 1; key_len >= 0; key_len--)
+		if (key[key_len] != 0)
 			break;
-	key_len = i + 1;
-
-	if (buff_len - (bp - buff) < 6)
-		return (-1);
-	strcat(bp, "Key: ");
-	bp += strlen("Key: ");
+	key_len++;
 
-	len = b64_ntop(key, key_len, bp, buff_len - (bp - buff));
+	len = b64_ntop(key, key_len, bp, BUF_LEFT);
 	if (len < 0)
-		return (-1);
+		return -1;
 	bp += len;
-	if (buff_len - (bp - buff) < 2)
-		return (-1);
+
+	if (BUF_LEFT < 2)
+		return -1;
 	*(bp++) = '\n';
-	*bp = '\0';
 
-	return (bp - buff);
+	memset(bp, 0, BUF_LEFT);
+
+	return (int)(bp - buff);
 }
 
 
@@ -359,7 +350,7 @@ dst_hmac_md5_key_from_file_format(DST_KEY *dkey, const char \
*buff,  eol = strchr(p, '\n');
 	if (eol == NULL)
 		return (-4);
-	len = eol - p;
+	len = (int)(eol - p);
 	tmp = malloc(len + 2);
 	if (tmp == NULL)
 		return (-5);
@@ -441,10 +432,9 @@ dst_hmac_md5_free_key_structure(void *key)
  */
 
 static int
+/*ARGSUSED*/
 dst_hmac_md5_generate_key(DST_KEY *key, const int nothing)
 {
-	(void)key;
-	(void)nothing;
 	return (-1);
 }
 
@@ -454,9 +444,9 @@ dst_hmac_md5_generate_key(DST_KEY *key, const int nothing)
  */
 int
 #ifdef	SUNW_LIBMD5
-dst_md5_hmac_init()
+dst_md5_hmac_init(void)
 #else
-dst_hmac_md5_init()
+dst_hmac_md5_init(void)
 #endif
 {
 	if (dst_t_func[KEY_HMAC_MD5] != NULL)
@@ -477,15 +467,4 @@ dst_hmac_md5_init()
 	return (1);
 }
 
-#else
-int __dst_hmac_md5_init(void);
-#define	dst_hmac_md5_init	__dst_hmac_md5_init
-
-int
-dst_hmac_md5_init()
-{
-	return (0);
-}
-#endif
-
 /*! \file */
diff --git a/src/system/libnetwork/netresolv/dst/support.c \
b/src/system/libnetwork/netresolv/dst/support.c index 8c8c7e3dfc..c0b7956e79 100644
--- a/src/system/libnetwork/netresolv/dst/support.c
+++ b/src/system/libnetwork/netresolv/dst/support.c
@@ -1,3 +1,5 @@
+/*	$NetBSD: support.c,v 1.2 2014/10/18 08:33:23 snj Exp $	*/
+
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
  *
@@ -14,6 +16,10 @@
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
  */
+#include <sys/cdefs.h>
+#if 0
+static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/support.c,v 1.6 \
2005/10/11 00:10:13 marka Exp "; +#endif
 
 #include "port_before.h"
 
@@ -48,7 +54,7 @@
 int
 dst_s_verify_str(const char **buf, const char *str)
 {
-	int b, s;
+	size_t b, s;
 	if (*buf == NULL)	/*%< error checks */
 		return (0);
 	if (str == NULL || *str == '\0')
@@ -191,7 +197,7 @@ dst_s_get_int32(const u_char *buf)
 void
 dst_s_put_int16(u_int8_t *buf, const u_int16_t val)
 {
-	buf[0] = (u_int8_t)(val >> 8);
+	buf[0] = (u_int8_t)((uint32_t)val >> 8);
 	buf[1] = (u_int8_t)(val);
 }
 
@@ -248,7 +254,7 @@ dst_s_filename_length(const char *name, const char *suffix)
 
 /*%
  *  dst_s_build_filename ()
- *	Builds a key filename from the key name, it's id, and a
+ *	Builds a key filename from the key name, its id, and a
  *	suffix.  '\', '/' and ':' are not allowed. fA filename is of the
  *	form:  K&lt;keyname&gt;&lt;id&gt;.&lt;suffix&gt;
  *	form: K&lt;keyname&gt;+&lt;alg&gt;+&lt;id&gt;.&lt;suffix&gt;
@@ -314,7 +320,7 @@ dst_s_fopen(const char *filename, const char *mode, int perm)
 	
 	fp = fopen(pathname, mode);
 	if (perm)
-		chmod(pathname, perm);
+		chmod(pathname, (mode_t)perm);
 	return (fp);
 }
 
diff --git a/src/system/libnetwork/netresolv/include/fd_setsize.h \
b/src/system/libnetwork/netresolv/include/fd_setsize.h index 0e21049742..235b1ad1c2 \
                100644
--- a/src/system/libnetwork/netresolv/include/fd_setsize.h
+++ b/src/system/libnetwork/netresolv/include/fd_setsize.h
@@ -1,10 +1,9 @@
 #ifndef _FD_SETSIZE_H
 #define _FD_SETSIZE_H
 
-/*%
+/*
  * If you need a bigger FD_SETSIZE, this is NOT the place to set it.
  * This file is a fallback for BIND ports which don't specify their own.
  */
 
 #endif /* _FD_SETSIZE_H */
-/*! \file */
diff --git a/src/system/libnetwork/netresolv/include/irp.h \
b/src/system/libnetwork/netresolv/include/irp.h deleted file mode 100644
index 1290bd068f..0000000000
--- a/src/system/libnetwork/netresolv/include/irp.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * $Id: irp.h,v 1.4 2005/04/27 04:56:15 sra Exp $
- */
-
-#ifndef _IRP_H_INCLUDED
-#define _IRP_H_INCLUDED
-
-/*! \file */
-
-#define IRPD_TIMEOUT 30			/*%< seconds */
-#define IRPD_MAXSESS 50			/*%< number of simultaneous sessions. */
-#define IRPD_PORT 6660			/*%< 10 times the number of the beast. */
-#define IRPD_PATH "/var/run/irpd"	/*%< af_unix socket path */
-
-/* If sets the environment variable IRPDSERVER to an IP address
-   (e.g. "192.5.5.1"), then that's the host the client expects irpd to be
-   running on. */
-#define IRPD_HOST_ENV "IRPDSERVER"
-
-/* Protocol response codes.  */
-#define IRPD_WELCOME_CODE 200
-#define IRPD_NOT_WELCOME_CODE 500
-
-#define IRPD_GETHOST_ERROR 510
-#define IRPD_GETHOST_NONE 210
-#define IRPD_GETHOST_OK 211
-#define IRPD_GETHOST_SETOK 212
-
-#define IRPD_GETNET_ERROR 520
-#define IRPD_GETNET_NONE 220
-#define IRPD_GETNET_OK 221
-#define IRPD_GETNET_SETOK 222
-
-#define IRPD_GETUSER_ERROR 530
-#define IRPD_GETUSER_NONE 230
-#define IRPD_GETUSER_OK 231
-#define IRPD_GETUSER_SETOK 232
-
-#define IRPD_GETGROUP_ERROR 540
-#define IRPD_GETGROUP_NONE 240
-#define IRPD_GETGROUP_OK 241
-#define IRPD_GETGROUP_SETOK 242
-
-#define IRPD_GETSERVICE_ERROR 550
-#define IRPD_GETSERVICE_NONE 250
-#define IRPD_GETSERVICE_OK 251
-#define IRPD_GETSERVICE_SETOK 252
-
-#define IRPD_GETPROTO_ERROR 560
-#define IRPD_GETPROTO_NONE 260
-#define IRPD_GETPROTO_OK 261
-#define IRPD_GETPROTO_SETOK 262
-
-#define IRPD_GETNETGR_ERROR 570
-#define IRPD_GETNETGR_NONE 270
-#define IRPD_GETNETGR_OK 271
-#define IRPD_GETNETGR_NOMORE 272
-#define IRPD_GETNETGR_MATCHES 273
-#define IRPD_GETNETGR_NOMATCH 274
-#define IRPD_GETNETGR_SETOK 275
-#define IRPD_GETNETGR_SETERR 276
-
-#define	irs_irp_read_body __irs_irp_read_body
-#define irs_irp_read_response __irs_irp_read_response
-#define irs_irp_disconnect __irs_irp_disconnect
-#define irs_irp_connect __irs_irp_connect
-#define irs_irp_connection_setup __irs_irp_connection_setup
-#define irs_irp_send_command __irs_irp_send_command
-
-struct irp_p;
-
-char   *irs_irp_read_body(struct irp_p *, size_t *);
-int	irs_irp_read_response(struct irp_p *, char *, size_t);
-void	irs_irp_disconnect(struct irp_p *);
-int	irs_irp_connect(struct irp_p *);
-int	irs_irp_is_connected(struct irp_p *);
-int	irs_irp_connection_setup(struct irp_p *, int *);
-#ifdef __GNUC__
-int	irs_irp_send_command(struct irp_p *, const char *, ...)
-			     __attribute__((__format__(__printf__, 2, 3)));
-#else
-int	irs_irp_send_command(struct irp_p *, const char *, ...);
-#endif
-int	irs_irp_get_full_response(struct irp_p *, int *, char *, size_t,
-				  char **, size_t *);
-int	irs_irp_read_line(struct irp_p *, char *, int);
-
-#endif
-
-/*! \file */
diff --git a/src/system/libnetwork/netresolv/include/irs.h \
b/src/system/libnetwork/netresolv/include/irs.h deleted file mode 100644
index 42d4890dfd..0000000000
--- a/src/system/libnetwork/netresolv/include/irs.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1996,1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * $Id: irs.h,v 1.5 2005/04/27 04:56:15 sra Exp $
- */
-
-#ifndef _IRS_H_INCLUDED
-#define _IRS_H_INCLUDED
-
-/*! \file */
-
-#include <sys/types.h>
-
-#include <arpa/nameser.h>
-
-#include <grp.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <pwd.h>
-
-/*%
- * This is the group map class.
- */
-struct irs_gr {
-	void *		private;
-	void		(*close) __P((struct irs_gr *));
-	struct group *	(*next) __P((struct irs_gr *));
-	struct group *	(*byname) __P((struct irs_gr *, const char *));
-	struct group *	(*bygid) __P((struct irs_gr *, gid_t));
-	int		(*list) __P((struct irs_gr *, const char *,
-				     gid_t, gid_t *, int *));
-	void		(*rewind) __P((struct irs_gr *));
-	void		(*minimize) __P((struct irs_gr *));
-	struct __res_state * (*res_get) __P((struct irs_gr *));
-	void		(*res_set) __P((struct irs_gr *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is the password map class.
- */
-struct irs_pw {
-	void *		private;
-	void		(*close) __P((struct irs_pw *));
-	struct passwd *	(*next) __P((struct irs_pw *));
-	struct passwd *	(*byname) __P((struct irs_pw *, const char *));
-	struct passwd *	(*byuid) __P((struct irs_pw *, uid_t));
-	void		(*rewind) __P((struct irs_pw *));
-	void		(*minimize) __P((struct irs_pw *));
-	struct __res_state * (*res_get) __P((struct irs_pw *));
-	void		(*res_set) __P((struct irs_pw *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is the service map class.
- */
-struct irs_sv {
-	void *		private;
-	void		(*close) __P((struct irs_sv *));
-	struct servent *(*byname) __P((struct irs_sv *,
-				       const char *, const char *));
-	struct servent *(*byport) __P((struct irs_sv *, int, const char *));
-	struct servent *(*next) __P((struct irs_sv *));
-	void		(*rewind) __P((struct irs_sv *));
-	void		(*minimize) __P((struct irs_sv *));
-	struct __res_state * (*res_get) __P((struct irs_sv *));
-	void		(*res_set) __P((struct irs_sv *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is the protocols map class.
- */
-struct irs_pr {
-	void *		private;
-	void		(*close) __P((struct irs_pr *));
-	struct protoent	*(*byname) __P((struct irs_pr *, const char *));
-	struct protoent	*(*bynumber) __P((struct irs_pr *, int));
-	struct protoent	*(*next) __P((struct irs_pr *));
-	void		(*rewind) __P((struct irs_pr *));
-	void		(*minimize) __P((struct irs_pr *));
-	struct __res_state * (*res_get) __P((struct irs_pr *));
-	void		(*res_set) __P((struct irs_pr *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is the hosts map class.
- */
-struct irs_ho {
-	void *		private;
-	void		(*close) __P((struct irs_ho *));
-	struct hostent *(*byname) __P((struct irs_ho *, const char *));
-	struct hostent *(*byname2) __P((struct irs_ho *, const char *, int));
-	struct hostent *(*byaddr) __P((struct irs_ho *,
-				       const void *, int, int));
-	struct hostent *(*next) __P((struct irs_ho *));
-	void		(*rewind) __P((struct irs_ho *));
-	void		(*minimize) __P((struct irs_ho *));
-	struct __res_state * (*res_get) __P((struct irs_ho *));
-	void		(*res_set) __P((struct irs_ho *, res_state,
-					void (*)(void *)));
-	struct addrinfo *(*addrinfo) __P((struct irs_ho *, const char *,
-					  const struct addrinfo *));
-};
-
-/*%
- * This is the networks map class.
- */
-struct irs_nw {
-	void *		private;
-	void		(*close) __P((struct irs_nw *));
-	struct nwent *	(*byname) __P((struct irs_nw *, const char *, int));
-	struct nwent *	(*byaddr) __P((struct irs_nw *, void *, int, int));
-	struct nwent *	(*next) __P((struct irs_nw *));
-	void		(*rewind) __P((struct irs_nw *));
-	void		(*minimize) __P((struct irs_nw *));
-	struct __res_state * (*res_get) __P((struct irs_nw *));
-	void		(*res_set) __P((struct irs_nw *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is the netgroups map class.
- */
-struct irs_ng {
-	void *		private;
-	void		(*close) __P((struct irs_ng *));
-	int		(*next) __P((struct irs_ng *, const char **,
-				     const char **, const char **));
-	int		(*test) __P((struct irs_ng *, const char *,
-				     const char *, const char *,
-				     const char *));
-	void		(*rewind) __P((struct irs_ng *, const char *));
-	void		(*minimize) __P((struct irs_ng *));
-};
-
-/*%
- * This is the generic map class, which copies the front of all others.
- */
-struct irs_map {
-	void *		private;
-	void		(*close) __P((void *));
-};
-
-/*%
- * This is the accessor class.  It contains pointers to all of the
- * initializers for the map classes for a particular accessor.
- */
-struct irs_acc {
-	void *		private;
-	void		(*close) __P((struct irs_acc *));
-	struct irs_gr *	(*gr_map) __P((struct irs_acc *));
-	struct irs_pw *	(*pw_map) __P((struct irs_acc *));
-	struct irs_sv *	(*sv_map) __P((struct irs_acc *));
-	struct irs_pr *	(*pr_map) __P((struct irs_acc *));
-	struct irs_ho *	(*ho_map) __P((struct irs_acc *));
-	struct irs_nw *	(*nw_map) __P((struct irs_acc *));
-	struct irs_ng *	(*ng_map) __P((struct irs_acc *));
-	struct __res_state * (*res_get) __P((struct irs_acc *));
-	void		(*res_set) __P((struct irs_acc *, res_state,
-					void (*)(void *)));
-};
-
-/*%
- * This is because the official definition of "struct netent" has no
- * concept of CIDR even though it allows variant address families (on
- * output but not input).  The compatibility stubs convert the structs
- * below into "struct netent"'s.
- */
-struct nwent {
-	char		*n_name;	/*%< official name of net */
-	char		**n_aliases;	/*%< alias list */
-	int		n_addrtype;	/*%< net address type */
-	void		*n_addr;	/*%< network address */
-	int		n_length;	/*%< address length, in bits */
-};
-
-/*%
- * Hide external function names from POSIX.
- */
-#define	irs_gen_acc	__irs_gen_acc
-#define	irs_lcl_acc	__irs_lcl_acc
-#define	irs_dns_acc	__irs_dns_acc
-#define	irs_nis_acc	__irs_nis_acc
-#define	irs_irp_acc	__irs_irp_acc
-#define	irs_destroy	__irs_destroy
-#define	irs_dns_gr	__irs_dns_gr
-#define	irs_dns_ho	__irs_dns_ho
-#define	irs_dns_nw	__irs_dns_nw
-#define	irs_dns_pr	__irs_dns_pr
-#define	irs_dns_pw	__irs_dns_pw
-#define	irs_dns_sv	__irs_dns_sv
-#define	irs_gen_gr	__irs_gen_gr
-#define	irs_gen_ho	__irs_gen_ho
-#define	irs_gen_ng	__irs_gen_ng
-#define	irs_gen_nw	__irs_gen_nw
-#define	irs_gen_pr	__irs_gen_pr
-#define	irs_gen_pw	__irs_gen_pw
-#define	irs_gen_sv	__irs_gen_sv
-#define	irs_irp_get_full_response	__irs_irp_get_full_response
-#define	irs_irp_gr	__irs_irp_gr
-#define	irs_irp_ho	__irs_irp_ho
-#define	irs_irp_is_connected	__irs_irp_is_connected
-#define	irs_irp_ng	__irs_irp_ng
-#define	irs_irp_nw	__irs_irp_nw
-#define	irs_irp_pr	__irs_irp_pr
-#define	irs_irp_pw	__irs_irp_pw
-#define	irs_irp_read_line	__irs_irp_read_line
-#define	irs_irp_sv	__irs_irp_sv
-#define	irs_lcl_gr	__irs_lcl_gr
-#define	irs_lcl_ho	__irs_lcl_ho
-#define	irs_lcl_ng	__irs_lcl_ng
-#define	irs_lcl_nw	__irs_lcl_nw
-#define	irs_lcl_pr	__irs_lcl_pr
-#define	irs_lcl_pw	__irs_lcl_pw
-#define	irs_lcl_sv	__irs_lcl_sv
-#define	irs_nis_gr	__irs_nis_gr
-#define	irs_nis_ho	__irs_nis_ho
-#define	irs_nis_ng	__irs_nis_ng
-#define	irs_nis_nw	__irs_nis_nw
-#define	irs_nis_pr	__irs_nis_pr
-#define	irs_nis_pw	__irs_nis_pw
-#define	irs_nis_sv	__irs_nis_sv
-#define	net_data_create	__net_data_create
-#define	net_data_destroy	__net_data_destroy
-#define	net_data_minimize	__net_data_minimize
-
-/*%
- * Externs.
- */
-extern struct irs_acc *	irs_gen_acc __P((const char *, const char *));
-extern struct irs_acc *	irs_lcl_acc __P((const char *));
-extern struct irs_acc *	irs_dns_acc __P((const char *));
-extern struct irs_acc *	irs_nis_acc __P((const char *));
-extern struct irs_acc *	irs_irp_acc __P((const char *));
-
-extern void		irs_destroy __P((void));
-
-/*%
- * These forward declarations are for the semi-private functions in
- * the get*.c files. Each of these funcs implements the real get*
- * functionality and the standard versions are just wrappers that
- * call these. Apart from the wrappers, only irpd is expected to
- * call these directly, hence these decls are put here and not in
- * the /usr/include replacements.
- */
-
-struct net_data;			/*%< forward */
-/*
- * net_data_create gets a singleton net_data object.  net_data_init
- * creates as many net_data objects as times it is called.  Clients using
- * the default interface will use net_data_create by default.  Servers will
- * probably want net_data_init (one call per client)
- */
-struct net_data *net_data_create __P((const char *));
-struct net_data *net_data_init __P((const char *));
-void		net_data_destroy __P((void *));
-	
-extern struct group    *getgrent_p __P((struct net_data *));
-extern struct group    *getgrnam_p __P((const char *, struct net_data *));
-extern struct group    *getgrgid_p __P((gid_t, struct net_data *));
-extern int 		setgroupent_p __P((int, struct net_data *));
-extern void 		endgrent_p __P((struct net_data *));
-extern int		getgrouplist_p __P((const char *, gid_t, gid_t *, int *,
-					    struct net_data *));
-
-#ifdef SETGRENT_VOID
-extern void 		setgrent_p __P((struct net_data *));
-#else
-extern int 		setgrent_p __P((struct net_data *));
-#endif
-
-extern struct hostent 	*gethostbyname_p __P((const char *,
-					      struct net_data *));
-extern struct hostent 	*gethostbyname2_p __P((const char *, int,
-					       struct net_data *));
-extern struct hostent 	*gethostbyaddr_p __P((const char *, int, int,
-					      struct net_data *));
-extern struct hostent 	*gethostent_p __P((struct net_data *));
-extern void 		sethostent_p __P((int, struct net_data *));
-extern void 		endhostent_p __P((struct net_data *));
-extern struct hostent 	*getipnodebyname_p __P((const char *, int, int, int *,
-					       struct net_data *));
-extern struct hostent 	*getipnodebyaddr_p __P((const void *, size_t,
-					      int, int *, struct net_data *));
-
-extern struct netent 	*getnetent_p __P((struct net_data *));
-extern struct netent 	*getnetbyname_p __P((const char *, struct net_data *));
-extern struct netent 	*getnetbyaddr_p __P((unsigned long, int,
-					     struct net_data *));
-extern void		setnetent_p __P((int, struct net_data *));
-extern void		endnetent_p __P((struct net_data *));
-
-extern void		setnetgrent_p __P((const char *, struct net_data *));
-extern void		endnetgrent_p __P((struct net_data *));
-extern int		innetgr_p __P((const char *, const char *, const char *,
-				       const char *, struct net_data *));
-extern int		getnetgrent_p __P((const char **, const char **,
-					   const char **, struct net_data *));
-
-extern struct protoent  *getprotoent_p __P((struct net_data *));
-extern struct protoent  *getprotobyname_p __P((const char *,
-					       struct net_data *));
-extern struct protoent	*getprotobynumber_p __P((int, struct net_data *));
-extern void		setprotoent_p __P((int, struct net_data *));
-extern void		endprotoent_p __P((struct net_data *));
-
-
-extern struct passwd 	*getpwent_p __P((struct net_data *));
-extern struct passwd 	*getpwnam_p __P((const char *, struct net_data *));
-extern struct passwd 	*getpwuid_p __P((uid_t, struct net_data *));
-extern int		setpassent_p __P((int, struct net_data *));
-extern void		endpwent_p __P((struct net_data *));
-
-#ifdef SETPWENT_VOID
-extern void		setpwent_p __P((struct net_data *));
-#else
-extern int		setpwent_p __P((struct net_data *));
-#endif
-
-extern struct servent 	*getservent_p __P((struct net_data *));
-extern struct servent 	*getservbyname_p __P((const char *, const char *,
-					      struct net_data *));
-extern struct servent 	*getservbyport_p __P((int, const char *,
-					      struct net_data *));
-extern void		setservent_p __P((int, struct net_data *));
-extern void		endservent_p __P((struct net_data *));
-
-#endif /*_IRS_H_INCLUDED*/
-
-/*! \file */
diff --git a/src/system/libnetwork/netresolv/include/isc/assertions.h \
b/src/system/libnetwork/netresolv/include/isc/assertions.h index \
                68925e73b3..7db7361d0b 100644
--- a/src/system/libnetwork/netresolv/include/isc/assertions.h
+++ b/src/system/libnetwork/netresolv/include/isc/assertions.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: assertions.h,v 1.5 2009/04/12 17:07:16 christos Exp $	*/
+
 /*
  * Copyright (C) 2004, 2005, 2008  Internet Systems Consortium, Inc. ("ISC")
  * Copyright (C) 1997-2001  Internet Software Consortium.
@@ -16,7 +18,7 @@
  */
 
 /*
- * $Id: assertions.h,v 1.5 2008/11/14 02:36:51 marka Exp $
+ * Id: assertions.h,v 1.5 2008/11/14 02:36:51 marka Exp
  */
 
 #ifndef ASSERTIONS_H
@@ -48,6 +50,7 @@ const char *assertion_type_to_text(assertion_type type);
 #define CHECK_INVARIANT		0
 #endif
 
+#ifdef _DIAGNOSTIC
 #ifndef CHECK_REQUIRE
 #define CHECK_REQUIRE		1
 #endif
@@ -63,6 +66,7 @@ const char *assertion_type_to_text(assertion_type type);
 #ifndef CHECK_INVARIANT
 #define CHECK_INVARIANT		1
 #endif
+#endif	/* _DIAGNOSTIC */
 
 #if CHECK_REQUIRE != 0
 #define REQUIRE(cond) \
@@ -102,8 +106,13 @@ const char *assertion_type_to_text(assertion_type type);
 		 ((__assertion_failed)(__FILE__, __LINE__, assert_insist, \
 				       #cond, 1), 0)))
 #else
+#if !defined(__lint__)
 #define INSIST(cond)		((void) (cond))
 #define INSIST_ERR(cond)	((void) (cond))
+#else /* !__lint__ */
+#define INSIST(cond)
+#define INSIST_ERR(cond)
+#endif /* !__lint__ */
 #endif /* CHECK_INSIST */
 
 #if CHECK_INVARIANT != 0
diff --git a/src/system/libnetwork/netresolv/include/isc/ctl.h \
b/src/system/libnetwork/netresolv/include/isc/ctl.h deleted file mode 100644
index e2ba20201d..0000000000
--- a/src/system/libnetwork/netresolv/include/isc/ctl.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef ISC_CTL_H
-#define ISC_CTL_H
-
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1998,1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * $Id: ctl.h,v 1.5 2005/04/27 04:56:17 sra Exp $
- */
-
-/*! \file */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <isc/eventlib.h>
-
-/* Macros. */
-
-#define	CTL_MORE	0x0001	/*%< More will be / should be sent. */
-#define	CTL_EXIT	0x0002	/*%< Close connection after this. */
-#define	CTL_DATA	0x0004	/*%< Go into / this is DATA mode. */
-/* Types. */
-
-struct ctl_cctx;
-struct ctl_sctx;
-struct ctl_sess;
-struct ctl_verb;
-
-enum ctl_severity { ctl_debug, ctl_warning, ctl_error };
-
-typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...);
-
-typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *,
-			     const struct ctl_verb *, const char *,
-			     u_int, const void *, void *);
-
-typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *);
-
-typedef void (*ctl_clntdone)(struct ctl_cctx *, void *, const char *, u_int);
-
-struct ctl_verb {
-	const char *	name;
-	ctl_verbfunc	func;
-	const char *	help;
-};
-
-/* General symbols. */
-
-#define	ctl_logger	__ctl_logger
-
-#ifdef __GNUC__
-void			ctl_logger(enum ctl_severity, const char *, ...)
-				__attribute__((__format__(__printf__, 2, 3)));
-#else
-void			ctl_logger(enum ctl_severity, const char *, ...);
-#endif
-
-/* Client symbols. */
-
-#define	ctl_client	__ctl_client
-#define	ctl_endclient	__ctl_endclient
-#define	ctl_command	__ctl_command
-
-struct ctl_cctx *	ctl_client(evContext, const struct sockaddr *, size_t,
-				   const struct sockaddr *, size_t,
-				   ctl_clntdone, void *,
-				   u_int, ctl_logfunc);
-void			ctl_endclient(struct ctl_cctx *);
-int			ctl_command(struct ctl_cctx *, const char *, size_t,
-				    ctl_clntdone, void *);
-
-/* Server symbols. */
-
-#define	ctl_server	__ctl_server
-#define	ctl_endserver	__ctl_endserver
-#define	ctl_response	__ctl_response
-#define	ctl_sendhelp	__ctl_sendhelp
-#define ctl_getcsctx	__ctl_getcsctx
-#define ctl_setcsctx	__ctl_setcsctx
-
-struct ctl_sctx *	ctl_server(evContext, const struct sockaddr *, size_t,
-				   const struct ctl_verb *,
-				   u_int, u_int,
-				   u_int, int, int,
-				   ctl_logfunc, void *);
-void			ctl_endserver(struct ctl_sctx *);
-void			ctl_response(struct ctl_sess *, u_int,
-				     const char *, u_int, const void *,
-				     ctl_srvrdone, void *,
-				     const char *, size_t);
-void			ctl_sendhelp(struct ctl_sess *, u_int);
-void *			ctl_getcsctx(struct ctl_sess *);
-void *			ctl_setcsctx(struct ctl_sess *, void *);
-
-#endif /*ISC_CTL_H*/
-
-/*! \file */
diff --git a/src/system/libnetwork/netresolv/include/isc/dst.h \
b/src/system/libnetwork/netresolv/include/isc/dst.h index 90a9e67468..a25cf011d2 \
                100644
--- a/src/system/libnetwork/netresolv/include/isc/dst.h
+++ b/src/system/libnetwork/netresolv/include/isc/dst.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: dst.h,v 1.2 2014/08/03 19:14:24 wiz Exp $	*/
+
 #ifndef DST_H
 #define DST_H
 
@@ -53,7 +55,7 @@ typedef struct dst_key {
 #define	dst_write_key		__dst_write_key
 
 /* 
- * DST Crypto API defintions 
+ * DST Crypto API definitions 
  */
 void     dst_init(void);
 int      dst_check_algorithm(const int);
diff --git a/src/system/libnetwork/netresolv/include/isc/eventlib.h \
b/src/system/libnetwork/netresolv/include/isc/eventlib.h index a4cfdf9092..4e9cc2e402 \
                100644
--- a/src/system/libnetwork/netresolv/include/isc/eventlib.h
+++ b/src/system/libnetwork/netresolv/include/isc/eventlib.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: eventlib.h,v 1.3 2009/04/12 17:07:16 christos Exp $	*/
+
 /*
  * Copyright (C) 2004, 2005, 2008  Internet Systems Consortium, Inc. ("ISC")
  * Copyright (C) 1995-1999, 2001, 2003  Internet Software Consortium.
@@ -18,7 +20,7 @@
 /* eventlib.h - exported interfaces for eventlib
  * vix 09sep95 [initial]
  *
- * $Id: eventlib.h,v 1.7 2008/11/14 02:36:51 marka Exp $
+ * Id: eventlib.h,v 1.7 2008/11/14 02:36:51 marka Exp
  */
 
 #ifndef _EVENTLIB_H
@@ -29,8 +31,6 @@
 #include <sys/time.h>
 #include <stdio.h>
 
-#include <isc/platform.h>
-
 #ifndef __P
 # define __EVENTLIB_P_DEFINED
 # ifdef __STDC__
diff --git a/src/system/libnetwork/netresolv/include/isc/heap.h \
b/src/system/libnetwork/netresolv/include/isc/heap.h index 384d507cf5..30cec98f24 \
                100644
--- a/src/system/libnetwork/netresolv/include/isc/heap.h
+++ b/src/system/libnetwork/netresolv/include/isc/heap.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: heap.h,v 1.1.1.4 2009/04/12 16:35:44 christos Exp $	*/
+
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1997,1999 by Internet Software Consortium.
diff --git a/src/system/libnetwork/netresolv/include/isc/irpmarshall.h \
b/src/system/libnetwork/netresolv/include/isc/irpmarshall.h deleted file mode 100644
index 244b3e3460..0000000000
--- a/src/system/libnetwork/netresolv/include/isc/irpmarshall.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * $Id: irpmarshall.h,v 1.4 2005/04/27 04:56:17 sra Exp $
- */
-
-#ifndef _IRPMARSHALL_H_INCLUDED
-#define _IRPMARSHALL_H_INCLUDED
-
-/* Hide function names */
-#define irp_marshall_gr __irp_marshall_gr
-#define irp_marshall_ho __irp_marshall_ho
-#define irp_marshall_ne __irp_marshall_ne
-#define irp_marshall_ng __irp_marshall_ng
-#define irp_marshall_nw __irp_marshall_nw
-#define irp_marshall_pr __irp_marshall_pr
-#define irp_marshall_pw __irp_marshall_pw
-#define irp_marshall_sv __irp_marshall_sv
-#define irp_unmarshall_gr __irp_unmarshall_gr
-#define irp_unmarshall_ho __irp_unmarshall_ho
-#define irp_unmarshall_ne __irp_unmarshall_ne
-#define irp_unmarshall_ng __irp_unmarshall_ng
-#define irp_unmarshall_nw __irp_unmarshall_nw
-#define irp_unmarshall_pr __irp_unmarshall_pr
-#define irp_unmarshall_pw __irp_unmarshall_pw
-#define irp_unmarshall_sv __irp_unmarshall_sv
-
-#define MAXPADDRSIZE (sizeof "255.255.255.255" + 1)
-#define ADDR_T_STR(x) (x == AF_INET ? "AF_INET" :\
-		       (x == AF_INET6 ? "AF_INET6" : "UNKNOWN"))
-
-/* See comment below on usage */
-int irp_marshall_pw(const struct passwd *, char **, size_t *);
-int irp_unmarshall_pw(struct passwd *, char *);
-int irp_marshall_gr(const struct group *, char **, size_t *);
-int irp_unmarshall_gr(struct group *, char *);
-int irp_marshall_sv(const struct servent *, char **, size_t *);
-int irp_unmarshall_sv(struct servent *, char *);
-int irp_marshall_pr(struct protoent *, char **, size_t *);
-int irp_unmarshall_pr(struct protoent *, char *);
-int irp_marshall_ho(struct hostent *, char **, size_t *);
-int irp_unmarshall_ho(struct hostent *, char *);
-int irp_marshall_ng(const char *, const char *, const char *,
-		    char **, size_t *);
-int irp_unmarshall_ng(const char **, const char **, const char **, char *);
-int irp_marshall_nw(struct nwent *, char **, size_t *);
-int irp_unmarshall_nw(struct nwent *, char *);
-int irp_marshall_ne(struct netent *, char **, size_t *);
-int irp_unmarshall_ne(struct netent *, char *);
-
-/*! \file
- * \brief
- * Functions to marshall and unmarshall various system data structures. We
- * use a printable ascii format that is as close to various system config
- * files as reasonable (e.g. /etc/passwd format).
- *
- * We are not forgiving with unmarhsalling misformatted buffers. In
- * particular whitespace in fields is not ignored. So a formatted password
- * entry "brister  :1364:100:...." will yield a username of "brister   "
- *
- * We potentially do a lot of mallocs to fill fields that are of type
- * (char **) like a hostent h_addr field. Building (for example) the
- * h_addr field and its associated addresses all in one buffer is
- * certainly possible, but not done here.
- *
- * The following description is true for all the marshalling functions:
- *
- * int irp_marshall_XX(struct yyyy *XX, char **buffer, size_t *len);
- *
- * The argument XX (of type struct passwd for example) is marshalled in the
- * buffer pointed at by *BUFFER, which is of length *LEN. Returns 0
- * on success and -1 on failure. Failure will occur if *LEN is
- * smaller than needed.
- *
- * If BUFFER is NULL, then *LEN is set to the size of the buffer
- * needed to marshall the data and no marshalling is actually done.
- *
- * If *BUFFER is NULL, then a buffer large enough will be allocated
- * with memget() and the size allocated will be stored in *LEN. An extra 2
- * bytes will be allocated for the client to append CRLF if wanted. The
- * value of *LEN will include these two bytes.
- *
- * All the marshalling functions produce a buffer with the fields
- * separated by colons (except for the hostent marshalling, which uses '@'
- * to separate fields). Fields that have multiple subfields (like the
- * gr_mem field in struct group) have their subparts separated by
- * commas.
- *
- * int irp_unmarshall_XX(struct YYYYY *XX, char *buffer);
- *
- * The unmashalling functions break apart the buffer and store the
- * values in the struct pointed to by XX. All pointer values inside
- * XX are allocated with malloc. All arrays of pointers have a NULL
- * as the last element.
- */
-
-#endif
diff --git a/src/system/libnetwork/netresolv/include/isc/list.h \
b/src/system/libnetwork/netresolv/include/isc/list.h index 5fe9031141..46f2e79be3 \
                100644
--- a/src/system/libnetwork/netresolv/include/isc/list.h
+++ b/src/system/libnetwork/netresolv/include/isc/list.h
@@ -1,3 +1,5 @@
+/*	$NetBSD: list.h,v 1.5 2009/04/12 17:07:16 christos Exp $	*/
+
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1997,1999 by Internet Software Consortium.
@@ -21,14 +23,14 @@
 
 #define LIST(type) struct { type *head, *tail; }
 #define INIT_LIST(list) \
-	do { (list).head = NULL; (list).tail = NULL; } while (0)
+	do { (list).head = NULL; (list).tail = NULL; } while (/*CONSTCOND*/0)
 
 #define LINK(type) struct { type *prev, *next; }
 #define INIT_LINK_TYPE(elt, link, type) \
 	do { \
 		(elt)->link.prev = (type *)(-1); \
 		(elt)->link.next = (type *)(-1); \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 #define INIT_LINK(elt, link) \
 	INIT_LINK_TYPE(elt, link, void)
 #define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1) && \
@@ -48,7 +50,7 @@
 		(elt)->link.prev = NULL; \
 		(elt)->link.next = (list).head; \
 		(list).head = (elt); \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define APPEND(list, elt, link) \
 	do { \
@@ -60,7 +62,7 @@
 		(elt)->link.prev = (list).tail; \
 		(elt)->link.next = NULL; \
 		(list).tail = (elt); \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define UNLINK_TYPE(list, elt, link, type) \
 	do { \
@@ -78,7 +80,7 @@
 			(list).head = (elt)->link.next; \
 		} \
 		INIT_LINK_TYPE(elt, link, type); \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 #define UNLINK(list, elt, link) \
 	UNLINK_TYPE(list, elt, link, void)
 
@@ -96,7 +98,7 @@
 			(elt)->link.prev->link.next = (elt); \
 			(elt)->link.next = (before); \
 		} \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define INSERT_AFTER(list, after, elt, link) \
 	do { \
@@ -109,7 +111,7 @@
 			(elt)->link.next->link.prev = (elt); \
 			(elt)->link.prev = (after); \
 		} \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define ENQUEUE(list, elt, link) APPEND(list, elt, link)
 #define DEQUEUE(list, elt, link) UNLINK(list, elt, link)
diff --git a/src/system/libnetwork/netresolv/include/isc/logging.h \
b/src/system/libnetwork/netresolv/include/isc/logging.h deleted file mode 100644
index c539443ff8..0000000000
--- a/src/system/libnetwork/netresolv/include/isc/logging.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef LOGGING_H
-#define LOGGING_H
-
-#include <sys/types.h>
-#include <stdio.h>

[ *** diff truncated: 15342 lines dropped *** ]


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic