|
@@ -12,8 +12,12 @@
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
+#include <vector>
|
|
|
|
+#include <boost/foreach.hpp>
|
|
|
|
+
|
|
#include <dns/message.h>
|
|
#include <dns/message.h>
|
|
#include <dns/rcode.h>
|
|
#include <dns/rcode.h>
|
|
|
|
+#include <dns/rdataclass.h>
|
|
|
|
|
|
#include <datasrc/memory_datasrc.h>
|
|
#include <datasrc/memory_datasrc.h>
|
|
|
|
|
|
@@ -21,6 +25,7 @@
|
|
|
|
|
|
using namespace isc::dns;
|
|
using namespace isc::dns;
|
|
using namespace isc::datasrc;
|
|
using namespace isc::datasrc;
|
|
|
|
+using namespace std;
|
|
|
|
|
|
namespace isc {
|
|
namespace isc {
|
|
namespace auth {
|
|
namespace auth {
|
|
@@ -53,6 +58,45 @@ Query::process() const {
|
|
response_.setRcode(Rcode::NOERROR());
|
|
response_.setRcode(Rcode::NOERROR());
|
|
response_.addRRset(Message::SECTION_ANSWER,
|
|
response_.addRRset(Message::SECTION_ANSWER,
|
|
boost::const_pointer_cast<RRset>(db_result.rrset));
|
|
boost::const_pointer_cast<RRset>(db_result.rrset));
|
|
|
|
+ // Some additional processing
|
|
|
|
+ if (qtype_ == RRType::MX()) {
|
|
|
|
+ // We look up these RR types
|
|
|
|
+ vector<RRType> interesting_types;
|
|
|
|
+ interesting_types.push_back(RRType::A());
|
|
|
|
+ interesting_types.push_back(RRType::AAAA());
|
|
|
|
+ // Go trough all the RRs in the RRset
|
|
|
|
+ for (RdataIteratorPtr i(
|
|
|
|
+ db_result.rrset->getRdataIterator()); !i->isLast();
|
|
|
|
+ i->next())
|
|
|
|
+ {
|
|
|
|
+ // Who does it talk about?
|
|
|
|
+ Name name(
|
|
|
|
+ dynamic_cast<const isc::dns::rdata::generic::MX &>(
|
|
|
|
+ i->getCurrent()).getMXName());
|
|
|
|
+ // Look up both addresses
|
|
|
|
+ BOOST_FOREACH(const RRType& type, interesting_types) {
|
|
|
|
+ // Recursively call query
|
|
|
|
+ Message response(Message::RENDER);
|
|
|
|
+ Query sub(memory_datasrc_, name, type, response);
|
|
|
|
+ sub.process();
|
|
|
|
+ // And run trough all the answers and look if some
|
|
|
|
+ // of them match
|
|
|
|
+ for (SectionIterator<RRsetPtr> ai(
|
|
|
|
+ response.beginSection(
|
|
|
|
+ Message::SECTION_ANSWER)); ai !=
|
|
|
|
+ response.endSection(Message::SECTION_ANSWER);
|
|
|
|
+ ++ ai)
|
|
|
|
+ {
|
|
|
|
+ if ((*ai)->getType() == type &&
|
|
|
|
+ (*ai)->getName() == name)
|
|
|
|
+ {
|
|
|
|
+ response_.addRRset(
|
|
|
|
+ Message::SECTION_ADDITIONAL, *ai);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// TODO : fill in authority and addtional sections.
|
|
// TODO : fill in authority and addtional sections.
|
|
break;
|
|
break;
|
|
case Zone::DELEGATION:
|
|
case Zone::DELEGATION:
|