From: Kees Monshouwer Date: Tue, 22 Oct 2019 17:01:27 +0000 (+0200) Subject: auth: remove lua backend X-Git-Tag: dnsdist-1.4.0~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50de1cbad0a557d969caf19d9b6027b334bd5971;p=thirdparty%2Fpdns.git auth: remove lua backend --- diff --git a/build-scripts/test-auth b/build-scripts/test-auth index 0ceda84f62..8ea5de671d 100755 --- a/build-scripts/test-auth +++ b/build-scripts/test-auth @@ -108,10 +108,7 @@ if [ -z "$context" ]; then ./timestamp ./start-test-stop 5300 tinydns || EXITCODE=1 - cd ../modules/luabackend/test2/ - ../../../regression-tests/timestamp ./runtest || EXITCODE=1 - - cd ../../../regression-tests.nobackend/ + cd ../regression-tests.nobackend/ ./runtests || EXITCODE=1 elif [ "$context" = "odbc" ]; then diff --git a/build-scripts/travis.sh b/build-scripts/travis.sh index 9da7b2489b..9dd3231edb 100755 --- a/build-scripts/travis.sh +++ b/build-scripts/travis.sh @@ -392,7 +392,7 @@ build_auth() { run "autoreconf -vi" run "./configure \ ${sanitizerflags} \ - --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 lmdb lua opendbx pipe random remote tinydns godbc lua2' \ + --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 lmdb opendbx pipe random remote tinydns godbc lua2' \ --with-modules='' \ --with-sqlite3 \ --with-libsodium \ @@ -496,8 +496,6 @@ test_auth() { #travis unbound is too old for this test (unbound 1.6.0 required) run "touch tests/ent-asterisk/fail.nsec" - run "./timestamp ./start-test-stop 5300 lua-minimal nowait 0 apex-level-a-but-no-a" - run "./timestamp ./start-test-stop 5300 bind-both" run "./timestamp ./start-test-stop 5300 bind-dnssec-both" run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both" @@ -552,12 +550,7 @@ test_auth() { run "rm tests/ent-asterisk/fail.nsec" - run "cd ../modules/luabackend/test2" - run "../../../regression-tests/timestamp ./runtest" - - run "cd ../../.." - - run "cd regression-tests.rootzone" + run "cd ../regression-tests.rootzone" run "./timestamp ./start-test-stop 5300 bind-both" run "./timestamp ./start-test-stop 5300 bind-dnssec-both" run "./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both" diff --git a/builder-support/debian/authoritative/debian-buster/config/lua.conf b/builder-support/debian/authoritative/debian-buster/config/lua.conf deleted file mode 100644 index e2edf4b8b1..0000000000 --- a/builder-support/debian/authoritative/debian-buster/config/lua.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration for the lua backend -#lua-filename = powerdns-luabackend.lua -#lua-query-logging = no - -# You can also override all the default functionsnames for the luafunctions if you -# want. The prefix is lua-f_=mynewfunction. For example: -#lua-f_lookup = mynewfunction -# -# will call the function 'mynewfunction' for the lookup-routine. -# -# If you want your own configuration parameters you can have that too. -# Just call the function getarg("my_parameter") and it will return the value -# of 'lua-my_parameter'. For boolean you use the function mustdo("my_parameter"). diff --git a/builder-support/debian/authoritative/debian-buster/control b/builder-support/debian/authoritative/debian-buster/control index 14fccb0510..3b79ddea5c 100644 --- a/builder-support/debian/authoritative/debian-buster/control +++ b/builder-support/debian/authoritative/debian-buster/control @@ -228,20 +228,6 @@ Description: sqlite 3 backend for PowerDNS . This package contains a generic SQLite 3 backend for PowerDNS. -Package: pdns-backend-lua -Architecture: any -Depends: pdns-server (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Provides: pdns-backend -Description: Lua backend for PowerDNS - PowerDNS is a versatile nameserver which supports a large number - of different backends ranging from simple zonefiles to relational - databases and load balancing/failover algorithms. - PowerDNS tries to emphasize speed and security. - . - This package contains the Lua backend for PowerDNS. - Package: pdns-backend-lua2 Architecture: any Depends: pdns-server (= ${binary:Version}), diff --git a/builder-support/debian/authoritative/debian-buster/copyright b/builder-support/debian/authoritative/debian-buster/copyright index 5345b6b3ab..b3279e931f 100644 --- a/builder-support/debian/authoritative/debian-buster/copyright +++ b/builder-support/debian/authoritative/debian-buster/copyright @@ -52,10 +52,6 @@ Files: modules/ldapbackend/* pdns/zone2ldap.cc Copyright: 2003-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception -Files: modules/luabackend/* -Copyright: 2011 Fredrik Danerklint -License: GPL-2 with OpenSSL Exception - Files: modules/opendbxbackend/* Copyright: 2005-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception diff --git a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.docs b/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.docs deleted file mode 100644 index e1bae8137e..0000000000 --- a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.docs +++ /dev/null @@ -1 +0,0 @@ -modules/luabackend/README diff --git a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.examples b/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.examples deleted file mode 100644 index d2df686bd4..0000000000 --- a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.examples +++ /dev/null @@ -1 +0,0 @@ -debian/config/lua.conf diff --git a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.install b/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.install deleted file mode 100644 index 3cfcc3799d..0000000000 --- a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/pdns/libluabackend.so* diff --git a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.postinst b/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.postinst deleted file mode 100644 index 1beff20037..0000000000 --- a/builder-support/debian/authoritative/debian-buster/pdns-backend-lua.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -dpkg-trigger pdns-server - -#DEBHELPER# - -exit 0 diff --git a/builder-support/debian/authoritative/debian-buster/rules b/builder-support/debian/authoritative/debian-buster/rules index 26864689bb..6f43408a4d 100755 --- a/builder-support/debian/authoritative/debian-buster/rules +++ b/builder-support/debian/authoritative/debian-buster/rules @@ -9,7 +9,7 @@ CXXFLAGS += -Wall export DEB_BUILD_MAINT_OPTIONS = hardening=+all # Backends -backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lmdb lua lua2 remote random opendbx tinydns +backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lmdb lua2 remote random opendbx tinydns # Disable systemd integration on non-linux archs ifeq ($(DEB_HOST_ARCH_OS),linux) diff --git a/builder-support/debian/authoritative/debian-jessie/config/lua.conf b/builder-support/debian/authoritative/debian-jessie/config/lua.conf deleted file mode 100644 index e2edf4b8b1..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/config/lua.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration for the lua backend -#lua-filename = powerdns-luabackend.lua -#lua-query-logging = no - -# You can also override all the default functionsnames for the luafunctions if you -# want. The prefix is lua-f_=mynewfunction. For example: -#lua-f_lookup = mynewfunction -# -# will call the function 'mynewfunction' for the lookup-routine. -# -# If you want your own configuration parameters you can have that too. -# Just call the function getarg("my_parameter") and it will return the value -# of 'lua-my_parameter'. For boolean you use the function mustdo("my_parameter"). diff --git a/builder-support/debian/authoritative/debian-jessie/control b/builder-support/debian/authoritative/debian-jessie/control index b6d8aaf042..0b3cf231f8 100644 --- a/builder-support/debian/authoritative/debian-jessie/control +++ b/builder-support/debian/authoritative/debian-jessie/control @@ -226,20 +226,6 @@ Description: sqlite 3 backend for PowerDNS . This package contains a generic SQLite 3 backend for PowerDNS. -Package: pdns-backend-lua -Architecture: any -Depends: pdns-server (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Provides: pdns-backend -Description: Lua backend for PowerDNS - PowerDNS is a versatile nameserver which supports a large number - of different backends ranging from simple zonefiles to relational - databases and load balancing/failover algorithms. - PowerDNS tries to emphasize speed and security. - . - This package contains the Lua backend for PowerDNS. - Package: pdns-backend-lua2 Architecture: any Depends: pdns-server (= ${binary:Version}), diff --git a/builder-support/debian/authoritative/debian-jessie/copyright b/builder-support/debian/authoritative/debian-jessie/copyright index 5345b6b3ab..b3279e931f 100644 --- a/builder-support/debian/authoritative/debian-jessie/copyright +++ b/builder-support/debian/authoritative/debian-jessie/copyright @@ -52,10 +52,6 @@ Files: modules/ldapbackend/* pdns/zone2ldap.cc Copyright: 2003-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception -Files: modules/luabackend/* -Copyright: 2011 Fredrik Danerklint -License: GPL-2 with OpenSSL Exception - Files: modules/opendbxbackend/* Copyright: 2005-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.docs b/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.docs deleted file mode 100644 index e1bae8137e..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.docs +++ /dev/null @@ -1 +0,0 @@ -modules/luabackend/README diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.examples b/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.examples deleted file mode 100644 index d2df686bd4..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.examples +++ /dev/null @@ -1 +0,0 @@ -debian/config/lua.conf diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.install b/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.install deleted file mode 100644 index 3cfcc3799d..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/pdns/libluabackend.so* diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.postinst b/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.postinst deleted file mode 100644 index 1beff20037..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-lua.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -dpkg-trigger pdns-server - -#DEBHELPER# - -exit 0 diff --git a/builder-support/debian/authoritative/debian-jessie/rules b/builder-support/debian/authoritative/debian-jessie/rules index 1c77133cc2..a2248701b8 100755 --- a/builder-support/debian/authoritative/debian-jessie/rules +++ b/builder-support/debian/authoritative/debian-jessie/rules @@ -4,7 +4,7 @@ DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Backends -backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua lua2 remote random opendbx tinydns +backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua2 remote random opendbx tinydns # Disable systemd integration on non-linux archs ifeq ($(DEB_HOST_ARCH_OS),linux) diff --git a/builder-support/debian/authoritative/debian-stretch/config/lua.conf b/builder-support/debian/authoritative/debian-stretch/config/lua.conf deleted file mode 100644 index e2edf4b8b1..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/config/lua.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration for the lua backend -#lua-filename = powerdns-luabackend.lua -#lua-query-logging = no - -# You can also override all the default functionsnames for the luafunctions if you -# want. The prefix is lua-f_=mynewfunction. For example: -#lua-f_lookup = mynewfunction -# -# will call the function 'mynewfunction' for the lookup-routine. -# -# If you want your own configuration parameters you can have that too. -# Just call the function getarg("my_parameter") and it will return the value -# of 'lua-my_parameter'. For boolean you use the function mustdo("my_parameter"). diff --git a/builder-support/debian/authoritative/debian-stretch/control b/builder-support/debian/authoritative/debian-stretch/control index 14fccb0510..3b79ddea5c 100644 --- a/builder-support/debian/authoritative/debian-stretch/control +++ b/builder-support/debian/authoritative/debian-stretch/control @@ -228,20 +228,6 @@ Description: sqlite 3 backend for PowerDNS . This package contains a generic SQLite 3 backend for PowerDNS. -Package: pdns-backend-lua -Architecture: any -Depends: pdns-server (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Provides: pdns-backend -Description: Lua backend for PowerDNS - PowerDNS is a versatile nameserver which supports a large number - of different backends ranging from simple zonefiles to relational - databases and load balancing/failover algorithms. - PowerDNS tries to emphasize speed and security. - . - This package contains the Lua backend for PowerDNS. - Package: pdns-backend-lua2 Architecture: any Depends: pdns-server (= ${binary:Version}), diff --git a/builder-support/debian/authoritative/debian-stretch/copyright b/builder-support/debian/authoritative/debian-stretch/copyright index 5345b6b3ab..b3279e931f 100644 --- a/builder-support/debian/authoritative/debian-stretch/copyright +++ b/builder-support/debian/authoritative/debian-stretch/copyright @@ -52,10 +52,6 @@ Files: modules/ldapbackend/* pdns/zone2ldap.cc Copyright: 2003-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception -Files: modules/luabackend/* -Copyright: 2011 Fredrik Danerklint -License: GPL-2 with OpenSSL Exception - Files: modules/opendbxbackend/* Copyright: 2005-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.docs b/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.docs deleted file mode 100644 index e1bae8137e..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.docs +++ /dev/null @@ -1 +0,0 @@ -modules/luabackend/README diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.examples b/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.examples deleted file mode 100644 index d2df686bd4..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.examples +++ /dev/null @@ -1 +0,0 @@ -debian/config/lua.conf diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.install b/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.install deleted file mode 100644 index 3cfcc3799d..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/pdns/libluabackend.so* diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.postinst b/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.postinst deleted file mode 100644 index 1beff20037..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-lua.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -dpkg-trigger pdns-server - -#DEBHELPER# - -exit 0 diff --git a/builder-support/debian/authoritative/debian-stretch/rules b/builder-support/debian/authoritative/debian-stretch/rules index ee792b2627..3f0806e2f9 100755 --- a/builder-support/debian/authoritative/debian-stretch/rules +++ b/builder-support/debian/authoritative/debian-stretch/rules @@ -4,7 +4,7 @@ DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Backends -backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lmdb lua lua2 remote random opendbx tinydns +backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lmdb lua2 remote random opendbx tinydns # Disable systemd integration on non-linux archs ifeq ($(DEB_HOST_ARCH_OS),linux) diff --git a/builder-support/debian/authoritative/ubuntu-trusty/config/lua.conf b/builder-support/debian/authoritative/ubuntu-trusty/config/lua.conf deleted file mode 100644 index e2edf4b8b1..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/config/lua.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration for the lua backend -#lua-filename = powerdns-luabackend.lua -#lua-query-logging = no - -# You can also override all the default functionsnames for the luafunctions if you -# want. The prefix is lua-f_=mynewfunction. For example: -#lua-f_lookup = mynewfunction -# -# will call the function 'mynewfunction' for the lookup-routine. -# -# If you want your own configuration parameters you can have that too. -# Just call the function getarg("my_parameter") and it will return the value -# of 'lua-my_parameter'. For boolean you use the function mustdo("my_parameter"). diff --git a/builder-support/debian/authoritative/ubuntu-trusty/control b/builder-support/debian/authoritative/ubuntu-trusty/control index e31125f0cc..e33d4cba56 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/control +++ b/builder-support/debian/authoritative/ubuntu-trusty/control @@ -222,20 +222,6 @@ Description: sqlite 3 backend for PowerDNS . This package contains a generic SQLite 3 backend for PowerDNS. -Package: pdns-backend-lua -Architecture: any -Depends: pdns-server (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Provides: pdns-backend -Description: Lua backend for PowerDNS - PowerDNS is a versatile nameserver which supports a large number - of different backends ranging from simple zonefiles to relational - databases and load balancing/failover algorithms. - PowerDNS tries to emphasize speed and security. - . - This package contains the Lua backend for PowerDNS. - Package: pdns-backend-lua2 Architecture: any Depends: pdns-server (= ${binary:Version}), diff --git a/builder-support/debian/authoritative/ubuntu-trusty/copyright b/builder-support/debian/authoritative/ubuntu-trusty/copyright index 5345b6b3ab..b3279e931f 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/copyright +++ b/builder-support/debian/authoritative/ubuntu-trusty/copyright @@ -52,10 +52,6 @@ Files: modules/ldapbackend/* pdns/zone2ldap.cc Copyright: 2003-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception -Files: modules/luabackend/* -Copyright: 2011 Fredrik Danerklint -License: GPL-2 with OpenSSL Exception - Files: modules/opendbxbackend/* Copyright: 2005-2007 Norbert Sendetzky License: GPL-2 with OpenSSL Exception diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.docs b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.docs deleted file mode 100644 index e1bae8137e..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.docs +++ /dev/null @@ -1 +0,0 @@ -modules/luabackend/README diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.examples b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.examples deleted file mode 100644 index d2df686bd4..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.examples +++ /dev/null @@ -1 +0,0 @@ -debian/config/lua.conf diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.install b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.install deleted file mode 100644 index 3cfcc3799d..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/pdns/libluabackend.so* diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.postinst b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.postinst deleted file mode 100644 index 1beff20037..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-lua.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -dpkg-trigger pdns-server - -#DEBHELPER# - -exit 0 diff --git a/builder-support/debian/authoritative/ubuntu-trusty/rules b/builder-support/debian/authoritative/ubuntu-trusty/rules index b766a58ad5..89d4b0ad08 100755 --- a/builder-support/debian/authoritative/ubuntu-trusty/rules +++ b/builder-support/debian/authoritative/ubuntu-trusty/rules @@ -4,7 +4,7 @@ DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Backends -backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua lua2 remote random opendbx tinydns +backends := bind ldap pipe gmysql godbc gpgsql gsqlite3 geoip lua2 remote random opendbx tinydns # Use new build system diff --git a/builder-support/specs/pdns.spec b/builder-support/specs/pdns.spec index 839b1415f4..856d6ec3e4 100644 --- a/builder-support/specs/pdns.spec +++ b/builder-support/specs/pdns.spec @@ -113,15 +113,6 @@ BuildRequires: openldap-devel %description backend-ldap This package contains the LDAP backend for %{name} -%package backend-lua -Summary: Lua backend for %{name} -Group: System Environment/Daemons -Requires: %{name}%{?_isa} = %{version}-%{release} -%global backends %{backends} lua - -%description backend-lua -This package contains the lua backend for %{name} - %package backend-lua2 Summary: Lua backend for %{name} Group: System Environment/Daemons @@ -387,9 +378,6 @@ fi %doc modules/ldapbackend/dnsdomain2.schema %doc modules/ldapbackend/pdns-domaininfo.schema -%files backend-lua -%{_libdir}/%{name}/libluabackend.so - %files backend-lua2 %{_libdir}/%{name}/liblua2backend.so diff --git a/configure.ac b/configure.ac index af00987fbd..eeec215237 100644 --- a/configure.ac +++ b/configure.ac @@ -341,7 +341,6 @@ AC_CONFIG_FILES([ modules/gsqlite3backend/Makefile modules/ldapbackend/Makefile modules/lmdbbackend/Makefile - modules/luabackend/Makefile modules/lua2backend/Makefile modules/opendbxbackend/Makefile modules/pipebackend/Makefile diff --git a/docs/backends/index.rst b/docs/backends/index.rst index 23b8de27d5..91060250f4 100644 --- a/docs/backends/index.rst +++ b/docs/backends/index.rst @@ -22,8 +22,6 @@ The following table describes the supported backends and some of their capabilit +------------------------------------------------+--------+--------+-------+--------------+---------------------------------+--------------+ | :doc:`LMDB ` | Yes | Yes | Yes | No | Yes | ``lmdb`` | +------------------------------------------------+--------+--------+-------+--------------+---------------------------------+--------------+ -| :doc:`Lua ` | Yes | Yes | No | No | Yes | ``lua`` | -+------------------------------------------------+--------+--------+-------+--------------+---------------------------------+--------------+ | :doc:`Lua2 ` | Yes | Yes | No | No | Yes | ``lua2`` | +------------------------------------------------+--------+--------+-------+--------------+---------------------------------+--------------+ | :doc:`OpenDBX ` | Yes | Yes | Yes | Yes | No | ``opendbx`` | @@ -53,7 +51,6 @@ These backends have :doc:`features unique ` to the generic SQL back geoip ldap lmdb - lua lua2 opendbx pipe diff --git a/docs/backends/lua.rst b/docs/backends/lua.rst deleted file mode 100644 index a45ca26d72..0000000000 --- a/docs/backends/lua.rst +++ /dev/null @@ -1,203 +0,0 @@ -Lua Backend -=========== - -* Native: Yes -* Master: Yes -* Slave: No -* Superslave: No -* Autoserial: No -* DNSSEC: Yes -* Disabled data: Yes -* Comments: Yes -* Module name: lua -* Launch name: ``lua`` - -The main author for this module is Fredrik Danerklint. - -This backend is just a "glue" between PowerDNS and your own Lua -application. - -What this means is that you can not have a working setup that can serve -you dns-questions directly from start. What you need to do is to program -your own backend completely in Lua! Which database server to use etc is -now up to you! - -What you have here is the possibility to make your own "dns-server" -without the knowledge of programming in c/c++. - -There is one thing that needs to be said. Remember that each thread -PowerDNS launches of this backend is completely different so they cannot -share information between each other! - -You will need some kind of a database that can be shared for this. - -All the functionnames that PowerDNS accept for a backend should be the -same in your Lua script, in lowercase. Also, the parameters should be in -the same order. Where there is a structure in c/c++ there is a table in -the Lua backend. This is also true for return values. A few functions -expect that you return a table in a table. - -New functions -------------- - -There is a couple of new functions for you to use in Lua: - -``logger(log_facility, "your", "messages")`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -All these ``log_facilities`` is available: - -* ``log_all`` -* ``log_ntlog`` -* ``log_alert`` -* ``log_critical`` -* ``log_error`` -* ``log_warning`` -* ``log_notice,`` -* ``log_info`` -* ``log_debug`` -* ``log_none`` - -``dnspacket()`` -~~~~~~~~~~~~~~~ - -This will give you back three parameters with ``remote_ip``, -``remote_port`` and ``local_ip`` in that order. - -Can only be used in the functions ``list()`` and ``getsoa()``. - -.. _backends_lua_fun_getarg: - -``getarg("PARAMETER")`` -~~~~~~~~~~~~~~~~~~~~~~~ - -This one tries to get the value of the name ``"lua-PARAMETER"`` from the -pdns.conf file. - -``mustdo("PARAMETER")`` -~~~~~~~~~~~~~~~~~~~~~~~ - -This is the same as :ref:`getarg() `, but returns -a boolean instead of a string. - -You also have all the different QTypes in a table called 'QTypes'. - -What has been tested --------------------- - -The only functionality of the minimal functions except zone-transfer has -been tested. - -In the included powerdns-luabackend.lua file there is a example of how -this can be done. Note that this is more or less a static example since -there is no possibility for each thread to know when something has -changed. - -However, you can run ``pdns_control reload`` and it should reload the -whole thing from scratch (does not work for the moment, PowerDNS only -calls two thread with the reload command - not all of them). - -What you will find under the test directory -------------------------------------------- - -The following script can be used to test the server: - -This will yield the following result: - -.. code-block:: shell - - $ dig any www.test.com @127.0.0.1 -p5300 +multiline - ; <<>> DiG 9.7.3 <<>> any www.test.com @127.0.0.1 -p5300 +multiline - ;; global options: +cmd - ;; Got answer: - ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1001 - ;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 - ;; WARNING: recursion requested but not available - - ;; QUESTION SECTION: - ;www.test.com. IN ANY - - ;; ANSWER SECTION: - www.test.com. 120 IN CNAME host.test.com. - host.test.com. 120 IN A 10.11.12.13 - host.test.com. 120 IN AAAA 1:2:3:4:5:6:7:8 - - ;; Query time: 1 msec - ;; SERVER: 127.0.0.1#5300(127.0.0.1) - ;; WHEN: Thu Jun 2 22:19:56 2011 - ;; MSG SIZE rcvd: 93 - -Parameters ----------- - -.. _setting-lua-filename: - -``lua-filename`` -~~~~~~~~~~~~~~~~ - -Path to your lua script, 'powerdns-luabackend.lua' by default. - -.. _setting-lua-query-logging: - -``lua-query-logging`` -~~~~~~~~~~~~~~~~~~~~~ - -Log queries. default is 'no'. - -.. _setting-lua-f_FUNCTION: - -``lua-f_FUNCTION=NEWFUNCTION`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can also override all the default functionsnames for the -luafunctions if you want. For example: - -.. _setting-lua-f_lookup: - -.. code-block:: ini - - lua-f_lookup = mynewfunction - -will call the function ``mynewfunction`` for the lookup-routine. - -If you want your own configuration parameters you can have that too. -Just call the function ``getarg("PARAMETER")`` and it will return the -value of ``lua-PARAMETER``. For boolean you use the function -``mustdo("PARAMETER")``. - -Your own error function in lua -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -You can have an error function in Lua when Lua gives back a error. - -First make your error function then you put this in ``pdns.conf``: - -.. code-block:: ini - - lua-f_exec_error = YOUR_METHOD - -DNSSEC ------- - -You can have full dnssec support in our Lua application. You should note -the following regarding this: - -You don't have to implement the function 'updateDNSSECOrderAndAuth' -since the default code will work correctly for you via the backend -itself. - -The functions activateDomainKey and deactivateDomainKey can be -implemented via a new function called updateDomainKey, which has three -parameters (the other two has only two parameters) where the third is a -boolean which is true or false depending on which function that was -called from the beginning. - -Information for logging ------------------------ - -If you have the parameter ``query-logging`` or ``lua-query-logging`` set -to true/yes/on, then you will see what is happening in each function -when PowerDNS calls them. - -This can, hopefully, help you with some debugging if you run into some -kind of trouble with your Lua application. diff --git a/modules/Makefile.am b/modules/Makefile.am index f0b697e7bc..4995934a16 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -9,7 +9,6 @@ DIST_SUBDIRS = \ gsqlite3backend \ ldapbackend \ lmdbbackend \ - luabackend \ lua2backend \ opendbxbackend \ pipebackend \ diff --git a/modules/luabackend/Makefile.am b/modules/luabackend/Makefile.am deleted file mode 100644 index 33ac5b6056..0000000000 --- a/modules/luabackend/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -AM_CPPFLAGS += $(LUA_CFLAGS) - -EXTRA_DIST = OBJECTFILES OBJECTLIBS - -pkglib_LTLIBRARIES = libluabackend.la - -libluabackend_la_SOURCES = \ - dnssec.cc \ - lua_functions.cc lua_functions.hh \ - luabackend.cc luabackend.hh \ - master.cc \ - minimal.cc \ - private.cc \ - reload.cc \ - slave.cc \ - supermaster.cc - -libluabackend_la_LDFLAGS = -module -avoid-version -libluabackend_la_LIBADD = $(LUA_LIBS) diff --git a/modules/luabackend/OBJECTFILES b/modules/luabackend/OBJECTFILES deleted file mode 100644 index 0906c9196c..0000000000 --- a/modules/luabackend/OBJECTFILES +++ /dev/null @@ -1 +0,0 @@ -luabackend.lo minimal.lo reload.lo lua_functions.lo master.lo private.lo slave.lo supermaster.lo dnssec.lo \ No newline at end of file diff --git a/modules/luabackend/OBJECTLIBS b/modules/luabackend/OBJECTLIBS deleted file mode 100644 index 9094a029cd..0000000000 --- a/modules/luabackend/OBJECTLIBS +++ /dev/null @@ -1 +0,0 @@ -$(LUA_LIBS) diff --git a/modules/luabackend/README b/modules/luabackend/README deleted file mode 100644 index f49f50e88f..0000000000 --- a/modules/luabackend/README +++ /dev/null @@ -1,191 +0,0 @@ -==================================== -This is the luabackend for PowerDNS! -==================================== - -Note: shortly before the 3.2 release of PowerDNS, Fredrik Danerklinkt -(author of this Luabackend) opened https://github.com/fredan/luabackend -and is doing development there. - - -http://www.lua.org for more information about what Lua really is. - - -This backend is just a "glue" between PowerDNS and your own Lua application. - -What this means is that you can not have a working setup that can serve you -dns-questions directly from start. What you need to do is to program your own -backend completely in Lua! Which database server to use etc is now up to you! - -What you have here is the possibility to make your own "dns-server" without the -knowledge of programming in c/c++. - -There is one thing that needs to be said. Remember that each thread -PowerDNS launches of this backend is completely different so they cannot -share information between each other! - -You will need some kind of a database that can be shared for this. - -All the functionnames that PowerDNS accept for a backend should be the same -in your Lua script, in lowercase. Also, the parameters should be in the same -order. Where there is a structure in c/c++ there is a table in the Lua backend. -This is also true for return values. A few functions expect that you return a -table in a table. - - -============= -NEW FUNCTIONS -============= - -There is a couple of new functions for you to use in Lua: - ----------------------------------------- -logger(log_facility, "your", "messages") ----------------------------------------- - -All these log_facilities is available: -log_all, log_ntlog, log_alert, log_critical, log_error, log_warning, log_notice, -log_info, log_debug, log_none - - ------------ -dnspacket() ------------ - -This will give you back three parameters with -remote_ip, remote_port and local_ip in that order. - -Can only be used in the functions list() and getsoa(). - - ------------------------- -getarg("your_parameter") ------------------------- - -This one tries to get the value of the name "lua-your_parameter" from the -pdns.conf file. - - ------------------------- -mustdo("your_parameter") ------------------------- - -This is the same as getarg() but return a boolean instead of a string. - - -You also have all the different QTypes in a table called 'QTypes'. - - -==================== -WHAT HAS BEEN TESTED -==================== - -The only functionality of the minimal functions except zone-transfer has -been tested. - -In the included powerdns-luabackend.lua file there is a example of how -this can be done. Note that this is more or less a static example since -there is no possibility for each thread to know when something has changed. - -However, you can run 'pdns_control reload' and it should reload the hole thing -from scratch (does not work for the moment, PowerDNS only calls two thread with -the reload command - not all of them). - - -=========================================== -WHAT YOU WILL FIND UNDER THE TEST DIRECTORY -=========================================== - -The script 'pdns' is used to test the server on the ip address '127.0.0.1' with -the port 5300. You should be able to run the following test with the included -'powerdns-luabackend.lua' file: - -$dig any www.test.com @127.0.0.1 -p5300 +multiline -; <<>> DiG 9.7.3 <<>> any www.test.com @127.0.0.1 -p5300 +multiline -;; global options: +cmd -;; Got answer: -;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1001 -;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 -;; WARNING: recursion requested but not available - -;; QUESTION SECTION: -;www.test.com. IN ANY - -;; ANSWER SECTION: -www.test.com. 120 IN CNAME host.test.com. -host.test.com. 120 IN A 10.11.12.13 -host.test.com. 120 IN AAAA 1:2:3:4:5:6:7:8 - -;; Query time: 1 msec -;; SERVER: 127.0.0.1#5300(127.0.0.1) -;; WHEN: Thu Jun 2 22:19:56 2011 -;; MSG SIZE rcvd: 93 - - -============================= -OPTIONS IN THE CONFIGURE FILE -============================= - -The default values is: - -lua-filename = powerdns-luabackend.lua -lua-query-logging = no - -You can also override all the default functionsnames for the luafunctions if you -want. The prefix is lua-f_=mynewfunction. For example: - -lua-f_lookup = mynewfunction - -will call the function 'mynewfunction' for the lookup-routine. - -If you want your own configuration parameters you can have that too. -Just call the function getarg("my_parameter") and it will return the value -of 'lua-my_parameter'. For boolean you use the function mustdo("my_parameter"). - - -============================== -YOUR OWN ERROR FUNCTION IN LUA -============================== - -You can have an error function in Lua when Lua gives back a error. - -First make your error function then you put this in pdns.conf: - -lua-f_exec_error = - - -====== -DNSSEC -====== - -You can have full dnssec support in our Lua application. You should note the -following regarding this: - -You don't have to implement the function 'updateDNSSECOrderAndAuth' since the -default code will work correctly for you via the backend itself. - -The functions activateDomainKey and deactivateDomainKey can be implemented via a -new function called updateDomainKey, which has three parameters (the other two -has only two parameters) where the third is a boolean which is true or false -depending on which function that was called from the beginning. - - -======================= -INFORMATION FOR LOGGING -======================= - -If you have the parameter 'query-logging' or 'lua-query-logging' set to -true/yes/on, then you will see what is happening in each function when PowerDNS -calls them. - -This can, hopefully, help you with some debugging if you run into some kind of -trouble with your Lua application. - - -=============== -ASKING QUESTION -=============== - -You can send question about this backend to >dev/null first and if you don't get any -answer from that you can try to send them to me at fredan-pdns@fredan.org - -Fredrik Danerklint. \ No newline at end of file diff --git a/modules/luabackend/dnssec.cc b/modules/luabackend/dnssec.cc deleted file mode 100644 index 0edbacf832..0000000000 --- a/modules/luabackend/dnssec.cc +++ /dev/null @@ -1,604 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - - -bool LUABackend::updateDNSSECOrderAndAuth(uint32_t domain_id, const DNSName& zonename, const DNSName& qname, bool auth) { - - if(f_lua_updatednssecorderandauth == 0) { - - if(logging) - g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl; - - string ins=qname.makeRelative(zonename).makeLowerCase().labelReverse().toString(" ", false); - return this->updateDNSSECOrderAndAuthAbsolute(domain_id, qname, ins, auth); - } - - if(logging) - g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) BEGIN domain_id: '" << domain_id << "' zonename: '" << zonename << "' qname: '" << qname << "' auth: '" << auth << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauth); - - lua_pushinteger(lua, domain_id); - lua_pushstring(lua, zonename.toString().c_str()); - lua_pushstring(lua, qname.toString().c_str()); - lua_pushboolean(lua, auth); - - if(lua_pcall(lua, 4, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuth) END" << endl; - - return ok; -} - -bool LUABackend::updateDNSSECOrderNameAndAuth(unsigned int, DNSName const&, DNSName const&, bool, unsigned short) -{ - return false; -} - -bool LUABackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const DNSName& qname, const std::string& ordername, bool auth) { - - if(f_lua_updatednssecorderandauthabsolute == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) BEGIN domain_id: '" << domain_id << "' qname: '" << qname << "' ordername: '" << ordername << "' auth: '" << auth << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauthabsolute); - - lua_pushinteger(lua, domain_id); - lua_pushstring(lua, qname.toString().c_str()); - lua_pushstring(lua, ordername.c_str()); - lua_pushboolean(lua, auth); - - if(lua_pcall(lua, 4, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(updateDNSSECOrderAndAuthAbsolute) END" << endl; - - return ok; -} - -bool LUABackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) { - - if(f_lua_getbeforeandafternamesabsolute == 0) - return false; - - unhashed.clear(); - before.clear(); - after.clear(); - - if(logging) - g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) BEGIN id: '" << id << "' qname: '" << qname << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatednssecorderandauthabsolute); - - lua_pushinteger(lua, id); - lua_pushstring(lua, qname.toString().c_str()); - - if(lua_pcall(lua, 2, 3, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = returnedwhat == LUA_TSTRING; - - if (!ok) { - if(logging) - g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) ERROR!" << endl; - - return false; - } - - //will this be correct since we are poping one at the time? - unhashed = DNSName(lua_tostring(lua, -1)); - lua_pop(lua, 1); - - returnedwhat = lua_type(lua, -1); - ok = (returnedwhat == LUA_TSTRING) && ok; - - before = DNSName(lua_tostring(lua, -1)); - lua_pop(lua, 1); - - returnedwhat = lua_type(lua, -1); - ok = (returnedwhat == LUA_TSTRING) && ok; - - after = DNSName(lua_tostring(lua, -1)); - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(getBeforeAndAfterNamesAbsolute) END unhashed: '" << unhashed << "' before: '" << before << "' after: '" << after << "' " << endl; - - return ok; -} - -bool LUABackend::updateDomainKey(const DNSName& name, unsigned int &id, bool toowhat ) { - - if(f_lua_updatedomainkey == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(updateDomainKey) BEGIN name: '" << name << "' id: '" << id << "' toowhat: '" << toowhat << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_updatedomainkey); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushinteger(lua, id); - lua_pushboolean(lua, toowhat); - - if(lua_pcall(lua, 3, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(updateDomainKey) END" << endl; - - return ok; -} - -bool LUABackend::activateDomainKey(const DNSName& name, unsigned int id) { - - if(f_lua_activatedomainkey == 0) - return updateDomainKey(name, id, true); - - if(logging) - g_log << Logger::Info << backend_name << "(activateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_activatedomainkey); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushinteger(lua, id); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(activateDomainKey) END" << endl; - - return ok; -} - -bool LUABackend::deactivateDomainKey(const DNSName& name, unsigned int id) { - - if(f_lua_deactivatedomainkey == 0) - return updateDomainKey(name, id, false); - - if(logging) - g_log << Logger::Info << backend_name << "(deactivateDomainKey) BEGIN name: '" << name << "' id: '" << id << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_deactivatedomainkey); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushinteger(lua, id); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(deactivateDomainKey) END" << endl; - - return ok; -} - -bool LUABackend::removeDomainKey(const DNSName& name, unsigned int id) { - - if(f_lua_removedomainkey == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(removeDomainKey) BEGIN name: '" << name << "' id: '" << id << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_removedomainkey); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushinteger(lua, id); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(removeDomainKey) END" << endl; - - return ok; -} - -// TODO: tcely: Find out about the logging situation and remove cerr if possible. -bool LUABackend::addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) { -// there is no logging function in pdnsutil when running this routine? - -//key = id, flags, active, content - - if(f_lua_adddomainkey == 0) - return false; - - if(logging) - //g_log << Logger::Info << backend_name << "(addDomainKey) BEGIN name: '" << name << "' id: '" << id << endl; - cerr << backend_name << "(addDomainKey) BEGIN name: '" << name << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_adddomainkey); - - lua_pushstring(lua, name.toString().c_str()); - - lua_newtable(lua); - - lua_pushliteral(lua, "flags"); - lua_pushinteger(lua, key.flags); - lua_settable(lua, -3); - - lua_pushliteral(lua, "active"); - lua_pushboolean(lua, key.active); - lua_settable(lua, -3); - - lua_pushliteral(lua, "content"); - lua_pushstring(lua, key.content.c_str()); - lua_settable(lua, -3); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - int ok = -1; - - if (returnedwhat == LUA_TNUMBER) - ok = lua_tonumber(lua, -1); - - lua_pop(lua, 1); - - if(logging) - cerr << backend_name << "(addDomainKey) END" << endl; - - return ok >= 0; -} - -bool LUABackend::getDomainKeys(const DNSName& name, std::vector& keys) { - if(f_lua_getdomainkeys == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(getDomainKeys) BEGIN name: '" << name << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomainkeys); - - lua_pushstring(lua, name.toString().c_str()); - - if(lua_pcall(lua, 1, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - - if (returnedwhat != LUA_TTABLE) { - lua_pop(lua, 1); - if(logging) - g_log << Logger::Info << backend_name << "(getDomainKeys) ERROR!" << endl; - - return false; - } - - lua_pushnil(lua); - - int j = 0; - - while (lua_next(lua, -2)) { - returnedwhat = lua_type(lua, -1); - if (returnedwhat == LUA_TTABLE) { - KeyData kd; - bool i,f,a,c = false; - - i = getValueFromTable(lua, "id", kd.id); - f = getValueFromTable(lua, "flags", kd.flags); - a = getValueFromTable(lua, "active", kd.active); - c = getValueFromTable(lua, "content", kd.content); - - if (i && f && a && c) { - j++; - keys.push_back(kd); - } - } - - lua_pop(lua,1); - } - - if(logging) - g_log << Logger::Info << backend_name << "(getDomainKeys) END" << endl; - - return j > 0; -} - -bool LUABackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) { - - if(f_lua_gettsigkey == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(getTSIGKey) BEGIN name: '" << name << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_gettsigkey); - - lua_pushstring(lua, name.toString().c_str()); - - if(lua_pcall(lua, 1, 2, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - if ( (lua_type(lua, -1) != LUA_TSTRING) && (lua_type(lua, -2) != LUA_TSTRING) ) { - lua_pop(lua, 2); - if(logging) - g_log << Logger::Info << backend_name << "(getTSIGKey) ERROR" << endl; - return false; - } - - string a,c = ""; - - a = lua_tostring(lua, -1); - lua_pop(lua, 1); - - c = lua_tostring(lua, -1); - lua_pop(lua, 1); - - *algorithm = DNSName(a); - *content = c; - - if(logging) - g_log << Logger::Info << backend_name << "(getTSIGKey) END" << endl; - - return true; -} - -bool LUABackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) { - - if(f_lua_setdomainmetadata == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(setDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setdomainmetadata); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushstring(lua, kind.c_str()); - - lua_newtable(lua); - - std::vector::const_iterator i; - - int c = 0; - - for(i = meta.begin(); ic_str()); - lua_settable(lua, -3); - } - - if(lua_pcall(lua, 3, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if(logging) - g_log << Logger::Info << backend_name << "(setDomainMetadata) END" << endl; - - return ok; - -} - -bool LUABackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) { - if(f_lua_getdomainmetadata == 0) - return false; - - if(logging) - g_log << Logger::Info << backend_name << "(getDomainMetadata) BEGIN name: '" << name << "' kind: '" << kind << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomainmetadata); - - lua_pushstring(lua, name.toString().c_str()); - lua_pushstring(lua, kind.c_str()); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - if (lua_type(lua, -1) != LUA_TTABLE) - return false; - - lua_pushnil(lua); - - int j = 0; - size_t returnedwhat; - - while (lua_next(lua, -2)) { - returnedwhat = lua_type(lua, -1); - if (returnedwhat == LUA_TSTRING) { - j++; - meta.push_back(lua_tostring(lua, -1)); - } - - lua_pop(lua,1); - } - - if(logging) - g_log << Logger::Info << backend_name << "(getDomainMetadata) END" << endl; - - return j > 0; - -} - -void LUABackend::alsoNotifies(const DNSName& domain, set *ips) { - - if(f_lua_alsonotifies == 0) - return; - - if(logging) - g_log << Logger::Info << backend_name << "(alsonotifies) BEGIN domain: '" << domain << "'" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_alsonotifies); - - lua_pushstring(lua, domain.toString().c_str()); - - if(lua_pcall(lua, 1, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return; - } - - if (lua_type(lua, -1) != LUA_TTABLE) - return; - - lua_pushnil(lua); - - size_t returnedwhat; - - while (lua_next(lua, -2)) { - returnedwhat = lua_type(lua, -1); - if (returnedwhat == LUA_TSTRING) { - ips->insert(lua_tostring(lua, -1)); - } - - lua_pop(lua,1); - } - - if(logging) - g_log << Logger::Info << backend_name << "(alsoNotifies) END" << endl; - - return; - -} diff --git a/modules/luabackend/lua_functions.cc b/modules/luabackend/lua_functions.cc deleted file mode 100644 index fed16400c8..0000000000 --- a/modules/luabackend/lua_functions.cc +++ /dev/null @@ -1,377 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#define LUABACKEND_EXTERN_F_HH - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" -#include "pdns/dnspacket.hh" - -#include -#include -using namespace std; - -// It seems we don't want the coroutine standard library so we can't use -// luaL_openlibs(). FIXME: is the coroutine library really that bad? -const luaL_Reg lualibs[] = { -#if LUA_VERSION_NUM < 502 - {"", luaopen_base}, -#else - {"_G", luaopen_base}, -#endif - {LUA_LOADLIBNAME, luaopen_package}, - {LUA_TABLIBNAME, luaopen_table}, - {LUA_IOLIBNAME, luaopen_io}, - {LUA_OSLIBNAME, luaopen_os}, - {LUA_STRLIBNAME, luaopen_string}, - {LUA_MATHLIBNAME, luaopen_math}, - {LUA_DBLIBNAME, luaopen_debug}, -#if LUA_VERSION_NUM >= 502 - //{LUA_COLIBNAME, luaopen_coroutine}, -#endif -#if LUA_VERSION_NUM == 502 || defined(LUA_COMPAT_BITLIB) - {LUA_BITLIBNAME, luaopen_bit32}, -#endif -#if LUA_VERSION_NUM == 503 - {LUA_UTF8LIBNAME, luaopen_utf8}, -#endif -#ifdef USE_LUAJIT - {"bit", luaopen_bit}, - {"jit", luaopen_jit}, -#endif - {NULL, NULL} -}; - -int my_lua_panic (lua_State *lua_state) { - lua_getfield(lua_state, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua_state, -1); - - assert(lua_state == lb->lua); - - stringstream e; - - e << lb->backend_name << "LUA PANIC! '" << lua_tostring(lua_state,-1) << "'" << endl; - - throw LUAException (e.str()); - - return 0; -} - -int l_arg_get (lua_State *lua_state) { - int i = lua_gettop(lua_state); - if (i < 1) - return 0; - - lua_getfield(lua_state, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua_state, -1); - - string a = lua_tostring(lua_state, 1); - - if (lb->my_isEmpty(a)) - lua_pushnil(lua_state); - else - lua_pushstring(lua_state, lb->my_getArg(a).c_str()); - - return 1; -} - -int l_arg_mustdo (lua_State *lua_state) { - int i = lua_gettop(lua_state); - if (i < 1) - return 0; - - lua_getfield(lua_state, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua_state, -1); - - string a = lua_tostring(lua_state, 1); - - if (lb->my_isEmpty(a)) - lua_pushnil(lua_state); - else - lua_pushboolean(lua_state, lb->my_mustDo(a)); - - return 1; -} - -int l_dnspacket (lua_State *lua_state) { - lua_getfield(lua_state, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua_state, -1); - - if (lb->dnspacket == NULL) { - lua_pushnil(lua_state); - - return 1; - } - - lua_pushstring(lua_state, lb->dnspacket->getRemote().toString().c_str()); - lua_pushinteger(lua_state, lb->dnspacket->getRemotePort()); - lua_pushstring(lua_state, lb->dnspacket->getLocal().toString().c_str()); - lua_pushstring(lua_state, lb->dnspacket->getRealRemote().toString().c_str()); - - return 4; -} - -int l_logger (lua_State *lua_state) { - - int i = lua_gettop(lua_state); - if (i < 1) - return 0; - - lua_getfield(lua_state, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua_state, -1); - - int log_level = 0; - stringstream s; - int j; - const char *ss; - - log_level = lua_tointeger(lua_state, 1); - - string space = ""; - - for(j=2; j<=i; j++) { - ss = lua_tostring(lua_state, j); - s << space << ss; - space = " "; - } - - g_log.log(lb->backend_name + s.str(), (Logger::Urgency) log_level); - - return 0; -} - -void register_lua_functions(lua_State *lua_state) { - lua_gc(lua_state, LUA_GCSTOP, 0); // stop collector during initialization - - const luaL_Reg *lib = lualibs; - for (; lib->func; lib++) { -#if LUA_VERSION_NUM < 502 - lua_pushcfunction(lua_state, lib->func); - lua_pushstring(lua_state, lib->name); - lua_call(lua_state, 1, 0); -#else - luaL_requiref(lua_state, lib->name, lib->func, 1); - lua_pop(lua_state, 1); /* remove lib */ -#endif - } - - lua_gc(lua_state, LUA_GCRESTART, 0); - - lua_pushinteger(lua_state, Logger::All); - lua_setglobal(lua_state, "log_all"); - - lua_pushinteger(lua_state, Logger::Alert); - lua_setglobal(lua_state, "log_alert"); - - lua_pushinteger(lua_state, Logger::Critical); - lua_setglobal(lua_state, "log_critical"); - - lua_pushinteger(lua_state, Logger::Error); - lua_setglobal(lua_state, "log_error"); - - lua_pushinteger(lua_state, Logger::Warning); - lua_setglobal(lua_state, "log_warning"); - - lua_pushinteger(lua_state, Logger::Notice); - lua_setglobal(lua_state, "log_notice"); - - lua_pushinteger(lua_state, Logger::Info); - lua_setglobal(lua_state, "log_info"); - - lua_pushinteger(lua_state, Logger::Debug); - lua_setglobal(lua_state, "log_debug"); - - lua_pushinteger(lua_state, Logger::None); - lua_setglobal(lua_state, "log_none"); - - lua_pushcfunction(lua_state, l_dnspacket); - lua_setglobal(lua_state, "dnspacket"); - - lua_pushcfunction(lua_state, l_logger); - lua_setglobal(lua_state, "logger"); - - lua_pushcfunction(lua_state, l_arg_get); - lua_setglobal(lua_state, "getarg"); - - lua_pushcfunction(lua_state, l_arg_mustdo); - lua_setglobal(lua_state, "mustdo"); - - lua_newtable(lua_state); - for(vector::const_iterator iter = QType::names.begin(); iter != QType::names.end(); ++iter) { - lua_pushinteger(lua_state, iter->second); - lua_setfield(lua_state, -2, iter->first.c_str()); - } - lua_pushinteger(lua_state, 3); - lua_setfield(lua_state, -2, "NXDOMAIN"); - lua_setglobal(lua_state, "QTypes"); -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, string& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = lua_tostring(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, DNSName& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = DNSName(lua_tostring(lua_state, -1)); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, uint32_t key, string& value) { - lua_pushinteger(lua_state, key); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = lua_tostring(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -#if !(defined(__i386__) && defined(__FreeBSD__)) -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, time_t& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = (time_t)lua_tonumber(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} -#endif - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, uint32_t& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = (uint32_t)lua_tointeger(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, uint16_t& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = (uint16_t)lua_tointeger(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, uint8_t& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = (uint8_t)lua_tointeger(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, int& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = (int)lua_tointeger(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} - -bool LUABackend::getValueFromTable(lua_State *lua_state, const std::string& key, bool& value) { - lua_pushstring(lua_state, key.c_str()); - lua_gettable(lua_state, -2); - - bool ret = false; - - if(!lua_isnil(lua_state, -1)) { - value = lua_toboolean(lua_state, -1); - ret = true; - } - - lua_pop(lua_state, 1); - - return ret; -} diff --git a/modules/luabackend/lua_functions.hh b/modules/luabackend/lua_functions.hh deleted file mode 100644 index 6f65d7eefe..0000000000 --- a/modules/luabackend/lua_functions.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LUABACKEND_EXTERN_F_HH -#define LUABACKEND_EXTERN_F_HH - -extern int my_lua_panic(lua_State* lua); -extern void register_lua_functions(lua_State* lua); - -#endif diff --git a/modules/luabackend/luabackend.cc b/modules/luabackend/luabackend.cc deleted file mode 100644 index cf056926ae..0000000000 --- a/modules/luabackend/luabackend.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" -#include "pdns/logger.hh" - -/* SECOND PART */ - -class LUAFactory : public BackendFactory -{ -public: - LUAFactory() : BackendFactory("lua") {} - - void declareArguments(const string &suffix="") - { - - declare(suffix,"filename","Filename of the script for lua backend","powerdns-luabackend.lua"); - declare(suffix,"query-logging","Logging of the LUA Backend","no"); - - // Allow overriding lua function names. - declare(suffix,"f_exec_error","lua function name",""); - declare(suffix,"f_rediscover","lua function name",""); - - // minimal - declare(suffix,"f_list","lua function name",""); - declare(suffix,"f_lookup","lua function name",""); - declare(suffix,"f_get","lua function name",""); - declare(suffix,"f_getsoa","lua function name",""); - - // master - declare(suffix,"f_getupdatedmasters","lua function name",""); - declare(suffix,"f_setnotified","lua function name",""); - - // slave - declare(suffix,"f_getdomaininfo","lua function name",""); - declare(suffix,"f_ismaster","lua function name",""); - declare(suffix,"f_getunfreshslaveinfos","lua function name",""); - declare(suffix,"f_setfresh","lua function name",""); - declare(suffix,"f_starttransaction","lua function name",""); - declare(suffix,"f_committransaction","lua function name",""); - declare(suffix,"f_aborttransaction","lua function name",""); - declare(suffix,"f_feedrecord","lua function name",""); - - // supermaster - declare(suffix,"f_supermasterbackend","lua function name",""); - declare(suffix,"f_createslavedomain","lua function name",""); - - // dnssec - declare(suffix,"f_alsonotifies","lua function name",""); - declare(suffix,"f_getdomainmetadata","lua function name",""); - declare(suffix,"f_setdomainmetadata","lua function name",""); - declare(suffix,"f_getdomainkeys","lua function name",""); - declare(suffix,"f_removedomainkey","lua function name",""); - declare(suffix,"f_activatedomainkey","lua function name",""); - declare(suffix,"f_deactivatedomainkey","lua function name",""); - declare(suffix,"f_updatedomainkey","lua function name",""); - declare(suffix,"f_adddomainkey","lua function name",""); - declare(suffix,"f_gettsigkey","lua function name",""); - declare(suffix,"f_getbeforeandafternamesabsolute","lua function name",""); - declare(suffix,"f_updatednssecorderandauthabsolute","lua function name",""); - declare(suffix,"f_updatednssecorderandauth","lua function name",""); - - } - - DNSBackend *make(const string &suffix="") - { - return new LUABackend(suffix); - } - -}; - -/* THIRD PART */ - -class LUALoader -{ -public: - LUALoader() - { - BackendMakers().report(new LUAFactory); - - g_log << Logger::Info << "[luabackend] This is the lua backend version " VERSION -#ifndef REPRODUCIBLE - << " (" __DATE__ " " __TIME__ ")" -#endif - << " reporting" << endl; - } -}; - -static LUALoader luaLoader; diff --git a/modules/luabackend/luabackend.hh b/modules/luabackend/luabackend.hh deleted file mode 100644 index 3c0459ea35..0000000000 --- a/modules/luabackend/luabackend.hh +++ /dev/null @@ -1,196 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LUABACKEND_HH -#define LUABACKEND_HH - -#include "lua.hpp" - -#include "pdns/dnsbackend.hh" - -#include -using std::string; - -#define LUABACKEND_PREFIX "lua" - -class LUAException { -public: - LUAException(const string &ex) : what(ex){} - string what; -}; - -class LUABackend : public DNSBackend { - -public: - -// MINIMAL BACKEND - - LUABackend(const string &suffix=""); - ~LUABackend(); - bool list(const DNSName &target, int domain_id, bool include_disabled=false) override; - void lookup(const QType &qtype, const DNSName &qname, int domain_id, DNSPacket *p=nullptr) override; - bool get(DNSResourceRecord &rr) override; - //! fills the soadata struct with the SOA details. Returns false if there is no SOA. - bool getSOA(const DNSName &name, SOAData &soadata) override; - - -// MASTER BACKEND - - void getUpdatedMasters(vector* domains) override; - void setNotified(uint32_t id, uint32_t serial) override; - - -// SLAVE BACKEND - - bool getDomainInfo(const DNSName& domain, DomainInfo &di, bool getSerial=true) override; - void getUnfreshSlaveInfos(vector* domains) override; - void setFresh(uint32_t id) override; - - bool startTransaction(const DNSName &qname, int id) override; - bool commitTransaction() override; - bool abortTransaction() override; - bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3=false) override; - - -// SUPERMASTER BACKEND - - bool superMasterBackend(const string &ip, const DNSName &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **db) override; - bool createSlaveDomain(const string &ip, const DNSName &domain, const string &nameserver, const string &account) override; - - -// DNSSEC BACKEND - - //! get a list of IP addresses that should also be notified for a domain - void alsoNotifies(const DNSName &domain, set *ips) override; - bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector& meta) override; - bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector& meta) override; - - bool getDomainKeys(const DNSName& name, std::vector& keys) override ; - bool removeDomainKey(const DNSName& name, unsigned int id) override ; - bool activateDomainKey(const DNSName& name, unsigned int id) override ; - bool deactivateDomainKey(const DNSName& name, unsigned int id) override ; - bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) override ; - bool addDomainKey(const DNSName& name, const KeyData& key, int64_t& id) override ; - bool updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const DNSName& qname, const std::string& ordername, bool auth); - bool getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override; - bool updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName& qname, const DNSName& ordername, bool auth, const uint16_t qtype=QType::ANY) override; - bool updateDNSSECOrderAndAuth(uint32_t domain_id, const DNSName& zonename, const DNSName& qname, bool auth); - - -// OTHER - void reload() override ; - void rediscover(string* status=0) override ; - - - string backend_name; - lua_State *lua; - DNSPacket *dnspacket; - - //private.cc - string my_getArg(string a); - bool my_mustDo(string a); - bool my_isEmpty(string a); - -private: - - pthread_t backend_pid; - unsigned int backend_count{0}; - - int f_lua_exec_error; - - //minimal functions.... - int f_lua_list; - int f_lua_lookup; - int f_lua_get; - int f_lua_getsoa; - - //master functions.... - int f_lua_getupdatedmasters; - int f_lua_setnotified; - - //slave functions.... - int f_lua_getdomaininfo; - int f_lua_ismaster; - int f_lua_getunfreshslaveinfos; - int f_lua_setfresh; - - int f_lua_starttransaction; - int f_lua_committransaction; - int f_lua_aborttransaction; - int f_lua_feedrecord; - - //supermaster functions.... - int f_lua_supermasterbackend; - int f_lua_createslavedomain; - - //rediscover - int f_lua_rediscover; - - //dnssec - int f_lua_alsonotifies; - int f_lua_getdomainmetadata; - int f_lua_setdomainmetadata; - - int f_lua_getdomainkeys; - int f_lua_removedomainkey; - int f_lua_activatedomainkey; - int f_lua_deactivatedomainkey; - int f_lua_updatedomainkey; - int f_lua_gettsigkey; - int f_lua_adddomainkey; - - int f_lua_getbeforeandafternamesabsolute; - int f_lua_updatednssecorderandauthabsolute; - int f_lua_updatednssecorderandauth; - - -// FUNCTIONS TO THIS BACKEND - bool getValueFromTable(lua_State *lua, const std::string& key, string& value); - bool getValueFromTable(lua_State *lua, const std::string& key, DNSName& value); - bool getValueFromTable(lua_State *lua, uint32_t key, string& value); -#if !(defined(__i386__) && defined(__FreeBSD__)) - bool getValueFromTable(lua_State *lua, const std::string& key, time_t& value); -#endif - bool getValueFromTable(lua_State *lua, const std::string& key, uint32_t& value); - bool getValueFromTable(lua_State *lua, const std::string& key, uint16_t& value); - bool getValueFromTable(lua_State *lua, const std::string& key, uint8_t& value); - bool getValueFromTable(lua_State *lua, const std::string& key, int& value); - bool getValueFromTable(lua_State *lua, const std::string& key, bool& value); - - //private.cc - bool domaininfo_from_table(DomainInfo *di); - void domains_from_table(vector* domains, const char *f_name); - void dnsrr_to_table(lua_State *lua, const DNSResourceRecord *rr); - bool dnsrr_from_table(lua_State *lua, DNSResourceRecord &rr); - - //reload.cc - void get_lua_function(lua_State *lua, const char *name, int *function); - - bool dnssec; - - bool logging; - - //dnssec.cc - bool updateDomainKey(const DNSName& name, unsigned int &id, bool toowhat); -}; - -#endif diff --git a/modules/luabackend/master.cc b/modules/luabackend/master.cc deleted file mode 100644 index 6ca3dc69e2..0000000000 --- a/modules/luabackend/master.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - -void LUABackend::getUpdatedMasters(vector* domains) { - - if (f_lua_getupdatedmasters == 0) - return; - - if (logging) - g_log << Logger::Info << backend_name << "(getUpdatedMasters) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getupdatedmasters); - - if(lua_pcall(lua, 0, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return; - } - - size_t returnedwhat = lua_type(lua, -1); - if (returnedwhat != LUA_TTABLE) { - lua_pop(lua, 1 ); - return; - } - - domains_from_table(domains, "getUpdatedMasters"); - - if (logging) - g_log << Logger::Info << backend_name << "(getUpdatedMasters) END" << endl; -} - -void LUABackend::setNotified(uint32_t id, uint32_t serial) { - - if (f_lua_setnotified == 0) - return; - - if (logging) - g_log << Logger::Info << backend_name << "(setNotified) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setnotified); - - lua_pushinteger(lua, id); - lua_pushinteger(lua, serial); - - if(lua_pcall(lua, 2, 0, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return; - } - - if (logging) - g_log << Logger::Info << backend_name << "(setNotified) END" << endl; -} - diff --git a/modules/luabackend/minimal.cc b/modules/luabackend/minimal.cc deleted file mode 100644 index 3da1253140..0000000000 --- a/modules/luabackend/minimal.cc +++ /dev/null @@ -1,239 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - -/* FIRST PART */ - -LUABackend::LUABackend(const string &suffix) { - - setArgPrefix(LUABACKEND_PREFIX+suffix); - - try { - - if (pthread_equal(backend_pid, pthread_self())) { - backend_count++; - } else { - backend_count = 1; - backend_pid = pthread_self(); - } - - lua = NULL; - dnspacket = NULL; - dnssec = false; - - reload(); - } - - catch(LUAException &e) { - g_log< 0) - soadata.ttl = soadata.default_ttl; - - if (soadata.ttl == 0) { - lua_pop(lua, 1 ); - return false; - } - - if (!getValueFromTable(lua, "nameserver", soadata.nameserver)) { - soadata.nameserver = DNSName(::arg()["default-soa-name"]); - if (soadata.nameserver.empty()) { - g_log<backend = NULL; - - if (!getValueFromTable(lua, "id", di->id)) - return false; - - if (!getValueFromTable(lua, "zone", di->zone)) - return false; - - if (!getValueFromTable(lua, "serial", di->serial)) - return false; - - getValueFromTable(lua, "notified_serial", di->notified_serial); - getValueFromTable(lua, "last_check", di->last_check); - - di->kind = DomainInfo::Native; - - string kind; - if (getValueFromTable(lua, "kind", kind)) { - - if (kind == "MASTER") - di->kind = DomainInfo::Master; - else if (kind == "SLAVE") - di->kind = DomainInfo::Slave; - } - - lua_pushstring(lua, "masters"); - lua_gettable(lua, -2); - - if(!lua_isnil(lua, -1)) { - lua_pushnil(lua); - const char *value; - while (lua_next(lua, -2)) { - value = lua_tostring(lua, -1); - lua_pop(lua,1); - di->masters.push_back(ComboAddress(value, 53)); - } - } - - lua_pop(lua, 1); - - di->backend = this; - - return true; -} - -void LUABackend::domains_from_table(vector* domains, const char *f_name) { - lua_pushnil(lua); - - size_t returnedwhat; - - while (lua_next(lua, -2)) { - returnedwhat = lua_type(lua, -1); - if (returnedwhat == LUA_TTABLE) { - DomainInfo di; - - if (domaininfo_from_table(&di)) - domains->push_back(di); - } - - lua_pop(lua,1); - } -} - - -void LUABackend::dnsrr_to_table(lua_State *lua_state, const DNSResourceRecord *rr) { - - lua_newtable(lua_state); - - lua_pushliteral(lua_state, "qtype"); - lua_pushstring(lua_state, rr->qtype.getName().c_str()); - lua_settable(lua_state, -3); - - lua_pushliteral(lua_state, "qclass"); - lua_pushinteger(lua_state, rr->qclass); - lua_settable(lua_state, -3); - - lua_pushliteral(lua_state, "ttl"); - lua_pushinteger(lua_state, rr->ttl); - lua_settable(lua_state, -3); - - lua_pushliteral(lua_state, "auth"); - lua_pushboolean(lua_state, rr->auth); - lua_settable(lua_state, -3); - - lua_pushliteral(lua_state, "content"); - lua_pushstring(lua_state, rr->content.c_str()); - lua_settable(lua_state, -3); - -} - -bool LUABackend::dnsrr_from_table(lua_State *lua_state, DNSResourceRecord &rr) { - - bool got_content = false; - string qt_name; - uint16_t qt_code; - - // look for qname key first - // try name key if qname wasn't set - if (!getValueFromTable(lua_state, "qname", rr.qname)) - getValueFromTable(lua_state, "name", rr.qname); - - // qtype is either a table, string or number - // when it's a table prefer the code key - lua_pushliteral(lua_state, "qtype"); - lua_gettable(lua_state, -2); - size_t returnedwhat = lua_type(lua_state, -1); - if (LUA_TTABLE == returnedwhat) { - if (getValueFromTable(lua_state, "code", qt_code)) - rr.qtype = qt_code; - else - if (getValueFromTable(lua_state, "name", qt_name)) - rr.qtype = qt_name; - lua_pop(lua_state, 1); - } else if (LUA_TNUMBER == returnedwhat) { - lua_pop(lua_state, 1); - if (getValueFromTable(lua_state, "qtype", qt_code)) - rr.qtype = qt_code; - } else { - lua_pop(lua_state, 1); - if (getValueFromTable(lua_state, "qtype", qt_name)) - rr.qtype = qt_name; - else // fallback to old key for tests to pass - if (getValueFromTable(lua_state, "type", qt_name)) - rr.qtype = qt_name; - } - - getValueFromTable(lua_state, "qclass", rr.qclass); - getValueFromTable(lua_state, "domain_id", rr.domain_id); - getValueFromTable(lua_state, "auth", rr.auth); - getValueFromTable(lua_state, "last_modified", rr.last_modified); - - getValueFromTable(lua_state, "ttl", rr.ttl); - got_content = getValueFromTable(lua_state, "content", rr.content); - getValueFromTable(lua_state, "scopeMask", rr.scopeMask); - - return got_content; - -} diff --git a/modules/luabackend/reload.cc b/modules/luabackend/reload.cc deleted file mode 100644 index 2798fb7d49..0000000000 --- a/modules/luabackend/reload.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - -#include -#include -using namespace std; - -#include "lua_functions.hh" - -void LUABackend::get_lua_function(lua_State *lua_state, const char *name, int *function) { - *function = 0; - - string f = "f_"; - f.append(name); - - string arg = ""; - if (!::arg().isEmpty(string(LUABACKEND_PREFIX)+"-"+f)) - arg = getArg(f); - - lua_getglobal(lua_state, arg == "" ? name : arg.c_str()); - if (!lua_isnil(lua_state, -1)) { - lua_pushvalue(lua_state, -1); - *function = luaL_ref(lua_state, LUA_REGISTRYINDEX); - } -} - - -void LUABackend::reload() { - - backend_name.clear(); - - backend_name = "[LUABackend: " + uitoa((uintptr_t)backend_pid) + " (" + uitoa(backend_count) +")] "; - - if (lua) - lua_close(lua); - - logging = ::arg().mustDo("query-logging") || mustDo("query-logging"); - -#if LUA_VERSION_NUM >= 502 - lua = luaL_newstate(); -#else - lua = lua_open(); -#endif - - if (lua != NULL) { - lua_atpanic(lua, my_lua_panic); - - string filename = getArg("filename"); //"powerdns-luabackend.lua"; - - if (luaL_loadfile (lua, filename.c_str()) != 0) { - stringstream e; - e << backend_name << "Error loading the file '" << filename << "' : " << lua_tostring(lua,-1) << endl; - - lua_pop(lua, 1); - throw LUAException (e.str()); - } else { - - lua_pushlightuserdata(lua, (void*)this); - lua_setfield(lua, LUA_REGISTRYINDEX, "__LUABACKEND"); - - register_lua_functions(lua); - - if(lua_pcall(lua, 0, 0, 0)) { - stringstream e; - e << backend_name << "Error running the file '" << filename << "' : " << lua_tostring(lua,-1) << endl; - - lua_pop(lua, 1); - throw LUAException (e.str()); - - } else { - get_lua_function(lua, "exec_error", &f_lua_exec_error); - - //minimal functions.... - get_lua_function(lua, "list", &f_lua_list); - get_lua_function(lua, "lookup", &f_lua_lookup); - get_lua_function(lua, "get", &f_lua_get); - get_lua_function(lua, "getsoa", &f_lua_getsoa); - - if (f_lua_list == 0 || f_lua_lookup == 0 || f_lua_get == 0 || f_lua_getsoa == 0) { - throw LUAException (backend_name + "MINIMAL BACKEND: Missing required function(s)!"); - } - - //master functions.... - get_lua_function(lua, "getupdatedmasters", &f_lua_getupdatedmasters); - get_lua_function(lua, "setnotified", &f_lua_setnotified); - - //slave functions.... - get_lua_function(lua, "getdomaininfo", &f_lua_getdomaininfo); - get_lua_function(lua, "ismaster", &f_lua_ismaster); - get_lua_function(lua, "getunfreshslaveinfos", &f_lua_getunfreshslaveinfos); - get_lua_function(lua, "setfresh", &f_lua_setfresh); - get_lua_function(lua, "starttransaction", &f_lua_starttransaction); - get_lua_function(lua, "committransaction", &f_lua_committransaction); - get_lua_function(lua, "aborttransaction", &f_lua_aborttransaction); - get_lua_function(lua, "feedrecord", &f_lua_feedrecord); - - //supermaster functions.... - get_lua_function(lua, "supermasterbackend", &f_lua_supermasterbackend); - get_lua_function(lua, "createslavedomain", &f_lua_createslavedomain); - - //rediscover - get_lua_function(lua, "rediscover", &f_lua_rediscover); - - //dnssec - get_lua_function(lua, "alsonotifies", &f_lua_alsonotifies); - get_lua_function(lua, "getdomainmetadata", &f_lua_getdomainmetadata); - get_lua_function(lua, "setdomainmetadata", &f_lua_setdomainmetadata); - - get_lua_function(lua, "getdomainkeys", &f_lua_getdomainkeys); - get_lua_function(lua, "removedomainkey", &f_lua_removedomainkey); - get_lua_function(lua, "activatedomainkey", &f_lua_activatedomainkey); - get_lua_function(lua, "deactivatedomainkey", &f_lua_deactivatedomainkey); - get_lua_function(lua, "updatedomainkey", &f_lua_updatedomainkey); - get_lua_function(lua, "adddomainkey", &f_lua_adddomainkey); - - get_lua_function(lua, "gettsigkey", &f_lua_gettsigkey); - - get_lua_function(lua, "getbeforeandafternamesabsolute", &f_lua_getbeforeandafternamesabsolute); - get_lua_function(lua, "updatednssecorderandauthabsolute", &f_lua_updatednssecorderandauthabsolute); - get_lua_function(lua, "updatednssecorderandauth", &f_lua_updatednssecorderandauth); // not needed... - - } - } - } else { - //a big kaboom here! - throw LUAException (backend_name + "LUA OPEN FAILED!"); - } -} - -void LUABackend::rediscover(string* status) { - - if (f_lua_rediscover == 0) - return; - - if (logging) - g_log << Logger::Info << backend_name << "(rediscover) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_rediscover); - - if(lua_pcall(lua, 0, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - if (returnedwhat != LUA_TSTRING) { - lua_pop(lua, 1 ); - return; - } - - string s = lua_tostring(lua, -1); - lua_pop(lua, 1 ); - *status = s; - - if (logging) - g_log << Logger::Info << backend_name << "(rediscover) END" << endl; - - return; -} - diff --git a/modules/luabackend/slave.cc b/modules/luabackend/slave.cc deleted file mode 100644 index 726ad8b926..0000000000 --- a/modules/luabackend/slave.cc +++ /dev/null @@ -1,243 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - - -bool LUABackend::startTransaction(const DNSName& qname, int id) { - - if (f_lua_starttransaction == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(startTransaction) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_starttransaction); - - lua_pushstring(lua, qname.toString().c_str()); - lua_pushinteger(lua, id); - - if(lua_pcall(lua, 2, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if (logging) - g_log << Logger::Info << backend_name << "(startTransaction) END" << endl; - - return ok; -} - -bool LUABackend::commitTransaction() { - - if (f_lua_committransaction == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(commitTransaction) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_committransaction); - - if(lua_pcall(lua, 0, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if (logging) - g_log << Logger::Info << backend_name << "(commitTransaction) END" << endl; - - return ok; -} - -bool LUABackend::abortTransaction() { - - if (f_lua_aborttransaction == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(abortTransaction) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_aborttransaction); - - if(lua_pcall(lua, 0, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if (logging) - g_log << Logger::Info << backend_name << "(abortTransaction) END" << endl; - return ok; -} - -bool LUABackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3) { - - if (f_lua_feedrecord == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(feedRecord) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_feedrecord); - dnsrr_to_table(lua, &rr); - - if(lua_pcall(lua, 1, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if (logging) - g_log << Logger::Info << backend_name << "(feedRecord) END" << endl; - - return ok; -} - -void LUABackend::setFresh(uint32_t id) { - - if (f_lua_setfresh == 0) - return; - - if (logging) - g_log << Logger::Info << backend_name << "(setFresh) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_setfresh); - - lua_pushinteger(lua, id); - - if(lua_pcall(lua, 1, 0, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return; - } - - if (logging) - g_log << Logger::Info << backend_name << "(setFresh) END" << endl; - -} - -void LUABackend::getUnfreshSlaveInfos(vector* domains) { - - if (f_lua_getunfreshslaveinfos == 0) - return; - - if (logging) - g_log << Logger::Info << backend_name << "(getUnfreshSlaveInfos) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getunfreshslaveinfos); - - if(lua_pcall(lua, 0, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return; - } - - size_t returnedwhat = lua_type(lua, -1); - if (returnedwhat != LUA_TTABLE) { - lua_pop(lua, 1 ); - return; - } - - domains_from_table(domains, "getUnfreshSlaveInfos"); - - if (logging) - g_log << Logger::Info << backend_name << "(getUnfreshSlaveInfos) END" << endl; - -} - -bool LUABackend::getDomainInfo(const DNSName&domain, DomainInfo &di, bool getSerial) { - if (f_lua_getdomaininfo == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(getDomainInfo) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_getdomaininfo); - - lua_pushstring(lua, domain.toString().c_str()); - - if(lua_pcall(lua, 1, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - } - - size_t returnedwhat = lua_type(lua, -1); - if (returnedwhat != LUA_TTABLE) { - lua_pop(lua, 1 ); - return false; - } - - if (logging) - g_log << Logger::Info << backend_name << "(getDomainInfo) END" << endl; - - return domaininfo_from_table(&di); -} diff --git a/modules/luabackend/supermaster.cc b/modules/luabackend/supermaster.cc deleted file mode 100644 index b1f99b03e9..0000000000 --- a/modules/luabackend/supermaster.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * originally authored by Fredrik Danerklint - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "luabackend.hh" - -#include "pdns/logger.hh" -#include "pdns/arguments.hh" - - -bool LUABackend::superMasterBackend(const string &ip, const DNSName &domain, const vector&nsset, string *nameserver, string *account, DNSBackend **db) { - - if (f_lua_supermasterbackend == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(superMasterBackend) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_supermasterbackend); - - lua_pushstring(lua, ip.c_str()); - lua_pushstring(lua, domain.toString().c_str()); - - - lua_newtable(lua); - int c = 0; - for(vector::const_iterator i=nsset.begin();i!=nsset.end();++i) { - c++; - lua_pushinteger(lua, c); - - DNSResourceRecord rr; - - rr.qtype = i->qtype; - rr.qclass = i->qclass; - rr.ttl = i->ttl; - rr.auth = i->auth; - rr.content = i->content; - - dnsrr_to_table(lua, &rr); - lua_settable(lua, -3); - } - - if(lua_pcall(lua, 3, 2, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - string a = ""; - returnedwhat = lua_type(lua, -1); - if (returnedwhat == LUA_TSTRING) - a = lua_tostring(lua, -1); - lua_pop(lua, 1); - - if (ok) { - *account = a; - *db = this; - } - - if (logging) - g_log << Logger::Info << backend_name << "(superMasterBackend) END" << endl; - - return ok; -} - -bool LUABackend::createSlaveDomain(const string &ip, const DNSName& domain, const string &nameserver, const string &account) { - - if (f_lua_createslavedomain == 0) - return false; - - if (logging) - g_log << Logger::Info << backend_name << "(createSlaveDomain) BEGIN" << endl; - - lua_rawgeti(lua, LUA_REGISTRYINDEX, f_lua_createslavedomain); - - lua_pushstring(lua, ip.c_str()); - lua_pushstring(lua, domain.toString().c_str()); - lua_pushstring(lua, account.c_str()); - - if(lua_pcall(lua, 3, 1, f_lua_exec_error) != 0) { - string e = backend_name + lua_tostring(lua, -1); - lua_pop(lua, 1); - - throw runtime_error(e); - return false; - } - - size_t returnedwhat = lua_type(lua, -1); - bool ok = false; - - if (returnedwhat == LUA_TBOOLEAN) - ok = lua_toboolean(lua, -1); - - lua_pop(lua, 1); - - if (logging) - g_log << Logger::Info << backend_name << "(createSlaveDomain) END" << endl; - - return ok; -} diff --git a/modules/luabackend/test/.gitignore b/modules/luabackend/test/.gitignore deleted file mode 100644 index d200e0e206..0000000000 --- a/modules/luabackend/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -pdns.pid diff --git a/modules/luabackend/test/dnsperf b/modules/luabackend/test/dnsperf deleted file mode 100755 index ecd910b3db..0000000000 --- a/modules/luabackend/test/dnsperf +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -dnsperf -d one -p5300 -H10 -T1 -l60 diff --git a/modules/luabackend/test/one b/modules/luabackend/test/one deleted file mode 100644 index 7d137ccf82..0000000000 --- a/modules/luabackend/test/one +++ /dev/null @@ -1,2 +0,0 @@ -www.test.com ANY - diff --git a/modules/luabackend/test/pdns b/modules/luabackend/test/pdns deleted file mode 100755 index 981414816d..0000000000 --- a/modules/luabackend/test/pdns +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -../../../pdns/pdns_server --daemon=no --local-port=5300 --socket-dir=./ \ ---no-shuffle --launch=lua --loglevel=9 \ ---config-dir=./ --cache-ttl=0 --negquery-cache-ttl=0 --query-cache-ttl=0 --recursive-cache-ttl=0 diff --git a/modules/luabackend/test/pdns.conf b/modules/luabackend/test/pdns.conf deleted file mode 100644 index 6f70567c1b..0000000000 --- a/modules/luabackend/test/pdns.conf +++ /dev/null @@ -1,3 +0,0 @@ -local-address=127.0.0.1 -local-ipv6=::1 -launch=lua diff --git a/modules/luabackend/test/pdns_control b/modules/luabackend/test/pdns_control deleted file mode 100755 index f3a6f77592..0000000000 --- a/modules/luabackend/test/pdns_control +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -../../../pdns/pdns_control --config-dir=./ --socket-dir=./ $@ diff --git a/modules/luabackend/test/pdnstool b/modules/luabackend/test/pdnstool deleted file mode 100755 index 86a8126ccc..0000000000 --- a/modules/luabackend/test/pdnstool +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -../../../pdns/pdnsutil --config-dir=./ $@ diff --git a/modules/luabackend/test/powerdns-luabackend.lua b/modules/luabackend/test/powerdns-luabackend.lua deleted file mode 100644 index fa5342be53..0000000000 --- a/modules/luabackend/test/powerdns-luabackend.lua +++ /dev/null @@ -1,562 +0,0 @@ --- An example of the minimal functions needed to test the lua backend - -local logger = logger -local pairs, ipairs = pairs, ipairs -local type = type - -local log_error = log_error -local log_debug = log_debug -local dnspacket = dnspacket - -local remote_ip, remote_port, local_ip - -local origin, ttl -local domains = {} - --- shared state between list/lookup and get functions -local domain_id, q_name, q_type -local c, r, size - - -function content_from_soatab(t) - return ("%s %s %u %u %u %u %u"):format( - t.nameserver, t.hostmaster, - t.serial, t.refresh, t.retry, - t.expire, t.default_ttl - ) -end - -ttl = 3600 -origin = "test.com." -domains[origin] = { - domain_id = 1 + #domains, - name = origin, - soa = { - ttl = ttl, - nameserver = "ns1."..origin, - hostmaster = "ahu.example.com.", - serial = 2005092501, - refresh = 28800, - retry = 7200, - expire = 604800, - default_ttl = 86400, - }, - records = {}, -} -domains[domains[origin].domain_id] = domains[origin] - - -domains[origin].records[origin] = { - -- This is not used since the getsoa function us using the SOA table instead. - --{qtype = "SOA", ttl = domains[origin].soa.ttl, content = content_from_soatab(domains[origin].soa)}, - {qtype = "NS", ttl = ttl, content = "ns1."..origin}, - {qtype = "NS", ttl = ttl, content = "ns2."..origin}, - {qtype = "MX", ttl = ttl, content = "10 ."}, - {qtype = "MX", ttl = ttl, content = "15 smtp-servers."..origin}, -} -domains[origin].records["ns1."..origin] = { - {qtype = "A", ttl = ttl, content = "1.1.1.1"}, -} -domains[origin].records["ns2."..origin] = { - {qtype = "A", ttl = ttl, content = "2.2.2.2"}, -} - -domains[origin].records["toroot."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "."}, -} -domains[origin].records["www."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "server1."..origin}, -} -domains[origin].records["server1."..origin] = { - {qtype = "A", ttl = ttl, content = "1.2.3.4"}, - {qtype = "RP", ttl = ttl, content = "ahu.ds9a.nl. counter"}, -} -domains[origin].records["*.test."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "server1."..origin}, -} -domains[origin].records["www.test."..origin] = { - {qtype = "A", ttl = ttl, content = "4.3.2.1"}, -} -domains[origin].records["sub.test."..origin] = { - {qtype = "NS", ttl = ttl, content = "ns-test.example.net."}, -} -domains[origin].records["enum."..origin] = { - {qtype = "NAPTR", ttl = ttl, content = [=[100 50 "u" "e2u+sip" "" testuser.domain.com.]=]}, -} -domains[origin].records["counter."..origin] = { - {qtype = "A", ttl = ttl, content = "1.1.1.5"}, -} -domains[origin].records["_ldap._tcp.dc."..origin] = { - {qtype = "SRV", ttl = ttl, content = "0 100 389 server2.example.net."}, -} -domains[origin].records["_double._tcp.dc."..origin] = { - {qtype = "SRV", ttl = ttl, content = "0 100 389 server1"..origin}, - {qtype = "SRV", ttl = ttl, content = "1 100 389 server1"..origin}, -} -domains[origin].records["_root._tcp.dc."..origin] = { - {qtype = "SRV", ttl = ttl, content = "0 0 0 ."}, -} -domains[origin].records["blah."..origin] = { - {qtype = "NS", ttl = ttl, content = "blah."..origin}, - {qtype = "A", ttl = ttl, content = "192.168.6.1"}, -} -domains[origin].records["very-long-txt."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["A very long TXT record! boy you won't believe how long. A very long TXT record! boy you won't believe how long. A very long TXT record! boy you won't believe how long. A very long TXT record! boy you won't believe how long. A very long TXT record! boy you won't believe how long!"]=]}, -} -domains[origin].records["within-server."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "outpost.example.com."}, -} -domains[origin].records["_underscore."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["underscores are terrible"]=]}, -} -domains[origin].records["b.c."..origin] = { - {qtype = "A", ttl = ttl, content = "5.6.7.8"}, -} -domains[origin].records["*.a.b.c."..origin] = { - {qtype = "A", ttl = ttl, content = "8.7.6.5"}, -} -domains[origin].records["aland."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["\195\133LAND ISLANDS"]=]}, -} -domains[origin].records["hightxt."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["v=spf1 mx ip4:78.46.192.210 -all"]=]}, - {qtype = "SPF", ttl = ttl, content = [=["v=spf1 mx ip4:78.46.192.210 -all"]=]}, -} -domains[origin].records["d."..origin] = { - {qtype = "DNAME", ttl = ttl, content = "d2.test2.com."}, -} -domains[origin].records["interrupted-rrset."..origin] = { - {qtype = "A", ttl = ttl, content = "1.1.1.1"}, - {qtype = "TXT", ttl = ttl, content = [=["check AXFR signpipe"]=]}, - {qtype = "A", ttl = ttl, content = "2.2.2.2"}, -} - - -ttl = 120 -origin = "example.com." -domains[origin] = { - domain_id = 1 + #domains, - name = origin, - soa = { - ttl = 100000, - nameserver = "ns1."..origin, - hostmaster = "ahu."..origin, - serial = 2847484148, - refresh = 28800, - retry = 7200, - expire = 604800, - default_ttl = 86400, - }, - records = {}, -} -domains[domains[origin].domain_id] = domains[origin] - - -domains[origin].records[origin] = { - -- This is not used since the getsoa function us using the SOA table instead. - --{qtype = "SOA", ttl = domains[origin].soa.ttl, content = content_from_soatab(domains[origin].soa)}, - {qtype = "NS", ttl = ttl, content = "ns1."..origin}, - {qtype = "NS", ttl = ttl, content = "ns2."..origin}, - {qtype = "MX", ttl = ttl, content = "10 smtp-servers.example.com."}, - {qtype = "MX", ttl = ttl, content = "15 smtp-servers.test.com."}, -} -domains[origin].records["ns1."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.1.1"}, -} -domains[origin].records["ns2."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.1.2"}, -} -domains[origin].records["double."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.5.1"}, - {qtype = "A", ttl = ttl, content = "192.168.5.1"}, -} -domains[origin].records["hightype."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.1.5"}, - {qtype = "TYPE65534", ttl = ttl, content = "\\# 5 07ED260001"}, -} -domains[origin].records["localhost."..origin] = { - {qtype = "A", ttl = ttl, content = "127.0.0.1"}, -} -domains[origin].records["www."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "outpost."..origin}, -} -domains[origin].records["location."..origin] = { - {qtype = "LOC", ttl = ttl, content = [=[51 56 0.123 N 5 54 0.000 E 4.00m 1.00m 10000.00m 10.00m]=]}, - {qtype = "LOC", ttl = ttl, content = [=[51 56 1.456 S 5 54 0.000 E 4.00m 2.00m 10000.00m 10.00m]=]}, - {qtype = "LOC", ttl = ttl, content = [=[51 56 2.789 N 5 54 0.000 W 4.00m 3.00m 10000.00m 10.00m]=]}, - {qtype = "LOC", ttl = ttl, content = [=[51 56 3.012 S 5 54 0.000 W 4.00m 4.00m 10000.00m 10.00m]=]}, -} -domains[origin].records["unauth."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "no-idea.example.org."}, -} -domains[origin].records["dsdelegation."..origin] = { - {qtype = "NS", ttl = ttl, content = "ns.example.com."}, - {qtype = "DS", ttl = ttl, content = "28129 8 1 caf1eaaecdabe7616670788f9022454bf5fd9fda"}, -} -domains[origin].records["nxd."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "nxdomain.example.com."}, -} -domains[origin].records["hwinfo."..origin] = { - {qtype = "HINFO", ttl = ttl, content = [=["abc" "def"]=]}, -} -domains[origin].records["smtp-servers."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.0.2"}, - {qtype = "A", ttl = ttl, content = "192.168.0.3"}, - {qtype = "A", ttl = ttl, content = "192.168.0.4"}, -} -domains[origin].records["outpost."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.2.1"}, -} -domains[origin].records["start."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "x.y.z.w1."..origin}, -} -domains[origin].records["*.w1."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "x.y.z.w2."..origin}, -} -domains[origin].records["*.w2."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "x.y.z.w3."..origin}, -} -domains[origin].records["*.w3."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "x.y.z.w4."..origin}, -} -domains[origin].records["*.w4."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "x.y.z.w5."..origin}, -} -domains[origin].records["*.w5."..origin] = { - {qtype = "A", ttl = ttl, content = "1.2.3.5"}, -} -domains[origin].records["start1."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "start2."..origin}, -} -domains[origin].records["start2."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "start3."..origin}, -} -domains[origin].records["start3."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "start4."..origin}, -} -domains[origin].records["start4."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.2.2"}, -} -domains[origin].records["loop1."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "loop2."..origin}, -} -domains[origin].records["loop2."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "loop3."..origin}, -} -domains[origin].records["loop3."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "loop1."..origin}, -} -domains[origin].records["external."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "somewhere.else.net."}, -} -domains[origin].records["semi-external."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "bla.something.wtest.com."}, -} -domains[origin].records["server1."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "server1.france."..origin}, -} -domains[origin].records["france."..origin] = { - {qtype = "NS", ttl = ttl, content = "ns1.otherprovider.net."}, - {qtype = "NS", ttl = ttl, content = "ns2.otherprovider.net."}, -} -domains[origin].records["usa."..origin] = { - {qtype = "NS", ttl = ttl, content = "usa-ns1.usa."..origin}, - {qtype = "NS", ttl = ttl, content = "usa-ns2.usa."..origin}, -} -domains[origin].records["usa-ns1.usa."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.4.1"}, -} -domains[origin].records["usa-ns2.usa."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.4.2"}, -} -domains[origin].records["italy."..origin] = { - {qtype = "NS", ttl = ttl, content = "italy-ns1."..origin}, - {qtype = "NS", ttl = ttl, content = "italy-ns2."..origin}, -} -domains[origin].records["italy-ns1."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.5.1"}, -} -domains[origin].records["italy-ns2."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.5.2"}, -} -domains[origin].records["mail."..origin] = { - {qtype = "MX", ttl = ttl, content = "25 smtp1."..origin}, -} -domains[origin].records["smtp1."..origin] = { - {qtype = "CNAME", ttl = ttl, content = "outpost."..origin}, -} -domains[origin].records["external-mail."..origin] = { - {qtype = "MX", ttl = ttl, content = "25 server1.test.com."}, -} -domains[origin].records["text."..origin] = { - {qtype = "TXT", ttl = ttl, content = "Hi, this is some text"}, -} -domains[origin].records["multitext."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["text part one" "text part two" "text part three"]=]}, -} -domains[origin].records["escapedtext."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["begin" "the \"middle\" p\\art" "the end"]=]}, -} -domains[origin].records["text0."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["k=rsa; p=one"]=]}, -} -domains[origin].records["text1."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["k=rsa\; p=one"]=]}, -} -domains[origin].records["text2."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["k=rsa\\; p=one"]=]}, -} -domains[origin].records["text3."..origin] = { - {qtype = "TXT", ttl = ttl, content = [=["k=rsa\\\; p=one"]=]}, -} -domains[origin].records["host.*.sub."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.6.1"}, -} -domains[origin].records["ipv6."..origin] = { - {qtype = "AAAA", ttl = ttl, content = "2001:6A8:0:1:210:4BFF:FE4B:4C61"}, -} -domains[origin].records["together-too-much."..origin] = { - {qtype = "MX", ttl = ttl, content = "25 toomuchinfo-a."..origin}, - {qtype = "MX", ttl = ttl, content = "25 toomuchinfo-b."..origin}, -} - -local tab = {} -for oct4 = 1, 25, 1 do - tab[1 + #tab] = {qtype = "A", ttl = ttl, content = "192.168.99."..oct4} -end -domains[origin].records["toomuchinfo-a."..origin] = tab -tab = nil - -local tab = {} -for oct4 = 26, 99, 1 do - tab[1 + #tab] = {qtype = "A", ttl = ttl, content = "192.168.99."..oct4} -end -domains[origin].records["toomuchinfo-b."..origin] = tab -tab = nil - -domains[origin].records["host-0."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.1.0"}, - {qtype = "EUI48", ttl = ttl, content = "00-50-56-9b-00-e7"}, -} -domains[origin].records["host-1."..origin] = { - {qtype = "A", ttl = ttl, content = "192.168.1.1"}, - {qtype = "EUI48", ttl = ttl, content = "00-50-56-9b-00-e7-7e-57"}, -} ---[=[ --- Disabled the in-memory storage since it was slower than computing --- these as needed. See the list/lookup functions below. -local hnfmt = "host-%d.%s" -local ipfmt = "192.168.1.%d" -for n = 2, 19999, 1 do - domains[origin].records[hnfmt:format(n, origin)] = { - {qtype = "A", ttl = ttl, content = ipfmt:format( n % 256)}, - } -end ---]=] - -domains[origin].records["rhs-at-expansion."..origin] = { - {qtype = "CNAME", ttl = ttl, content = origin}, -} -domains[origin].records["google-alias."..origin] = { - {qtype = "ALIAS", ttl = ttl, content = "google-public-dns-a.google.com."}, -} -domains[origin].records["host-for-auto-ptr."..origin] = { - {qtype = "A", ttl = ttl, content = "192.0.2.1"}, -} - - -function table_deepjoin(tab1, tab2) - local new = {} - local seen = {} - - if tab1 then - seen[tab1] = new - end - if tab2 then - seen[tab2] = new - end - - local function dj(ret, tab) - if not tab then - return ret - end - - local k, v - for k,v in pairs(tab) do - if ("table" ~= type(v)) then - if not ret[k] then - ret[k] = v - end - elseif seen[v] then - ret[k] = seen[v] - elseif ("table" == type(v)) then - if not ret[k] then - ret[k] = table_deepjoin(v, nil) - else - ret[k] = table_deepjoin(ret[k], v) - end - seen[v] = ret[k] - end - end - - return ret - end - - new = dj(new, tab1) - new = dj(new, tab2) - - return new -end - --- Args: --- qname string: "test.com." --- domainid number: 1 -function list(qname, domainid) - logger(log_debug, "(l_list) begin") - q_type = "ANY" - q_name = qname - domain_id = domainid - logger(log_debug, "(l_list)", "target:", q_name, "domain_id:", domain_id) - - c = 0 - r = nil - size = 0 - - local tab = domains[domain_id] or domains[q_name:lower()] - if (("table" == type(tab)) and ("table" == type(tab.records))) then - r = {} - - -- domain_id might have been -1 - domain_id = tab.domain_id - - local k, v, kk, vv - for k, v in pairs(tab.records) do - for kk, vv in ipairs(v) do - r[1 + #r] = table_deepjoin(vv, {qname = k, name = k}) - end - end - - -- compute the host-N.example.com. entries rather than using memory - if (2 == domain_id) then - local hnfmt = "host-%d.%s" - local ipfmt = "192.168.1.%d" - for n = 2, 19999, 1 do - r[1 + #r] = { - qname = hnfmt:format(n, q_name), - name = hnfmt:format(n, q_name), - qtype = "A", - ttl = 120, - content = ipfmt:format(n % 256), - } - end - end - end - - if ("table" == type(r)) then - size = #r - logger(log_debug, "(l_list)", "size:", size) - logger(log_debug, "(l_list) end: success") - return true - end - - logger(log_debug, "(l_list) end: not found") - return false -end - --- Args: --- qtype table: { name = "SOA", code = 6 } --- qname string: "test.com." --- domainid number: 1 -function lookup(qtype, qname, domainid) - logger(log_debug, "(l_lookup) begin") - q_type = ("table" == type(qtype)) and qtype.name or qtype - q_name = qname - domain_id = domainid - logger(log_debug, "(l_lookup)", "q_type:", q_type, "q_name:", q_name, "domain_id:", domain_id) - - if (0 < domain_id) then - r = domains[domain_id].records[q_name:lower()] - else - -- domain_id of -1 means we need to search all the records - local k, v, kk, vv - for k, v in ipairs(domains) do - if ("table" == type(v.records)) then - for kk, vv in ipairs(v.records) do - if (q_name:lower() == kk) then - r = vv - domain_id = v.domain_id - end - end - end - end - end - - c = 0 - size = 0 - - -- remote_ip, remote_port, local_ip = dnspacket() - -- logger(log_debug, "(l_lookup)", "dnspacket", "remote:", remote_ip, "port:", remote_port, "local:", local_ip) - - -- compute the host-N.example.com. entries rather than using memory - local hostname, num, domain = qname:lower():match("^(host%-(%d+))%.(example%.com%.)$") - if (hostname and domains[domain] and (2 <= num) and (19999 <= num)) then - domain_id = domaindomains[domain].domain_id - r = {{ - qtype = "A", - ttl = 120, - content = ("192.168.1.%d"):format(num % 256), - }} - end - - if ("table" == type(r)) then - size = #r - end - logger(log_debug, "(l_lookup)", "size:", size) - logger(log_debug, "(l_lookup) end") -end - -function get() - logger(log_debug, "(l_get) begin") - - local tab - local kk, vv - while c < size do - c = c + 1 - if (("ANY" == q_type) or (r[c].qtype == q_type)) then - for kk,vv in ipairs(r[c]) do - logger(log_debug, "(l_get)", kk, type(vv), vv) - end - tab = table_deepjoin(r[c], {domain_id = domain_id, qname = q_name:lower(), name = q_name:lower()}) - logger(log_debug, "(l_get)", tab.domain_id, tab.qname, tab.ttl, "IN", tab.qtype, tab.content) - logger(log_debug, "(l_get) end: success") - return tab - end - end - - logger(log_debug, "(l_get) end: not found") - return false -end - --- Args: --- qname string: "test.com." -function getsoa(qname) - logger(log_debug, "(l_getsoa) begin") - logger(log_debug, "(l_getsoa)", q_type, "qname:", qname) - - local tab - r = domains[qname:lower()] - if (("table" == type(r)) and ("table" == type(r.soa))) then - tab = table_deepjoin({qname = qname, domain_id = r.domain_id}, r.soa) - logger(log_debug, "(l_getsoa)", r.domain_id, r.name, r.soa.ttl, content_from_soatab(tab)) - logger(log_debug, "(l_getsoa) end: success") - return tab - end - - logger(log_debug, "(l_getsoa) end: not found") -end - -logger(log_debug, "the powerdns-luabackend is starting up!") - ---for k,v in pairs(QTypes) do --- logger(log_debug, k, v) ---end diff --git a/modules/luabackend/test2/.gitignore b/modules/luabackend/test2/.gitignore deleted file mode 100644 index d200e0e206..0000000000 --- a/modules/luabackend/test2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -pdns.pid diff --git a/modules/luabackend/test2/pdns b/modules/luabackend/test2/pdns deleted file mode 100755 index 138a8c0893..0000000000 --- a/modules/luabackend/test2/pdns +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -PDNS=${PDNS:-${PWD}/../../../pdns/pdns_server} -MODULEDIR= - -if [ -e ../.libs/libluabackend.so ] -then - MODULEDIR=--module-dir=../.libs/ -fi - -$PDNS --no-config --daemon=no --local-port=5300 --socket-dir=./ \ ---no-shuffle --launch=lua --loglevel=9 --config-dir=./ \ ---cache-ttl=0 --negquery-cache-ttl=0 --query-cache-ttl=0 \ -$MODULEDIR --lua-filename=./pdns-luabackend.lua diff --git a/modules/luabackend/test2/pdns-luabackend.lua b/modules/luabackend/test2/pdns-luabackend.lua deleted file mode 100644 index 7680b72e9e..0000000000 --- a/modules/luabackend/test2/pdns-luabackend.lua +++ /dev/null @@ -1,211 +0,0 @@ --- test script for luabackend - --- the test 'database' - -local info = {} -info["example.com."] = { - id = 11, - zone = "example.com.", - serial = '2005092501', - kind = "NATIVE", -} -info["example.org."] = { - id = 22, - zone = "example.org.", - serial = '2016020516', - kind = "NATIVE", -} - -local keys = {} -keys['example.org.'] = { - { - id = '1', - flags = '256', - active = 'true', - content = [[ -Private-key-format: v1.2 -Algorithm: 8 (RSASHA256) -Modulus: xU8TVNmCfHfOaWXQ1K503cpf13BOncXJffLl6ZFsLv1YFr1IyX+RSLvZuQ3krLGrAThgZhG1AepOBVGEKKMHlSvlEMHjS3Ef9u+KSUnhf6WLEUste8LBqqWuKqwtBNjgaiJBTP/woanA0CgDZQUua131jrhVwKObTbNHxJTRlHE= -PublicExponent: AQAB -PrivateExponent: H/Lx+mdODcGIluB5tDabjd5bLpNs53dDbTWLrQpzLhivzt7PjnEtoU1pr+FkCeKrAgOS+HQdjzXVdF8Cu2HKtEAbya+2/miH8X/+ZuduB13GH/aGEnwSJ1e6kNSwg6O8f2DfwFGp7ZKI4/fN3ad8BJB7BxUKsO96kTsDvyVmMQE= -Prime1: 5tLkvaua998MARoNTDr80DHe+qmfYVKcFbhFa7Deo0aAmIZhi9LjNvG30F0pn2PIOp0kaL8k9JBt2ganu6acKQ== -Prime2: 2tRfRF636knXuwJaiRACNf/+YoKtuNerzZMSVTLm5yXZxrxWn/eM74RZEs3z3NNSEhUrTFx4geUgwFXOkEg/CQ== -Exponent1: M12K+YpOmgpQqY4al3Qo/kuayz0j8oxnn426JRTe9oah509ANdVgKsHvnbadpJKX5DND/utKVgIt7+67NM8GwQ== -Exponent2: lb7EXnXupv3XCZrnt2lkCe3e9yxzkszLPUcKQZEunziwmSWipZ7yK6lGhu62lQNq4wLneT7CHCleSx+s1eEKeQ== -Coefficient: pOUqrMzliuwVzjlIvpK1kw4gt0Q+C9kt5QwuX+qYQ0Cqlggm1Gpn1sORmq/cSfKWlr5Dk8FpsmfJiXYNbzEpvw== -]] - }, - { - id = '2', - flags = '257', - active = 'true', - content = [[ -Private-key-format: v1.2 -Algorithm: 8 (RSASHA256) -Modulus: yjPoq6ffoOnXlU0/45ObxZFrXjQm2q88IehCnwqQBeEwzp+gjxshnz3UKYw7vlh3sRNngddzALCGDW8NUXI8XjbCquThfrt2NWvjSeU2/JkOoWt9JrPiDwCLDazVg4FyIe1hkVyli4zs3VGDgaesxB2KZd+1xsIeZfgFUHzbB4k= -PublicExponent: AQAB -PrivateExponent: M8sWFxoaEyqy2QB/k/iUVwgHu4qaRTvLqFfI8NoQyCDFkreate1aMGLy/G16RCh/CDGTOtQIFi4hOEGw5KLhST+g5Q0aBI3JPEtzj6EhkWEzpC4zxc7UATekIOh3/F4WzHzq7zsRyCusmu2sxl5qf8UvuZvTn9tlOPeFxIbfn3E= -Prime1: +lK3n337+P+kP/bMShKKddRdf/3r69ColakGxlszXNrZ7HxE6/ZrV6SVJN5KzPlbfvggJVNlrQZOABiHuMwtVQ== -Prime2: zsnSouZn6FT0f7ljE243kPcs2WVlaTtSQzZxJwg/D9k6b3dcHfQFbB/YY21x2m2nHkgdgXPvymYfL3/mNCCRZQ== -Exponent1: gPLbZG2hv0LxeYHI+t9SNCCRib1kKrXyIiZQNx4D93FFkWzylBr8cMl3iuZ34d8SIvXumUu8tMTqqWH5iFilgQ== -Exponent2: MFUv7G9aHg2tUCUuqR370uBTFUUD3QLGiXsyG2NsCfJGHEOTvlSI5+rRkvvDvsAebY+Bhf5pL6+K3nlQfyKVmQ== -Coefficient: PL3s7CSTjHmxhutEbN7S1MiBDnYAtr1P8sdf2/dA81qjcRtuZA2IGSXRo3pQBE5gFer5dAyEmeNwzdQhujPhrQ== -]] - } -} - -local meta = {} -meta['example.org.'] = { - NSEC3NARROW = {'1'}, - NSEC3PARAM = {'1 0 100 abba'}, - ['SOA-EDIT'] = {}, -} - -local domains_name = {} -domains_name["example.com."] = { - domain_id = 11, - name = "example.com.", - type = "NATIVE", - soa = { - nameserver = "ns1.example.com.", - hostmaster = "ahu.example.com.", - serial = 2005092501, - refresh = 7200, - retry = 3600, - expire = 1209600, - default_ttl = 3600, - ttl = 3600 - } -} -domains_name["example.org."] = { - domain_id = 22, - name = "example.org.", - type = "NATIVE", - soa = { - nameserver = "nsa.example.org.", - hostmaster = "ahu.example.org.", - serial = 2016020516, - refresh = 7200, - retry = 3600, - expire = 1209600, - default_ttl = 3600, - ttl = 36000 - } -} - -local records = {} -records["example.com."] = { - {domain_id = 11, name = "example.com.", type = "NS", ttl = 120, content = "ns1.example.com."}, - {domain_id = 11, name = "example.com.", type = "NS", ttl = 120, content = "ns2.example.com."}, -} -records["ns1.example.com."] = { - {domain_id = 11, name = "ns1.example.com.", type = "A", ttl = 120, content = "10.11.12.14"}, - {domain_id = 11, name = "ns1.example.com.", type = "AAAA", ttl = 120, content = "1:2:3:4:5:6:7:9"} -} -records["ns2.example.com."] = { - {domain_id = 11, name = "ns2.example.com.", type = "A", ttl = 120, content = "10.11.12.15"}, - {domain_id = 11, name = "ns2.example.com.", type = "AAAA", ttl = 120, content = "1:2:3:4:5:6:7:10"} -} -records["www.example.com."] = { - {domain_id = 11, name = "www.example.com.", type = "CNAME", ttl = 120, content = "host.example.com."} } -records["host.example.com."] = { - {domain_id = 11, name = "host.example.com.", type = "A", ttl = 120, content = "10.11.12.13"}, - {domain_id = 11, name = "host.example.com.", type = "AAAA", ttl = 120, content = "1:2:3:4:5:6:7:8"} -} -records["example.org."] = { - {domain_id = 22, name = "example.org.", type = "NS", ttl = 123, content = "nsa.example.org."}, - {domain_id = 22, name = "example.org.", type = "NS", ttl = 123, content = "nsb.example.org."}, -} -records["nsa.example.org."] = { - {domain_id = 22, name = "nsa.example.org.", type = "A", ttl = 123, content = "192.168.100.100"}, - {domain_id = 22, name = "nsa.example.org.", type = "AAAA", ttl = 123, content = "1:2:3:4:5:6:7:100"} -} -records["nsb.example.org."] = { - {domain_id = 22, name = "nsb.example.org.", type = "A", ttl = 123, content = "192.168.200.200"}, - {domain_id = 22, name = "nsb.example.org.", type = "AAAA", ttl = 123, content = "1:2:3:4:5:6:7:200"} -} -records["www.example.org."] = { - {domain_id = 22, name = "www.example.org.", type = "CNAME", ttl = 123, content = "host.example.org."} } -records["host.example.org."] = { - {domain_id = 22, name = "host.example.org.", type = "A", ttl = 123, content = "192.168.150.150"}, - {domain_id = 22, name = "host.example.org.", type = "AAAA", ttl = 123, content = "1:2:3:4:5:6:7:150"} -} - --- 'global' state: -local rrset -- the rrset we found for this query -local rrsetsize -- number of records in the rrset -local rrsetidx -- loop counter for looping over rrset - -function list(name, domain_id) -end - - -function lookup(qtype, qname, domain_id) - qtype = tostring(qtype) - logger(log_debug, "(l_lookup)", "qtype:", qtype, " qname:", qname, " domain_id:", domain_id ) - - rrset = {} - rrsetidx = 0 - rrsetsize = 0 - - local r = records[qname] - if not r then - return - end - - for k,v in pairs(r) do - if (qtype == "ANY" or qtype == v["type"]) then - table.insert(rrset, v) - end - end - - rrsetsize = #rrset - - logger(log_debug, "(l_lookup)", "size:", rrsetsize) -end - - -function get() - logger(log_debug, "(l_get) begin") - while rrsetidx < rrsetsize do - rrsetidx = rrsetidx + 1 - logger(log_debug, "(l_get) rrset ", rrsetidx) - return rrset[rrsetidx] - end - logger(log_debug, "(l_get) done") - return false -end - - -function getsoa(name) - logger(log_debug, "(l_getsoa) begin", "name:", name) - r = domains_name[name] - if type(r) == "table" then - logger(log_debug, "(l_getsoa) end: ", type(r), type(r["soa"])) - return r["soa"] - end - logger(log_debug, "(l_getsoa) end: not found") -end - - -function getdomaininfo(name) - logger(log_debug, "(l_getdomaininfo) name:", name) - return info[name] -end - - -function getdomainmetadata(name, kind) - -- ignore kind - logger(log_debug, "(l_getdomainmetadata) name:", name, 'kind: ', kind) - if meta[name] then - return meta[name][kind] - end -end - - -function getdomainkeys(name) - logger(log_debug, "(l_getdomainkeys) name:", name) - return keys[name] -end - -logger(log_debug, "the powerdns-luabackend is starting up!") diff --git a/modules/luabackend/test2/pdns_control b/modules/luabackend/test2/pdns_control deleted file mode 100755 index 8561e1066b..0000000000 --- a/modules/luabackend/test2/pdns_control +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -PDNSCONTROL=${PDNSCONTROL:-${PWD}/../../../pdns/pdns_control} -$PDNSCONTROL --config-dir=./ --socket-dir=./ $@ diff --git a/modules/luabackend/test2/runtest b/modules/luabackend/test2/runtest deleted file mode 100755 index d95b5a67a7..0000000000 --- a/modules/luabackend/test2/runtest +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -./pdns & - -sleep 2 # give some time to start - -./runtest.pl -testres=$? - -./pdns_control quit - -sleep 2 # and some time to shut down - -jobs -lr -[ -n "$(jobs -pr)" ] && jobs -x kill - -echo "all done? $testres" - -exit $testres diff --git a/modules/luabackend/test2/runtest.pl b/modules/luabackend/test2/runtest.pl deleted file mode 100755 index 3005b03f2b..0000000000 --- a/modules/luabackend/test2/runtest.pl +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use 5.10.0; # somewhat sane minimum? - -# standard perl -use Test::More; - -my $sdigpath = '../../../pdns/sdig'; -if (defined($ENV{SDIG})) { $sdigpath = $ENV{SDIG} } -my $sdig = "timeout 3 $sdigpath 127.0.0.1 5300"; - -exit main(@ARGV); - -sub main { - #plan(tests => 2); - query('A', 'www.example.com.', 0, <<'EOT'); -0 host.example.com. IN A 120 10.11.12.13 -0 www.example.com. IN CNAME 120 host.example.com. -Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 -Reply to question for qname='www.example.com.', qtype=A -EOT - - query('A', 'www.example.org.', 1, <<'EOT'); -0 host.example.org. IN A 123 192.168.150.150 -0 host.example.org. IN RRSIG 123 A 8 3 123 [expiry] [inception] [keytag] example.org. ... -0 www.example.org. IN CNAME 123 host.example.org. -0 www.example.org. IN RRSIG 123 CNAME 8 3 123 [expiry] [inception] [keytag] example.org. ... -2 . IN OPT 32768 -Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 -Reply to question for qname='www.example.org.', qtype=A -EOT - - query('A', 'foo.example.com.', 0, <<'EOT'); -1 example.com. IN SOA 3600 ns1.example.com. ahu.example.com. 2005092501 7200 3600 1209600 3600 -Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 -Reply to question for qname='foo.example.com.', qtype=A -EOT - - query('A', 'foo.example.org.', 1, <<'EOT'); -1 3he9ugm1663rsh2i0g48h0c5832av415.example.org. IN NSEC3 3600 1 [flags] 100 abba 3HE9UGM1663RSH2I0G48H0C5832AV417 -1 3he9ugm1663rsh2i0g48h0c5832av415.example.org. IN RRSIG 3600 NSEC3 8 3 3600 [expiry] [inception] [keytag] example.org. ... -1 example.org. IN RRSIG 3600 SOA 8 2 36000 [expiry] [inception] [keytag] example.org. ... -1 example.org. IN SOA 3600 nsa.example.org. ahu.example.org. 2016020516 7200 3600 1209600 3600 -1 ofe1tpras1895e6rdf38dtk4j0cebrli.example.org. IN NSEC3 3600 1 [flags] 100 abba OFE1TPRAS1895E6RDF38DTK4J0CEBRLJ NS SOA RRSIG DNSKEY NSEC3PARAM -1 ofe1tpras1895e6rdf38dtk4j0cebrli.example.org. IN RRSIG 3600 NSEC3 8 3 3600 [expiry] [inception] [keytag] example.org. ... -1 qlrm0joffkmpbcml75n92m51nod6n1o5.example.org. IN NSEC3 3600 1 [flags] 100 abba QLRM0JOFFKMPBCML75N92M51NOD6N1O7 -1 qlrm0joffkmpbcml75n92m51nod6n1o5.example.org. IN RRSIG 3600 NSEC3 8 3 3600 [expiry] [inception] [keytag] example.org. ... -2 . IN OPT 32768 -Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 -Reply to question for qname='foo.example.org.', qtype=A -EOT - done_testing(); - return 0; -} - -sub query { - my ($qtype, $qname, $sec, $should) = @_; - my $req = "$sdig $qname $qtype " . (($sec) ? ' dnssec' : '') . ' | LC_ALL=C sort'; - my $res = `$req`; - #print "req: '$req' $?\nres: $res\n"; - is($res, $should, "result for $qname $qtype"); -} - diff --git a/regression-tests/backends/common b/regression-tests/backends/common index 1339811ecb..fac0d7ce6d 100644 --- a/regression-tests/backends/common +++ b/regression-tests/backends/common @@ -63,10 +63,6 @@ start_master () source ./ext/bind-master ;; - lua*) - source ./backends/lua-master - ;; - *) nocontext=yes esac diff --git a/regression-tests/backends/lua-master b/regression-tests/backends/lua-master deleted file mode 100644 index b3e0189f4c..0000000000 --- a/regression-tests/backends/lua-master +++ /dev/null @@ -1,14 +0,0 @@ -case $context in - lua-minimal) - $RUNWRAPPER $PDNS --daemon=no --local-port=$port --socket-dir=./ \ - --no-config --no-shuffle --launch=lua --cache-ttl=$cachettl \ - --lua-filename=../modules/luabackend/test/powerdns-luabackend.lua \ - --module-dir=./modules & - #skipreasons="nodnssec noent nodyndns nometa noaxfr noalias" - skipreasons="dyndns ldap-strict narrow noalias noaxfr nodnssec nodyndns noent nometa nsec3 oracle-slave-nsec presigned" - ;; - - *) - nocontext=yes - ;; -esac diff --git a/regression-tests/modules/libluabackend.so b/regression-tests/modules/libluabackend.so deleted file mode 120000 index 30c62e820f..0000000000 --- a/regression-tests/modules/libluabackend.so +++ /dev/null @@ -1 +0,0 @@ -../../modules/luabackend/.libs/libluabackend.so \ No newline at end of file diff --git a/regression-tests/start-test-stop b/regression-tests/start-test-stop index 3fd6f837b3..6a16bac01e 100755 --- a/regression-tests/start-test-stop +++ b/regression-tests/start-test-stop @@ -58,7 +58,6 @@ remotebackend-pipe-dnssec remotebackend-unix-dnssec remotebackend-http-dnssec re tinydns ldap-tree ldap-simple ldap-strict lua2 lua2-dnssec lua2-nsec3 lua2-nsec3-narrow -lua-minimal #ext-nsd ext-nsd-nsec ext-nsd-nsec3 ext-bind ext-bind-nsec ext-bind-nsec3 * Add -presigned to any ext-nsd, ext-bind, bind, gmysql or gsqlite3 test (except narrow)