]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge pull request #5265 from rgacogne/rec-rpz-wildcard-target
authorPieter Lexis <pieterlexis@users.noreply.github.com>
Sat, 13 May 2017 09:34:28 +0000 (11:34 +0200)
committerGitHub <noreply@github.com>
Sat, 13 May 2017 09:34:28 +0000 (11:34 +0200)
rec: Add support for RPZ wildcarded target names

1  2 
pdns/filterpo.cc
pdns/filterpo.hh
pdns/pdns_recursor.cc

index 8a5b1e184096f1d6a402a3f4b123f5a4c38698fc,09bc0bec7c53c22359555b5b32a3e853899d6e41..8ef02f4db668f13bb38ae117fb531caeb4c6c502
@@@ -207,8 -237,38 +207,36 @@@ bool DNSFilterEngine::Zone::rmNSTrigger
    return true;
  }
  
 -bool DNSFilterEngine::rmNSIPTrigger(const Netmask& nm, Policy pol, size_t zone)
 +bool DNSFilterEngine::Zone::rmNSIPTrigger(const Netmask& nm, Policy pol)
  {
 -  assureZones(zone);
 -  auto& pols = d_zones[zone].propolNSAddr;
 -  pols.erase(nm);
 +  d_propolNSAddr.erase(nm);
    return true;
  }
+ DNSRecord DNSFilterEngine::Policy::getCustomRecord(const DNSName& qname) const
+ {
+   if (d_kind != PolicyKind::Custom) {
+     throw std::runtime_error("Asking for a custom record from a filtering policy of a non-custom type");
+   }
+   DNSRecord result;
+   result.d_name = qname;
+   result.d_type = d_custom->getType();
+   result.d_ttl = d_ttl;
+   result.d_class = QClass::IN;
+   result.d_place = DNSResourceRecord::ANSWER;
+   result.d_content = d_custom;
+   if (result.d_type == QType::CNAME) {
+     const auto content = std::dynamic_pointer_cast<CNAMERecordContent>(d_custom);
+     if (content) {
+       DNSName target = content->getTarget();
+       if (target.isWildcard()) {
+         target.chopOff();
+         result.d_content = std::make_shared<CNAMERecordContent>(qname + target);
+       }
+     }
+   }
+   return result;
+ }
Simple merge
Simple merge