summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2014-03-13 02:09:35 +0000
committerBrad Smith <brad@cvs.openbsd.org>2014-03-13 02:09:35 +0000
commit6081fe63f27aa8efcea9e824b91bcb86d56376bf (patch)
tree607202386fb7fb1deb91ece61c152d340d4bafde /usr.sbin/nsd
parent1342178419a992679fb622184c3449e6053d979d (diff)
merge conflicts
Diffstat (limited to 'usr.sbin/nsd')
-rw-r--r--usr.sbin/nsd/axfr.c5
-rw-r--r--usr.sbin/nsd/compat/snprintf.c20
-rw-r--r--usr.sbin/nsd/config.h.in3
-rw-r--r--usr.sbin/nsd/configure51
-rw-r--r--usr.sbin/nsd/configure.ac29
-rw-r--r--usr.sbin/nsd/nsd-checkconf.8.in6
-rw-r--r--usr.sbin/nsd/nsd.8.in4
-rw-r--r--usr.sbin/nsd/nsd.conf.5.in2
-rw-r--r--usr.sbin/nsd/query.c9
-rw-r--r--usr.sbin/nsd/server.c13
-rw-r--r--usr.sbin/nsd/zonec.c4
11 files changed, 94 insertions, 52 deletions
diff --git a/usr.sbin/nsd/axfr.c b/usr.sbin/nsd/axfr.c
index f780811fc9f..20133766f71 100644
--- a/usr.sbin/nsd/axfr.c
+++ b/usr.sbin/nsd/axfr.c
@@ -51,11 +51,12 @@ query_axfr(struct nsd *nsd, struct query *query)
&closest_encloser);
qdomain = closest_encloser;
- query->axfr_zone = domain_find_zone(closest_encloser);
+ query->axfr_zone = domain_find_zone(nsd->db, closest_encloser);
if (!exact
|| query->axfr_zone == NULL
- || query->axfr_zone->apex != qdomain)
+ || query->axfr_zone->apex != qdomain
+ || query->axfr_zone->soa_rrset == NULL)
{
/* No SOA no transfer */
RCODE_SET(query->packet, RCODE_NOTAUTH);
diff --git a/usr.sbin/nsd/compat/snprintf.c b/usr.sbin/nsd/compat/snprintf.c
index 65959309c9c..0663557037f 100644
--- a/usr.sbin/nsd/compat/snprintf.c
+++ b/usr.sbin/nsd/compat/snprintf.c
@@ -20,16 +20,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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.
+ * "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 COPYRIGHT
+ * HOLDER 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.
*/
#include "config.h"
diff --git a/usr.sbin/nsd/config.h.in b/usr.sbin/nsd/config.h.in
index 42c683a9be9..d80388b00bb 100644
--- a/usr.sbin/nsd/config.h.in
+++ b/usr.sbin/nsd/config.h.in
@@ -505,6 +505,9 @@
/* Define to 1 if on MINIX. */
#undef _MINIX
+/* Enable for compile on Minix */
+#undef _NETBSD_SOURCE
+
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
diff --git a/usr.sbin/nsd/configure b/usr.sbin/nsd/configure
index 170d7b2f729..fbb22071e7b 100644
--- a/usr.sbin/nsd/configure
+++ b/usr.sbin/nsd/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSD 4.0.1.
+# Generated by GNU Autoconf 2.69 for NSD 4.0.2.
#
# Report bugs to <nsd-bugs@nlnetlabs.nl>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='NSD'
PACKAGE_TARNAME='nsd'
-PACKAGE_VERSION='4.0.1'
-PACKAGE_STRING='NSD 4.0.1'
+PACKAGE_VERSION='4.0.2'
+PACKAGE_STRING='NSD 4.0.2'
PACKAGE_BUGREPORT='nsd-bugs@nlnetlabs.nl'
PACKAGE_URL=''
@@ -1279,7 +1279,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 NSD 4.0.1 to adapt to many kinds of systems.
+\`configure' configures NSD 4.0.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1340,7 +1340,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of NSD 4.0.1:";;
+ short | recursive ) echo "Configuration of NSD 4.0.2:";;
esac
cat <<\_ACEOF
@@ -1350,8 +1350,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-flto Disable link-time optimization (gcc specific option)
--disable-largefile omit support for large files
- --disable-recvmmsg Disable recvmmsg and sendmmsg compilation for
- compatibility with more Linux kernel versions
+ --enable-recvmmsg Enable recvmmsg and sendmmsg compilation, faster but
+ some kernel versions may have implementation
+ problems
--enable-root-server Configure NSD as a root server
--disable-ipv6 Disables IPv6 support
--enable-bind8-stats Enables BIND8 like NSTATS & XSTATS
@@ -1473,7 +1474,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-NSD configure 4.0.1
+NSD configure 4.0.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2182,7 +2183,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 NSD $as_me 4.0.1, which was
+It was created by NSD $as_me 4.0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3782,6 +3783,11 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+if test "$ac_cv_header_minix_config_h" = "yes"; then
+
+$as_echo "#define _NETBSD_SOURCE 1" >>confdefs.h
+
+fi
case "$prefix" in
NONE)
@@ -5425,7 +5431,7 @@ $as_echo_n "checking for libevent... " >&6; }
fi
for dir in $withval; do
thedir="$dir"
- if test -f "$dir/include/event.h"; then
+ if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
found_libevent="yes"
if test "$thedir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$thedir/include"
@@ -5450,8 +5456,18 @@ You can restart ./configure --with-libevent=no to use a builtin alternative." "$
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $thedir" >&5
$as_echo "found in $thedir" >&6; }
- if test "$thedir" != "/usr" -a "$thedir" != ""; then
- LDFLAGS="$LDFLAGS -L$thedir/lib"
+ if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
+ LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
+
+ if test "x$enable_rpath" = xyes; then
+ if echo "$thedir/lib/event2" | grep "^/" >/dev/null; then
+ RUNTIME_PATH="$RUNTIME_PATH -R$thedir/lib/event2"
+ fi
+ fi
+
+ else
+ if test "$thedir" != "/usr" -a "$thedir" != ""; then
+ LDFLAGS="$LDFLAGS -L$thedir/lib"
if test "x$enable_rpath" = xyes; then
if echo "$thedir/lib" | grep "^/" >/dev/null; then
@@ -5459,6 +5475,7 @@ $as_echo "found in $thedir" >&6; }
fi
fi
+ fi
fi
fi
# check for library used by libevent after 1.3c
@@ -7796,9 +7813,7 @@ if test "${enable_recvmmsg+set}" = set; then :
fi
case "$enable_recvmmsg" in
- no)
- ;;
- yes|*)
+ yes)
ac_fn_c_check_func "$LINENO" "recvmmsg" "ac_cv_func_recvmmsg"
if test "x$ac_cv_func_recvmmsg" = xyes; then :
@@ -7873,6 +7888,8 @@ fi
;;
+ no|*)
+ ;;
esac
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
@@ -9355,7 +9372,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 NSD $as_me 4.0.1, which was
+This file was extended by NSD $as_me 4.0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -9417,7 +9434,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="\\
-NSD config.status 4.0.1
+NSD config.status 4.0.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/usr.sbin/nsd/configure.ac b/usr.sbin/nsd/configure.ac
index f880ed66ccb..ab634fed56e 100644
--- a/usr.sbin/nsd/configure.ac
+++ b/usr.sbin/nsd/configure.ac
@@ -4,10 +4,13 @@ dnl
sinclude(acx_nlnetlabs.m4)
-AC_INIT(NSD,4.0.1,nsd-bugs@nlnetlabs.nl)
+AC_INIT(NSD,4.0.2,nsd-bugs@nlnetlabs.nl)
AC_CONFIG_HEADER([config.h])
AC_AIX
+if test "$ac_cv_header_minix_config_h" = "yes"; then
+ AC_DEFINE(_NETBSD_SOURCE,1, [Enable for compile on Minix])
+fi
dnl
dnl By default set $sysconfdir to /etc and $localstatedir to /var
@@ -337,7 +340,7 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
fi
for dir in $withval; do
thedir="$dir"
- if test -f "$dir/include/event.h"; then
+ if test -f "$dir/include/event.h" -o -f "$dir/include/event2/event.h"; then
found_libevent="yes"
dnl assume /usr is in default path.
if test "$thedir" != "/usr"; then
@@ -361,10 +364,16 @@ You can restart ./configure --with-libevent=no to use a builtin alternative.])
fi
else
AC_MSG_RESULT(found in $thedir)
- dnl assume /usr is in default path, do not add "".
- if test "$thedir" != "/usr" -a "$thedir" != ""; then
- LDFLAGS="$LDFLAGS -L$thedir/lib"
- ACX_RUNTIME_PATH_ADD([$thedir/lib])
+ dnl if event2 exists and no event lib in dir itself, use subdir
+ if test ! -f $thedir/lib/libevent.a -a ! -f $thedir/lib/libevent.so -a -d "$thedir/lib/event2"; then
+ LDFLAGS="$LDFLAGS -L$thedir/lib/event2"
+ ACX_RUNTIME_PATH_ADD([$thedir/lib/event2])
+ else
+ dnl assume /usr is in default path, do not add "".
+ if test "$thedir" != "/usr" -a "$thedir" != ""; then
+ LDFLAGS="$LDFLAGS -L$thedir/lib"
+ ACX_RUNTIME_PATH_ADD([$thedir/lib])
+ fi
fi
fi
# check for library used by libevent after 1.3c
@@ -575,11 +584,9 @@ AC_CHECK_SIZEOF(off_t)
AC_CHECK_FUNCS([arc4random arc4random_uniform])
AC_CHECK_FUNCS([tzset alarm chroot dup2 endpwent gethostname memset memcpy pwrite socket strcasecmp strchr strdup strerror strncasecmp strtol writev getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime setusercontext initgroups setresuid setreuid setresgid setregid getpwnam mmap])
-AC_ARG_ENABLE(recvmmsg, AC_HELP_STRING([--disable-recvmmsg], [Disable recvmmsg and sendmmsg compilation for compatibility with more Linux kernel versions]))
+AC_ARG_ENABLE(recvmmsg, AC_HELP_STRING([--enable-recvmmsg], [Enable recvmmsg and sendmmsg compilation, faster but some kernel versions may have implementation problems]))
case "$enable_recvmmsg" in
- no)
- ;;
- yes|*)
+ yes)
AC_CHECK_FUNC([recvmmsg], [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/socket.h>
@@ -614,6 +621,8 @@ AC_DEFINE([HAVE_SENDMMSG], [1], [Define if sendmmsg exists])]
)])
;;
+ no|*)
+ ;;
esac
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
diff --git a/usr.sbin/nsd/nsd-checkconf.8.in b/usr.sbin/nsd/nsd-checkconf.8.in
index b70408685e8..3d7622b763c 100644
--- a/usr.sbin/nsd/nsd-checkconf.8.in
+++ b/usr.sbin/nsd/nsd-checkconf.8.in
@@ -1,4 +1,4 @@
-.TH "nsd\-checkconf" "8" "Jan 27, 2014" "NLnet Labs" "nsd 4.0.1"
+.TH "nsd\-checkconf" "8" "Mar 12, 2014" "NLnet Labs" "nsd 4.0.2"
.\" Copyright (c) 2001\-2008, NLnet Labs. All rights reserved.
.\" See LICENSE for the license.
.SH "NAME"
@@ -55,9 +55,7 @@ The special value
prints out a list of configured patterns.
.P
.RS
-This option is primarily used by
-.B nsdc
-to parse the config file from the shell. If the
+This option can be used to parse the config file from the shell. If the
.B \-z
option is given, but the
.B \-o
diff --git a/usr.sbin/nsd/nsd.8.in b/usr.sbin/nsd/nsd.8.in
index d364782cbf7..88de32a4339 100644
--- a/usr.sbin/nsd/nsd.8.in
+++ b/usr.sbin/nsd/nsd.8.in
@@ -1,10 +1,10 @@
-.TH "NSD" "8" "Jan 27, 2014" "NLnet Labs" "NSD 4.0.1"
+.TH "NSD" "8" "Mar 12, 2014" "NLnet Labs" "NSD 4.0.2"
.\" Copyright (c) 2001\-2008, NLnet Labs. All rights reserved.
.\" See LICENSE for the license.
.SH "NAME"
.LP
.B nsd
-\- Name Server Daemon (NSD) version 4.0.1.
+\- Name Server Daemon (NSD) version 4.0.2.
.SH "SYNOPSIS"
.LP
.B nsd
diff --git a/usr.sbin/nsd/nsd.conf.5.in b/usr.sbin/nsd/nsd.conf.5.in
index 38296c2ea0a..d76f2b59a9b 100644
--- a/usr.sbin/nsd/nsd.conf.5.in
+++ b/usr.sbin/nsd/nsd.conf.5.in
@@ -1,4 +1,4 @@
-.TH "nsd.conf" "5" "Jan 27, 2014" "NLnet Labs" "nsd 4.0.1"
+.TH "nsd.conf" "5" "Mar 12, 2014" "NLnet Labs" "nsd 4.0.2"
.\" Copyright (c) 2001\-2008, NLnet Labs. All rights reserved.
.\" See LICENSE for the license.
.SH "NAME"
diff --git a/usr.sbin/nsd/query.c b/usr.sbin/nsd/query.c
index 09532677e2f..d5afe789cf0 100644
--- a/usr.sbin/nsd/query.c
+++ b/usr.sbin/nsd/query.c
@@ -1137,8 +1137,15 @@ answer_lookup_zone(struct nsd *nsd, struct query *q, answer_type *answer,
size_t domain_number, int exact, domain_type *closest_match,
domain_type *closest_encloser, const dname_type *qname)
{
- q->zone = domain_find_zone(closest_encloser);
+ q->zone = domain_find_zone(nsd->db, closest_encloser);
if (!q->zone) {
+ /* no zone for this */
+ if(q->cname_count == 0)
+ RCODE_SET(q->packet, RCODE_REFUSE);
+ return;
+ }
+ if(!q->zone->apex || !q->zone->soa_rrset) {
+ /* zone is configured but not loaded */
if(q->cname_count == 0)
RCODE_SET(q->packet, RCODE_SERVFAIL);
return;
diff --git a/usr.sbin/nsd/server.c b/usr.sbin/nsd/server.c
index 936687fe349..f2188257b18 100644
--- a/usr.sbin/nsd/server.c
+++ b/usr.sbin/nsd/server.c
@@ -33,14 +33,19 @@
#ifndef SHUT_WR
#define SHUT_WR 1
#endif
+#include <openssl/rand.h>
#ifndef USE_MINI_EVENT
-#include <event.h>
+# ifdef HAVE_EVENT_H
+# include <event.h>
+# else
+# include <event2/event.h>
+# include "event2/event_struct.h"
+# include "event2/event_compat.h"
+# endif
#else
-#include "mini_event.h"
+# include "mini_event.h"
#endif
-#include <openssl/rand.h>
-
#include "axfr.h"
#include "namedb.h"
#include "netio.h"
diff --git a/usr.sbin/nsd/zonec.c b/usr.sbin/nsd/zonec.c
index 9fad2e097b7..34391328ede 100644
--- a/usr.sbin/nsd/zonec.c
+++ b/usr.sbin/nsd/zonec.c
@@ -1563,7 +1563,7 @@ zonec_read(const char* name, const char* zonefile, zone_type* zone)
startzonec = time(NULL);
parser->errors = 0;
- dname = dname_parse(parser->region, name);
+ dname = dname_parse(parser->rr_region, name);
if (!dname) {
zc_error("incorrect zone name '%s'", name);
return 0;
@@ -1589,6 +1589,8 @@ zonec_read(const char* name, const char* zonefile, zone_type* zone)
/* remove origin if it was unused */
domain_table_deldomain(parser->db, parser->origin);
+ /* rr_region has been emptied by now */
+ dname = dname_parse(parser->rr_region, name);
/* check if zone file contained a correct SOA record */
if (!parser->current_zone) {