Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/5466723 to your computer and use it in GitHub Desktop.
Save Habbie/5466723 to your computer and use it in GitHub Desktop.
Patch fixing the problem
Index: packethandler.cc
===================================================================
--- packethandler.cc (revision 2313)
+++ packethandler.cc (working copy)
@@ -1327,7 +1327,9 @@
if(weRedirected) {
BOOST_FOREACH(rr, rrset) {
if(rr.qtype.getCode() == QType::CNAME) {
+ rr.cname_soa_qname = sd.qname;
r->addRecord(rr);
+ rr.cname_soa_qname = "";
target = rr.content;
retargetcount++;
goto retargeted;
Index: dns.hh
===================================================================
--- dns.hh (revision 2313)
+++ dns.hh (working copy)
@@ -77,6 +77,7 @@
uint16_t qclass; //!< class of this record
string qname; //!< the name of this record, for example: www.powerdns.com
string wildcardname;
+ string cname_soa_qname;
string content; //!< what this record points to. Example: 10.1.2.3
uint16_t priority; //!< For qtypes that support a priority or preference (MX, SRV)
uint32_t ttl; //!< Time To Live of this record
@@ -95,6 +96,7 @@
ar & qclass;
ar & qname;
ar & wildcardname;
+ ar & cname_soa_qname;
ar & content;
ar & priority;
ar & ttl;
Index: dnssecsigner.cc
===================================================================
--- dnssecsigner.cc (revision 2313)
+++ dnssecsigner.cc (working copy)
@@ -153,7 +153,7 @@
{
stable_sort(rrs.begin(), rrs.end(), rrsigncomp);
- string signQName, wildcardQName;
+ string signQName, wildcardQName, cnameSigner;
uint16_t signQType=0;
uint32_t signTTL=0;
@@ -164,11 +164,12 @@
for(vector<DNSResourceRecord>::const_iterator pos = rrs.begin(); pos != rrs.end(); ++pos) {
if(pos != rrs.begin() && (signQType != pos->qtype.getCode() || signQName != pos->qname)) {
- addSignature(dk, db, signer, signQName, wildcardQName, signQType, signTTL, signPlace, toSign, signedRecords);
+ addSignature(dk, db, cnameSigner != "" ? cnameSigner : signer, signQName, wildcardQName, signQType, signTTL, signPlace, toSign, signedRecords);
}
signedRecords.push_back(*pos);
signQName= pos->qname;
wildcardQName = pos->wildcardname;
+ cnameSigner = pos->qtype.getCode() == QType::CNAME ? pos->cname_soa_qname : "";
signQType = pos ->qtype.getCode();
signTTL = pos->ttl;
signPlace = (DNSPacketWriter::Place) pos->d_place;
@@ -187,6 +188,6 @@
toSign.push_back(drc);
}
}
- addSignature(dk, db, signer, signQName, wildcardQName, signQType, signTTL, signPlace, toSign, signedRecords);
+ addSignature(dk, db, cnameSigner != "" ? cnameSigner : signer, signQName, wildcardQName, signQType, signTTL, signPlace, toSign, signedRecords);
rrs.swap(signedRecords);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment