From: Otto Moerbeek Date: Mon, 3 Jan 2022 14:28:24 +0000 (+0100) Subject: Be more strict on conditional compiling (#ifdef ENABLE_GSS_TSIG), fixing non ENABLE_G... X-Git-Tag: rec-4.8.0-alpha1~31^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15e39ee4c601350b8a8098ae79c5c8bbba390e6c;p=thirdparty%2Fpdns.git Be more strict on conditional compiling (#ifdef ENABLE_GSS_TSIG), fixing non ENABLE_GSS_TSIG builds. --- diff --git a/pdns/distributor.hh b/pdns/distributor.hh index a3dd1d08ce..92b96b36ee 100644 --- a/pdns/distributor.hh +++ b/pdns/distributor.hh @@ -20,6 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include @@ -245,7 +248,9 @@ retry: } QD->callback(a, QD->start); +#ifdef ENABLE_GSS_TSIG QD->Q.cleanupGSS(a->d.rcode); +#endif QD.reset(); } @@ -307,8 +312,9 @@ retry: } } callback(a, start); +#ifdef ENABLE_GSS_TSIG q.cleanupGSS(a->d.rcode); - +#endif return 0; } diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index b58e1f1ca6..aa43d337e1 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -760,6 +760,7 @@ const DNSName& DNSPacket::getTSIGKeyname() const { return d_tsigkeyname; } +#ifdef ENABLE_GSS_TSIG void DNSPacket::cleanupGSS(int rcode) { if (rcode != RCode::NoError && d_tsig_algo == TSIG_GSS && !getTSIGKeyname().empty()) { @@ -767,4 +768,5 @@ void DNSPacket::cleanupGSS(int rcode) ctx.destroy(); } } - +#endif + diff --git a/pdns/dnspacket.hh b/pdns/dnspacket.hh index 02838b099b..283fd90f84 100644 --- a/pdns/dnspacket.hh +++ b/pdns/dnspacket.hh @@ -172,7 +172,10 @@ public: static bool s_doEDNSSubnetProcessing; static bool s_doEDNSCookieProcessing; static string s_EDNSCookieKey; + +#ifdef ENABLE_GSS_TSIG void cleanupGSS(int rcode); +#endif private: void pasteQ(const char *question, int length); //!< set the question of this packet, useful for crafting replies diff --git a/pdns/gss_context.cc b/pdns/gss_context.cc index ec6bdd7279..17cc3b59a1 100644 --- a/pdns/gss_context.cc +++ b/pdns/gss_context.cc @@ -21,8 +21,6 @@ */ #include "gss_context.hh" - -#include "lock.hh" #include "logger.hh" #ifndef ENABLE_GSS_TSIG @@ -50,6 +48,10 @@ GssContextError GssContext::getError() { return GSS_CONTEXT_UNSUPPORTED; } #else +#include + +#include "lock.hh" + class GssCredential : boost::noncopyable { public: diff --git a/pdns/gss_context.hh b/pdns/gss_context.hh index d75e211f2e..7f3a36bc6c 100644 --- a/pdns/gss_context.hh +++ b/pdns/gss_context.hh @@ -21,7 +21,10 @@ */ #pragma once + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "namespaces.hh" #include "pdnsexception.hh" @@ -30,7 +33,6 @@ #ifdef ENABLE_GSS_TSIG #include #include -#include #endif //! Generic errors diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 0ef5e39c7b..fdde319cb4 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -46,6 +46,7 @@ #include "version.hh" #include "auth-main.hh" #include "trusted-notification-proxy.hh" +#include "gss_context.hh" #if 0 #undef DLOG diff --git a/pdns/packethandler.hh b/pdns/packethandler.hh index 91faa7d344..3bd0511fc3 100644 --- a/pdns/packethandler.hh +++ b/pdns/packethandler.hh @@ -28,7 +28,6 @@ #include "packetcache.hh" #include "dnsseckeeper.hh" #include "lua-auth4.hh" -#include "gss_context.hh" #include "namespaces.hh" diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index ba4a919157..39b3a8cb41 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -18,6 +18,7 @@ #include "backends/gsql/ssql.hh" #include "communicator.hh" #include "query-local-address.hh" +#include "gss_context.hh" extern StatBag S; extern CommunicatorClass Communicator; diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index e35960f505..88d1be86c0 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -409,7 +409,9 @@ void TCPNameserver::doConnection(int fd) break; sendPacket(reply, fd); +#ifdef ENABLE_GSS_TSIG packet->cleanupGSS(reply->d.rcode); +#endif } } catch(PDNSException &ae) { diff --git a/pdns/tkey.cc b/pdns/tkey.cc index 0186e7c0a0..fe94438eeb 100644 --- a/pdns/tkey.cc +++ b/pdns/tkey.cc @@ -2,6 +2,7 @@ #include "config.h" #endif #include "packethandler.hh" +#include "gss_context.hh" void PacketHandler::tkeyHandler(const DNSPacket& p, std::unique_ptr& r) { #if 0