]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
make Lua mandatory for recursor builds 5146/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 14 Mar 2017 10:30:29 +0000 (11:30 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 14 Mar 2017 10:30:29 +0000 (11:30 +0100)
pdns/lua-recursor4.cc
pdns/lua-recursor4.hh
pdns/rec-lua-conf.cc
pdns/recursordist/configure.ac

index 7cf7d921deebe7c73fd5b90b45cf7cc04d417f70..2fac53682fccd93a5af1bd2ee9f6c033abf65e7f 100644 (file)
 #include "rec-snmp.hh"
 #include <unordered_set>
 
-#if !defined(HAVE_LUA)
-RecursorLua4::RecursorLua4(const std::string &fname)
-{
-  throw std::runtime_error("Attempt to load a Lua script in a PowerDNS binary without Lua support");
-}
-
-bool RecursorLua4::nxdomain(DNSQuestion& dq, int& res)
-{
-  return false;
-}
-
-bool RecursorLua4::nodata(DNSQuestion& dq, int& res)
-{
-  return false;
-}
-
-bool RecursorLua4::postresolve(DNSQuestion& dq, int& res)
-{
-  return false;
-}
-
-bool RecursorLua4::prerpz(DNSQuestion& dq, int& ret)
-{
-  return false;
-}
-
-bool RecursorLua4::preresolve(DNSQuestion& dq, int& res)
-{
-  return false;
-}
-
-bool RecursorLua4::preoutquery(const ComboAddress& ns, const ComboAddress& requestor, const DNSName& query, const QType& qtype, bool isTcp, vector<DNSRecord>& res, int& ret)
-{
-  return false;
-}
-
-bool RecursorLua4::ipfilter(const ComboAddress& remote, const ComboAddress& local, const struct dnsheader& dh)
-{
-  return false;
-}
-
-unsigned int RecursorLua4::gettag(const ComboAddress& remote, const Netmask& ednssubnet, const ComboAddress& local, const DNSName& qname, uint16_t qtype, std::vector<std::string>* policyTags, std::unordered_map<string,string>& data)
-{
-  return 0;
-}
-
-
-#else
 #undef L
 #include "ext/luawrapper/include/LuaContext.hpp"
 
@@ -715,5 +667,4 @@ loop:;
   return handled;
 }
 
-#endif
 RecursorLua4::~RecursorLua4(){}
index 0339e18eb2bdafd3a99a793fe7ee2ac33e079990..80a829622bfbc3ecb027cb5817569e6647a053a2 100644 (file)
@@ -38,9 +38,7 @@ class LuaContext;
 class RecursorLua4 : public boost::noncopyable
 {
 private:
-#ifdef HAVE_LUA
   std::unique_ptr<LuaContext> d_lw; // this is way on top because it must get destroyed _last_
-#endif
 
 public:
   explicit RecursorLua4(const std::string& fname);
@@ -67,7 +65,6 @@ public:
     bool& wantsRPZ;
     unsigned int tag{0};
 
-#ifdef HAVE_LUA
     void addAnswer(uint16_t type, const std::string& content, boost::optional<int> ttl, boost::optional<string> name);
     void addRecord(uint16_t type, const std::string& content, DNSResourceRecord::Place place, boost::optional<int> ttl, boost::optional<string> name);
     vector<pair<int,DNSRecord> > getRecords() const;
@@ -93,7 +90,6 @@ public:
     
     std::unordered_map<string,string> data;
     DNSName followupName;
-#endif
   };
 
   unsigned int gettag(const ComboAddress& remote, const Netmask& ednssubnet, const ComboAddress& local, const DNSName& qname, uint16_t qtype, std::vector<std::string>* policyTags, std::unordered_map<string,string>& data);
index d70dd4b2e3ed4a78237c9e6a454e8acaa6227ec2..dce282cffcbe3f7624596161cafc9963e383e3bc 100644 (file)
@@ -1,7 +1,5 @@
 #include "config.h"
-#ifdef HAVE_LUA
 #include "ext/luawrapper/include/LuaContext.hpp"
-#endif
 
 #include <fstream>
 #include <thread>
@@ -52,13 +50,6 @@ typename C::value_type::second_type constGet(const C& c, const std::string& name
   return iter->second;
 }
 
-#ifndef HAVE_LUA
-void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
-{
-  if(!fname.empty())
-    throw PDNSException("Asked to load a Lua configuration file '"+fname+"' in binary without Lua support");
-}
-#else
 
 void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
 {
@@ -348,4 +339,3 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
 
 }
 
-#endif
index e79af91b8cb716fd66aef3ab3e2b240d2b820dac..e790395ec0b8395f0cfa255dc12f63cd11faf393 100644 (file)
@@ -100,6 +100,9 @@ PDNS_WITH_LUAJIT
 AS_IF([test "x$with_luajit" = "xno"], [
   PDNS_WITH_LUA
 ])
+AS_IF([test "x$LUAPC" = "x" -a "x$LUAJITPC" = "x"], [
+  AC_MSG_ERROR([Neither Lua nor LuaJIT found, Lua support is not optional])
+])
 PDNS_CHECK_LUA_HPP
 
 PDNS_ENABLE_VERBOSE_LOGGING