]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
772. [security] When validating, track whether pending data was from
authorMark Andrews <marka@isc.org>
Wed, 25 Nov 2009 04:50:25 +0000 (04:50 +0000)
committerMark Andrews <marka@isc.org>
Wed, 25 Nov 2009 04:50:25 +0000 (04:50 +0000)
                        the additional section or not and only return it if
                        validates as secure. [RT #20438]

14 files changed:
CHANGES
bin/named/query.c
bin/tests/system/conf.sh.in
bin/tests/system/pending/ns1/root.db.in
bin/tests/system/pending/ns2/named.conf
bin/tests/system/pending/ns2/sign.sh
bin/tests/system/pending/ns3/named.conf
bin/tests/system/pending/prereq.sh
bin/tests/system/pending/tests.sh
lib/dns/include/dns/types.h
lib/dns/masterdump.c
lib/dns/rbtdb.c
lib/dns/resolver.c
lib/dns/validator.c

diff --git a/CHANGES b/CHANGES
index 429680f504896e5fa33c1e3b9bd42f33b634ca4e..8db96beadb8eb48868d3ea73ea6916fb54e37790 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2772.  [security]      When validating, track whether pending data was from
+                       the additional section or not and only return it if
+                       validates as secure. [RT #20438]
 
        --- 9.4-ESVb1 released ---
 
index 6f185e8269e2c26a1429786d9cc110dd39533d98..e66462aa0c65912f0580f6a4fbc01ad4a6b1ec74 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.257.18.51 2009/09/24 21:38:50 jinmei Exp $ */
+/* $Id: query.c,v 1.257.18.52 2009/11/25 04:50:24 marka Exp $ */
 
 /*! \file */
 
 #define DNS_GETDB_NOLOG 0x02U
 #define DNS_GETDB_PARTIAL 0x04U
 
+#define PENDINGOK(x)   (((x) & DNS_DBFIND_PENDINGOK) != 0)
+
 typedef struct client_additionalctx {
        ns_client_t *client;
        dns_rdataset_t *rdataset;
@@ -1730,8 +1732,8 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
         */
        if (result == ISC_R_SUCCESS &&
            additionaltype == dns_rdatasetadditional_fromcache &&
-           (rdataset->trust == dns_trust_pending ||
-            rdataset->trust == dns_trust_glue) &&
+           (DNS_TRUST_PENDING(rdataset->trust) ||
+            DNS_TRUST_GLUE(rdataset->trust)) &&
            !validate(client, db, fname, rdataset, sigrdataset)) {
                dns_rdataset_disassociate(rdataset);
                if (dns_rdataset_isassociated(sigrdataset))
@@ -1770,8 +1772,8 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
         */
        if (result == ISC_R_SUCCESS &&
            additionaltype == dns_rdatasetadditional_fromcache &&
-           (rdataset->trust == dns_trust_pending ||
-            rdataset->trust == dns_trust_glue) &&
+           (DNS_TRUST_PENDING(rdataset->trust) ||
+            DNS_TRUST_GLUE(rdataset->trust)) &&
            !validate(client, db, fname, rdataset, sigrdataset)) {
                dns_rdataset_disassociate(rdataset);
                if (dns_rdataset_isassociated(sigrdataset))
@@ -2556,14 +2558,14 @@ query_addbestns(ns_client_t *client) {
        /*
         * Attempt to validate RRsets that are pending or that are glue.
         */
-       if ((rdataset->trust == dns_trust_pending ||
-            (sigrdataset != NULL && sigrdataset->trust == dns_trust_pending))
+       if ((DNS_TRUST_PENDING(rdataset->trust) ||
+            (sigrdataset != NULL && DNS_TRUST_PENDING(sigrdataset->trust)))
            && !validate(client, db, fname, rdataset, sigrdataset) &&
-           (client->query.dboptions & DNS_DBFIND_PENDINGOK) == 0)
+           !PENDINGOK(client->query.dboptions))
                goto cleanup;
 
-       if ((rdataset->trust == dns_trust_glue ||
-            (sigrdataset != NULL && sigrdataset->trust == dns_trust_glue)) &&
+       if ((DNS_TRUST_GLUE(rdataset->trust) ||
+            (sigrdataset != NULL && DNS_TRUST_GLUE(sigrdataset->trust))) &&
            !validate(client, db, fname, rdataset, sigrdataset) &&
            SECURE(client) && WANTDNSSEC(client))
                goto cleanup;
@@ -3373,6 +3375,8 @@ 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");
 
@@ -3584,9 +3588,49 @@ 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,
-                            client->query.dboptions, client->now,
-                            &node, fname, rdataset, sigrdataset);
+                            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;
+       }
 
  resume:
        CTRACE("query_find: resume");
index 10756a0db5890e651e94fd18f9b9591b5bb8f135..efa09bcc80b5ad7f579e3afbbaef88c3bff98cd9 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: conf.sh.in,v 1.27.18.10 2008/01/11 23:45:59 tbox Exp $
+# $Id: conf.sh.in,v 1.27.18.11 2009/11/25 04:50:24 marka Exp $
 
 #
 # Common configuration data for system tests, to be sourced into
@@ -44,7 +44,7 @@ CHECKCONF=$TOP/bin/check/named-checkconf
 # load on the machine to make it unusable to other users.
 # v6synth
 SUBDIRS="acl cacheclean checkconf checknames dnssec forward glue ixfr limits
-    lwresd masterfile masterformat notify nsupdate resolver rrsetorder
+    lwresd masterfile masterformat notify nsupdate pending resolver rrsetorder
     sortlist stub tkey unknown upforwd views xfer xferquota zonechecks"
 
 # PERL will be an empty string if no perl interpreter was found.
index a53b09ac7f8419dbd89108e03b9f5e703ad25c22..7ebb8869af44de97849dd13e72cb856895535747 100644 (file)
@@ -1,4 +1,4 @@
-; Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+; Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
 ;
 ; Permission to use, copy, modify, and/or distribute this software for any
 ; purpose with or without fee is hereby granted, provided that the above
@@ -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.3 2009/11/18 23:48:06 tbox Exp $
+; $Id: root.db.in,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $
 
 $TTL 30
 .                      IN SOA  marka.isc.org. a.root.servers.nil. (
index cb63caa6e00f1fb7557bf3bd8eb1d23c6715b71a..fb9b17285f3ba7c06a6afc2023c7b2775ba0c1b4 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2006-2008  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000-2002  Internet Software Consortium.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.3 2009/11/18 23:48:06 tbox Exp $ */
+/* $Id: named.conf,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $ */
 
 // NS2
 
index 3bd1102f852284e0c1aa1daa933249c31bb1f71b..84f8a64718642d7ccb68e4a4290d491c7eab24cb 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 #
-# Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004, 2006-2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000-2003  Internet Software Consortium.
 #
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -14,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.3 2009/11/18 23:48:07 tbox Exp $
+# $Id: sign.sh,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $
 
 SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
index 659746a4b74f9fcec53d398dccede76430843c93..ddbf2a8aeb03ffae91ceb6d993d4a63abc5f9015 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2006-2008  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000-2002  Internet Software Consortium.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.3 2009/11/18 23:48:07 tbox Exp $ */
+/* $Id: named.conf,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $ */
 
 // NS2
 
index b05b622ed7ee62014a0667f6de9367ac3edc6b4b..3ce98142e3f55ab3c469a29e9b4c3283da256931 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
-# Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004, 2006, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000-2002  Internet Software Consortium.
 #
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: prereq.sh,v 1.3 2009/11/18 23:48:06 tbox Exp $
+# $Id: prereq.sh,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $
 
 ../../../tools/genrandom 400 random.data
 
index e56b4079dc69717166ec98473ae93d98ca02beb5..d3dd8e688b05bdc8ba732653985a698edc5d7320 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
-# Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000-2002  Internet Software Consortium.
 #
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -14,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.3 2009/11/18 23:48:06 tbox Exp $
+# $Id: tests.sh,v 1.3.8.1 2009/11/25 04:50:24 marka Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
index e4c886efdd1fc7d3dcebb7c393fd46aa2ac03fd6..94c2d86f8233fa8485da285b01c77440d6a85a2e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: types.h,v 1.109.18.14 2009/01/19 23:46:16 tbox Exp $ */
+/* $Id: types.h,v 1.109.18.15 2009/11/25 04:50:25 marka Exp $ */
 
 #ifndef DNS_TYPES_H
 #define DNS_TYPES_H 1
@@ -241,40 +241,52 @@ enum {
        dns_trust_none = 0,
 #define dns_trust_none                 ((dns_trust_t)dns_trust_none)
 
-       /*% Subject to DNSSEC validation but has not yet been validated */
-       dns_trust_pending = 1,
-#define dns_trust_pending              ((dns_trust_t)dns_trust_pending)
+       /*%
+        * Subject to DNSSEC validation but has not yet been validated
+        * dns_trust_pending_additional (from the additional section).
+        */
+       dns_trust_pending_additional = 1,
+#define dns_trust_pending_additional \
+                ((dns_trust_t)dns_trust_pending_additional)
+
+       dns_trust_pending_answer = 2,
+#define dns_trust_pending_answer       ((dns_trust_t)dns_trust_pending_answer)
 
        /*% Received in the additional section of a response. */
-       dns_trust_additional = 2,
+       dns_trust_additional = 3,
 #define dns_trust_additional           ((dns_trust_t)dns_trust_additional)
 
        /* Received in a referral response. */
-       dns_trust_glue = 3,
+       dns_trust_glue = 4,
 #define dns_trust_glue                 ((dns_trust_t)dns_trust_glue)
 
        /* Answer from a non-authoritative server */
-       dns_trust_answer = 4,
+       dns_trust_answer = 5,
 #define dns_trust_answer               ((dns_trust_t)dns_trust_answer)
 
        /*  Received in the authority section as part of an
            authoritative response */
-       dns_trust_authauthority = 5,
+       dns_trust_authauthority = 6,
 #define dns_trust_authauthority                ((dns_trust_t)dns_trust_authauthority)
 
        /* Answer from an authoritative server */
-       dns_trust_authanswer = 6,
+       dns_trust_authanswer = 7,
 #define dns_trust_authanswer           ((dns_trust_t)dns_trust_authanswer)
 
        /* Successfully DNSSEC validated */
-       dns_trust_secure = 7,
+       dns_trust_secure = 8,
 #define dns_trust_secure               ((dns_trust_t)dns_trust_secure)
 
        /* This server is authoritative */
-       dns_trust_ultimate = 8
+       dns_trust_ultimate = 9
 #define dns_trust_ultimate             ((dns_trust_t)dns_trust_ultimate)
 };
 
+#define DNS_TRUST_PENDING(x)           ((x) == dns_trust_pending_answer || \
+                                        (x) == dns_trust_pending_additional)
+#define DNS_TRUST_GLUE(x)              ((x) == dns_trust_glue)
+
+
 /*%
  * Name checking severities.
  */
index 462952cd6566ff9deae9b20a09d8da1fa7c2ddca..bfa638105d3c3ea8edfc1a1e0f878c59ad07edc4 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: masterdump.c,v 1.73.18.18 2009/01/19 23:46:15 tbox Exp $ */
+/* $Id: masterdump.c,v 1.73.18.19 2009/11/25 04:50:24 marka Exp $ */
 
 /*! \file */
 
@@ -774,7 +774,8 @@ dump_order_compare(const void *a, const void *b) {
 
 static const char *trustnames[] = {
        "none",
-       "pending",
+       "pending-additional",
+       "pending-answer",
        "additional",
        "glue",
        "answer",
index e8b481a8fa1615e9fe6166687c7b1e52390ebee7..0db0ec27d5ec6ec2ec3fbec08fc25d4c64d2b315 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbtdb.c,v 1.196.18.56 2009/03/05 05:01:00 marka Exp $ */
+/* $Id: rbtdb.c,v 1.196.18.57 2009/11/25 04:50:24 marka Exp $ */
 
 /*! \file */
 
@@ -3072,7 +3072,7 @@ cache_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) {
        }
 
        if (dname_header != NULL &&
-           (dname_header->trust != dns_trust_pending ||
+           (!DNS_TRUST_PENDING(dname_header->trust) ||
             (search->options & DNS_DBFIND_PENDINGOK) != 0)) {
                /*
                 * We increment the reference count on node to ensure that
@@ -3586,7 +3586,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
        if (found == NULL ||
            (found->trust == dns_trust_glue &&
             ((options & DNS_DBFIND_GLUEOK) == 0)) ||
-           (found->trust == dns_trust_pending &&
+           (DNS_TRUST_PENDING(found->trust) &&
             ((options & DNS_DBFIND_PENDINGOK) == 0))) {
                /*
                 * If there is an NS rdataset at this node, then this is the
index 9e4f3c8ea778267b7b88eaefd4c56abfaf5b0ede..37b35ce0ac0edf22957a64224b89749ff638931e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.284.18.95 2009/09/24 23:46:06 tbox Exp $ */
+/* $Id: resolver.c,v 1.284.18.96 2009/11/25 04:50:25 marka Exp $ */
 
 /*! \file */
 
@@ -4129,6 +4129,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
                 * for it, unless it is glue.
                 */
                if (secure_domain && rdataset->trust != dns_trust_glue) {
+                       dns_trust_t trust;
                        /*
                         * RRSIGs are validated as part of validating the
                         * type they cover.
@@ -4165,12 +4166,34 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
                        }
 
                        /*
+                        * Reject out of bailiwick additional records
+                        * without RRSIGs as they can't possibly validate
+                        * as "secure" and as we will never never want to
+                        * store these as "answers" after validation.
+                        */
+                       if (rdataset->trust == dns_trust_additional &&
+                           sigrdataset == NULL && EXTERNAL(rdataset))
+                               continue;
+                               
+                       /*
+                         * XXXMPA: If we store as "answer" after validating
+                         * then we need to do bailiwick processing and
+                         * also need to track whether RRsets are in or
+                         * out of bailiwick.  This will require a another 
+                         * pending trust level.
+                         *
                         * Cache this rdataset/sigrdataset pair as
-                        * pending data.
+                        * pending data.  Track whether it was additional
+                        * or not.
                         */
-                       rdataset->trust = dns_trust_pending;
+                       if (rdataset->trust == dns_trust_additional)
+                               trust = dns_trust_pending_additional;
+                       else
+                               trust = dns_trust_pending_answer;
+
+                       rdataset->trust = trust;
                        if (sigrdataset != NULL)
-                               sigrdataset->trust = dns_trust_pending;
+                               sigrdataset->trust = trust;
                        if (!need_validation || !ANSWER(rdataset)) {
                                addedrdataset = ardataset;
                                result = dns_db_addrdataset(fctx->cache, node,
@@ -4518,7 +4541,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
                        for (trdataset = ISC_LIST_HEAD(tname->list);
                             trdataset != NULL;
                             trdataset = ISC_LIST_NEXT(trdataset, link))
-                               trdataset->trust = dns_trust_pending;
+                               trdataset->trust = dns_trust_pending_answer;
                        result = dns_message_nextname(fctx->rmessage,
                                                      DNS_SECTION_AUTHORITY);
                }
index 27e7866d493c17bf617ee1e90846049d4fb7214b..84bdcfc9f83fda8a1b56ac962dff2393ef574dab 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: validator.c,v 1.119.18.49 2009/03/17 23:46:05 tbox Exp $ */
+/* $Id: validator.c,v 1.119.18.50 2009/11/25 04:50:25 marka Exp $ */
 
 /*! \file */
 
@@ -1191,7 +1191,7 @@ get_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo) {
                 * We have an rrset for the given keyname.
                 */
                val->keyset = &val->frdataset;
-               if (val->frdataset.trust == dns_trust_pending &&
+               if (DNS_TRUST_PENDING(val->frdataset.trust) &&
                    dns_rdataset_isassociated(&val->fsigrdataset))
                {
                        /*
@@ -1206,7 +1206,7 @@ get_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo) {
                        if (result != ISC_R_SUCCESS)
                                return (result);
                        return (DNS_R_WAIT);
-               } else if (val->frdataset.trust == dns_trust_pending) {
+               } else if (DNS_TRUST_PENDING(val->frdataset.trust)) {
                        /*
                         * Having a pending key with no signature means that
                         * something is broken.
@@ -1827,7 +1827,7 @@ validatezonekey(dns_validator_t *val) {
                         * We have DS records.
                         */
                        val->dsset = &val->frdataset;
-                       if (val->frdataset.trust == dns_trust_pending &&
+                       if (DNS_TRUST_PENDING(val->frdataset.trust) &&
                            dns_rdataset_isassociated(&val->fsigrdataset))
                        {
                                result = create_validator(val,
@@ -1840,7 +1840,7 @@ validatezonekey(dns_validator_t *val) {
                                if (result != ISC_R_SUCCESS)
                                        return (result);
                                return (DNS_R_WAIT);
-                       } else if (val->frdataset.trust == dns_trust_pending) {
+                       } else if (DNS_TRUST_PENDING(val->frdataset.trust)) {
                                /*
                                 * There should never be an unsigned DS.
                                 */
@@ -2694,7 +2694,7 @@ proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume)
                         * There is no DS.  If this is a delegation,
                         * we maybe done.
                         */
-                       if (val->frdataset.trust == dns_trust_pending) {
+                       if (DNS_TRUST_PENDING(val->frdataset.trust)) {
                                result = create_fetch(val, tname,
                                                      dns_rdatatype_ds,
                                                      dsfetched2,