]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix up MBOXFW fancy records, plus add them to the regression tests
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 18 Nov 2008 17:20:16 +0000 (17:20 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 18 Nov 2008 17:20:16 +0000 (17:20 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1302 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnsrecords.cc
pdns/dnsrecords.hh
pdns/packethandler.cc
regression-tests/mboxfw-record/command [new file with mode: 0755]
regression-tests/mboxfw-record/description [new file with mode: 0644]
regression-tests/mboxfw-record/expected_result [new file with mode: 0644]
regression-tests/test.com

index ed58468860d6a12b365a499c0a272cfdb8566baa..90bed74868a12ffbec845dcecd48192c45afff3c 100644 (file)
@@ -342,10 +342,15 @@ boilerplate_conv(DNSKEY, 48,
                 conv.xfrBlob(d_key);
                 )
 
-boilerplate_conv(URL, 256, 
+// "fancy records" 
+boilerplate_conv(URL, QType::URL, 
                 conv.xfrLabel(d_url);
                 )
 
+boilerplate_conv(MBOXFW, QType::MBOXFW, 
+                conv.xfrLabel(d_mboxfw);
+                )
+
 bool getEDNSOpts(const MOADNSParser& mdp, EDNSOpts* eo)
 {
   if(mdp.d_header.arcount && !mdp.d_answers.empty() && 
@@ -409,6 +414,7 @@ void reportOtherTypes()
 void reportFancyTypes()
 {
   URLRecordContent::report();
+  MBOXFWRecordContent::report();
 }
 
 void reportAllTypes()
index 35f70d6c33fde513ebd310a1141db50ebe825734..03fe6815193445a414a789058cf8fb80ddaf612d 100644 (file)
@@ -372,6 +372,15 @@ private:
   string d_url;
 };
 
+class MBOXFWRecordContent : public DNSRecordContent // Fake, 'fancy record' with type 256
+{
+public:
+  includeboilerplate(MBOXFW)
+private:
+  string d_mboxfw;
+};
+
+
 #define boilerplate(RNAME, RTYPE)                                                                         \
 RNAME##RecordContent::DNSRecordContent* RNAME##RecordContent::make(const DNSRecord& dr, PacketReader& pr) \
 {                                                                                                  \
index ae13a68f8510c4209d8c20a3497c37889fd15dd8..d9e85ff80d60a79fce251d811d3ffa9c71278a2b 100644 (file)
@@ -658,16 +658,17 @@ 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;  
-       }
+    }
+    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;  
       }
+    }
+    if(mret == 2) {
       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)) {
diff --git a/regression-tests/mboxfw-record/command b/regression-tests/mboxfw-record/command
new file mode 100755 (executable)
index 0000000..5bc3129
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+cleandig test.com MX
+
diff --git a/regression-tests/mboxfw-record/description b/regression-tests/mboxfw-record/description
new file mode 100644 (file)
index 0000000..a932d2c
--- /dev/null
@@ -0,0 +1 @@
+Test for the "MBOXFW" fancy-record in PowerDNS
diff --git a/regression-tests/mboxfw-record/expected_result b/regression-tests/mboxfw-record/expected_result
new file mode 100644 (file)
index 0000000..70affec
--- /dev/null
@@ -0,0 +1,3 @@
+0      test.com.       IN      MX      7200    25 127.0.0.2.
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='test.com.', qtype=MX
index dfc9530538a3b55142bed5360cf1a555729cddb4..9c675556d2a6e2e40ac263e1264a8c3a87cffca6 100644 (file)
@@ -24,3 +24,4 @@ _double._tcp.dc               IN      SRV     1 100 389 server1
 blah                   IN      NS      blah
 blah                   IN      A       9.9.9.9
 images                 IN      URL     "http://www.ds9a.nl"
+bert@test.com.                 IN      MBOXFW  "bert@ds9a.nl"