]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix up the URL fancy record type, plus tell sdig no longer to emit EDNS0 by default
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 18 Nov 2008 12:58:43 +0000 (12:58 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 18 Nov 2008 12:58:43 +0000 (12:58 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1299 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/packethandler.cc
pdns/sdig.cc

index 0ba74cba57759866dc211dd1469c6a9263872f28..ae13a68f8510c4209d8c20a3497c37889fd15dd8 100644 (file)
@@ -180,13 +180,11 @@ int PacketHandler::findUrl(DNSPacket *p, DNSPacket *r, string &target)
 int PacketHandler::doFancyRecords(DNSPacket *p, DNSPacket *r, string &target)
 {
   DNSResourceRecord rr;
-
   if(p->qtype.getCode()==QType::MX)  // check if this domain has smtp service from us
     return findMboxFW(p,r,target);
   
   if(p->qtype.getCode()==QType::A)   // search for a URL record for an A
     return findUrl(p,r,target);
-
   return 0;
 }
 
@@ -660,6 +658,16 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
 
     if(mret==2) { // there is some data, but not of the correct type
       r->clearRecords();
+
+      if(d_doFancyRecords) { // MBOXFW, URL <- fake records, emulated with MX and A
+       DLOG(L<<"There is some data, but not of the correct type, checking fancy records"<<endl);
+       int res=doFancyRecords(p,r,target);
+       if(res) { // had a result
+         if(res<0) // it was an error
+           r->setRcode(RCode::ServFail);
+         goto sendit;  
+       }
+      }
       DLOG(L<<"There is some data, but not of the correct type, adding SOA for NXRECORDSET"<<endl);
       SOAData sd;
       if(getAuth(p, &sd, target, 0)) {
@@ -678,14 +686,6 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
     if(mret == 1) 
       goto sendit; // this might be the end of it (client requested a CNAME, or we found the answer already)
 
-    if(d_doFancyRecords) { // MBOXFW, URL <- fake records, emulated with MX and A
-      int res=doFancyRecords(p,r,target);
-      if(res) { // had a result
-       if(res<0) // it was an error
-         r->setRcode(RCode::ServFail);
-       goto sendit;  
-      }
-    }
     
     // now ready to start the real direct search
 
index c5fbba278ea8cd984591ccec44f1542ab7c24fe1..2400e95baa319a8a631bb85d0052ef661c9ba15f 100644 (file)
@@ -31,16 +31,15 @@ try
   NSRecordContent nrc2("ns2.powerdns.com");
   nrc2.toPacket(pw);
   */
-
+  /*
   DNSPacketWriter::optvect_t opts;
   string ping("hallo!");
   //  opts.push_back(make_pair(5, ping));
   pw.addOpt(5200, 0, 0x8000, opts);
   pw.commit();
-
+  */
   Socket sock(InterNetwork, Datagram);
   IPEndpoint dest(argv[1] + (*argv[1]=='@'), atoi(argv[2]));
-
   sock.sendTo(string((char*)&*packet.begin(), (char*)&*packet.end()), dest);
   
   string reply;
@@ -55,7 +54,7 @@ try
     cout<<i->first.d_place-1<<"\t"<<i->first.d_label<<"\tIN\t"<<DNSRecordContent::NumberToType(i->first.d_type);
     cout<<"\t"<<i->first.d_ttl<<"\t"<< i->first.d_content->getZoneRepresentation()<<"\n";
   }
-
+#if 0
   EDNSOpts edo;
   if(getEDNSOpts(mdp, &edo)) {
     
@@ -71,6 +70,7 @@ try
     }
 
   }
+#endif
 }
 catch(std::exception &e)
 {