Browse Source

[trac699] Look up additional data for ANY type query

chenzhengzhang 14 years ago
parent
commit
681b1839bc
2 changed files with 12 additions and 2 deletions
  1. 2 0
      src/bin/auth/query.cc
  2. 10 2
      src/bin/auth/tests/query_unittest.cc

+ 2 - 0
src/bin/auth/query.cc

@@ -210,6 +210,8 @@ Query::process() const {
                     // into answer section.
                     BOOST_FOREACH(RRsetPtr rrset, *target) {
                         response_.addRRset(Message::SECTION_ANSWER, rrset);
+                        // Handle additional for answer section
+                        getAdditional(*result.zone, *rrset.get());
                     }
                 } else {
                     response_.addRRset(Message::SECTION_ANSWER,

+ 10 - 2
src/bin/auth/tests/query_unittest.cc

@@ -341,12 +341,20 @@ TEST_F(QueryTest, apexAnyMatch) {
     // in the answer section from the additional.
     EXPECT_NO_THROW(Query(memory_datasrc, Name("example.com"),
                           RRType::ANY(), response).process());
-    responseCheck(response, Rcode::NOERROR(), AA_FLAG, 4, 0, 0,
+    responseCheck(response, Rcode::NOERROR(), AA_FLAG, 4, 0, 3,
                   "example.com. 3600 IN SOA . . 0 0 0 0 0\n"
                   "example.com. 3600 IN NS glue.delegation.example.com.\n"
                   "example.com. 3600 IN NS noglue.example.com.\n"
                   "example.com. 3600 IN NS example.net.\n",
-                  NULL, NULL, mock_zone->getOrigin());
+                  NULL, ns_addrs_txt, mock_zone->getOrigin());
+}
+
+TEST_F(QueryTest, mxANYMatch) {
+    EXPECT_NO_THROW(Query(memory_datasrc, Name("mx.example.com"),
+                          RRType::ANY(), response).process());
+    responseCheck(response, Rcode::NOERROR(), AA_FLAG, 3, 3, 4,
+                  mx_txt, zone_ns_txt,
+                  (string(ns_addrs_txt) + string(www_a_txt)).c_str());
 }
 
 TEST_F(QueryTest, glueANYMatch) {