From: George Thessalonikefs Date: Tue, 14 Jun 2022 15:44:37 +0000 (+0200) Subject: - Add testcase for allowing NOTIFY on URL addresses. X-Git-Tag: release-1.16.1rc1~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F688%2Fhead;p=thirdparty%2Funbound.git - Add testcase for allowing NOTIFY on URL addresses. --- diff --git a/services/authzone.c b/services/authzone.c index ba3335326..5f2b7154a 100644 --- a/services/authzone.c +++ b/services/authzone.c @@ -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; } diff --git a/testdata/auth_https.tdir/auth_https.test b/testdata/auth_https.tdir/auth_https.test index cff93544b..c2471b7d6 100644 --- a/testdata/auth_https.tdir/auth_https.test +++ b/testdata/auth_https.tdir/auth_https.test @@ -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 diff --git a/testdata/common.sh b/testdata/common.sh index f6d72c2f0..280f5dac4 100644 --- a/testdata/common.sh +++ b/testdata/common.sh @@ -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