From 6acc156cb662ffc991637b4af7400db99a9cf063 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 22 Sep 2011 19:55:11 +0000 Subject: [PATCH] Paul Wouter's release candidate review: Removed ipcalc dependency of ldnsx. Removed the unused function 'ldns_rr_list_contains_name' from ldns-verify-zone.c And a very ugly syntax error in Makefile.in --- Makefile.in | 14 +++++------ ax_python_module.m4 | 49 ------------------------------------- configure.ac | 5 ---- contrib/ldnsx/ldnsx.py | 24 ++++++++---------- examples/ldns-verify-zone.c | 14 ----------- 5 files changed, 17 insertions(+), 89 deletions(-) delete mode 100644 ax_python_module.m4 diff --git a/Makefile.in b/Makefile.in index f05aa4f5..e1399acc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -199,8 +199,8 @@ destclean: uninstall install-config: if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \ - $(INSTALL) -d $(DESTDIR)$(bindir) \ - $(INSTALL) -c -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/ \ + $(INSTALL) -d $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/ ; \ fi uninstall-config: @@ -215,8 +215,8 @@ install-manpages: manpages ${INSTALL} -c -m 444 $$f $(DESTDIR)$(mandir)/man3/; \ done if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \ - ${INSTALL} -d $(DESTDIR)$(mandir)/man1 \ - ${INSTALL} -c -m 444 packaging/ldns-config.1 $(DESTDIR)$(mandir)/man1/ \ + ${INSTALL} -d $(DESTDIR)$(mandir)/man1; \ + ${INSTALL} -c -m 444 packaging/ldns-config.1 $(DESTDIR)$(mandir)/man1/; \ fi uninstall-manpages: @@ -224,7 +224,7 @@ uninstall-manpages: rm -f $(DESTDIR)$(mandir)/man3/$$i.3 ; done rmdir -p $(DESTDIR)$(mandir)/man3 || echo "ok, dir already gone" if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \ - rm -f $(DESTDIR)$(mandir)/man1/ldns-config.1 \ + rm -f $(DESTDIR)$(mandir)/man1/ldns-config.1; \ [ ! -d $(DESTDIR)$(mandir)/man1 ] || rmdir -p $(DESTDIR)$(mandir)/man1 || echo "ok, dir already gone"; \ fi @@ -242,7 +242,7 @@ uninstall-h: rm -f $(DESTDIR)$(includedir)/ldns/net.h rm -f $(DESTDIR)$(includedir)/ldns/util.h rm -f $(DESTDIR)$(includedir)/ldns/common.h - [ ! -d $(DESTDIR)$(includedir)/ldns ] || rmdir -p $(DESTDI)$(includedir)/ldns || echo "ok, dir already gone" + [ ! -d $(DESTDIR)$(includedir)/ldns ] || rmdir -p $(DESTDIR)$(includedir)/ldns || echo "ok, dir already gone" exit 0 install-lib: lib @@ -262,7 +262,7 @@ install-pyldns: @PYLDNS@ uninstall-pyldns: rm -f $(DESTDIR)$(python_site)/ldns/* - rmdir -p $(DESTDIR)$(python_site)/ldns + rmdir $(DESTDIR)$(python_site)/ldns || echo "ok, dir already gone" install-pyldnsx: $(INSTALL) -c -m 644 $(pyldnsxwrapdir)/ldnsx.py $(DESTDIR)$(python_site)/ldnsx.py diff --git a/ax_python_module.m4 b/ax_python_module.m4 deleted file mode 100644 index bd70a06b..00000000 --- a/ax_python_module.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_python_module.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PYTHON_MODULE(modname[, fatal]) -# -# DESCRIPTION -# -# Checks for Python module. -# -# If fatal is non-empty then absence of a module will trigger an error. -# -# LICENSE -# -# Copyright (c) 2008 Andrew Collier -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 5 - -AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) -AC_DEFUN([AX_PYTHON_MODULE],[ - if test -z $PYTHON; - then - PYTHON="python" - fi - PYTHON_NAME=`basename $PYTHON` - AC_MSG_CHECKING($PYTHON_NAME module: $1) - $PYTHON -c "import $1" 2>/dev/null - if test $? -eq 0; - then - AC_MSG_RESULT(yes) - eval AS_TR_CPP(HAVE_PYMOD_$1)=yes - else - AC_MSG_RESULT(no) - eval AS_TR_CPP(HAVE_PYMOD_$1)=no - # - if test -n "$2" - then - AC_MSG_ERROR(failed to find required module $1) - exit 1 - fi - fi -]) diff --git a/configure.ac b/configure.ac index c3be2dda..8c518786 100644 --- a/configure.ac +++ b/configure.ac @@ -147,11 +147,6 @@ AC_ARG_WITH(pyldnsx, AC_HELP_STRING([--without-pyldnsx], [],[ withval="with_pyldns" ]) if test x_$withval != x_no; then if test x_$ldns_with_pyldns != x_no; then - # The python ipcalc module is needed for pyldnsx, but it is not - # a build dependency - # - #sinclude(ax_python_module.m4) - #AX_PYTHON_MODULE(ipcalc) AC_SUBST(PYLDNSX, "pyldnsx") else if test x_$withval != x_with_pyldns; then diff --git a/contrib/ldnsx/ldnsx.py b/contrib/ldnsx/ldnsx.py index 9b59c4b2..ee81b2fd 100644 --- a/contrib/ldnsx/ldnsx.py +++ b/contrib/ldnsx/ldnsx.py @@ -1,4 +1,5 @@ -# (c) Christopher Olah , 2011. Xelerance . +# Copyright (C) Xelerance Corp. . +# Author: Christopher Olah # License: BSD """ Easy DNS (including DNSSEC) via ldns. @@ -41,15 +42,7 @@ response, else an error message. """ -import time, sys, calendar, warnings -try: - import ipcalc -except ImportError: - print >> sys.stderr, "ldnsx requires the python-ipcalc" - print >> sys.stderr, "Fedora/CentOS: yum install python-ipcalc" - print >> sys.stderr, "Debian/Ubuntu: apt-get install python-ipcalc" - print >> sys.stderr, "openSUSE: zypper in python-ipcalc" - sys.exit(1) +import time, sys, calendar, warnings, socket try: import ldns except ImportError: @@ -63,11 +56,14 @@ __version__ = "0.1" def isValidIP(ipaddr): try: - bits_to_type = { 32 : 4, 128 : 6} - bits = len(ipcalc.IP(ipaddr).bin()) - return bits_to_type[bits] + v4 = socket.inet_pton(socket.AF_INET,ipaddr) + return 4 except: - return 0 + try: + v6 = socket.inet_pton(socket.AF_INET6,ipaddr) + return 6 + except: + return 0 def query(name, rr_type, rr_class="IN", flags=["RD"], tries = 3, res=None): """Convenience function. Creates a resolver and then queries it. Refer to resolver.query() diff --git a/examples/ldns-verify-zone.c b/examples/ldns-verify-zone.c index eb19ea18..796e9659 100644 --- a/examples/ldns-verify-zone.c +++ b/examples/ldns-verify-zone.c @@ -45,20 +45,6 @@ zone_is_nsec3_optout(ldns_rbtree_t *zone_nodes) return 0; } -static bool -ldns_rr_list_contains_name(const ldns_rr_list *rr_list, - const ldns_rdf *name) -{ - size_t i; - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - if (ldns_dname_compare(name, - ldns_rr_owner(ldns_rr_list_rr(rr_list, i))) == 0) { - return true; - } - } - return false; -} - static void print_type(ldns_rr_type type) { -- 2.47.3