]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test passing update-policy grant external address to handler 12546/head
authorMark Andrews <marka@isc.org>
Mon, 10 Aug 2026 23:45:26 +0000 (09:45 +1000)
committerMark Andrews <marka@isc.org>
Tue, 11 Aug 2026 23:12:31 +0000 (09:12 +1000)
These addresses are only supposed to only be passed for TCP
connections.  There should be no address for UDP requests.

bin/tests/system/authsock.pl [moved from bin/tests/system/tsiggss/authsock.pl with 98% similarity]
bin/tests/system/nsupdate/ns1/grant-external.test.db.in [new file with mode: 0644]
bin/tests/system/nsupdate/ns1/named.conf.j2
bin/tests/system/nsupdate/setup.sh
bin/tests/system/nsupdate/tests.sh
bin/tests/system/nsupdate/tests_sh_nsupdate.py
bin/tests/system/tsiggss/tests.sh

similarity index 98%
rename from bin/tests/system/tsiggss/authsock.pl
rename to bin/tests/system/authsock.pl
index 4c76bf8d56362430d136a6d4f721ecf64122f92c..2829abb38210a6b4e1a05e7560028ccb723cae35 100644 (file)
@@ -15,6 +15,7 @@
 
 require 5.6.0;
 
+use IO::File;
 use IO::Socket::UNIX;
 use Getopt::Long;
 
@@ -28,6 +29,8 @@ GetOptions("path=s" => \$path,
           "pidfile=s" => \$pidfile,
           "timeout=i" => \$timeout);
 
+STDOUT->autoflush(1);
+
 if (!defined($path)) {
        print("Usage: authsock.pl --path=<sockpath> --type=type --pidfile=pidfile\n");
        exit(1);
diff --git a/bin/tests/system/nsupdate/ns1/grant-external.test.db.in b/bin/tests/system/nsupdate/ns1/grant-external.test.db.in
new file mode 100644 (file)
index 0000000..a9453d7
--- /dev/null
@@ -0,0 +1,10 @@
+$TTL 300       ; 5 minutes
+@              IN SOA  ns1.example.nil. hostmaster.example.nil. (
+                               1          ; serial
+                               2000       ; refresh (2000 seconds)
+                               2000       ; retry (2000 seconds)
+                               1814400    ; expire (3 weeks)
+                               3600       ; minimum (1 hour)
+                               )
+@              NS      ns1.example.nil.
+               NS      ns2.example.nil.
index 362aa333fab3e504c4edf6bb1de9f5191d0b22d2..a38be0e6066db2fa108ed6e29316740967a09415 100644 (file)
@@ -145,6 +145,14 @@ zone "keytests.nil" {
        };
 };
 
+zone "grant-external.test" {
+       type primary;
+       file "grant-external.test.db";
+       update-policy {
+               grant "local:auth.sock" external * CNAME;
+       };
+};
+
 zone "many.test" {
        type primary;
        allow-update { any; };
index 9d27b20a760dfc92ccb5caa9237863d62c3496a7..9e3cd4f6b730c4453e4890635358b943891d2fc8 100644 (file)
@@ -14,6 +14,7 @@
 . ../conf.sh
 
 cp -f ns1/example1.db ns1/example.db
+cp -f ns1/grant-external.test.db.in ns1/grant-external.test.db
 sed 's/example.nil/other.nil/g' ns1/example1.db >ns1/other.db
 sed 's/example.nil/unixtime.nil/g' ns1/example1.db >ns1/unixtime.db
 sed 's/example.nil/yyyymmddvv.nil/g' ns1/example1.db >ns1/yyyymmddvv.db
index d71136c563e780698cf68f3de484c0d7a80f29c4..ca8cf804954d8bc280de980f76873c3eb46b4ba3 100755 (executable)
@@ -2435,6 +2435,32 @@ wait_for_log 10 "too many DNS UPDATEs queued" ns1/named.run || ret=1
   status=1
 }
 
+n=$((n + 1))
+ret=0
+echo_i "check that grant external pass client address properly ($n)" {
+($PERL "${TOP_SRCDIR}/bin/tests/system/authsock.pl" --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >authsock.out.test$n 2>&1 &) &
+sleep 1
+nextpart authsock.out.test$n >/dev/null
+$NSUPDATE -k ns1/ddns.key -d <<EOF >nsupdate.udp.test$n 2>&1 || ret=1
+server 10.53.0.1 ${PORT}
+zone grant-external.test
+update add cnameoverudp.grant-external.test 0 IN CNAME grant-external.test.
+send
+EOF
+nextpart authsock.out.test$n | grep ' addr= ' >/dev/null || ret=1
+$NSUPDATE -v -d <<EOF >nsupdate.tcp.test$n 2>&1 || ret=1
+server 10.53.0.1 ${PORT}
+zone grant-external.test
+update add cnameovertcp.grant-external.test 0 IN CNAME grant-external.test.
+send
+EOF
+nextpart authsock.out.test$n | grep ' addr=10.53.0.1 ' >/dev/null || ret=1
+kill $(cat authsock.pid) || true
+[ $ret = 0 ] || {
+  echo_i "failed"
+  status=1
+}
+
 if ! $FEATURETEST --gssapi; then
   echo_i "SKIPPED: GSSAPI tests"
 else
index 0765a90d718f4b296aafe1ec8454efaaa2edc5af..bcab4d6e4d61e7b3ce4476561e599d0aa8c9f944 100644 (file)
@@ -18,20 +18,26 @@ import isctest.mark
 EXTRA_ARTIFACTS = pytest.mark.extra_artifacts(
     [
         "Kxxx*",
+        "authsock.out.*",
+        "authsock.pid",
         "dig.out.*",
         "nextpart.out.*",
         "nsupdate.*out*",
+        "nsupdate.tcp.*",
+        "nsupdate.udp.*",
+        "perl.update_test.out",
         "policy.expected.*",
         "policy.log*",
-        "perl.update_test.out",
         "typelist.out.*",
         "update.in.*",
         "verylarge",
         "ans*/ans.run",
         "ns*/*.jnl",
         "ns*/*.jnl",
+        "ns1/auth.sock",
         "ns1/ddns.key",
         "ns1/example.db",
+        "ns1/grant-external.test.db",
         "ns1/keytests.db",
         "ns1/legacy*.key",
         "ns1/many.test.db",
index 11c310d634ae33381825f5ac6159a357ebbce368..482b940e902acf0d966d0c0ffdb6a95083d53451 100644 (file)
@@ -120,7 +120,7 @@ status=$((status + ret))
 
 echo_i "testing external update policy (CNAME) with auth sock ($n)"
 ret=0
-$PERL ./authsock.pl --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >/dev/null 2>&1 &
+($PERL "${TOP_SRCDIR}/bin/tests/system/authsock.pl" --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >/dev/null 2>&1 &) &
 sleep 1
 test_update $n testcname.example.nil. CNAME "86400 CNAME testdenied.example.nil" "testdenied" || ret=1
 n=$((n + 1))