From: bert hubert Date: Wed, 12 Jun 2013 14:17:57 +0000 (+0200) Subject: SRV record can have a '.' as final field, from which we would dutifully strip the... X-Git-Tag: rec-3.6.0-rc1~670 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ab3fdc6cb7ef0ff26a842504f5d5eedbbce53d9;p=thirdparty%2Fpdns.git SRV record can have a '.' as final field, from which we would dutifully strip the trailing ., leaving void, confusing everything. We now remove the trailing . in the right place, and not if we are trying to server '.'. Again thanks to Jelte & SIDN for catching this. --- diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 8cf9437071..c532e1af73 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -162,11 +162,9 @@ SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_ boilerplate_conv(SRV, ns_t_srv, conv.xfr16BitInt(d_preference); conv.xfr16BitInt(d_weight); conv.xfr16BitInt(d_port); - conv.xfrLabel(d_target); + conv.xfrLabel(d_target); ) - - SOARecordContent::SOARecordContent(const string& mname, const string& rname, const struct soatimes& st) : DNSRecordContent(ns_t_soa), d_mname(mname), d_rname(rname) { diff --git a/pdns/misc.hh b/pdns/misc.hh index 4da6bdadc6..00a0e1caf3 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -126,6 +126,7 @@ stringtok (Container &container, string const &in, } } +// fills container with ranges, so {posbegin,posend} template void vstringtok (Container &container, string const &in, diff --git a/pdns/resolver.cc b/pdns/resolver.cc index 6ffb3a11ed..8dae6bb749 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -182,8 +182,11 @@ static int parseResult(MOADNSParser& mdp, const std::string& origQname, uint16_t rr.priority = atoi(rr.content.c_str()); vector > fields; vstringtok(fields, rr.content, " "); - if(fields.size()==4) + if(fields.size()==4) { + if(fields[3].second - fields[3].first > 1) // strip dot, unless root + fields[3].second--; rr.content=string(rr.content.c_str() + fields[1].first, fields[3].second - fields[1].first); + } } result->push_back(rr); } diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index e610f227d1..58aebbc6b6 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -193,8 +193,6 @@ void CommunicatorClass::suck(const string &domain,const string &remote) } i->domain_id=domain_id; - if (i->qtype.getCode() == QType::SRV) - i->content = stripDot(i->content); #if 0 if(i->qtype.getCode()>=60000)