update to 1.5.0
Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
e57a26f704
commit
6cdcf55a00
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,3 +26,4 @@ unbound-1.4.5.tar.gz
|
||||
/unbound-1.4.20.tar.gz
|
||||
/unbound-1.4.21.tar.gz
|
||||
/unbound-1.4.22.tar.gz
|
||||
/unbound-1.5.0.tar.gz
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
59728c74fef8783f8bad1d7451eba97f unbound-1.4.22.tar.gz
|
||||
5c14ce292564a66e6041f149398309e9 unbound-1.5.0.tar.gz
|
||||
|
@ -1,122 +0,0 @@
|
||||
From 5bc8036ec65ce616aa68138bfe6656e895316203 Mon Sep 17 00:00:00 2001
|
||||
From: wouter <wouter@be551aaa-1e26-0410-a405-d3ace91eadb9>
|
||||
Date: Thu, 16 Jan 2014 13:04:34 +0000
|
||||
Subject: [PATCH] - fix #544: Fixed +i causes segfault when running with module
|
||||
conf "iterator".
|
||||
|
||||
git-svn-id: http://unbound.nlnetlabs.nl/svn/trunk@3038 be551aaa-1e26-0410-a405-d3ace91eadb9
|
||||
Signed-off-by: Tomas Hozza <thozza@redhat.com>
|
||||
---
|
||||
daemon/remote.c | 33 ++++++++++++++++++++-------------
|
||||
validator/val_anchor.c | 2 ++
|
||||
2 files changed, 22 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 6150502..a5bb75e 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -1571,7 +1571,7 @@ do_forward_add(SSL* ssl, struct worker* worker, char* args)
|
||||
struct delegpt* dp = NULL;
|
||||
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, NULL))
|
||||
return;
|
||||
- if(insecure) {
|
||||
+ if(insecure && worker->env.anchors) {
|
||||
if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
|
||||
nm)) {
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
@@ -1598,7 +1598,7 @@ do_forward_remove(SSL* ssl, struct worker* worker, char* args)
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL))
|
||||
return;
|
||||
- if(insecure)
|
||||
+ if(insecure && worker->env.anchors)
|
||||
anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
|
||||
nm);
|
||||
forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, nm);
|
||||
@@ -1616,7 +1616,7 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args)
|
||||
struct delegpt* dp = NULL;
|
||||
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, &prime))
|
||||
return;
|
||||
- if(insecure) {
|
||||
+ if(insecure && worker->env.anchors) {
|
||||
if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
|
||||
nm)) {
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
@@ -1626,8 +1626,9 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args)
|
||||
}
|
||||
}
|
||||
if(!forwards_add_stub_hole(fwd, LDNS_RR_CLASS_IN, nm)) {
|
||||
- if(insecure) anchors_delete_insecure(worker->env.anchors,
|
||||
- LDNS_RR_CLASS_IN, nm);
|
||||
+ if(insecure && worker->env.anchors)
|
||||
+ anchors_delete_insecure(worker->env.anchors,
|
||||
+ LDNS_RR_CLASS_IN, nm);
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
delegpt_free_mlc(dp);
|
||||
free(nm);
|
||||
@@ -1636,8 +1637,9 @@ do_stub_add(SSL* ssl, struct worker* worker, char* args)
|
||||
if(!hints_add_stub(worker->env.hints, LDNS_RR_CLASS_IN, dp, !prime)) {
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm);
|
||||
- if(insecure) anchors_delete_insecure(worker->env.anchors,
|
||||
- LDNS_RR_CLASS_IN, nm);
|
||||
+ if(insecure && worker->env.anchors)
|
||||
+ anchors_delete_insecure(worker->env.anchors,
|
||||
+ LDNS_RR_CLASS_IN, nm);
|
||||
free(nm);
|
||||
return;
|
||||
}
|
||||
@@ -1654,7 +1656,7 @@ do_stub_remove(SSL* ssl, struct worker* worker, char* args)
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL))
|
||||
return;
|
||||
- if(insecure)
|
||||
+ if(insecure && worker->env.anchors)
|
||||
anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
|
||||
nm);
|
||||
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm);
|
||||
@@ -1672,10 +1674,13 @@ do_insecure_add(SSL* ssl, struct worker* worker, char* arg)
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
|
||||
return;
|
||||
- if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm)) {
|
||||
- (void)ssl_printf(ssl, "error out of memory\n");
|
||||
- free(nm);
|
||||
- return;
|
||||
+ if(worker->env.anchors) {
|
||||
+ if(!anchors_add_insecure(worker->env.anchors,
|
||||
+ LDNS_RR_CLASS_IN, nm)) {
|
||||
+ (void)ssl_printf(ssl, "error out of memory\n");
|
||||
+ free(nm);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
free(nm);
|
||||
send_ok(ssl);
|
||||
@@ -1690,7 +1695,9 @@ do_insecure_remove(SSL* ssl, struct worker* worker, char* arg)
|
||||
uint8_t* nm = NULL;
|
||||
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
|
||||
return;
|
||||
- anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN, nm);
|
||||
+ if(worker->env.anchors)
|
||||
+ anchors_delete_insecure(worker->env.anchors,
|
||||
+ LDNS_RR_CLASS_IN, nm);
|
||||
free(nm);
|
||||
send_ok(ssl);
|
||||
}
|
||||
diff --git a/validator/val_anchor.c b/validator/val_anchor.c
|
||||
index e710f2f..b300718 100644
|
||||
--- a/validator/val_anchor.c
|
||||
+++ b/validator/val_anchor.c
|
||||
@@ -1197,6 +1197,8 @@ anchors_get_mem(struct val_anchors* anchors)
|
||||
{
|
||||
struct trust_anchor *ta;
|
||||
size_t s = sizeof(*anchors);
|
||||
+ if(!anchors)
|
||||
+ return 0;
|
||||
RBTREE_FOR(ta, struct trust_anchor*, anchors->tree) {
|
||||
s += sizeof(*ta) + ta->namelen;
|
||||
/* keys and so on */
|
||||
--
|
||||
1.8.4.2
|
||||
|
@ -1,131 +0,0 @@
|
||||
diff -Naur unbound-1.4.22-orig/daemon/remote.c unbound-1.4.22/daemon/remote.c
|
||||
--- unbound-1.4.22-orig/daemon/remote.c 2014-02-07 08:28:39.000000000 -0500
|
||||
+++ unbound-1.4.22/daemon/remote.c 2014-05-01 09:58:08.552554289 -0400
|
||||
@@ -1330,7 +1330,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-/** remove all rrsets and keys from zone from cache */
|
||||
+/** remove all bogus rrsets, msgs and keys from cache */
|
||||
static void
|
||||
do_flush_bogus(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
@@ -1359,6 +1359,82 @@
|
||||
(unsigned)inf.num_msgs, (unsigned)inf.num_keys);
|
||||
}
|
||||
|
||||
+/** callback to delete negative and servfail rrsets */
|
||||
+static void
|
||||
+negative_del_rrset(struct lruhash_entry* e, void* arg)
|
||||
+{
|
||||
+ /* entry is locked */
|
||||
+ struct del_info* inf = (struct del_info*)arg;
|
||||
+ struct ub_packed_rrset_key* k = (struct ub_packed_rrset_key*)e->key;
|
||||
+ struct packed_rrset_data* d = (struct packed_rrset_data*)e->data;
|
||||
+ /* delete the parentside negative cache rrsets,
|
||||
+ * these are namerserver rrsets that failed lookup, rdata empty */
|
||||
+ if((k->rk.flags & PACKED_RRSET_PARENT_SIDE) && d->count == 1 &&
|
||||
+ d->rrsig_count == 0 && d->rr_len[0] == 0) {
|
||||
+ d->ttl = inf->expired;
|
||||
+ inf->num_rrsets++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/** callback to delete negative and servfail messages */
|
||||
+static void
|
||||
+negative_del_msg(struct lruhash_entry* e, void* arg)
|
||||
+{
|
||||
+ /* entry is locked */
|
||||
+ struct del_info* inf = (struct del_info*)arg;
|
||||
+ struct reply_info* d = (struct reply_info*)e->data;
|
||||
+ /* rcode not NOERROR: NXDOMAIN, SERVFAIL, ..: an nxdomain or error
|
||||
+ * or NOERROR rcode with ANCOUNT==0: a NODATA answer */
|
||||
+ if(FLAGS_GET_RCODE(d->flags) != 0 || d->an_numrrsets == 0) {
|
||||
+ d->ttl = inf->expired;
|
||||
+ inf->num_msgs++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/** callback to delete negative key entries */
|
||||
+static void
|
||||
+negative_del_kcache(struct lruhash_entry* e, void* arg)
|
||||
+{
|
||||
+ /* entry is locked */
|
||||
+ struct del_info* inf = (struct del_info*)arg;
|
||||
+ struct key_entry_data* d = (struct key_entry_data*)e->data;
|
||||
+ /* could be bad because of lookup failure on the DS, DNSKEY, which
|
||||
+ * was nxdomain or servfail, and thus a result of negative lookups */
|
||||
+ if(d->isbad) {
|
||||
+ d->ttl = inf->expired;
|
||||
+ inf->num_keys++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/** remove all negative(NODATA,NXDOMAIN), and servfail messages from cache */
|
||||
+static void
|
||||
+do_flush_negative(SSL* ssl, struct worker* worker)
|
||||
+{
|
||||
+ struct del_info inf;
|
||||
+ /* what we do is to set them all expired */
|
||||
+ inf.worker = worker;
|
||||
+ inf.now = *worker->env.now;
|
||||
+ inf.expired = *worker->env.now;
|
||||
+ inf.expired -= 3; /* handle 3 seconds skew between threads */
|
||||
+ inf.num_rrsets = 0;
|
||||
+ inf.num_msgs = 0;
|
||||
+ inf.num_keys = 0;
|
||||
+ slabhash_traverse(&worker->env.rrset_cache->table, 1,
|
||||
+ &negative_del_rrset, &inf);
|
||||
+
|
||||
+ slabhash_traverse(worker->env.msg_cache, 1, &negative_del_msg, &inf);
|
||||
+
|
||||
+ /* and validator cache */
|
||||
+ if(worker->env.key_cache) {
|
||||
+ slabhash_traverse(worker->env.key_cache->slab, 1,
|
||||
+ &negative_del_kcache, &inf);
|
||||
+ }
|
||||
+
|
||||
+ (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages "
|
||||
+ "and %lu key entries\n", (unsigned long)inf.num_rrsets,
|
||||
+ (unsigned long)inf.num_msgs, (unsigned long)inf.num_keys);
|
||||
+}
|
||||
+
|
||||
/** remove name rrset from cache */
|
||||
static void
|
||||
do_flush_name(SSL* ssl, struct worker* w, char* arg)
|
||||
@@ -2173,6 +2249,8 @@
|
||||
do_get_option(ssl, worker, skipwhite(p+10));
|
||||
} else if(cmdcmp(p, "flush_bogus", 11)) {
|
||||
do_flush_bogus(ssl, worker);
|
||||
+ } else if(cmdcmp(p, "flush_negative", 14)) {
|
||||
+ do_flush_negative(ssl, worker);
|
||||
} else {
|
||||
(void)ssl_printf(ssl, "error unknown command '%s'\n", p);
|
||||
}
|
||||
diff -Naur unbound-1.4.22-orig/doc/unbound-control.8.in unbound-1.4.22/doc/unbound-control.8.in
|
||||
--- unbound-1.4.22-orig/doc/unbound-control.8.in 2014-03-12 08:31:42.000000000 -0400
|
||||
+++ unbound-1.4.22/doc/unbound-control.8.in 2014-05-01 09:58:08.552554289 -0400
|
||||
@@ -133,6 +133,12 @@
|
||||
.B flush_bogus
|
||||
Remove all bogus data from the cache.
|
||||
.TP
|
||||
+.B flush_negative
|
||||
+Remove all negative data from the cache. This is nxdomain answers,
|
||||
+nodata answers and servfail answers. Also removes bad key entries
|
||||
+(which could be due to failed lookups) from the dnssec key cache, and
|
||||
+iterator last-resort lookup failures from the rrset cache.
|
||||
+.TP
|
||||
.B flush_stats
|
||||
Reset statistics to zero.
|
||||
.TP
|
||||
diff -Naur unbound-1.4.22-orig/smallapp/unbound-control.c unbound-1.4.22/smallapp/unbound-control.c
|
||||
--- unbound-1.4.22-orig/smallapp/unbound-control.c 2014-02-07 08:28:39.000000000 -0500
|
||||
+++ unbound-1.4.22/smallapp/unbound-control.c 2014-05-01 09:58:08.552554289 -0400
|
||||
@@ -95,6 +95,7 @@
|
||||
printf(" flush_zone <name> flush everything at or under name\n");
|
||||
printf(" from rr and dnssec caches\n");
|
||||
printf(" flush_bogus flush all bogus data\n");
|
||||
+ printf(" flush_negative flush all negative data\n");
|
||||
printf(" flush_stats flush statistics, make zero\n");
|
||||
printf(" flush_requestlist drop queries that are worked on\n");
|
||||
printf(" dump_requestlist show what is worked on\n");
|
@ -1,482 +0,0 @@
|
||||
diff --git a/acx_python.m4 b/acx_python.m4
|
||||
index 99ffa25..254ff20 100644
|
||||
--- a/acx_python.m4
|
||||
+++ b/acx_python.m4
|
||||
@@ -14,58 +14,11 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
|
||||
fi
|
||||
|
||||
if test -z "$PYTHON_VERSION"; then
|
||||
- PYTHON_VERSION=`$PYTHON -c "import sys, string; \
|
||||
- print string.split(sys.version)[[0]]"`
|
||||
+ PYTHON_VERSION=`$PYTHON -c "import sys; \
|
||||
+ print(sys.version.split()[[0]])"`
|
||||
fi
|
||||
|
||||
#
|
||||
- # Check for a version of Python >= 2.1.0
|
||||
- #
|
||||
- AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
|
||||
- ac_supports_python_ver=`$PYTHON -c "import sys, string; \
|
||||
- ver = string.split(sys.version)[[0]]; \
|
||||
- print ver >= '2.1.0'"`
|
||||
- if test "$ac_supports_python_ver" != "True"; then
|
||||
- if test -z "$PYTHON_NOVERSIONCHECK"; then
|
||||
- AC_MSG_RESULT([no])
|
||||
- AC_MSG_FAILURE([
|
||||
-This version of the AC@&t@_PYTHON_DEVEL macro
|
||||
-doesn't work properly with versions of Python before
|
||||
-2.1.0. You may need to re-run configure, setting the
|
||||
-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
|
||||
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
|
||||
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
|
||||
-to something else than an empty string.
|
||||
-])
|
||||
- else
|
||||
- AC_MSG_RESULT([skip at user request])
|
||||
- fi
|
||||
- else
|
||||
- AC_MSG_RESULT([yes])
|
||||
- fi
|
||||
-
|
||||
- #
|
||||
- # if the macro parameter ``version'' is set, honour it
|
||||
- #
|
||||
- if test -n "$1"; then
|
||||
- AC_MSG_CHECKING([for a version of Python $1])
|
||||
- ac_supports_python_ver=`$PYTHON -c "import sys, string; \
|
||||
- ver = string.split(sys.version)[[0]]; \
|
||||
- print ver $1"`
|
||||
- if test "$ac_supports_python_ver" = "True"; then
|
||||
- AC_MSG_RESULT([yes])
|
||||
- else
|
||||
- AC_MSG_RESULT([no])
|
||||
- AC_MSG_ERROR([this package requires Python $1.
|
||||
-If you have it installed, but it isn't the default Python
|
||||
-interpreter in your system path, please pass the PYTHON_VERSION
|
||||
-variable to configure. See ``configure --help'' for reference.
|
||||
-])
|
||||
- PYTHON_VERSION=""
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- #
|
||||
# Check if you have distutils, else fail
|
||||
#
|
||||
AC_MSG_CHECKING([for the distutils Python package])
|
||||
@@ -86,7 +39,7 @@ $ac_distutils_result])
|
||||
AC_MSG_CHECKING([for Python include path])
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print distutils.sysconfig.get_python_inc();"`
|
||||
+ print(distutils.sysconfig.get_python_inc());"`
|
||||
if test -n "${python_path}"; then
|
||||
python_path="-I$python_path"
|
||||
fi
|
||||
@@ -100,25 +53,8 @@ $ac_distutils_result])
|
||||
#
|
||||
AC_MSG_CHECKING([for Python library path])
|
||||
if test -z "$PYTHON_LDFLAGS"; then
|
||||
- # (makes two attempts to ensure we've got a version number
|
||||
- # from the interpreter)
|
||||
- py_version=`$PYTHON -c "from distutils.sysconfig import *; \
|
||||
- from string import join; \
|
||||
- print join(get_config_vars('VERSION'))"`
|
||||
- if test "$py_version" = "[None]"; then
|
||||
- if test -n "$PYTHON_VERSION"; then
|
||||
- py_version=$PYTHON_VERSION
|
||||
- else
|
||||
- py_version=`$PYTHON -c "import sys; \
|
||||
- print sys.version[[:3]]"`
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
|
||||
- from string import join; \
|
||||
- print '-L' + get_python_lib(0,1), \
|
||||
- '-L' + os.path.dirname(get_python_lib(0,1)), \
|
||||
- '-lpython';"`$py_version
|
||||
+ print(get_config_var('BLDLIBRARY'));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_LDFLAGS])
|
||||
AC_SUBST([PYTHON_LDFLAGS])
|
||||
@@ -129,36 +65,12 @@ $ac_distutils_result])
|
||||
AC_MSG_CHECKING([for Python site-packages path])
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print distutils.sysconfig.get_python_lib(1,0);"`
|
||||
+ print(distutils.sysconfig.get_python_lib(1,0));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_SITE_PKG])
|
||||
AC_SUBST([PYTHON_SITE_PKG])
|
||||
|
||||
#
|
||||
- # libraries which must be linked in when embedding
|
||||
- #
|
||||
- AC_MSG_CHECKING(python extra libraries)
|
||||
- if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
- print conf('LOCALMODLIBS'), conf('LIBS')"`
|
||||
- fi
|
||||
- AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
|
||||
- AC_SUBST(PYTHON_EXTRA_LIBS)
|
||||
-
|
||||
- #
|
||||
- # linking flags needed when embedding
|
||||
- #
|
||||
- AC_MSG_CHECKING(python extra linking flags)
|
||||
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
- print conf('LINKFORSHARED')"`
|
||||
- fi
|
||||
- AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
|
||||
- AC_SUBST(PYTHON_EXTRA_LDFLAGS)
|
||||
-
|
||||
- #
|
||||
# final check to see if everything compiles alright
|
||||
#
|
||||
AC_MSG_CHECKING([consistency of all components of python development environment])
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 26e8abc..a22ddc9 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -465,7 +465,7 @@ if test x_$ub_test_python != x_no; then
|
||||
ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
|
||||
AC_PYTHON_DEVEL
|
||||
if test ! -z "$PYTHON_VERSION"; then
|
||||
- if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
|
||||
+ if test `$PYTHON -c "print('$PYTHON_VERSION' >= '2.4.0')"` = "False"; then
|
||||
AC_ERROR([Python version >= 2.4.0 is required])
|
||||
fi
|
||||
|
||||
diff --git a/libunbound/python/examples/async-lookup.py b/libunbound/python/examples/async-lookup.py
|
||||
index 52a2d3c..cbb8ea0 100644
|
||||
--- a/libunbound/python/examples/async-lookup.py
|
||||
+++ b/libunbound/python/examples/async-lookup.py
|
||||
@@ -39,9 +39,9 @@ ctx = unbound.ub_ctx()
|
||||
ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
def call_back(my_data,status,result):
|
||||
- print "Call_back:", my_data
|
||||
+ print("Call_back:", my_data)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
my_data['done_flag'] = True
|
||||
|
||||
|
||||
@@ -53,4 +53,4 @@ while (status == 0) and (not my_data['done_flag']):
|
||||
time.sleep(0.1)
|
||||
|
||||
if (status != 0):
|
||||
- print "Resolve error:", unbound.ub_strerror(status)
|
||||
+ print("Resolve error:", unbound.ub_strerror(status))
|
||||
diff --git a/libunbound/python/examples/dns-lookup.py b/libunbound/python/examples/dns-lookup.py
|
||||
index 2821ed3..b3f4008 100644
|
||||
--- a/libunbound/python/examples/dns-lookup.py
|
||||
+++ b/libunbound/python/examples/dns-lookup.py
|
||||
@@ -39,6 +39,6 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
elif status != 0:
|
||||
- print "Error:", unbound.ub_strerror(status)
|
||||
+ print("Error:", unbound.ub_strerror(status))
|
||||
diff --git a/libunbound/python/examples/dnssec-valid.py b/libunbound/python/examples/dnssec-valid.py
|
||||
index 3e05ddd..5c3cad9 100644
|
||||
--- a/libunbound/python/examples/dnssec-valid.py
|
||||
+++ b/libunbound/python/examples/dnssec-valid.py
|
||||
@@ -48,12 +48,12 @@ if os.path.isfile("keys"):
|
||||
status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
|
||||
if result.secure:
|
||||
- print "Result is secure"
|
||||
+ print("Result is secure")
|
||||
elif result.bogus:
|
||||
- print "Result is bogus"
|
||||
+ print("Result is bogus")
|
||||
else:
|
||||
- print "Result is insecure"
|
||||
+ print("Result is insecure")
|
||||
|
||||
diff --git a/libunbound/python/examples/dnssec_test.py b/libunbound/python/examples/dnssec_test.py
|
||||
index 138e19b..0d62b9f 100644
|
||||
--- a/libunbound/python/examples/dnssec_test.py
|
||||
+++ b/libunbound/python/examples/dnssec_test.py
|
||||
@@ -3,27 +3,27 @@ from unbound import ub_ctx, RR_TYPE_A, RR_TYPE_RRSIG, RR_TYPE_NSEC, RR_TYPE_NSEC
|
||||
import ldns
|
||||
|
||||
def dnssecParse(domain, rrType=RR_TYPE_A):
|
||||
- print "Resolving domain", domain
|
||||
+ print("Resolving domain", domain)
|
||||
s, r = resolver.resolve(domain)
|
||||
- print "status: %s, secure: %s, rcode: %s, havedata: %s, answer_len; %s" % (s, r.secure, r.rcode_str, r.havedata, r.answer_len)
|
||||
+ print("status: %s, secure: %s, rcode: %s, havedata: %s, answer_len; %s" % (s, r.secure, r.rcode_str, r.havedata, r.answer_len))
|
||||
|
||||
s, pkt = ldns.ldns_wire2pkt(r.packet)
|
||||
if s != 0:
|
||||
raise RuntimeError("Error parsing DNS packet")
|
||||
|
||||
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_ANSWER)
|
||||
- print "RRSIGs from answer:", rrsigs
|
||||
+ print("RRSIGs from answer:", rrsigs)
|
||||
|
||||
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "RRSIGs from authority:", rrsigs
|
||||
+ print("RRSIGs from authority:", rrsigs)
|
||||
|
||||
nsecs = pkt.rr_list_by_type(RR_TYPE_NSEC, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "NSECs:", nsecs
|
||||
+ print("NSECs:", nsecs)
|
||||
|
||||
nsec3s = pkt.rr_list_by_type(RR_TYPE_NSEC3, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "NSEC3s:", nsec3s
|
||||
+ print("NSEC3s:", nsec3s)
|
||||
|
||||
- print "---"
|
||||
+ print("---")
|
||||
|
||||
|
||||
resolver = ub_ctx()
|
||||
diff --git a/libunbound/python/examples/example8-1.py b/libunbound/python/examples/example8-1.py
|
||||
index 6816da0..ca868e5 100644
|
||||
--- a/libunbound/python/examples/example8-1.py
|
||||
+++ b/libunbound/python/examples/example8-1.py
|
||||
@@ -40,22 +40,22 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.domain_list:
|
||||
- print " host: %s" % k
|
||||
+ print(" host: %s" % k)
|
||||
|
||||
diff --git a/libunbound/python/examples/idn-lookup.py b/libunbound/python/examples/idn-lookup.py
|
||||
index 7cfdc9e..2170637 100644
|
||||
--- a/libunbound/python/examples/idn-lookup.py
|
||||
+++ b/libunbound/python/examples/idn-lookup.py
|
||||
@@ -43,20 +43,20 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
#The unicode IDN string is automatically converted (if necessary)
|
||||
status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list_idn:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result.data:", result.data
|
||||
+ print("Result.data:", result.data)
|
||||
for k in result.data.domain_list_idn:
|
||||
- print " dname:%s" % k
|
||||
+ print(" dname:%s" % k)
|
||||
diff --git a/libunbound/python/examples/mx-lookup.py b/libunbound/python/examples/mx-lookup.py
|
||||
index cdcd1b1..f83f690 100644
|
||||
--- a/libunbound/python/examples/mx-lookup.py
|
||||
+++ b/libunbound/python/examples/mx-lookup.py
|
||||
@@ -40,14 +40,14 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
diff --git a/libunbound/python/examples/ns-lookup.py b/libunbound/python/examples/ns-lookup.py
|
||||
index f9eafb2..bcd51de 100644
|
||||
--- a/libunbound/python/examples/ns-lookup.py
|
||||
+++ b/libunbound/python/examples/ns-lookup.py
|
||||
@@ -40,8 +40,8 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("vutbr.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.domain_list:
|
||||
- print " host: %s" % k
|
||||
+ print(" host: %s" % k)
|
||||
|
||||
diff --git a/libunbound/python/examples/reverse-lookup.py b/libunbound/python/examples/reverse-lookup.py
|
||||
index 4d3e0bb..7e06844 100644
|
||||
--- a/libunbound/python/examples/reverse-lookup.py
|
||||
+++ b/libunbound/python/examples/reverse-lookup.py
|
||||
@@ -39,5 +39,5 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result.data:", result.data, result.data.domain_list
|
||||
+ print("Result.data:", result.data, result.data.domain_list)
|
||||
|
||||
diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i
|
||||
index 4f92799..313c748 100644
|
||||
--- a/libunbound/python/libunbound.i
|
||||
+++ b/libunbound/python/libunbound.i
|
||||
@@ -44,6 +44,15 @@
|
||||
|
||||
%pythoncode %{
|
||||
import encodings.idna
|
||||
+
|
||||
+ # Ensure compatibility with older python versions
|
||||
+ if 'bytes' not in vars():
|
||||
+ bytes = str
|
||||
+
|
||||
+ def ord(s):
|
||||
+ if isinstance(s, int):
|
||||
+ return s
|
||||
+ return __builtins__.ord(s)
|
||||
%}
|
||||
|
||||
//%include "doc.i"
|
||||
@@ -559,10 +568,10 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
:returns: * (int) 0 if OK, else error.
|
||||
* (:class:`ub_result`) the result data is returned in a newly allocated result structure. May be None on return, return value is set to an error in that case (out of memory).
|
||||
"""
|
||||
- if isinstance(name, unicode): #probably IDN
|
||||
- return _unbound.ub_resolve(self,idn2dname(name),rrtype,rrclass)
|
||||
- else:
|
||||
+ if isinstance(name, bytes): #probably IDN
|
||||
return _unbound.ub_resolve(self,name,rrtype,rrclass)
|
||||
+ else:
|
||||
+ return _unbound.ub_resolve(self,idn2dname(name),rrtype,rrclass)
|
||||
#parameters: struct ub_ctx *,char *,int,int,
|
||||
#retvals: int,struct ub_result **
|
||||
|
||||
@@ -597,10 +606,10 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
* `result` - the result structure. The result may be None, in that case err is set.
|
||||
|
||||
"""
|
||||
- if isinstance(name, unicode): #probably IDN
|
||||
- return _unbound._ub_resolve_async(self,idn2dname(name),rrtype,rrclass,mydata,callback)
|
||||
- else:
|
||||
+ if isinstance(name, bytes): #probably IDN
|
||||
return _unbound._ub_resolve_async(self,name,rrtype,rrclass,mydata,callback)
|
||||
+ else:
|
||||
+ return _unbound._ub_resolve_async(self,idn2dname(name),rrtype,rrclass,mydata,callback)
|
||||
#parameters: struct ub_ctx *,char *,int,int,void *,ub_callback_t,
|
||||
#retvals: int, int
|
||||
|
||||
@@ -689,7 +698,8 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
idx = ofs
|
||||
while (idx < slen):
|
||||
complen = ord(s[idx])
|
||||
- res.append(s[idx+1:idx+1+complen])
|
||||
+ # In python 3.x `str()` converts the string to unicode which is the expected text string type
|
||||
+ res.append(str(s[idx+1:idx+1+complen]))
|
||||
idx += complen + 1
|
||||
|
||||
return res
|
||||
@@ -764,13 +774,13 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
|
||||
list = PyList_New(cnt);
|
||||
for (i=0;i<cnt;i++)
|
||||
- PyList_SetItem(list, i, PyString_FromStringAndSize(result->data[i],result->len[i]));
|
||||
+ PyList_SetItem(list, i, PyBytes_FromStringAndSize(result->data[i],result->len[i]));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
PyObject* _packet() {
|
||||
- return PyString_FromStringAndSize($self->answer_packet, $self->answer_len);
|
||||
+ return PyBytes_FromStringAndSize($self->answer_packet, $self->answer_len);
|
||||
}
|
||||
|
||||
%pythoncode %{
|
||||
diff --git a/pythonmod/interface.i b/pythonmod/interface.i
|
||||
index 606d85f..4f1a25f 100644
|
||||
--- a/pythonmod/interface.i
|
||||
+++ b/pythonmod/interface.i
|
||||
@@ -48,7 +48,7 @@
|
||||
list = PyList_New(cnt);
|
||||
i = 0; cnt = 0;
|
||||
while (i < len) {
|
||||
- PyList_SetItem(list, cnt, PyString_FromStringAndSize(name + i + 1, name[i]));
|
||||
+ PyList_SetItem(list, cnt, PyBytes_FromStringAndSize(name + i + 1, name[i]));
|
||||
i += name[i] + 1;
|
||||
cnt++;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ struct query_info {
|
||||
};
|
||||
|
||||
PyObject* _get_qname(struct query_info* q) {
|
||||
- return PyString_FromStringAndSize((char*)q->qname, q->qname_len);
|
||||
+ return PyBytes_FromStringAndSize((char*)q->qname, q->qname_len);
|
||||
}
|
||||
|
||||
PyObject* _get_qname_components(struct query_info* q) {
|
||||
@@ -210,7 +210,7 @@ uint16_t ntohs(uint16_t netshort);
|
||||
|
||||
%inline %{
|
||||
PyObject* _get_dname(struct packed_rrset_key* k) {
|
||||
- return PyString_FromStringAndSize((char*)k->dname, k->dname_len);
|
||||
+ return PyBytes_FromStringAndSize((char*)k->dname, k->dname_len);
|
||||
}
|
||||
PyObject* _get_dname_components(struct packed_rrset_key* k) {
|
||||
return GetNameAsLabelList((char*)k->dname, k->dname_len);
|
||||
@@ -317,7 +317,7 @@ struct packed_rrset_data {
|
||||
PyObject* _get_data_rr_data(struct packed_rrset_data* d, int idx) {
|
||||
if ((d != NULL) && (idx >= 0) &&
|
||||
((size_t)idx < (d->count+d->rrsig_count)))
|
||||
- return PyString_FromStringAndSize((char*)d->rr_data[idx],
|
||||
+ return PyBytes_FromStringAndSize((char*)d->rr_data[idx],
|
||||
d->rr_len[idx]);
|
||||
return Py_None;
|
||||
}
|
13
unbound.spec
13
unbound.spec
@ -18,8 +18,8 @@
|
||||
|
||||
Summary: Validating, recursive, and caching DNS(SEC) resolver
|
||||
Name: unbound
|
||||
Version: 1.4.22
|
||||
Release: 6%{?dist}
|
||||
Version: 1.5.0
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
|
||||
@ -40,10 +40,6 @@ Source13: root.anchor
|
||||
Source14: unbound.sysconfig
|
||||
Source15: unbound.cron
|
||||
Source16: unbound-munin.README
|
||||
Patch1: unbound-1.4.22-flushcache.patch
|
||||
# Support building with Python 3.x
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1115489
|
||||
Patch2: unbound-1.4.22-python3.patch
|
||||
|
||||
Group: System Environment/Daemons
|
||||
BuildRequires: flex, openssl-devel
|
||||
@ -117,8 +113,6 @@ Python modules and extensions for unbound
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
# This is needed to rebuild the configure script to support Python 3.x
|
||||
@ -296,6 +290,9 @@ exit 0
|
||||
/bin/systemctl try-restart unbound-keygen.service >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Wed Nov 19 2014 Tomas Hozza <thozza@redhat.com> - 1.5.0-1
|
||||
- update to 1.5.0
|
||||
|
||||
* Wed Sep 24 2014 Pavel Šimerda <psimerda@redhat.com> - 1.4.22-6
|
||||
- Resolves: #1115489 - build with python 3.x for fedora >= 22
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user