]> granicus.if.org Git - pdns/commitdiff
add realwho
authorbert hubert <bert.hubert@netherlabs.nl>
Mon, 20 Nov 2017 11:13:19 +0000 (12:13 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Mon, 20 Nov 2017 11:13:19 +0000 (12:13 +0100)
pdns/lua-auth4.cc
pdns/lua-auth4.hh
pdns/packethandler.cc

index 1ce405467ebb4e2e4eab01250a63df039e45d972..8cc2fac33bc38dcd877ddd8b08995c48245df8f8 100644 (file)
@@ -429,13 +429,14 @@ void IsUpOracle::checkURLThread(ComboAddress rem, std::string url, opts_t opts)
 
 IsUpOracle g_up;
 
-std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, const DNSName& query, const DNSName& zone, int zoneid, const ComboAddress& who, uint16_t qtype) 
+std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, const DNSName& query, const DNSName& zone, int zoneid, const ComboAddress& who, const Netmask& realWho, uint16_t qtype) 
 {
   std::vector<shared_ptr<DNSRecordContent>> ret;
   
   LuaContext lua;
   lua.writeVariable("qname", query.toString());
   lua.writeVariable("who", who.toString());
+  lua.writeVariable("realwho", realWho.toString());
 
   lua.writeFunction("ifportup", [](int port, const vector<pair<int, string> >& ips) {
       vector<ComboAddress> candidates;
index ca3797585f452f70c8fd25eaf2092c0a3cf7c475..5d6ccf9e18a564683c5ac248c5ec1f685e67565c 100644 (file)
@@ -43,4 +43,5 @@ private:
   luacall_axfr_filter_t d_axfr_filter;
 };
 std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, const DNSName& qname,
-                                                   const DNSName& zone, int zoneid, const ComboAddress& who, uint16_t qtype);
+                                                   const DNSName& zone, int zoneid, const ComboAddress& who,
+                                                   const Netmask& realwho, uint16_t qtype);
index 397caeae4ebe310cf824fa8c6026227c7b47bd4f..d0ab73c2d48e98e3967850b4e323e0931f9a3306 100644 (file)
@@ -1288,7 +1288,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
         if(rec->d_type != QType::CNAME && rec->d_type != p->qtype.getCode())
           continue;
         
-        auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), rec->d_type);
+        auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), p->getRealRemote(), rec->d_type);
         if(!recvec.empty()) {
           for(const auto& r : recvec) {
             rr.dr.d_type = rec->d_type; // might be CNAME