From: Amos Jeffries Date: Fri, 16 Oct 2015 14:28:52 +0000 (-0700) Subject: Bug 4351: compile errors when authentication modules disabled X-Git-Tag: SQUID_4_0_2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0026a6cfd47376632bdd7565c173a49bf5cd717;p=thirdparty%2Fsquid.git Bug 4351: compile errors when authentication modules disabled Authentication modules can be selectively disabled. This means the module header files need to be wrapped with disable macros, and also code that depends on module internal definitions. --- diff --git a/src/auth/Gadgets.cc b/src/auth/Gadgets.cc index 4c23e16029..cf9151e372 100644 --- a/src/auth/Gadgets.cc +++ b/src/auth/Gadgets.cc @@ -112,22 +112,34 @@ authenticateCachedUsersList() return lhs->userKey() < rhs->userKey(); }; std::vector v1, v2, rv, u1, u2; +#if HAVE_AUTH_MODULE_BASIC if (Auth::Config::Find("basic") != nullptr) u1 = Auth::Basic::User::Cache()->sortedUsersList(); +#endif +#if HAVE_AUTH_MODULE_DIGEST if (Auth::Config::Find("digest") != nullptr) u2 = Auth::Digest::User::Cache()->sortedUsersList(); - v1.reserve(u1.size()+u2.size()); - std::merge(u1.begin(), u1.end(),u2.begin(), u2.end(), - std::back_inserter(v1), aucp_compare); - u1.clear(); - u2.clear(); +#endif + if (u1.size() > 0 || u2.size() > 0) { + v1.reserve(u1.size()+u2.size()); + std::merge(u1.begin(), u1.end(),u2.begin(), u2.end(), + std::back_inserter(v1), aucp_compare); + u1.clear(); + u2.clear(); + } +#if HAVE_AUTH_MODULE_NEGOTIATE if (Auth::Config::Find("negotiate") != nullptr) u1 = Auth::Negotiate::User::Cache()->sortedUsersList(); +#endif +#if HAVE_AUTH_MODULE_NTLM if (Auth::Config::Find("ntlm") != nullptr) u2 = Auth::Ntlm::User::Cache()->sortedUsersList(); - v2.reserve(u1.size()+u2.size()); - std::merge(u1.begin(), u1.end(),u2.begin(), u2.end(), - std::back_inserter(v2), aucp_compare); +#endif + if (u1.size() > 0 || u2.size() > 0) { + v2.reserve(u1.size()+u2.size()); + std::merge(u1.begin(), u1.end(),u2.begin(), u2.end(), + std::back_inserter(v2), aucp_compare); + } rv.reserve(v1.size()+v2.size()); std::merge(v1.begin(), v1.end(),v2.begin(), v2.end(), std::back_inserter(rv), aucp_compare); diff --git a/src/auth/basic/Config.h b/src/auth/basic/Config.h index 3d82ae394b..babec9fab6 100644 --- a/src/auth/basic/Config.h +++ b/src/auth/basic/Config.h @@ -9,6 +9,8 @@ #ifndef __AUTH_BASIC_H__ #define __AUTH_BASIC_H__ +#if HAVE_AUTH_MODULE_BASIC + #include "auth/Config.h" #include "auth/Gadgets.h" #include "auth/UserRequest.h" @@ -51,5 +53,6 @@ private: extern helper *basicauthenticators; +#endif /* HAVE_AUTH_MODULE_BASIC */ #endif /* __AUTH_BASIC_H__ */ diff --git a/src/auth/basic/Scheme.h b/src/auth/basic/Scheme.h index 8846ab2fba..3b5a406a11 100644 --- a/src/auth/basic/Scheme.h +++ b/src/auth/basic/Scheme.h @@ -9,6 +9,8 @@ #ifndef SQUID_AUTH_BASIC_SCHEME_H #define SQUID_AUTH_BASIC_SCHEME_H +#if HAVE_AUTH_MODULE_BASIC + #include "auth/Scheme.h" namespace Auth @@ -41,5 +43,6 @@ private: } // namespace Basic } // namespace Auth +#endif /* HAVE_AUTH_MODULE_BASIC */ #endif /* SQUID_AUTH_BASIC_SCHEME_H */ diff --git a/src/auth/basic/User.h b/src/auth/basic/User.h index 8d449d4617..473f1d9b5a 100644 --- a/src/auth/basic/User.h +++ b/src/auth/basic/User.h @@ -9,6 +9,8 @@ #ifndef _SQUID_AUTH_BASIC_USER_H #define _SQUID_AUTH_BASIC_USER_H +#if HAVE_AUTH_MODULE_BASIC + #include "auth/User.h" #include "auth/UserRequest.h" @@ -51,5 +53,6 @@ private: } // namespace Basic } // namespace Auth +#endif /* HAVE_AUTH_MODULE_BASIC */ #endif /* _SQUID_AUTH_BASIC_USER_H */ diff --git a/src/auth/basic/UserRequest.h b/src/auth/basic/UserRequest.h index c3b0d18f8d..731af71e06 100644 --- a/src/auth/basic/UserRequest.h +++ b/src/auth/basic/UserRequest.h @@ -9,6 +9,8 @@ #ifndef _SQUID_SRC_AUTH_BASIC_USERREQUEST_H #define _SQUID_SRC_AUTH_BASIC_USERREQUEST_H +#if HAVE_AUTH_MODULE_BASIC + #include "auth/UserRequest.h" class ConnStateData; @@ -43,5 +45,6 @@ private: } // namespace Basic } // namespace Auth +#endif /* HAVE_AUTH_MODULE_BASIC */ #endif /* _SQUID_SRC_AUTH_BASIC_USERREQUEST_H */ diff --git a/src/auth/digest/Config.h b/src/auth/digest/Config.h index f460cb4344..10da5745e3 100644 --- a/src/auth/digest/Config.h +++ b/src/auth/digest/Config.h @@ -9,6 +9,8 @@ #ifndef __AUTH_DIGEST_H__ #define __AUTH_DIGEST_H__ +#if HAVE_AUTH_MODULE_DIGEST + #include "auth/Config.h" #include "auth/Gadgets.h" #include "auth/UserRequest.h" @@ -103,5 +105,6 @@ public: extern helper *digestauthenticators; +#endif /* HAVE_AUTH_MODULE_DIGEST */ #endif diff --git a/src/auth/digest/Scheme.h b/src/auth/digest/Scheme.h index 713236a3ed..2753a4b5ef 100644 --- a/src/auth/digest/Scheme.h +++ b/src/auth/digest/Scheme.h @@ -9,6 +9,8 @@ #ifndef SQUID_AUTH_DIGEST_SCHEME_H #define SQUID_AUTH_DIGEST_SCHEME_H +#if HAVE_AUTH_MODULE_DIGEST + #include "auth/Scheme.h" namespace Auth @@ -43,5 +45,6 @@ private: } // namespace Digest } // namespace Auth +#endif /* HAVE_AUTH_MODULE_DIGEST */ #endif /* SQUID_AUTH_DIGEST_SCHEME_H */ diff --git a/src/auth/digest/User.h b/src/auth/digest/User.h index 902a8b2206..bbe3059b83 100644 --- a/src/auth/digest/User.h +++ b/src/auth/digest/User.h @@ -9,6 +9,8 @@ #ifndef _SQUID_AUTH_DIGEST_USER_H #define _SQUID_AUTH_DIGEST_USER_H +#if HAVE_AUTH_MODULE_DIGEST + #include "auth/digest/Config.h" #include "auth/User.h" #include "rfc2617.h" @@ -45,5 +47,6 @@ public: } // namespace Digest } // namespace Auth +#endif /* HAVE_AUTH_MODULE_DIGEST */ #endif /* _SQUID_AUTH_DIGEST_USER_H */ diff --git a/src/auth/digest/UserRequest.h b/src/auth/digest/UserRequest.h index 4273bbf940..015abe85df 100644 --- a/src/auth/digest/UserRequest.h +++ b/src/auth/digest/UserRequest.h @@ -9,6 +9,8 @@ #ifndef _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H #define _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H +#if HAVE_AUTH_MODULE_DIGEST + #include "auth/UserRequest.h" class ConnStateData; @@ -67,5 +69,6 @@ private: } // namespace Digest } // namespace Auth +#endif /* HAVE_AUTH_MODULE_DIGEST */ #endif /* _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H */ diff --git a/src/auth/negotiate/Config.h b/src/auth/negotiate/Config.h index 84413f8cd8..e99d7f9961 100644 --- a/src/auth/negotiate/Config.h +++ b/src/auth/negotiate/Config.h @@ -9,6 +9,8 @@ #ifndef __AUTH_NEGOTIATE_H__ #define __AUTH_NEGOTIATE_H__ +#if HAVE_AUTH_MODULE_NEGOTIATE + #include "auth/Config.h" #include "auth/Gadgets.h" #include "auth/UserRequest.h" @@ -45,5 +47,6 @@ public: extern statefulhelper *negotiateauthenticators; +#endif /* HAVE_AUTH_MODULE_NEGOTIATE */ #endif diff --git a/src/auth/negotiate/Scheme.h b/src/auth/negotiate/Scheme.h index 4364e77804..8d2fd6f6a6 100644 --- a/src/auth/negotiate/Scheme.h +++ b/src/auth/negotiate/Scheme.h @@ -9,6 +9,8 @@ #ifndef SQUID_AUTH_NEGOTIATE_SCHEME_H #define SQUID_AUTH_NEGOTIATE_SCHEME_H +#if HAVE_AUTH_MODULE_NEGOTIATE + #include "auth/Scheme.h" namespace Auth @@ -42,5 +44,6 @@ private: } // namespace Negotiate } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NEGOTIATE */ #endif /* SQUID_AUTH_NEGOTIATE_SCHEME_H */ diff --git a/src/auth/negotiate/User.h b/src/auth/negotiate/User.h index 5c5ecfeaf6..f75e64872d 100644 --- a/src/auth/negotiate/User.h +++ b/src/auth/negotiate/User.h @@ -9,6 +9,8 @@ #ifndef _SQUID_AUTH_NEGOTIATE_USER_H #define _SQUID_AUTH_NEGOTIATE_USER_H +#if HAVE_AUTH_MODULE_NEGOTIATE + #include "auth/User.h" namespace Auth @@ -39,5 +41,6 @@ public: } // namespace Negotiate } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NEGOTIATE */ #endif /* _SQUID_AUTH_NEGOTIATE_USER_H */ diff --git a/src/auth/negotiate/UserRequest.h b/src/auth/negotiate/UserRequest.h index 8d3e267a9f..18d7a42e07 100644 --- a/src/auth/negotiate/UserRequest.h +++ b/src/auth/negotiate/UserRequest.h @@ -9,6 +9,8 @@ #ifndef _SQUID_SRC_AUTH_NEGOTIATE_USERREQUEST_H #define _SQUID_SRC_AUTH_NEGOTIATE_USERREQUEST_H +#if HAVE_AUTH_MODULE_NEGOTIATE + #include "auth/UserRequest.h" #include "helper/forward.h" @@ -62,5 +64,6 @@ private: } // namespace Negotiate } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NEGOTIATE */ #endif /* _SQUID_SRC_AUTH_NEGOTIATE_USERREQUEST_H */ diff --git a/src/auth/ntlm/Config.h b/src/auth/ntlm/Config.h index 98065cc06e..0c904b0927 100644 --- a/src/auth/ntlm/Config.h +++ b/src/auth/ntlm/Config.h @@ -9,6 +9,8 @@ #ifndef __AUTH_NTLM_H__ #define __AUTH_NTLM_H__ +#if HAVE_AUTH_MODULE_NTLM + #include "auth/Config.h" #include "auth/Gadgets.h" #include "auth/UserRequest.h" @@ -48,5 +50,6 @@ public: extern statefulhelper *ntlmauthenticators; +#endif /* HAVE_AUTH_MODULE_NTLM */ #endif diff --git a/src/auth/ntlm/Scheme.h b/src/auth/ntlm/Scheme.h index ef22499633..4cb022814d 100644 --- a/src/auth/ntlm/Scheme.h +++ b/src/auth/ntlm/Scheme.h @@ -9,6 +9,8 @@ #ifndef SQUID_AUTH_NTLM_SCHEME_H #define SQUID_AUTH_NTLM_SCHEME_H +#if HAVE_AUTH_MODULE_NTLM + #include "auth/Scheme.h" namespace Auth @@ -46,5 +48,6 @@ private: } // namespace Ntlm } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NTLM */ #endif /* SQUID_AUTH_NTLM_SCHEME_H */ diff --git a/src/auth/ntlm/User.h b/src/auth/ntlm/User.h index 9c6fdbaa1d..a4bac5d5bf 100644 --- a/src/auth/ntlm/User.h +++ b/src/auth/ntlm/User.h @@ -9,6 +9,8 @@ #ifndef _SQUID_AUTH_NTLM_USER_H #define _SQUID_AUTH_NTLM_USER_H +#if HAVE_AUTH_MODULE_NTLM + #include "auth/User.h" namespace Auth @@ -39,5 +41,6 @@ public: } // namespace Ntlm } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NTLM */ #endif /* _SQUID_AUTH_NTLM_USER_H */ diff --git a/src/auth/ntlm/UserRequest.h b/src/auth/ntlm/UserRequest.h index e9252f3083..4f5899a2cc 100644 --- a/src/auth/ntlm/UserRequest.h +++ b/src/auth/ntlm/UserRequest.h @@ -9,6 +9,8 @@ #ifndef _SQUID_SRC_AUTH_NTLM_USERREQUEST_H #define _SQUID_SRC_AUTH_NTLM_USERREQUEST_H +#if HAVE_AUTH_MODULE_NTLM + #include "auth/UserRequest.h" #include "helper/forward.h" @@ -59,5 +61,6 @@ private: } // namespace Ntlm } // namespace Auth +#endif /* HAVE_AUTH_MODULE_NTLM */ #endif /* _SQUID_SRC_AUTH_NTLM_USERREQUEST_H */