bool TinyDNSBackend::list(const DNSName &target, int domain_id, bool include_disabled) {
d_isAxfr=true;
- string key = simpleCompress(target.toString()); // FIXME bug: no lowercase here? or do we promise lowercase from core now?
+ string key = target.toDNSString(); // FIXME bug: no lowercase here? or promise that from core?
d_cdbReader=new CDB(getArg("dbfile"));
return d_cdbReader->searchSuffix(key);
}
key.insert(0, 1, '\052');
key.insert(0, 1, '\001');
}
- rr.qname.clear();
- rr.qname=key;
+ // rr.qname.clear();
+ rr.qname=DNSName(key.c_str(), key.size(), 0, false);
rr.domain_id=-1;
// 11:13.21 <@ahu> IT IS ALWAYS AUTH --- well not really because we are just a backend :-)
// We could actually do NSEC3-NARROW DNSSEC according to Habbie, if we do, we need to change something ehre.
DNSRecordContent *drc = DNSRecordContent::mastermake(dr, pr);
rr.content = drc->getZoneRepresentation();
- // cerr<<"CONTENT: "<<rr.content<<endl;
+ cerr<<"CONTENT: "<<rr.content<<endl;
delete drc;
}
catch (...) {
vector<string> segmentDNSText(const string& input )
{
- cerr<<"segmentDNSText("<<input<<")"<<endl;
+ // cerr<<"segmentDNSText("<<input<<")"<<endl;
%%{
machine dnstext;
write data;
deque<string> segmentDNSName(const string& input )
{
- cerr<<"segmentDNSName("<<input<<")"<<endl;
+ // cerr<<"segmentDNSName("<<input<<")"<<endl;
%%{
machine dnsname;
write data;
{
// this removes duplicates from the packet in case we are not compressing
// for AXFR, no such checking is performed!
+ cerr<<"addrecord, content=["<<rr.content<<"]"<<endl;
if(d_compress)
for(vector<DNSResourceRecord>::const_iterator i=d_rrs.begin();i!=d_rrs.end();++i)
if(rr.qname==i->qname && rr.qtype==i->qtype && rr.content==i->content) {
return;
}
-
+ cerr<<"added to d_rrs"<<endl;
d_rrs.push_back(rr);
}
try {
uint8_t maxScopeMask=0;
for(pos=d_rrs.begin(); pos < d_rrs.end(); ++pos) {
+ cerr<<"during wrapup, content=["<<pos->content<<"]"<<endl;
maxScopeMask = max(maxScopeMask, pos->scopeMask);
if(!pos->content.empty() && pos->qtype.getCode()==QType::TXT && pos->content[0]!='"') {
{
// string label = d_lowerCase ? toLower(Label) : Label;
// FIXME: we ignore d_lowerCase for now
+ cerr<<"xfrName writing ["<<name.toString()<<"]"<<endl;
std::vector<std::string> parts = name.getRawLabels();
// labelparts_t parts;
+ cerr<<"labelcount: "<<parts.size()<<endl;
if(d_canonic)
compress=false;
unsigned int startPos;
for(auto &label: parts) {
+ cerr<<"xfrName labelpart ["<<label<<"]"<<endl;
// if(deDot)
// chopped.assign(label.c_str() + i->first, labellen - i->first -1);
// else
lmap_t::iterator li=d_labelmap.end();
// see if we've written out this domain before
// cerr<<"Searching for compression pointer to '"<<chopped<<"', "<<d_labelmap.size()<<" cmp-records"<<endl;
- if(compress && (li=find(d_labelmap, label))!=d_labelmap.end()) {
- // cerr<<"\tFound a compression pointer to '"<<chopped<<"': "<<li->second<<endl;
- if (d_record.size() - startRecordSize + label.size() > 253) // chopped does not include a length octet for the first label and the root label
- throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name");
- uint16_t offset=li->second;
- offset|=0xc000;
- d_record.push_back((char)(offset >> 8));
- d_record.push_back((char)(offset & 0xff));
- goto out; // skip trailing 0 in case of compression
- }
+ // if(compress && (li=find(d_labelmap, label))!=d_labelmap.end()) {
+ // cerr<<"doing compression, my label=["<<label<<"] found match ["<<li->first<<"]"<<endl;
+ // // cerr<<"\tFound a compression pointer to '"<<chopped<<"': "<<li->second<<endl;
+ // if (d_record.size() - startRecordSize + label.size() > 253) // chopped does not include a length octet for the first label and the root label
+ // throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name");
+ // uint16_t offset=li->second;
+ // offset|=0xc000;
+ // d_record.push_back((char)(offset >> 8));
+ // d_record.push_back((char)(offset & 0xff));
+ // goto out; // skip trailing 0 in case of compression
+ // }
if(li==d_labelmap.end() && pos< 16384) {
// cerr<<"\tStoring a compression pointer to '"<<chopped<<"': "<<pos<<endl;
// }
// else {
char labelsize=label.size();
+ cerr<<"labelsize = "<<int(labelsize)<<" for label ["<<label<<"]"<<endl;
d_record.push_back(labelsize);
unsigned int len=d_record.size();
d_record.resize(len + labelsize);
/** Start a new DNS record within this packet for namq, qtype, ttl, class and in the requested place. Note that packets can only be written in natural order -
ANSWER, AUTHORITY, ADDITIONAL */
- void startRecord(const DNSName& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=QClass::IN, Place place=ANSWER, bool compress=true);
+ void startRecord(const DNSName& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=QClass::IN, Place place=ANSWER, bool compress=false);
/** Shorthand way to add an Opt-record, for example for EDNS0 purposes */
typedef vector<pair<uint16_t,std::string> > optvect_t;
weDone = weRedirected = weHaveUnauth = false;
while(B.get(rr)) {
+ cerr<<"got content: ["<<rr.content<<"]"<<endl;
if (p->qtype.getCode() == QType::ANY && !p->d_dnssecOk && (rr.qtype.getCode() == QType:: DNSKEY || rr.qtype.getCode() == QType::NSEC3PARAM))
continue; // Don't send dnssec info to non validating resolvers.
if (rr.qtype.getCode() == QType::RRSIG) // RRSIGS are added later any way.