From: bert hubert Date: Sat, 5 Mar 2016 10:42:48 +0000 (+0100) Subject: wow yet another misnamed function attempting to encode DNS strings! X-Git-Tag: rec-4.0.0-alpha2~12^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98584698520818c2f802f5e24977e40a7cbc018f;p=pdns wow yet another misnamed function attempting to encode DNS strings! --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index f5330aadb..81753618a 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -84,25 +84,6 @@ private: vector d_record; }; -//FIXME400 lots of overlap with DNSPacketWriter::xfrName -static const string EncodeDNSLabel(const DNSName& input) -{ - if(!input.countLabels()) // otherwise we encode .. (long story) - return string (1, 0); - - auto parts = input.getRawLabels(); - string ret; - - for(auto &label: parts) { - ret.append(1, label.size()); - ret.append(label); - } - - ret.append(1, 0); - return ret; -} - - shared_ptr DNSRecordContent::unserialize(const DNSName& qname, uint16_t qtype, const string& serialized) { dnsheader dnsheader; @@ -114,7 +95,7 @@ shared_ptr DNSRecordContent::unserialize(const DNSName& qname, /* will look like: dnsheader, 5 bytes, encoded qname, dns record header, serialized data */ - string encoded=EncodeDNSLabel(qname); + string encoded=qname.toDNSString(); packet.resize(sizeof(dnsheader) + 5 + encoded.size() + sizeof(struct dnsrecordheader) + serialized.size());