]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- rpz-triggers, fix what domain name to match for nsdname.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Apr 2021 11:11:51 +0000 (13:11 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Apr 2021 11:11:51 +0000 (13:11 +0200)
services/rpz.c
testdata/rpz_nsdname.rpl

index 6a37cb9b34b48fa7f0af2dc1b34f5e8b05768d55..9af6529848c1fa3b1c3ae478b1308b603348760e 100644 (file)
@@ -1928,23 +1928,18 @@ rpz_delegation_point_zone_lookup(struct delegpt* dp, struct local_zones* zones,
        struct local_zone* z = NULL;
 
        rpz_log_dname("delegation point", dp->name, dp->namelen);
-       // XXX: do we want this?
-       z = rpz_find_zone(zones, dp->name, dp->namelen, qclass, 0, 0, 0);
-       if(z != NULL) {
-               match->dname = dp->name;
-               match->dname_len = dp->namelen;
-       } else if(z == NULL) {
-               for(nameserver = dp->nslist;
-                   nameserver != NULL;
-                   nameserver = nameserver->next) {
-                       rpz_log_dname("delegation point", nameserver->name, nameserver->namelen);
-                       z = rpz_find_zone(zones, nameserver->name, nameserver->namelen,
-                                         qclass, 0, 0, 0);
-                       if(z != NULL) {
-                               match->dname = nameserver->name;
-                               match->dname_len = nameserver->namelen;
-                               break;
-                       }
+       /* the rpz specs match the nameserver names (NS records), not the
+        * name of the delegation point itself, to the nsdname triggers */
+       for(nameserver = dp->nslist;
+           nameserver != NULL;
+           nameserver = nameserver->next) {
+               rpz_log_dname("delegation point ns", nameserver->name, nameserver->namelen);
+               z = rpz_find_zone(zones, nameserver->name, nameserver->namelen,
+                                 qclass, 0, 0, 0);
+               if(z != NULL) {
+                       match->dname = nameserver->name;
+                       match->dname_len = nameserver->namelen;
+                       break;
                }
        }
 
index 64fb98880335cc9f68493dbe7175d66756517635..7b55ebeb7b54ddeb7632a7872338b375295d5c54 100644 (file)
@@ -16,13 +16,13 @@ rpz 3600    IN      SOA     ns1.rpz.example.com. hostmaster.rpz.example.com. (
        3600    IN      NS      ns1.rpz.example.com.
        3600    IN      NS      ns2.rpz.example.com.
 $ORIGIN rpz.example.com.
-gotham.aa.rpz-nsdname CNAME .
-gotham.bb.rpz-nsdname CNAME *.
-gotham.cc.rpz-nsdname CNAME rpz-drop.
-gotham.com.rpz-nsdname CNAME rpz-passthru.
-gotham.dd.rpz-nsdname CNAME rpz-tcp-only.
-gotham.ff.rpz-nsdname A 127.0.0.1
-gotham.ff.rpz-nsdname TXT "42"
+ns1.gotham.aa.rpz-nsdname CNAME .
+ns1.gotham.bb.rpz-nsdname CNAME *.
+ns1.gotham.cc.rpz-nsdname CNAME rpz-drop.
+ns1.gotham.com.rpz-nsdname CNAME rpz-passthru.
+ns1.gotham.dd.rpz-nsdname CNAME rpz-tcp-only.
+ns1.gotham.ff.rpz-nsdname A 127.0.0.1
+ns1.gotham.ff.rpz-nsdname TXT "42"
 TEMPFILE_END
 
 stub-zone: