[Pdns-dev] DNS HINFO query causes authorative server to crash

Daniel Drown dan-pdns at drown.org
Sat Nov 15 01:10:31 CET 2008


I was looking at the PacketHandler::doDNSCheckRequest function, and it seems
to send back invalid data.

When using the following against powerdns 2.9.21.1:
dig @127.0.0.1  . HINFO CHAOS

The DNS server crashes and I get the following messages in my syslog:
pdns-1[6213]: Exception: Parsing record content: Data field in DNS should start with quote (") at position 0 of 'PowerDNS $Id: packethandle r.cc 1036 2007-04-19 20:43:14Z ahu $'
pdns-1[6213]: Got a signal 6, attempting to print trace:
pdns-1[6213]: /usr/sbin/pdns_server [0x47b5c6]
[backtrace removed]

As doDNSCheckRequest seems to be along the same lines as
PacketHandler::doVersionRequest, I just removed doDNSCheckRequest (patch
attached) and now the server no longer crashes when using the above dig. 
-------------- next part --------------
--- pdns/packethandler.cc.orig	2008-11-14 19:52:30.000000000 -0500
+++ pdns/packethandler.cc	2008-11-14 19:53:04.000000000 -0500
@@ -188,23 +188,6 @@
   return 0;
 }
 
-int PacketHandler::doDNSCheckRequest(DNSPacket *p, DNSPacket *r, string &target)
-{
-  int result = 0;
-  DNSResourceRecord rr;
-
-  if (p->qclass == 3 && p->qtype.getName() == "HINFO") {
-    rr.content = "PowerDNS $Id: packethandler.cc 1036 2007-04-19 20:43:14Z ahu $";
-    rr.ttl = 5;
-    rr.qname=target;
-    rr.qtype=13; // hinfo
-    r->addRecord(rr);
-    result = 1;
-  }
-  
-  return result;
-}
-
 /** This catches version requests. Returns 1 if it was handled, 0 if it wasn't */
 int PacketHandler::doVersionRequest(DNSPacket *p, DNSPacket *r, string &target)
 {
@@ -619,9 +602,6 @@
     string target=p->qdomain;
     bool noCache=false;
 
-    if (doDNSCheckRequest(p, r, target))
-      goto sendit;
-    
     if(doVersionRequest(p,r,target)) // catch version.bind requests
       goto sendit;
 
--- pdns/packethandler.hh.orig	2008-11-14 19:53:17.000000000 -0500
+++ pdns/packethandler.hh	2008-11-14 19:53:24.000000000 -0500
@@ -88,7 +88,6 @@
   int findMboxFW(DNSPacket *p, DNSPacket *r, string &target);
   int findUrl(DNSPacket *p, DNSPacket *r, string &target);
   int doFancyRecords(DNSPacket *p, DNSPacket *r, string &target);
-  int doDNSCheckRequest(DNSPacket *p, DNSPacket *r, string &target);
   int doVersionRequest(DNSPacket *p, DNSPacket *r, string &target);
   bool getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId);
   bool getTLDAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId);


More information about the Pdns-dev mailing list