Skip to content

Commit

Permalink
traling dot in DNAME content
Browse files Browse the repository at this point in the history
  • Loading branch information
mind04 committed Dec 11, 2015
1 parent 2a077df commit f745312
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/bindbackend/bindbackend2.cc
Expand Up @@ -276,6 +276,7 @@ bool Bind2Backend::feedRecord(const DNSResourceRecord &r, string *ordername)
*d_of<<qname<<"\t"<<r.ttl<<"\t"<<r.qtype.getName()<<"\t"<<r.priority<<"\t"<<content<<endl; *d_of<<qname<<"\t"<<r.ttl<<"\t"<<r.qtype.getName()<<"\t"<<r.priority<<"\t"<<content<<endl;
break; break;
case QType::CNAME: case QType::CNAME:
case QType::DNAME:
case QType::NS: case QType::NS:
if(!stripDomainSuffix(&content, domain)) if(!stripDomainSuffix(&content, domain))
content=stripDot(content)+"."; content=stripDot(content)+".";
Expand Down
3 changes: 2 additions & 1 deletion pdns/dnsrecords.cc
Expand Up @@ -26,7 +26,7 @@


void DNSResourceRecord::setContent(const string &cont) { void DNSResourceRecord::setContent(const string &cont) {
content = cont; content = cont;
if(!content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME)) if(!content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME || qtype==QType::DNAME))
boost::erase_tail(content, 1); boost::erase_tail(content, 1);


if(qtype.getCode() == QType::MX) { if(qtype.getCode() == QType::MX) {
Expand Down Expand Up @@ -58,6 +58,7 @@ string DNSResourceRecord::getZoneRepresentation() const {
if (*(content.rbegin()) != '.') ret<<"."; if (*(content.rbegin()) != '.') ret<<".";
break; break;
case QType::CNAME: case QType::CNAME:
case QType::DNAME:
case QType::NS: case QType::NS:
ret<<content; ret<<content;
if (*(content.rbegin()) != '.') ret<<"."; if (*(content.rbegin()) != '.') ret<<".";
Expand Down
2 changes: 1 addition & 1 deletion pdns/pdnssec.cc
Expand Up @@ -607,7 +607,7 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
numerrors++; numerrors++;
} }


if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME) && if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME || rr.qtype.getCode() == QType::DNAME) &&
rr.content[rr.content.size()-1] == '.') { rr.content[rr.content.size()-1] == '.') {
cout<<"[Warning] The record "<<rr.qname<<" with type "<<rr.qtype.getName()<<" has a trailing dot in the content ("<<rr.content<<"). Your backend might not work well with this."<<endl; cout<<"[Warning] The record "<<rr.qname<<" with type "<<rr.qtype.getName()<<" has a trailing dot in the content ("<<rr.content<<"). Your backend might not work well with this."<<endl;
numwarnings++; numwarnings++;
Expand Down
2 changes: 1 addition & 1 deletion pdns/resolver.cc
Expand Up @@ -203,7 +203,7 @@ static int parseResult(MOADNSParser& mdp, const std::string& origQname, uint16_t


uint16_t qtype=rr.qtype.getCode(); uint16_t qtype=rr.qtype.getCode();


if(!rr.content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME)) if(!rr.content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME || qtype==QType::DNAME))
boost::erase_tail(rr.content, 1); boost::erase_tail(rr.content, 1);


if(rr.qtype.getCode() == QType::MX) { if(rr.qtype.getCode() == QType::MX) {
Expand Down

0 comments on commit f745312

Please sign in to comment.