]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Add testcase for allowing NOTIFY on URL addresses. 688/head
authorGeorge Thessalonikefs <george@nlnetlabs.nl>
Tue, 14 Jun 2022 15:44:37 +0000 (17:44 +0200)
committerGeorge Thessalonikefs <george@nlnetlabs.nl>
Tue, 14 Jun 2022 15:44:37 +0000 (17:44 +0200)
services/authzone.c
testdata/auth_https.tdir/auth_https.test
testdata/common.sh

index ba33353260797021c6463f50c0c5ceb406e76946..5f2b7154a9466daa86a836b7c1042f1d718cb94e 100644 (file)
@@ -5512,7 +5512,7 @@ xfr_transfer_init_fetch(struct auth_xfer* xfr, struct module_env* env)
                        addr_to_str(&addr, addrlen, as, sizeof(as));
                        verbose(VERB_ALGO, "auth zone %s transfer next HTTP fetch from %s started", zname, as);
                }
-               /* Create or refresh the list of of allow_notify addrs */
+               /* Create or refresh the list of allow_notify addrs */
                probe_copy_masters_for_allow_notify(xfr);
                return 1;
        }
index cff93544b14a591cff69f16ca3a81485d00b6ff0..c2471b7d6439fc69181bcb76a192172ec56be2fc 100644 (file)
@@ -5,6 +5,7 @@
 [ -f .tpkg.var.test ] && source .tpkg.var.test
 
 PRE="../.."
+. ../common.sh
 # do the test
 echo "> dig www.example.com."
 dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
@@ -48,4 +49,15 @@ else
        exit 1
 fi
 
+# Test that notify is allowed from the webserver address
+get_ldns_notify
+echo "> ldns-notify -z example.com"
+$LDNS_NOTIFY -p $UNBOUND_PORT -z example.com 127.0.0.1 | tee outfile
+if grep "rcode: REFUSED"  outfile; then
+       echo "Not OK"
+       exit 1
+else
+       echo "OK"
+fi
+
 exit 0
index f6d72c2f046a7d996960a24475c72cfdfae80964..280f5dac4cec6bbaa50d41985ff8bdd8d69b4b34 100644 (file)
@@ -14,6 +14,7 @@
 # info x               : print info
 # test_tool_avail x    : see if program in path and complain, exit if not.
 # get_ldns_testns      : set LDNS_TESTNS to executable ldns-testns
+# get_ldns_notify      : set LDNS_NOTIFY to executable ldns-notify
 # get_make             : set MAKE to gmake or make tool.
 # get_gcc              : set cc or gcc in CC
 # get_pcat             : set PCAT, PCAT_DIFF and PCAT_PRINT executables.
@@ -62,6 +63,15 @@ get_ldns_testns () {
        fi
 }
 
+# get ldns-notify tool in LDNS_NOTIFY variable.
+get_ldns_notify () {
+       if test -x "`which ldns-notify 2>&1`"; then
+               LDNS_NOTIFY=ldns-notify
+       else
+               LDNS_NOTIFY=/home/wouter/bin/ldns-notify
+       fi
+}
+
 # get make tool in MAKE variable, gmake is used if present.
 get_make () {
        if test -x "`which gmake 2>&1`"; then