along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// $Id: bindbackend2.cc,v 1.2 2003/03/20 12:53:44 ahu Exp $
+// $Id: bindbackend2.cc,v 1.3 2003/03/20 13:29:29 ahu Exp $
#include <errno.h>
#include <string>
#include <map>
/** This function adds a record to a domain with a certain id. */
void Bind2Backend::insert(int id, const string &qnameu, const string &qtype, const string &content, int ttl=300, int prio=25)
{
- static int s_count;
- DLOG(
- if(!((s_count++)%10000))
- cerr<<"\r"<<s_count-1<<", "<<s_contents.size()<<" different contents, "<<d_qnames.size()<<" different qnames, "<<len/1000000<<"MB, saved: "<<
- (ulen-len)/1000;
- );
-
DNSResourceRecord rr;
rr.domain_id=id;
rr.qname=canonic(qnameu);
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// $Id: dnspacket.cc,v 1.18 2003/03/12 16:06:35 ahu Exp $
+// $Id: dnspacket.cc,v 1.19 2003/03/20 13:29:29 ahu Exp $
#include "utility.hh"
#include <cstdio>
return false;
}
-vector<DNSResourceRecord> DNSPacket::getAPRecords()
+vector<DNSResourceRecord*> DNSPacket::getAPRecords()
{
- vector<DNSResourceRecord> arrs;
+ vector<DNSResourceRecord*> arrs;
- for(vector<DNSResourceRecord>::const_iterator i=rrs.begin();
+ for(vector<DNSResourceRecord>::iterator i=rrs.begin();
i!=rrs.end();
++i)
{
(i->qtype.getCode()==15 ||
i->qtype.getCode()==2 )) // CNAME or MX or NS
{
- arrs.push_back(*i);
+ arrs.push_back(&*i);
}
}
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// $Id: dnspacket.hh,v 1.14 2003/01/21 15:04:02 ahu Exp $
+// $Id: dnspacket.hh,v 1.15 2003/03/20 13:29:29 ahu Exp $
#ifndef DNSPACKET_HH
#define DNSPACKET_HH
void truncate(int new_length); // has documentation in source
bool needAP(); //!< query this to find out if this packet needs additional processing
- vector<DNSResourceRecord> getAPRecords(); //!< get a vector with DNSResourceRecords that need additional processing
+ vector<DNSResourceRecord*> getAPRecords(); //!< get a vector with DNSResourceRecords that need additional processing
void setCompress(bool compress);
DNSPacket *replyPacket() const; //!< convenience function that creates a virgin answer packet to this question
DNSResourceRecord rr;
if (p->qclass == 3 && p->qtype.getName() == "HINFO") {
- rr.content = "PowerDNS $Id: packethandler.cc,v 1.12 2003/03/17 13:44:53 ahu Exp $";
+ rr.content = "PowerDNS $Id: packethandler.cc,v 1.13 2003/03/20 13:29:29 ahu Exp $";
rr.ttl = 5;
rr.qname=target;
rr.qtype=13; // hinfo
{
DNSResourceRecord rr;
if(p->qtype.getCode()==QType::TXT && target=="version.bind") {// TXT
- rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.12 2003/03/17 13:44:53 ahu Exp $";
+ rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.13 2003/03/20 13:29:29 ahu Exp $";
rr.ttl=5;
rr.qname=target;
rr.qtype=QType::TXT; // TXT
if(p->qtype.getCode()!=QType::AXFR && r->needAP()) { // this packet needs additional processing
DLOG(L<<Logger::Warning<<"This packet needs additional processing!"<<endl);
- vector<DNSResourceRecord> arrs=r->getAPRecords();
- for(vector<DNSResourceRecord>::const_iterator i=arrs.begin();
+ vector<DNSResourceRecord *> arrs=r->getAPRecords();
+ for(vector<DNSResourceRecord *>::const_iterator i=arrs.begin();
i!=arrs.end();
++i) {
- if(r->d.aa && i->qtype.getCode()==QType::NS && !B.getSOA(i->qname,sd)) // drop AA in case of non-SOA-level NS answer
+ if((*i)->qtype.getCode()==QType::NS && !B.getSOA((*i)->qname,sd)) { // drop AA in case of non-SOA-level NS answer
r->d.aa=false;
+ (*i)->d_place=DNSResourceRecord::AUTHORITY;
+ }
QType qtypes[2];
qtypes[0]="A"; qtypes[1]="AAAA";
for(int n=0;n < d_doIPv6AdditionalProcessing + 1; ++n) {
- B.lookup(qtypes[n],i->content,p);
+ B.lookup(qtypes[n],(*i)->content,p);
bool foundOne=false;
while(B.get(rr)) {
foundOne=true;
- if(rr.domain_id!=i->domain_id && arg()["out-of-zone-additional-processing"]=="no") {
- DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->qname<<" ("<<rr.qname<<")"<<endl);
+ if(rr.domain_id!=(*i)->domain_id && arg()["out-of-zone-additional-processing"]=="no") {
+ DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<(*i)->qname<<" ("<<rr.qname<<")"<<endl);
continue; // not adding out-of-zone additional data
}
if(d_doRecursion && DP->recurseFor(p)) {
try {
Resolver resolver;
- resolver.resolve(arg()["recursor"],i->content.c_str(),QType::A);
+ resolver.resolve(arg()["recursor"],(*i)->content.c_str(),QType::A);
Resolver::res_t res=resolver.result();
for(Resolver::res_t::const_iterator j=res.begin();j!=res.end();++j) {
if(j->d_place==DNSResourceRecord::ANSWER) {