From 450c3bb49884857deffb3e86ba3aa2a3793e3ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatuya=20JINMEI=20=E7=A5=9E=E6=98=8E=E9=81=94=E5=93=89?= Date: Wed, 30 Dec 2009 08:34:30 +0000 Subject: [PATCH] 2828. [security] Cached CNAME or DNAME RR could be returned to clients without DNSSEC validation. [RT #20737] 9.4-ESV, 9.5.3, 9.6.2, 9.7.0, 9.8.0(?) --- CHANGES | 3 + bin/named/query.c | 48 +------- bin/tests/system/dnssec/ns2/example.db.in | 5 +- bin/tests/system/dnssec/ns2/sign.sh | 49 ++++++++- bin/tests/system/dnssec/tests.sh | 37 ++++++- bin/tests/system/pending/clean.sh | 5 +- bin/tests/system/pending/ns1/root.db.in | 4 +- bin/tests/system/pending/ns1/sign.sh | 3 +- bin/tests/system/pending/ns2/named.conf | 8 +- bin/tests/system/pending/ns2/sign.sh | 18 +-- bin/tests/system/pending/tests.sh | 128 +++++++++++++++++++++- lib/dns/include/dns/types.h | 4 +- lib/dns/rbtdb.c | 4 +- 13 files changed, 247 insertions(+), 69 deletions(-) diff --git a/CHANGES b/CHANGES index 9ef863d9ba..9abf6c051c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2828. [security] Cached CNAME or DNAME RR could be returned to clients + without DNSSEC validation. [RT #20737] + 2827. [security] Bogus NXDOMAIN could be cached as if valid. [RT #20712] 2825. [bug] Changing the setting of OPTOUT in a NSEC3 chain that diff --git a/bin/named/query.c b/bin/named/query.c index 4877d8fcb6..cef6d7f7c3 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.15 2009/12/03 04:38:28 marka Exp $ */ +/* $Id: query.c,v 1.313.20.16 2009/12/30 08:34:29 jinmei Exp $ */ /*! \file */ @@ -3729,8 +3729,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) dns_rdataset_t *noqname; isc_boolean_t resuming; int line = -1; - dns_rdataset_t tmprdataset; - unsigned int dboptions; CTRACE("query_find"); @@ -3948,49 +3946,9 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) /* * Now look for an answer in the database. */ - dboptions = client->query.dboptions; - if (sigrdataset == NULL && client->view->enablednssec) { - /* - * If the client doesn't want DNSSEC we still want to - * look for any data pending validation to save a remote - * lookup if possible. - */ - dns_rdataset_init(&tmprdataset); - sigrdataset = &tmprdataset; - dboptions |= DNS_DBFIND_PENDINGOK; - } - refind: result = dns_db_find(db, client->query.qname, version, type, - dboptions, client->now, &node, fname, - rdataset, sigrdataset); - /* - * If we have found pending data try to validate it. - * If the data does not validate as secure and we can't - * use the unvalidated data requery the database with - * pending disabled to prevent infinite looping. - */ - if (result != ISC_R_SUCCESS || !DNS_TRUST_PENDING(rdataset->trust)) - goto validation_done; - if (validate(client, db, fname, rdataset, sigrdataset)) - goto validation_done; - if (rdataset->trust != dns_trust_pending_answer || - !PENDINGOK(client->query.dboptions)) { - dns_rdataset_disassociate(rdataset); - if (sigrdataset != NULL && - dns_rdataset_isassociated(sigrdataset)) - dns_rdataset_disassociate(sigrdataset); - if (sigrdataset == &tmprdataset) - sigrdataset = NULL; - dns_db_detachnode(db, &node); - dboptions &= ~DNS_DBFIND_PENDINGOK; - goto refind; - } - validation_done: - if (sigrdataset == &tmprdataset) { - if (dns_rdataset_isassociated(sigrdataset)) - dns_rdataset_disassociate(sigrdataset); - sigrdataset = NULL; - } + client->query.dboptions, client->now, + &node, fname, rdataset, sigrdataset); resume: CTRACE("query_find: resume"); diff --git a/bin/tests/system/dnssec/ns2/example.db.in b/bin/tests/system/dnssec/ns2/example.db.in index c2b5e987a7..d934e56585 100644 --- a/bin/tests/system/dnssec/ns2/example.db.in +++ b/bin/tests/system/dnssec/ns2/example.db.in @@ -13,7 +13,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: example.db.in,v 1.19 2008/09/25 04:02:38 tbox Exp $ +; $Id: example.db.in,v 1.19.48.1 2009/12/30 08:34:29 jinmei Exp $ $TTL 300 ; 5 minutes @ IN SOA mname1. . ( @@ -36,6 +36,9 @@ d A 10.0.0.4 foo TXT "testing" foo A 10.0.1.0 +bad-cname CNAME a +bad-dname DNAME @ + ; Used for testing CNAME queries cname1 CNAME cname1-target cname1-target TXT "testing cname" diff --git a/bin/tests/system/dnssec/ns2/sign.sh b/bin/tests/system/dnssec/ns2/sign.sh index eb3f78bd88..dd74552063 100644 --- a/bin/tests/system/dnssec/ns2/sign.sh +++ b/bin/tests/system/dnssec/ns2/sign.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: sign.sh,v 1.30.48.5 2009/06/22 05:05:01 marka Exp $ +# $Id: sign.sh,v 1.30.48.6 2009/12/30 08:34:29 jinmei Exp $ SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh @@ -42,6 +42,53 @@ cat $infile $keyname1.key $keyname2.key >$zonefile $SIGNER -P -g -r $RANDFILE -o $zone -k $keyname1 $zonefile $keyname2 > /dev/null +# +# lower/uppercase the signature bits with the exception of the last characters +# changing the last 4 characters will lead to a bad base64 encoding. +# +$CHECKZONE -D -q -i local $zone $zonefile.signed | +awk ' +tolower($1) == "bad-cname.example." && $4 == "RRSIG" && $5 == "CNAME" { + for (i = 1; i <= NF; i++ ) { + if (i <= 12) { + printf("%s ", $i); + continue; + } + prefix = substr($i, 1, length($i) - 4); + suffix = substr($i, length($i) - 4, 4); + if (i > 12 && tolower(prefix) != prefix) + printf("%s%s", tolower(prefix), suffix); + else if (i > 12 && toupper(prefix) != prefix) + printf("%s%s", toupper(prefix), suffix); + else + printf("%s%s ", prefix, suffix); + } + printf("\n"); + next; +} + +tolower($1) == "bad-dname.example." && $4 == "RRSIG" && $5 == "DNAME" { + for (i = 1; i <= NF; i++ ) { + if (i <= 12) { + printf("%s ", $i); + continue; + } + prefix = substr($i, 1, length($i) - 4); + suffix = substr($i, length($i) - 4, 4); + if (i > 12 && tolower(prefix) != prefix) + printf("%s%s", tolower(prefix), suffix); + else if (i > 12 && toupper(prefix) != prefix) + printf("%s%s", toupper(prefix), suffix); + else + printf("%s%s ", prefix, suffix); + } + printf("\n"); + next; +} + +{ print; }' > $zonefile.signed++ && mv $zonefile.signed++ $zonefile.signed + + # Sign the privately secure file privzone=private.secure.example. diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh index 57faa63787..624c8e184b 100644 --- a/bin/tests/system/dnssec/tests.sh +++ b/bin/tests/system/dnssec/tests.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: tests.sh,v 1.53 2008/09/25 04:02:38 tbox Exp $ +# $Id: tests.sh,v 1.53.48.1 2009/12/30 08:34:29 jinmei Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh @@ -522,6 +522,41 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:Checking that a bad CNAME signature is caught after a +CD query ($n)" +ret=0 +#prime +$DIG $DIGOPTS +cd bad-cname.example. @10.53.0.4 > dig.out.ns4.prime$n || ret=1 +#check: requery with +CD. pending data should be returned even if it's bogus +expect="a.example. +10.0.0.1" +ans=`$DIG $DIGOPTS +cd +nodnssec +short bad-cname.example. @10.53.0.4` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +#check: requery without +CD. bogus cached data should be rejected. +$DIG $DIGOPTS +nodnssec bad-cname.example. @10.53.0.4 > dig.out.ns4.test$n || ret=1 +grep "SERVFAIL" dig.out.ns4.test$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I:Checking that a bad DNAME signature is caught after a +CD query ($n)" +ret=0 +#prime +$DIG $DIGOPTS +cd a.bad-dname.example. @10.53.0.4 > dig.out.ns4.prime$n || ret=1 +#check: requery with +CD. pending data should be returned even if it's bogus +expect="example. +a.example. +10.0.0.1" +ans=`$DIG $DIGOPTS +cd +nodnssec +short a.bad-dname.example. @10.53.0.4` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +#check: requery without +CD. bogus cached data should be rejected. +$DIG $DIGOPTS +nodnssec a.bad-dname.example. @10.53.0.4 > dig.out.ns4.test$n || ret=1 +grep "SERVFAIL" dig.out.ns4.test$n > /dev/null || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + # Check the insecure.secure.example domain (insecurity proof) echo "I:checking 2-server insecurity proof ($n)" diff --git a/bin/tests/system/pending/clean.sh b/bin/tests/system/pending/clean.sh index c9eb47f598..c5d163c2ad 100644 --- a/bin/tests/system/pending/clean.sh +++ b/bin/tests/system/pending/clean.sh @@ -14,9 +14,10 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: clean.sh,v 1.2.4.2 2009/12/03 04:52:37 marka Exp $ +# $Id: clean.sh,v 1.2.4.3 2009/12/30 08:34:30 jinmei Exp $ rm -rf */*.signed +rm -rf */*.jnl rm -rf */K* rm -rf */dsset-* rm -rf */named.memstats @@ -24,4 +25,6 @@ rm -rf */named.run rm -rf */trusted.conf rm -rf ns1/root.db rm -rf ns2/example.db +rm -rf ns2/example.com.db rm -rf random.data +rm -rf nsupdate.out.test diff --git a/bin/tests/system/pending/ns1/root.db.in b/bin/tests/system/pending/ns1/root.db.in index 7f1e31ff50..a3b1c44ef2 100644 --- a/bin/tests/system/pending/ns1/root.db.in +++ b/bin/tests/system/pending/ns1/root.db.in @@ -12,7 +12,7 @@ ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. -; $Id: root.db.in,v 1.2.4.2 2009/11/18 23:47:24 tbox Exp $ +; $Id: root.db.in,v 1.2.4.3 2009/12/30 08:34:30 jinmei Exp $ $TTL 30 . IN SOA marka.isc.org. a.root.servers.nil. ( @@ -27,5 +27,7 @@ a.root-servers.nil. A 10.53.0.1 example. NS ns2.example. ns2.example. A 10.53.0.2 +example.com. NS ns2.example.com. +ns2.example.com. A 10.53.0.2 hostile. NS ns3.hostile. ns3.hostile. A 10.53.0.3 diff --git a/bin/tests/system/pending/ns1/sign.sh b/bin/tests/system/pending/ns1/sign.sh index 3690a196e9..1b682fac4a 100644 --- a/bin/tests/system/pending/ns1/sign.sh +++ b/bin/tests/system/pending/ns1/sign.sh @@ -14,7 +14,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: sign.sh,v 1.2.4.2 2009/11/25 20:50:25 marka Exp $ +# $Id: sign.sh,v 1.2.4.3 2009/12/30 08:34:30 jinmei Exp $ SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh @@ -28,6 +28,7 @@ zonefile=root.db (cd ../ns2 && sh -e sign.sh ) cp ../ns2/dsset-example. . +cp ../ns2/dsset-example.com. . keyname1=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -n zone $zone` keyname2=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 2048 -f KSK -n zone $zone` diff --git a/bin/tests/system/pending/ns2/named.conf b/bin/tests/system/pending/ns2/named.conf index c5be8e6af6..5a7b41b290 100644 --- a/bin/tests/system/pending/ns2/named.conf +++ b/bin/tests/system/pending/ns2/named.conf @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named.conf,v 1.2.4.2 2009/11/18 23:47:24 tbox Exp $ */ +/* $Id: named.conf,v 1.2.4.3 2009/12/30 08:34:30 jinmei Exp $ */ // NS2 @@ -45,3 +45,9 @@ zone "example" { type master; file "example.db.signed"; }; + +zone "example.com" { + type master; + file "example.com.db.signed"; + allow-update { 10.53.0.0/8; }; +}; diff --git a/bin/tests/system/pending/ns2/sign.sh b/bin/tests/system/pending/ns2/sign.sh index fc904bd771..adbb3d9a7e 100644 --- a/bin/tests/system/pending/ns2/sign.sh +++ b/bin/tests/system/pending/ns2/sign.sh @@ -14,20 +14,22 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: sign.sh,v 1.2.4.3 2009/11/25 20:50:25 marka Exp $ +# $Id: sign.sh,v 1.2.4.4 2009/12/30 08:34:30 jinmei Exp $ SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh RANDFILE=../random.data -zone=example. -infile=example.db.in -zonefile=example.db +for domain in example example.com; do + zone=${domain}. + infile=${domain}.db.in + zonefile=${domain}.db -keyname1=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 768 -n zone $zone` -keyname2=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -f KSK -n zone $zone` + keyname1=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 768 -n zone $zone` + keyname2=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -f KSK -n zone $zone` -cat $infile $keyname1.key $keyname2.key >$zonefile + cat $infile $keyname1.key $keyname2.key >$zonefile -$SIGNER -r $RANDFILE -o $zone $zonefile > /dev/null + $SIGNER -r $RANDFILE -o $zone $zonefile > /dev/null +done diff --git a/bin/tests/system/pending/tests.sh b/bin/tests/system/pending/tests.sh index 73cddabd38..ade0a276b2 100644 --- a/bin/tests/system/pending/tests.sh +++ b/bin/tests/system/pending/tests.sh @@ -14,22 +14,50 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: tests.sh,v 1.2.4.2 2009/11/18 23:47:24 tbox Exp $ +# $Id: tests.sh,v 1.2.4.3 2009/12/30 08:34:30 jinmei Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh +# replace_data dname RR old_data new_data +replace_data() +{ + if [ $# -ne 4 ]; then + echo I:unexpected input for replace_data + return 1 + fi + + _dname=$1 + _rr=$2 + _olddata=$3 + _newdata=$4 + + _ret=0 + $NSUPDATE -d <> nsupdate.out.test 2>&1 || _ret=1 +server 10.53.0.2 5300 +update delete ${_dname} 30 ${_rr} ${_olddata} +update add ${_dname} 30 ${_rr} ${_newdata} +send +END + + if [ $_ret != 0 ]; then + echo I:failed to update the test data + return 1 + fi + + return 0 +} + status=0 n=0 -rm -f dig.out.* - -DIGOPTS="+short +tcp +cd -p 5300" +DIGOPTS="+short +tcp -p 5300" +DIGOPTS_CD="$DIGOPTS +cd" echo I:Priming cache. ret=0 expect="10 mail.example." -ans=`$DIG $DIGOPTS @10.53.0.4 hostile MX` || ret=1 +ans=`$DIG $DIGOPTS_CD @10.53.0.4 hostile MX` || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" status=`expr $status + $ret` @@ -37,7 +65,95 @@ status=`expr $status + $ret` echo I:Checking that bogus additional is not returned with +CD. ret=0 expect="10.0.0.2" -ans=`$DIG $DIGOPTS @10.53.0.4 mail.example A` || ret=1 +ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example A` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +# +# Prime cache with pending additional records. These should not be promoted +# to answer. +# +echo "I:Priming cache (pending additional A and AAAA)" +ret=0 +expect="10 mail.example.com." +ans=`$DIG $DIGOPTS @10.53.0.4 example.com MX` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +echo "I:Replacing pending A" +ret=0 +replace_data mail.example.com. A 192.0.2.2 192.0.2.3 || ret=1 +status=`expr $status + $ret` + +echo "I:Replacing pending AAAA" +ret=0 +replace_data mail.example.com. AAAA 2001:db8::2 2001:db8::3 || ret=1 +status=`expr $status + $ret` + +echo "I:Checking updated data to be returned (without CD)" +ret=0 +expect="192.0.2.3" +ans=`$DIG $DIGOPTS @10.53.0.4 mail.example.com A` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +echo "I:Checking updated data to be returned (with CD)" +ret=0 +expect="2001:db8::3" +ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example.com AAAA` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +# +# Prime cache with a pending answer record. It can be returned (without +# validation) with +CD. +# +echo "I:Priming cache (pending answer)" +ret=0 +expect="192.0.2.2" +ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +echo I:Replacing pending data +ret=0 +replace_data pending-ok.example.com. A 192.0.2.2 192.0.2.3 || ret=1 +status=`expr $status + $ret` + +echo I:Confirming cached pending data to be returned with CD +ret=0 +expect="192.0.2.2" +ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +# +# Prime cache with a pending answer record. It should not be returned +# to no-DNSSEC clients. +# +echo "I:Priming cache (pending answer)" +ret=0 +expect="192.0.2.102" +ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ng.example.com A` || ret=1 +test "$ans" = "$expect" || ret=1 +test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" +status=`expr $status + $ret` + +echo I:Replacing pending data +ret=0 +replace_data pending-ng.example.com. A 192.0.2.102 192.0.2.103 || ret=1 +status=`expr $status + $ret` + +echo I:Confirming updated data returned, not the cached one, without CD +ret=0 +expect="192.0.2.103" +ans=`$DIG $DIGOPTS @10.53.0.4 pending-ng.example.com A` || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'" status=`expr $status + $ret` diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 53f840e452..10ce229ac9 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: types.h,v 1.130.50.4 2009/11/18 00:15:38 marka Exp $ */ +/* $Id: types.h,v 1.130.50.5 2009/12/30 08:34:30 jinmei Exp $ */ #ifndef DNS_TYPES_H #define DNS_TYPES_H 1 @@ -301,6 +301,8 @@ enum { #define DNS_TRUST_PENDING(x) ((x) == dns_trust_pending_answer || \ (x) == dns_trust_pending_additional) +#define DNS_TRUST_ADDITIONAL(x) ((x) == dns_trust_additional || \ + (x) == dns_trust_pending_additional) #define DNS_TRUST_GLUE(x) ((x) == dns_trust_glue) diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index e7335a2fa6..f841ebea5e 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.270.12.15 2009/12/29 22:12:35 marka Exp $ */ +/* $Id: rbtdb.c,v 1.270.12.16 2009/12/30 08:34:30 jinmei Exp $ */ /*! \file */ @@ -4537,7 +4537,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, * If we didn't find what we were looking for... */ if (found == NULL || - (found->trust == dns_trust_additional && + (DNS_TRUST_ADDITIONAL(found->trust) && ((options & DNS_DBFIND_ADDITIONALOK) == 0)) || (found->trust == dns_trust_glue && ((options & DNS_DBFIND_GLUEOK) == 0)) ||