summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2018-10-08 16:03:54 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2018-10-08 16:03:54 +0000
commitc92abada57222b3de4c40244b747671a838884db (patch)
treeb0c6b1a802dc76cdfe20d591f9e1a28b152c5b34 /usr.sbin
parent1f341ffcf8d68e3e3ae81e7c15934715a61b12f8 (diff)
merge 1.8.1
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/unbound/config.h.in18
-rw-r--r--usr.sbin/unbound/configure95
-rw-r--r--usr.sbin/unbound/configure.ac40
-rw-r--r--usr.sbin/unbound/daemon/daemon.c13
-rw-r--r--usr.sbin/unbound/daemon/remote.c4
-rw-r--r--usr.sbin/unbound/daemon/unbound.c2
-rw-r--r--usr.sbin/unbound/daemon/worker.c6
-rw-r--r--usr.sbin/unbound/doc/Changelog79
-rw-r--r--usr.sbin/unbound/doc/README2
-rw-r--r--usr.sbin/unbound/doc/example.conf.in2
-rw-r--r--usr.sbin/unbound/doc/libunbound.3.in4
-rw-r--r--usr.sbin/unbound/doc/unbound-anchor.8.in2
-rw-r--r--usr.sbin/unbound/doc/unbound-checkconf.8.in2
-rw-r--r--usr.sbin/unbound/doc/unbound-control.8.in4
-rw-r--r--usr.sbin/unbound/doc/unbound-host.1.in2
-rw-r--r--usr.sbin/unbound/doc/unbound.8.in4
-rw-r--r--usr.sbin/unbound/doc/unbound.conf.5.in4
-rw-r--r--usr.sbin/unbound/iterator/iter_scrub.c4
-rw-r--r--usr.sbin/unbound/iterator/iterator.c16
-rw-r--r--usr.sbin/unbound/libunbound/context.c4
-rw-r--r--usr.sbin/unbound/libunbound/libunbound.c11
-rw-r--r--usr.sbin/unbound/libunbound/libworker.c4
-rw-r--r--usr.sbin/unbound/respip/respip.c2
-rw-r--r--usr.sbin/unbound/services/authzone.c6
-rw-r--r--usr.sbin/unbound/services/cache/infra.c4
-rw-r--r--usr.sbin/unbound/services/outside_network.c16
-rw-r--r--usr.sbin/unbound/sldns/sbuffer.h4
-rw-r--r--usr.sbin/unbound/smallapp/unbound-anchor.c28
-rw-r--r--usr.sbin/unbound/smallapp/unbound-control.c4
-rw-r--r--usr.sbin/unbound/util/config_file.c27
-rw-r--r--usr.sbin/unbound/util/config_file.h3
-rw-r--r--usr.sbin/unbound/util/data/msgencode.c2
-rw-r--r--usr.sbin/unbound/util/data/msgreply.c8
-rw-r--r--usr.sbin/unbound/util/iana_ports.inc1
-rw-r--r--usr.sbin/unbound/util/log.h2
-rw-r--r--usr.sbin/unbound/validator/autotrust.c1
-rw-r--r--usr.sbin/unbound/validator/val_nsec3.c12
-rw-r--r--usr.sbin/unbound/validator/val_secalgo.c62
38 files changed, 375 insertions, 129 deletions
diff --git a/usr.sbin/unbound/config.h.in b/usr.sbin/unbound/config.h.in
index 04356f334ed..7ffb3c989b1 100644
--- a/usr.sbin/unbound/config.h.in
+++ b/usr.sbin/unbound/config.h.in
@@ -1,5 +1,11 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* apply the noreturn attribute to a function that exits the program */
+#undef ATTR_NORETURN
+
+/* apply the weak attribute to a symbol */
+#undef ATTR_WEAK
+
/* Directory to chroot to */
#undef CHROOT_DIR
@@ -45,6 +51,9 @@
/* Whether the C compiler accepts the "format" attribute */
#undef HAVE_ATTR_FORMAT
+/* Whether the C compiler accepts the "noreturn" attribute */
+#undef HAVE_ATTR_NORETURN
+
/* Whether the C compiler accepts the "unused" attribute */
#undef HAVE_ATTR_UNUSED
@@ -199,6 +208,9 @@
/* Define to 1 if you have the <expat.h> header file. */
#undef HAVE_EXPAT_H
+/* Define to 1 if you have the `explicit_bzero' function. */
+#undef HAVE_EXPLICIT_BZERO
+
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
@@ -1144,6 +1156,11 @@ char *strsep(char **stringp, const char *delim);
int isblank(int c);
#endif
+#ifndef HAVE_EXPLICIT_BZERO
+#define explicit_bzero unbound_explicit_bzero
+void explicit_bzero(void* buf, size_t len);
+#endif
+
#if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
@@ -1176,7 +1193,6 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size);
# endif
#endif /* HAVE_LIBRESSL */
#ifndef HAVE_ARC4RANDOM
-void explicit_bzero(void* buf, size_t len);
int getentropy(void* buf, size_t len);
uint32_t arc4random(void);
void arc4random_buf(void* buf, size_t n);
diff --git a/usr.sbin/unbound/configure b/usr.sbin/unbound/configure
index 92fe4dbf16c..91446151094 100644
--- a/usr.sbin/unbound/configure
+++ b/usr.sbin/unbound/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for unbound 1.8.0.
+# Generated by GNU Autoconf 2.69 for unbound 1.8.1.
#
# Report bugs to <unbound-bugs@nlnetlabs.nl>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='unbound'
PACKAGE_TARNAME='unbound'
-PACKAGE_VERSION='1.8.0'
-PACKAGE_STRING='unbound 1.8.0'
+PACKAGE_VERSION='1.8.1'
+PACKAGE_STRING='unbound 1.8.1'
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
PACKAGE_URL=''
@@ -1440,7 +1440,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures unbound 1.8.0 to adapt to many kinds of systems.
+\`configure' configures unbound 1.8.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1505,7 +1505,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of unbound 1.8.0:";;
+ short | recursive ) echo "Configuration of unbound 1.8.1:";;
esac
cat <<\_ACEOF
@@ -1722,7 +1722,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-unbound configure 1.8.0
+unbound configure 1.8.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2431,7 +2431,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by unbound $as_me 1.8.0, which was
+It was created by unbound $as_me 1.8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2783,11 +2783,11 @@ UNBOUND_VERSION_MAJOR=1
UNBOUND_VERSION_MINOR=8
-UNBOUND_VERSION_MICRO=0
+UNBOUND_VERSION_MICRO=1
LIBUNBOUND_CURRENT=8
-LIBUNBOUND_REVISION=0
+LIBUNBOUND_REVISION=1
LIBUNBOUND_AGE=0
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -2850,7 +2850,8 @@ LIBUNBOUND_AGE=0
# 1.7.1 had 7:9:5
# 1.7.2 had 7:10:5
# 1.7.3 had 7:11:5
-# 1.7.4 had 8:0:0 # changes the event callback function signature
+# 1.8.0 had 8:0:0 # changes the event callback function signature
+# 1.8.1 had 8:1:0
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -6265,6 +6266,54 @@ if test $ac_cv_c_weak_attribute = yes; then
$as_echo "#define HAVE_ATTR_WEAK 1" >>confdefs.h
+
+$as_echo "#define ATTR_WEAK __attribute__((weak))" >>confdefs.h
+
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"noreturn\" attribute" >&5
+$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"noreturn\" attribute... " >&6; }
+if ${ac_cv_c_noreturn_attribute+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_noreturn_attribute=no
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+ #include <stdio.h>
+__attribute__((noreturn)) void f(int x) { printf("%d", x); }
+
+int
+main ()
+{
+
+ f(1);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_noreturn_attribute="yes"
+else
+ ac_cv_c_noreturn_attribute="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_noreturn_attribute" >&5
+$as_echo "$ac_cv_c_noreturn_attribute" >&6; }
+if test $ac_cv_c_noreturn_attribute = yes; then
+
+$as_echo "#define HAVE_ATTR_NORETURN 1" >>confdefs.h
+
+
+$as_echo "#define ATTR_NORETURN __attribute__((__noreturn__))" >>confdefs.h
+
fi
@@ -20033,6 +20082,20 @@ esac
fi
+ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
+if test "x$ac_cv_func_explicit_bzero" = xyes; then :
+ $as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" explicit_bzero.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
+ ;;
+esac
+
+fi
+
+
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
@@ -20080,12 +20143,6 @@ fi
if test "$ac_cv_func_arc4random" = "no"; then
case " $LIBOBJS " in
- *" explicit_bzero.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
- ;;
-esac
-
- case " $LIBOBJS " in
*" arc4_lock.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS arc4_lock.$ac_objext"
;;
@@ -21077,7 +21134,7 @@ _ACEOF
-version=1.8.0
+version=1.8.1
date=`date +'%b %e, %Y'`
@@ -21596,7 +21653,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by unbound $as_me 1.8.0, which was
+This file was extended by unbound $as_me 1.8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21662,7 +21719,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-unbound config.status 1.8.0
+unbound config.status 1.8.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/usr.sbin/unbound/configure.ac b/usr.sbin/unbound/configure.ac
index b4b65728bda..32d5eaa42ed 100644
--- a/usr.sbin/unbound/configure.ac
+++ b/usr.sbin/unbound/configure.ac
@@ -11,14 +11,14 @@ sinclude(dnscrypt/dnscrypt.m4)
# must be numbers. ac_defun because of later processing
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[8])
-m4_define([VERSION_MICRO],[0])
+m4_define([VERSION_MICRO],[1])
AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
LIBUNBOUND_CURRENT=8
-LIBUNBOUND_REVISION=0
+LIBUNBOUND_REVISION=1
LIBUNBOUND_AGE=0
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -81,7 +81,8 @@ LIBUNBOUND_AGE=0
# 1.7.1 had 7:9:5
# 1.7.2 had 7:10:5
# 1.7.3 had 7:11:5
-# 1.7.4 had 8:0:0 # changes the event callback function signature
+# 1.8.0 had 8:0:0 # changes the event callback function signature
+# 1.8.1 had 8:1:0
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -310,11 +311,36 @@ __attribute__((weak)) void f(int x) { printf("%d", x); }
AC_MSG_RESULT($ac_cv_c_weak_attribute)
if test $ac_cv_c_weak_attribute = yes; then
AC_DEFINE(HAVE_ATTR_WEAK, 1, [Whether the C compiler accepts the "weak" attribute])
+ AC_DEFINE(ATTR_WEAK, [__attribute__((weak))], [apply the weak attribute to a symbol])
fi
])dnl End of CHECK_WEAK_ATTRIBUTE
CHECK_WEAK_ATTRIBUTE
+AC_DEFUN([CHECK_NORETURN_ATTRIBUTE],
+[AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "noreturn" attribute)
+AC_CACHE_VAL(ac_cv_c_noreturn_attribute,
+[ac_cv_c_noreturn_attribute=no
+AC_TRY_COMPILE(
+[ #include <stdio.h>
+__attribute__((noreturn)) void f(int x) { printf("%d", x); }
+], [
+ f(1);
+],
+[ac_cv_c_noreturn_attribute="yes"],
+[ac_cv_c_noreturn_attribute="no"])
+])
+
+AC_MSG_RESULT($ac_cv_c_noreturn_attribute)
+if test $ac_cv_c_noreturn_attribute = yes; then
+ AC_DEFINE(HAVE_ATTR_NORETURN, 1, [Whether the C compiler accepts the "noreturn" attribute])
+ AC_DEFINE(ATTR_NORETURN, [__attribute__((__noreturn__))], [apply the noreturn attribute to a function that exits the program])
+fi
+])dnl End of CHECK_NORETURN_ATTRIBUTE
+
+CHECK_NORETURN_ATTRIBUTE
+
if test "$srcdir" != "."; then
CPPFLAGS="$CPPFLAGS -I$srcdir"
fi
@@ -1396,6 +1422,7 @@ AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(gmtime_r)
AC_REPLACE_FUNCS(isblank)
+AC_REPLACE_FUNCS(explicit_bzero)
dnl without CTIME, ARC4-functions and without reallocarray.
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
@@ -1404,7 +1431,6 @@ if test "$USE_NSS" = "no"; then
AC_REPLACE_FUNCS(arc4random)
AC_REPLACE_FUNCS(arc4random_uniform)
if test "$ac_cv_func_arc4random" = "no"; then
- AC_LIBOBJ(explicit_bzero)
AC_LIBOBJ(arc4_lock)
AC_CHECK_FUNCS([getentropy],,[
if test "$USE_WINSOCK" = 1; then
@@ -1729,6 +1755,11 @@ char *strsep(char **stringp, const char *delim);
int isblank(int c);
#endif
+#ifndef HAVE_EXPLICIT_BZERO
+#define explicit_bzero unbound_explicit_bzero
+void explicit_bzero(void* buf, size_t len);
+#endif
+
#if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
@@ -1761,7 +1792,6 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size);
# endif
#endif /* HAVE_LIBRESSL */
#ifndef HAVE_ARC4RANDOM
-void explicit_bzero(void* buf, size_t len);
int getentropy(void* buf, size_t len);
uint32_t arc4random(void);
void arc4random_buf(void* buf, size_t n);
diff --git a/usr.sbin/unbound/daemon/daemon.c b/usr.sbin/unbound/daemon/daemon.c
index a6bfe390271..4c3d5f1c1a1 100644
--- a/usr.sbin/unbound/daemon/daemon.c
+++ b/usr.sbin/unbound/daemon/daemon.c
@@ -660,18 +660,15 @@ daemon_fork(struct daemon* daemon)
/* Start resolver service on main thread. */
#ifdef HAVE_SYSTEMD
- if(daemon->cfg->use_systemd)
- sd_notify(0, "READY=1");
+ sd_notify(0, "READY=1");
#endif
log_info("start of service (%s).", PACKAGE_STRING);
worker_work(daemon->workers[0]);
#ifdef HAVE_SYSTEMD
- if(daemon->cfg->use_systemd) {
- if (daemon->workers[0]->need_to_exit)
- sd_notify(0, "STOPPING=1");
- else
- sd_notify(0, "RELOADING=1");
- }
+ if (daemon->workers[0]->need_to_exit)
+ sd_notify(0, "STOPPING=1");
+ else
+ sd_notify(0, "RELOADING=1");
#endif
log_info("service stopped (%s).", PACKAGE_STRING);
diff --git a/usr.sbin/unbound/daemon/remote.c b/usr.sbin/unbound/daemon/remote.c
index 91e5609f50f..3971e454051 100644
--- a/usr.sbin/unbound/daemon/remote.c
+++ b/usr.sbin/unbound/daemon/remote.c
@@ -275,12 +275,13 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err,
struct addrinfo hints;
struct addrinfo* res;
struct listen_port* n;
- int noproto;
+ int noproto = 0;
int fd, r;
char port[15];
snprintf(port, sizeof(port), "%d", nr);
port[sizeof(port)-1]=0;
memset(&hints, 0, sizeof(hints));
+ log_assert(ip);
if(ip[0] == '/') {
/* This looks like a local socket */
@@ -1069,6 +1070,7 @@ do_stats(RES* ssl, struct daemon_remote* rc, int reset)
struct ub_stats_info total;
struct ub_stats_info s;
int i;
+ memset(&total, 0, sizeof(total));
log_assert(daemon->num > 0);
/* gather all thread statistics in one place */
for(i=0; i<daemon->num; i++) {
diff --git a/usr.sbin/unbound/daemon/unbound.c b/usr.sbin/unbound/daemon/unbound.c
index 3f0f75a560c..020e453034a 100644
--- a/usr.sbin/unbound/daemon/unbound.c
+++ b/usr.sbin/unbound/daemon/unbound.c
@@ -730,7 +730,7 @@ main(int argc, char* argv[])
}
}
argc -= optind;
- argv += optind;
+ /* argv += optind; not using further arguments */
if(winopt) {
#ifdef UB_ON_WINDOWS
diff --git a/usr.sbin/unbound/daemon/worker.c b/usr.sbin/unbound/daemon/worker.c
index 9551c60f4a6..2697ea6534f 100644
--- a/usr.sbin/unbound/daemon/worker.c
+++ b/usr.sbin/unbound/daemon/worker.c
@@ -1180,7 +1180,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
char addrbuf[128];
addr_to_str(&repinfo->addr, repinfo->addrlen,
addrbuf, sizeof(addrbuf));
- verbose(VERB_OPS, "ip_ratelimit allowed through for ip address %s ",
+ verbose(VERB_QUERY, "ip_ratelimit allowed through for ip address %s because of slip in ip_ratelimit_factor",
addrbuf);
} else {
worker->stats.num_queries_ip_ratelimited++;
@@ -1671,14 +1671,14 @@ worker_create(struct daemon* daemon, int id, int* ports, int n)
(((unsigned int)worker->thread_num)<<17);
/* shift thread_num so it does not match out pid bits */
if(!(worker->rndstate = ub_initstate(seed, daemon->rand))) {
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
log_err("could not init random numbers.");
tube_delete(worker->cmd);
free(worker->ports);
free(worker);
return NULL;
}
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
#ifdef USE_DNSTAP
if(daemon->cfg->dnstap) {
log_assert(daemon->dtenv != NULL);
diff --git a/usr.sbin/unbound/doc/Changelog b/usr.sbin/unbound/doc/Changelog
index 7e81304f930..69bab6f640a 100644
--- a/usr.sbin/unbound/doc/Changelog
+++ b/usr.sbin/unbound/doc/Changelog
@@ -1,5 +1,80 @@
+8 October 2018: Wouter
+ - fastrpz.patch fix included.
+
+1 October 2018: Wouter
+ - tag for release 1.8.1rc1.
+
+27 September 2018: Wouter
+ - Fix #4188: IPv6 forwarders without ipv6 result in SERVFAIL, fixes
+ qname minimisation with a forwarder when connectivity has issues
+ from rejecting responses.
+
+25 September 2018: Wouter
+ - Perform TLS SNI indication of the host that is being contacted
+ for DNS over TLS service. It sets the configured tls auth name.
+ This is useful for hosts that apart from the DNS over TLS services
+ also provide other (web) services.
+ - Fix #4149: Add SSL cleanup for tcp timeout.
+
+17 September 2018: Wouter
+ - Fix compile on Mac for unbound, provide explicit_bzero when libc
+ does not have it.
+ - Fix unbound for openssl in FIPS mode, it uses the digests with
+ the EVP call contexts.
+ - Fix that with harden-below-nxdomain and qname minisation enabled
+ some iterator states for nonresponsive domains can get into a
+ state where they waited for an empty list.
+ - Stop UDP to TCP failover after timeouts that causes the ping count
+ to be reset by the TCP time measurement (that exists for TLS),
+ because that causes the UDP part to not be measured as timeout.
+ - Fix #4156: Fix systemd service manager state change notification.
+
+13 September 2018: Wouter
+ - Fix seed for random backup code to use explicit zero when wiped.
+ - exit log routine is annotated as noreturn function.
+ - free memory leaks in config strlist and str2list insert functions.
+ - do not move unused argv variable after getopt.
+ - Remove unused if clause in testcode.
+ - in testcode, free async ids, initialise array, and check for null
+ pointer during test of the test. And use exit for return to note
+ irregular program stop.
+ - Free memory leak in config strlist append.
+ - make sure nsec3 comparison salt is initialized.
+ - unit test has clang analysis.
+ - remove unused variable assignment from iterator scrub routine.
+ - check for null in delegation point during iterator refetch
+ in forward zone.
+ - neater pointer cast in libunbound context quit routine.
+ - initialize statistics totals for printout.
+ - in authzone check that node exists before adding rrset.
+ - in unbound-anchor, use readwrite memory BIO.
+ - assertion in autotrust that packed rrset is formed correctly.
+ - Fix memory leak when message parse fails partway through copy.
+ - remove unused udpsize assignment in message encode.
+ - nicer bio free code in unbound-anchor.
+ - annotate exit functions with noreturn in unbound-control.
+
+11 September 2018: Wouter
+ - Fixed unused return value warnings in contrib/fastrpz.patch for
+ asprintf.
+ - Fix to squelch respip warning in unit test, it is printed at
+ higher verbosity settings.
+ - Fix spelling errors.
+ - Fix initialisation in remote.c
+
+10 September 2018: Wouter
+ - 1.8.1 in svn trunk. (changes from 4,5,.. sep apply).
+ - iana port update.
+
+5 September 2018: Wouter
+ - Fix spelling error in header, from getdns commit by Andreas Gelmini.
+
+4 September 2018: Ralph
+ - More explicitly mention the type of ratelimit when applying
+ ip-ratelimit.
+
4 September 2018: Wouter
- - Tag for 1.8.0rc1 release.
+ - Tag for 1.8.0rc1 release, became 1.8.0 release on 10 Sep 2018.
31 August 2018: Wouter
- Disable minimal-responses in subnet unit tests.
@@ -1856,7 +1931,7 @@
compatibility with cisco dns guard. This lowers false positives.
18 April 2016: Wouter
- - Fix some malformed reponses to edns queries get fallback to nonedns.
+ - Fix some malformed responses to edns queries get fallback to nonedns.
15 April 2016: Wouter
- cachedb module event handling design.
diff --git a/usr.sbin/unbound/doc/README b/usr.sbin/unbound/doc/README
index ae90773412f..c817e34be24 100644
--- a/usr.sbin/unbound/doc/README
+++ b/usr.sbin/unbound/doc/README
@@ -1,4 +1,4 @@
-README for Unbound 1.8.0
+README for Unbound 1.8.1
Copyright 2007 NLnet Labs
http://unbound.net
diff --git a/usr.sbin/unbound/doc/example.conf.in b/usr.sbin/unbound/doc/example.conf.in
index 993a08d620d..d6f577b1419 100644
--- a/usr.sbin/unbound/doc/example.conf.in
+++ b/usr.sbin/unbound/doc/example.conf.in
@@ -1,7 +1,7 @@
#
# Example configuration file.
#
-# See unbound.conf(5) man page, version 1.8.0.
+# See unbound.conf(5) man page, version 1.8.1.
#
# this is a comment.
diff --git a/usr.sbin/unbound/doc/libunbound.3.in b/usr.sbin/unbound/doc/libunbound.3.in
index 9a2fff83560..003c867b1a7 100644
--- a/usr.sbin/unbound/doc/libunbound.3.in
+++ b/usr.sbin/unbound/doc/libunbound.3.in
@@ -1,4 +1,4 @@
-.TH "libunbound" "3" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "libunbound" "3" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" libunbound.3 -- unbound library functions manual
.\"
@@ -43,7 +43,7 @@
.B ub_ctx_zone_remove,
.B ub_ctx_data_add,
.B ub_ctx_data_remove
-\- Unbound DNS validating resolver 1.8.0 functions.
+\- Unbound DNS validating resolver 1.8.1 functions.
.SH "SYNOPSIS"
.B #include <unbound.h>
.LP
diff --git a/usr.sbin/unbound/doc/unbound-anchor.8.in b/usr.sbin/unbound/doc/unbound-anchor.8.in
index ece844deff3..089aa47dfac 100644
--- a/usr.sbin/unbound/doc/unbound-anchor.8.in
+++ b/usr.sbin/unbound/doc/unbound-anchor.8.in
@@ -1,4 +1,4 @@
-.TH "unbound-anchor" "8" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound-anchor" "8" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
.\"
diff --git a/usr.sbin/unbound/doc/unbound-checkconf.8.in b/usr.sbin/unbound/doc/unbound-checkconf.8.in
index 1fa91d35d3c..60f56267ff1 100644
--- a/usr.sbin/unbound/doc/unbound-checkconf.8.in
+++ b/usr.sbin/unbound/doc/unbound-checkconf.8.in
@@ -1,4 +1,4 @@
-.TH "unbound-checkconf" "8" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound-checkconf" "8" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound-checkconf.8 -- unbound configuration checker manual
.\"
diff --git a/usr.sbin/unbound/doc/unbound-control.8.in b/usr.sbin/unbound/doc/unbound-control.8.in
index 596138470e5..d176394cf2d 100644
--- a/usr.sbin/unbound/doc/unbound-control.8.in
+++ b/usr.sbin/unbound/doc/unbound-control.8.in
@@ -1,4 +1,4 @@
-.TH "unbound-control" "8" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound-control" "8" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound-control.8 -- unbound remote control manual
.\"
@@ -301,7 +301,7 @@ you set unbound to validate with for-upstream yes and that can be cleared
with \fBflush_zone\fR \fIzone\fR.
.TP
.B auth_zone_transfer \fIzone\fR
-Tranfer the auth zone from master. The auth zone probe sequence is started,
+Transfer the auth zone from master. The auth zone probe sequence is started,
where the masters are probed to see if they have an updated zone (with the SOA
serial check). And then the zone is transferred for a newer zone version.
.TP
diff --git a/usr.sbin/unbound/doc/unbound-host.1.in b/usr.sbin/unbound/doc/unbound-host.1.in
index dacee3d1342..d3a0b42bf5e 100644
--- a/usr.sbin/unbound/doc/unbound-host.1.in
+++ b/usr.sbin/unbound/doc/unbound-host.1.in
@@ -1,4 +1,4 @@
-.TH "unbound\-host" "1" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound\-host" "1" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound-host.1 -- unbound DNS lookup utility
.\"
diff --git a/usr.sbin/unbound/doc/unbound.8.in b/usr.sbin/unbound/doc/unbound.8.in
index 7062fb07eac..65aa4b11d76 100644
--- a/usr.sbin/unbound/doc/unbound.8.in
+++ b/usr.sbin/unbound/doc/unbound.8.in
@@ -1,4 +1,4 @@
-.TH "unbound" "8" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound" "8" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound.8 -- unbound manual
.\"
@@ -9,7 +9,7 @@
.\"
.SH "NAME"
.B unbound
-\- Unbound DNS validating resolver 1.8.0.
+\- Unbound DNS validating resolver 1.8.1.
.SH "SYNOPSIS"
.B unbound
.RB [ \-h ]
diff --git a/usr.sbin/unbound/doc/unbound.conf.5.in b/usr.sbin/unbound/doc/unbound.conf.5.in
index 3fc16dc2b53..db0d30dfd16 100644
--- a/usr.sbin/unbound/doc/unbound.conf.5.in
+++ b/usr.sbin/unbound/doc/unbound.conf.5.in
@@ -1,4 +1,4 @@
-.TH "unbound.conf" "5" "Sep 10, 2018" "NLnet Labs" "unbound 1.8.0"
+.TH "unbound.conf" "5" "Oct 8, 2018" "NLnet Labs" "unbound 1.8.1"
.\"
.\" unbound.conf.5 -- unbound.conf manual
.\"
@@ -462,7 +462,7 @@ a daemon. Set the value to \fIno\fR when unbound runs as systemd service.
Default is yes.
.TP
.B tcp\-connection\-limit: \fI<IP netblock> <limit>
-Allow up to \fIlimit\R simultaneous TCP connections from the given netblock.
+Allow up to \fIlimit\fR simultaneous TCP connections from the given netblock.
When at the limit, further connections are accepted but closed immediately.
This option is experimental at this time.
.TP
diff --git a/usr.sbin/unbound/iterator/iter_scrub.c b/usr.sbin/unbound/iterator/iter_scrub.c
index 12580dcdb53..b354eaa285b 100644
--- a/usr.sbin/unbound/iterator/iter_scrub.c
+++ b/usr.sbin/unbound/iterator/iter_scrub.c
@@ -437,7 +437,9 @@ scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
rrset->rrset_all_next =
nx->rrset_all_next;
nx->rrset_all_next = rrset;
- prev = nx;
+ /* prev = nx; unused, enable if there
+ * is other rrset removal code after
+ * this */
}
}
diff --git a/usr.sbin/unbound/iterator/iterator.c b/usr.sbin/unbound/iterator/iterator.c
index e99a559fae4..2f26bd3349d 100644
--- a/usr.sbin/unbound/iterator/iterator.c
+++ b/usr.sbin/unbound/iterator/iterator.c
@@ -1125,7 +1125,7 @@ forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
struct delegpt* dp;
uint8_t* delname = iq->qchase.qname;
size_t delnamelen = iq->qchase.qname_len;
- if(iq->refetch_glue) {
+ if(iq->refetch_glue && iq->dp) {
delname = iq->dp->name;
delnamelen = iq->dp->namelen;
}
@@ -2174,7 +2174,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
return 0;
}
- if(iq->minimisation_state == INIT_MINIMISE_STATE) {
+ if(iq->minimisation_state == INIT_MINIMISE_STATE
+ && !(iq->chase_flags & BIT_RD)) {
/* (Re)set qinfo_out to (new) delegation point, except when
* qinfo_out is already a subdomain of dp. This happens when
* increasing by more than one label at once (QNAMEs with more
@@ -2715,7 +2716,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
sock_list_insert(&qstate->reply_origin,
&qstate->reply->addr, qstate->reply->addrlen,
qstate->region);
- if(iq->minimisation_state != DONOT_MINIMISE_STATE) {
+ if(iq->minimisation_state != DONOT_MINIMISE_STATE
+ && !(iq->chase_flags & BIT_RD)) {
if(FLAGS_GET_RCODE(iq->response->rep->flags) !=
LDNS_RCODE_NOERROR) {
if(qstate->env->cfg->qname_minimisation_strict)
@@ -2752,6 +2754,12 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
verbose(VERB_ALGO,
"could not validate NXDOMAIN "
"response");
+ outbound_list_clear(&iq->outlist);
+ iq->num_current_queries = 0;
+ fptr_ok(fptr_whitelist_modenv_detach_subs(
+ qstate->env->detach_subs));
+ (*qstate->env->detach_subs)(qstate);
+ iq->num_target_queries = 0;
}
}
return next_state(iq, QUERYTARGETS_STATE);
@@ -2993,7 +3001,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
iq->dp->name, iq->dp->namelen, qstate->qinfo.qclass)) {
verbose(VERB_ALGO, "auth zone response bad, and no"
" fallback possible, servfail");
- errinf_dname(qstate, "reponse is bad, no fallback, "
+ errinf_dname(qstate, "response is bad, no fallback, "
"for auth zone", iq->dp->name);
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
diff --git a/usr.sbin/unbound/libunbound/context.c b/usr.sbin/unbound/libunbound/context.c
index 9a35ce56f30..20e3680ec3b 100644
--- a/usr.sbin/unbound/libunbound/context.c
+++ b/usr.sbin/unbound/libunbound/context.c
@@ -392,12 +392,12 @@ struct ctx_query* context_deserialize_cancel(struct ub_ctx* ctx,
uint8_t*
context_serialize_quit(uint32_t* len)
{
- uint8_t* p = (uint8_t*)malloc(sizeof(uint32_t));
+ uint32_t* p = (uint32_t*)malloc(sizeof(uint32_t));
if(!p)
return NULL;
*len = sizeof(uint32_t);
sldns_write_uint32(p, UB_LIBCMD_QUIT);
- return p;
+ return (uint8_t*)p;
}
enum ub_ctx_cmd context_serial_getcmd(uint8_t* p, uint32_t len)
diff --git a/usr.sbin/unbound/libunbound/libunbound.c b/usr.sbin/unbound/libunbound/libunbound.c
index 275e8d25a16..31adbd54dcd 100644
--- a/usr.sbin/unbound/libunbound/libunbound.c
+++ b/usr.sbin/unbound/libunbound/libunbound.c
@@ -109,13 +109,13 @@ static struct ub_ctx* ub_ctx_create_nopipe(void)
alloc_init(&ctx->superalloc, NULL, 0);
seed = (unsigned int)time(NULL) ^ (unsigned int)getpid();
if(!(ctx->seed_rnd = ub_initstate(seed, NULL))) {
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
ub_randfree(ctx->seed_rnd);
free(ctx);
errno = ENOMEM;
return NULL;
}
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
lock_basic_init(&ctx->qqpipe_lock);
lock_basic_init(&ctx->rrpipe_lock);
lock_basic_init(&ctx->cfglock);
@@ -392,7 +392,6 @@ ub_ctx_add_ta(struct ub_ctx* ctx, const char* ta)
}
if(!cfg_strlist_insert(&ctx->env->cfg->trust_anchor_list, dup)) {
lock_basic_unlock(&ctx->cfglock);
- free(dup);
return UB_NOMEM;
}
lock_basic_unlock(&ctx->cfglock);
@@ -412,7 +411,6 @@ ub_ctx_add_ta_file(struct ub_ctx* ctx, const char* fname)
}
if(!cfg_strlist_insert(&ctx->env->cfg->trust_anchor_file_list, dup)) {
lock_basic_unlock(&ctx->cfglock);
- free(dup);
return UB_NOMEM;
}
lock_basic_unlock(&ctx->cfglock);
@@ -432,7 +430,6 @@ int ub_ctx_add_ta_autr(struct ub_ctx* ctx, const char* fname)
if(!cfg_strlist_insert(&ctx->env->cfg->auto_trust_anchor_file_list,
dup)) {
lock_basic_unlock(&ctx->cfglock);
- free(dup);
return UB_NOMEM;
}
lock_basic_unlock(&ctx->cfglock);
@@ -452,7 +449,6 @@ ub_ctx_trustedkeys(struct ub_ctx* ctx, const char* fname)
}
if(!cfg_strlist_insert(&ctx->env->cfg->trusted_keys_file_list, dup)) {
lock_basic_unlock(&ctx->cfglock);
- free(dup);
return UB_NOMEM;
}
lock_basic_unlock(&ctx->cfglock);
@@ -962,7 +958,6 @@ ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr)
return UB_NOMEM;
}
if(!cfg_strlist_insert(&s->addrs, dupl)) {
- free(dupl);
lock_basic_unlock(&ctx->cfglock);
errno=ENOMEM;
return UB_NOMEM;
@@ -1045,7 +1040,6 @@ int ub_ctx_set_stub(struct ub_ctx* ctx, const char* zone, const char* addr,
}
if(!cfg_strlist_insert(&elem->addrs, a)) {
lock_basic_unlock(&ctx->cfglock);
- free(a);
errno = ENOMEM;
return UB_NOMEM;
}
@@ -1233,7 +1227,6 @@ ub_ctx_hosts(struct ub_ctx* ctx, const char* fname)
ins)) {
lock_basic_unlock(&ctx->cfglock);
fclose(in);
- free(ins);
errno=ENOMEM;
return UB_NOMEM;
}
diff --git a/usr.sbin/unbound/libunbound/libworker.c b/usr.sbin/unbound/libunbound/libworker.c
index 05006a0ec44..065f0a7b141 100644
--- a/usr.sbin/unbound/libunbound/libworker.c
+++ b/usr.sbin/unbound/libunbound/libworker.c
@@ -187,7 +187,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg, struct ub_event_base* eb)
if(!w->is_bg || w->is_bg_thread) {
lock_basic_unlock(&ctx->cfglock);
}
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
libworker_delete(w);
return NULL;
}
@@ -207,7 +207,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg, struct ub_event_base* eb)
hash_set_raninit((uint32_t)ub_random(w->env->rnd));
}
}
- seed = 0;
+ explicit_bzero(&seed, sizeof(seed));
if(eb)
w->base = comm_base_create_event(eb);
diff --git a/usr.sbin/unbound/respip/respip.c b/usr.sbin/unbound/respip/respip.c
index 135c45fe53c..aea528f1516 100644
--- a/usr.sbin/unbound/respip/respip.c
+++ b/usr.sbin/unbound/respip/respip.c
@@ -172,7 +172,7 @@ respip_action_cfg(struct respip_set* set, const char* ipstr,
if(!(node=respip_find_or_create(set, ipstr, 1)))
return 0;
if(node->action != respip_none) {
- log_warn("duplicate response-ip action for '%s', overridden.",
+ verbose(VERB_QUERY, "duplicate response-ip action for '%s', overridden.",
ipstr);
}
if(strcmp(actnstr, "deny") == 0)
diff --git a/usr.sbin/unbound/services/authzone.c b/usr.sbin/unbound/services/authzone.c
index fe56c9f81b6..4d0dd1b5ae9 100644
--- a/usr.sbin/unbound/services/authzone.c
+++ b/usr.sbin/unbound/services/authzone.c
@@ -218,7 +218,7 @@ msg_add_rrset_an(struct auth_zone* z, struct regional* region,
{
log_assert(msg->rep->ns_numrrsets == 0);
log_assert(msg->rep->ar_numrrsets == 0);
- if(!rrset)
+ if(!rrset || !node)
return 1;
if(msg_rrset_duplicate(msg, node->name, node->namelen, rrset->type,
z->dclass))
@@ -242,7 +242,7 @@ msg_add_rrset_ns(struct auth_zone* z, struct regional* region,
struct dns_msg* msg, struct auth_data* node, struct auth_rrset* rrset)
{
log_assert(msg->rep->ar_numrrsets == 0);
- if(!rrset)
+ if(!rrset || !node)
return 1;
if(msg_rrset_duplicate(msg, node->name, node->namelen, rrset->type,
z->dclass))
@@ -265,7 +265,7 @@ static int
msg_add_rrset_ar(struct auth_zone* z, struct regional* region,
struct dns_msg* msg, struct auth_data* node, struct auth_rrset* rrset)
{
- if(!rrset)
+ if(!rrset || !node)
return 1;
if(msg_rrset_duplicate(msg, node->name, node->namelen, rrset->type,
z->dclass))
diff --git a/usr.sbin/unbound/services/cache/infra.c b/usr.sbin/unbound/services/cache/infra.c
index 6f8fea6ad82..489f939491d 100644
--- a/usr.sbin/unbound/services/cache/infra.c
+++ b/usr.sbin/unbound/services/cache/infra.c
@@ -1013,8 +1013,8 @@ int infra_ip_ratelimit_inc(struct infra_cache* infra,
char client_ip[128];
addr_to_str((struct sockaddr_storage *)&repinfo->addr,
repinfo->addrlen, client_ip, sizeof(client_ip));
- verbose(VERB_OPS, "ratelimit exceeded %s %d", client_ip,
- infra_ip_ratelimit);
+ verbose(VERB_OPS, "ip_ratelimit exceeded %s %d",
+ client_ip, infra_ip_ratelimit);
}
return (max <= infra_ip_ratelimit);
}
diff --git a/usr.sbin/unbound/services/outside_network.c b/usr.sbin/unbound/services/outside_network.c
index 87c88349b3f..e2c59c4616d 100644
--- a/usr.sbin/unbound/services/outside_network.c
+++ b/usr.sbin/unbound/services/outside_network.c
@@ -365,6 +365,11 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
comm_point_tcp_win_bio_cb(pend->c, pend->c->ssl);
#endif
pend->c->ssl_shake_state = comm_ssl_shake_write;
+ if(w->tls_auth_name) {
+#ifdef HAVE_SSL
+ (void)SSL_set_tlsext_host_name(pend->c->ssl, w->tls_auth_name);
+#endif
+ }
#ifdef HAVE_SSL_SET1_HOST
if(w->tls_auth_name) {
SSL_set_verify(pend->c->ssl, SSL_VERIFY_PEER, NULL);
@@ -374,6 +379,8 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
if(!SSL_set1_host(pend->c->ssl, w->tls_auth_name)) {
log_err("SSL_set1_host failed");
pend->c->fd = s;
+ SSL_free(pend->c->ssl);
+ pend->c->ssl = NULL;
comm_point_close(pend->c);
return 0;
}
@@ -1261,6 +1268,13 @@ outnet_tcptimer(void* arg)
} else {
/* it was in use */
struct pending_tcp* pend=(struct pending_tcp*)w->next_waiting;
+ if(pend->c->ssl) {
+#ifdef HAVE_SSL
+ SSL_shutdown(pend->c->ssl);
+ SSL_free(pend->c->ssl);
+ pend->c->ssl = NULL;
+#endif
+ }
comm_point_close(pend->c);
pend->query = NULL;
pend->next_free = outnet->tcp_free;
@@ -1979,7 +1993,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
return 0;
}
if(rto >= RTT_MAX_TIMEOUT) {
- fallback_tcp = 1;
+ /* fallback_tcp = 1; */
/* UDP does not work, fallback to TCP below */
} else {
serviced_callbacks(sq, NETEVENT_TIMEOUT, c, rep);
diff --git a/usr.sbin/unbound/sldns/sbuffer.h b/usr.sbin/unbound/sldns/sbuffer.h
index 2c30b373670..2241640ddb1 100644
--- a/usr.sbin/unbound/sldns/sbuffer.h
+++ b/usr.sbin/unbound/sldns/sbuffer.h
@@ -130,7 +130,7 @@ struct sldns_buffer
/** If the buffer is fixed it cannot be resized */
unsigned _fixed : 1;
- /** If the buffer is vfixed, no more than capacity bytes willl be
+ /** If the buffer is vfixed, no more than capacity bytes will be
* written to _data, however the _position counter will be updated
* with the amount that would have been written in consecutive
* writes. This allows for a modus operandi in which a sequence is
@@ -160,7 +160,7 @@ sldns_buffer_invariant(sldns_buffer *buffer)
assert(buffer != NULL);
assert(buffer->_position <= buffer->_limit || buffer->_vfixed);
assert(buffer->_limit <= buffer->_capacity);
- assert(buffer->_data != NULL || (buffer->_vfixed && buffer->_capacity == 0));
+ assert(buffer->_data != NULL || (buffer->_vfixed && buffer->_capacity == 0 && buffer->_limit == 0));
}
#endif
diff --git a/usr.sbin/unbound/smallapp/unbound-anchor.c b/usr.sbin/unbound/smallapp/unbound-anchor.c
index f398509018d..fbd8f130f55 100644
--- a/usr.sbin/unbound/smallapp/unbound-anchor.c
+++ b/usr.sbin/unbound/smallapp/unbound-anchor.c
@@ -1097,11 +1097,14 @@ read_http_result(SSL* ssl)
}
if(!data) return NULL;
if(verb >= 4) print_data("read data", data, (int)len);
- m = BIO_new_mem_buf(data, (int)len);
+ m = BIO_new(BIO_s_mem());
if(!m) {
if(verb) printf("out of memory\n");
+ free(data);
exit(0);
}
+ BIO_write(m, data, (int)len);
+ free(data);
return m;
}
@@ -1168,17 +1171,6 @@ https(struct ip_list* ip_list, const char* pathname, const char* urlname)
return bio;
}
-/** free up a downloaded file BIO */
-static void
-free_file_bio(BIO* bio)
-{
- char* pp = NULL;
- (void)BIO_reset(bio);
- (void)BIO_get_mem_data(bio, &pp);
- free(pp);
- BIO_free(bio);
-}
-
/** XML parse private data during the parse */
struct xml_data {
/** the parser, reference */
@@ -1603,7 +1595,7 @@ xml_parse(BIO* xml, time_t now)
xml_parse_setup(parser, &data, now);
/* parse it */
- (void)BIO_reset(xml);
+ (void)BIO_seek(xml, 0);
len = (int)BIO_get_mem_data(xml, &pp);
if(!len || !pp) {
if(verb) printf("out of memory\n");
@@ -1777,8 +1769,8 @@ verify_p7sig(BIO* data, BIO* p7s, STACK_OF(X509)* trust, const char* p7signer)
X509_VERIFY_PARAM_free(param);
#endif
- (void)BIO_reset(p7s);
- (void)BIO_reset(data);
+ (void)BIO_seek(p7s, 0);
+ (void)BIO_seek(data, 0);
/* convert p7s to p7 (the signature) */
p7 = d2i_PKCS7_bio(p7s, NULL);
@@ -1956,8 +1948,8 @@ do_certupdate(const char* root_anchor_file, const char* root_cert_file,
if(verb) printf("success: the anchor has been updated "
"using the cert\n");
- free_file_bio(xml);
- free_file_bio(p7s);
+ BIO_free(xml);
+ BIO_free(p7s);
#ifndef S_SPLINT_S
sk_X509_pop_free(cert, X509_free);
#endif
@@ -2349,7 +2341,7 @@ int main(int argc, char* argv[])
}
}
argc -= optind;
- argv += optind;
+ /* argv += optind; not using further arguments */
if(argc != 0)
usage();
diff --git a/usr.sbin/unbound/smallapp/unbound-control.c b/usr.sbin/unbound/smallapp/unbound-control.c
index 9e4c006f3b5..54be62e65dc 100644
--- a/usr.sbin/unbound/smallapp/unbound-control.c
+++ b/usr.sbin/unbound/smallapp/unbound-control.c
@@ -73,6 +73,10 @@
#include <sys/un.h>
#endif
+static void usage(void) ATTR_NORETURN;
+static void ssl_err(const char* s) ATTR_NORETURN;
+static void ssl_path_err(const char* s, const char *path) ATTR_NORETURN;
+
/** Give unbound-control usage, and exit (1). */
static void
usage(void)
diff --git a/usr.sbin/unbound/util/config_file.c b/usr.sbin/unbound/util/config_file.c
index 55ac97af4f3..a570f44899b 100644
--- a/usr.sbin/unbound/util/config_file.c
+++ b/usr.sbin/unbound/util/config_file.c
@@ -841,6 +841,7 @@ config_get_option(struct config_file* cfg, const char* opt,
{
char buf[1024], nopt[64];
size_t len = sizeof(buf);
+ if(!opt) return 0;
if(opt && opt[strlen(opt)-1] == ':' && strlen(opt)<sizeof(nopt)) {
memmove(nopt, opt, strlen(opt));
nopt[strlen(opt)-1] = 0;
@@ -1526,11 +1527,15 @@ int ub_c_wrap(void)
int cfg_strlist_append(struct config_strlist_head* list, char* item)
{
struct config_strlist *s;
- if(!item || !list)
+ if(!item || !list) {
+ free(item);
return 0;
+ }
s = (struct config_strlist*)calloc(1, sizeof(struct config_strlist));
- if(!s)
+ if(!s) {
+ free(item);
return 0;
+ }
s->str = item;
s->next = NULL;
if(list->last)
@@ -1578,11 +1583,15 @@ int
cfg_strlist_insert(struct config_strlist** head, char* item)
{
struct config_strlist *s;
- if(!item || !head)
+ if(!item || !head) {
+ free(item);
return 0;
+ }
s = (struct config_strlist*)calloc(1, sizeof(struct config_strlist));
- if(!s)
+ if(!s) {
+ free(item);
return 0;
+ }
s->str = item;
s->next = *head;
*head = s;
@@ -1593,11 +1602,17 @@ int
cfg_str2list_insert(struct config_str2list** head, char* item, char* i2)
{
struct config_str2list *s;
- if(!item || !i2 || !head)
+ if(!item || !i2 || !head) {
+ free(item);
+ free(i2);
return 0;
+ }
s = (struct config_str2list*)calloc(1, sizeof(struct config_str2list));
- if(!s)
+ if(!s) {
+ free(item);
+ free(i2);
return 0;
+ }
s->str = item;
s->str2 = i2;
s->next = *head;
diff --git a/usr.sbin/unbound/util/config_file.h b/usr.sbin/unbound/util/config_file.h
index d1bce1b69be..8c630b8a109 100644
--- a/usr.sbin/unbound/util/config_file.h
+++ b/usr.sbin/unbound/util/config_file.h
@@ -792,6 +792,7 @@ char* config_collate_cat(struct config_strlist* list);
* @param list: list head. zeroed at start.
* @param item: new item. malloced by caller. if NULL the insertion fails.
* @return true on success.
+ * on fail the item is free()ed.
*/
int cfg_strlist_append(struct config_strlist_head* list, char* item);
@@ -809,6 +810,7 @@ struct config_strlist* cfg_strlist_find(struct config_strlist* head,
* @param head: pointer to strlist head variable.
* @param item: new item. malloced by caller. If NULL the insertion fails.
* @return: true on success.
+ * on fail, the item is free()d.
*/
int cfg_strlist_insert(struct config_strlist** head, char* item);
@@ -822,6 +824,7 @@ int cfg_region_strlist_insert(struct regional* region,
* @param item: new item. malloced by caller. If NULL the insertion fails.
* @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
* @return: true on success.
+ * on fail, the item and i2 are free()d.
*/
int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);
diff --git a/usr.sbin/unbound/util/data/msgencode.c b/usr.sbin/unbound/util/data/msgencode.c
index aab7f5dfecb..6bc3216ff9e 100644
--- a/usr.sbin/unbound/util/data/msgencode.c
+++ b/usr.sbin/unbound/util/data/msgencode.c
@@ -647,8 +647,6 @@ reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
sldns_buffer_clear(buffer);
if(udpsize < sldns_buffer_limit(buffer))
sldns_buffer_set_limit(buffer, udpsize);
- else if(sldns_buffer_limit(buffer) < udpsize)
- udpsize = sldns_buffer_limit(buffer);
if(sldns_buffer_remaining(buffer) < LDNS_HEADER_SIZE)
return 0;
diff --git a/usr.sbin/unbound/util/data/msgreply.c b/usr.sbin/unbound/util/data/msgreply.c
index 540d7d4b3de..45d42a87f45 100644
--- a/usr.sbin/unbound/util/data/msgreply.c
+++ b/usr.sbin/unbound/util/data/msgreply.c
@@ -441,10 +441,14 @@ parse_create_msg(sldns_buffer* pkt, struct msg_parse* msg,
return 0;
if(!parse_create_repinfo(msg, rep, region))
return 0;
- if(!reply_info_alloc_rrset_keys(*rep, alloc, region))
+ if(!reply_info_alloc_rrset_keys(*rep, alloc, region)) {
+ if(!region) reply_info_parsedelete(*rep, alloc);
return 0;
- if(!parse_copy_decompress(pkt, msg, *rep, region))
+ }
+ if(!parse_copy_decompress(pkt, msg, *rep, region)) {
+ if(!region) reply_info_parsedelete(*rep, alloc);
return 0;
+ }
return 1;
}
diff --git a/usr.sbin/unbound/util/iana_ports.inc b/usr.sbin/unbound/util/iana_ports.inc
index 55d041e4084..e2432293132 100644
--- a/usr.sbin/unbound/util/iana_ports.inc
+++ b/usr.sbin/unbound/util/iana_ports.inc
@@ -4860,6 +4860,7 @@
8800,
8804,
8805,
+8807,
8808,
8873,
8880,
diff --git a/usr.sbin/unbound/util/log.h b/usr.sbin/unbound/util/log.h
index 7bc3d9e7615..f73c0754d65 100644
--- a/usr.sbin/unbound/util/log.h
+++ b/usr.sbin/unbound/util/log.h
@@ -174,7 +174,7 @@ void log_buf(enum verbosity_value level, const char* msg, struct sldns_buffer* b
* Pass printf formatted arguments. No trailing newline is needed.
* @param format: printf-style format string. Arguments follow.
*/
-void fatal_exit(const char* format, ...) ATTR_FORMAT(printf, 1, 2);
+void fatal_exit(const char* format, ...) ATTR_FORMAT(printf, 1, 2) ATTR_NORETURN;
/**
* va_list argument version of log_info.
diff --git a/usr.sbin/unbound/validator/autotrust.c b/usr.sbin/unbound/validator/autotrust.c
index a34a7c96c81..a72967302df 100644
--- a/usr.sbin/unbound/validator/autotrust.c
+++ b/usr.sbin/unbound/validator/autotrust.c
@@ -718,6 +718,7 @@ packed_rrset_heap_data(int iter(struct autr_ta**, uint8_t**, size_t*,
list_i = list;
i = 0;
while(iter(&list_i, &rr, &rr_len, &dname_len)) {
+ log_assert(data->rr_data[i]);
memmove(data->rr_data[i],
sldns_wirerr_get_rdatawl(rr, rr_len, dname_len),
data->rr_len[i]);
diff --git a/usr.sbin/unbound/validator/val_nsec3.c b/usr.sbin/unbound/validator/val_nsec3.c
index 773ed30cde5..763b5ab7c76 100644
--- a/usr.sbin/unbound/validator/val_nsec3.c
+++ b/usr.sbin/unbound/validator/val_nsec3.c
@@ -520,6 +520,10 @@ nsec3_hash_cmp(const void* c1, const void* c2)
}
(void)nsec3_get_salt(h1->nsec3, h1->rr, &s1, &s1len);
(void)nsec3_get_salt(h2->nsec3, h2->rr, &s2, &s2len);
+ if(s1len == 0 && s2len == 0)
+ return 0;
+ if(!s1) return -1;
+ if(!s2) return 1;
if(s1len != s2len) {
if(s1len < s2len)
return -1;
@@ -736,7 +740,7 @@ find_matching_nsec3(struct module_env* env, struct nsec3_filter* flt,
size_t i_rs;
int i_rr;
struct ub_packed_rrset_key* s;
- struct nsec3_cached_hash* hash;
+ struct nsec3_cached_hash* hash = NULL;
int r;
/* this loop skips other-zone and unknown NSEC3s, also non-NSEC3 RRs */
@@ -748,7 +752,7 @@ find_matching_nsec3(struct module_env* env, struct nsec3_filter* flt,
if(r == 0) {
log_err("nsec3: malloc failure");
break; /* alloc failure */
- } else if(r < 0)
+ } else if(r != 1)
continue; /* malformed NSEC3 */
else if(nsec3_hash_matches_owner(flt, hash, s)) {
*rrset = s; /* rrset with this name */
@@ -829,7 +833,7 @@ find_covering_nsec3(struct module_env* env, struct nsec3_filter* flt,
size_t i_rs;
int i_rr;
struct ub_packed_rrset_key* s;
- struct nsec3_cached_hash* hash;
+ struct nsec3_cached_hash* hash = NULL;
int r;
/* this loop skips other-zone and unknown NSEC3s, also non-NSEC3 RRs */
@@ -841,7 +845,7 @@ find_covering_nsec3(struct module_env* env, struct nsec3_filter* flt,
if(r == 0) {
log_err("nsec3: malloc failure");
break; /* alloc failure */
- } else if(r < 0)
+ } else if(r != 1)
continue; /* malformed NSEC3 */
else if(nsec3_covers(flt->zone, hash, s, i_rr,
env->scratch_buffer)) {
diff --git a/usr.sbin/unbound/validator/val_secalgo.c b/usr.sbin/unbound/validator/val_secalgo.c
index 95200a48b61..0613316c908 100644
--- a/usr.sbin/unbound/validator/val_secalgo.c
+++ b/usr.sbin/unbound/validator/val_secalgo.c
@@ -77,6 +77,22 @@ int fake_dsa = 0;
/** fake SHA1 support for unit tests */
int fake_sha1 = 0;
+/**
+ * Output a libcrypto openssl error to the logfile.
+ * @param str: string to add to it.
+ * @param e: the error to output, error number from ERR_get_error().
+ */
+static void
+log_crypto_error(const char* str, unsigned long e)
+{
+ char buf[128];
+ /* or use ERR_error_string if ERR_error_string_n is not avail TODO */
+ ERR_error_string_n(e, buf, sizeof(buf));
+ /* buf now contains */
+ /* error:[error code]:[library name]:[function name]:[reason string] */
+ log_err("%s crypto %s", str, buf);
+}
+
/* return size of digest if supported, or 0 otherwise */
size_t
nsec3_hash_algo_size_supported(int id)
@@ -96,7 +112,13 @@ secalgo_nsec3_hash(int algo, unsigned char* buf, size_t len,
{
switch(algo) {
case NSEC3_HASH_SHA1:
+#ifdef OPENSSL_FIPS
+ if(!sldns_digest_evp(buf, len, res, EVP_sha1()))
+ log_crypto_error("could not digest with EVP_sha1",
+ ERR_get_error());
+#else
(void)SHA1(buf, len, res);
+#endif
return 1;
default:
return 0;
@@ -106,7 +128,13 @@ secalgo_nsec3_hash(int algo, unsigned char* buf, size_t len,
void
secalgo_hash_sha256(unsigned char* buf, size_t len, unsigned char* res)
{
+#ifdef OPENSSL_FIPS
+ if(!sldns_digest_evp(buf, len, res, EVP_sha256()))
+ log_crypto_error("could not digest with EVP_sha256",
+ ERR_get_error());
+#else
(void)SHA256(buf, len, res);
+#endif
}
/**
@@ -165,12 +193,24 @@ secalgo_ds_digest(int algo, unsigned char* buf, size_t len,
switch(algo) {
#if defined(HAVE_EVP_SHA1) && defined(USE_SHA1)
case LDNS_SHA1:
+#ifdef OPENSSL_FIPS
+ if(!sldns_digest_evp(buf, len, res, EVP_sha1()))
+ log_crypto_error("could not digest with EVP_sha1",
+ ERR_get_error());
+#else
(void)SHA1(buf, len, res);
+#endif
return 1;
#endif
#ifdef HAVE_EVP_SHA256
case LDNS_SHA256:
+#ifdef OPENSSL_FIPS
+ if(!sldns_digest_evp(buf, len, res, EVP_sha256()))
+ log_crypto_error("could not digest with EVP_sha256",
+ ERR_get_error());
+#else
(void)SHA256(buf, len, res);
+#endif
return 1;
#endif
#ifdef USE_GOST
@@ -181,7 +221,13 @@ secalgo_ds_digest(int algo, unsigned char* buf, size_t len,
#endif
#ifdef USE_ECDSA
case LDNS_SHA384:
+#ifdef OPENSSL_FIPS
+ if(!sldns_digest_evp(buf, len, res, EVP_sha384()))
+ log_crypto_error("could not digest with EVP_sha384",
+ ERR_get_error());
+#else
(void)SHA384(buf, len, res);
+#endif
return 1;
#endif
default:
@@ -248,22 +294,6 @@ dnskey_algo_id_is_supported(int id)
}
}
-/**
- * Output a libcrypto openssl error to the logfile.
- * @param str: string to add to it.
- * @param e: the error to output, error number from ERR_get_error().
- */
-static void
-log_crypto_error(const char* str, unsigned long e)
-{
- char buf[128];
- /* or use ERR_error_string if ERR_error_string_n is not avail TODO */
- ERR_error_string_n(e, buf, sizeof(buf));
- /* buf now contains */
- /* error:[error code]:[library name]:[function name]:[reason string] */
- log_err("%s crypto %s", str, buf);
-}
-
#ifdef USE_DSA
/**
* Setup DSA key digest in DER encoding ...