[cpp-sp] 01/02: Clean up code for C++14/17 support.
Scott Cantor
cantor.2 at osu.edu
Tue Dec 3 19:20:52 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=6c52d1805cae39144164359dcc0b3f929f8637d3
commit 6c52d1805cae39144164359dcc0b3f929f8637d3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Dec 3 14:20:10 2024 -0500
Clean up code for C++14/17 support.
---
configure.ac | 6 +-
shibsp/Makefile.am | 4 +-
shibsp/config_pub.h.in | 21 ++--
shibsp/config_pub_win32.h | 44 +++-----
shibsp/handler/LogoutInitiator.h | 3 -
shibsp/handler/SessionInitiator.h | 3 -
shibsp/handler/impl/ChainingLogoutInitiator.cpp | 125 ----------------------
shibsp/handler/impl/ChainingSessionInitiator.cpp | 126 -----------------------
shibsp/handler/impl/LogoutInitiator.cpp | 2 -
shibsp/handler/impl/SessionInitiator.cpp | 2 -
shibsp/handler/impl/StatusHandler.cpp | 8 +-
shibsp/impl/ChainingAccessControl.cpp | 26 +++--
shibsp/impl/XMLRequestMapper.cpp | 2 +-
shibsp/remoting/impl/ddf.cpp | 6 +-
shibsp/util/BoostPropertySet.cpp | 10 +-
shibsp/util/CGIParser.cpp | 2 +-
shibsp/util/URLEncoder.cpp | 4 +-
17 files changed, 54 insertions(+), 340 deletions(-)
diff --git a/configure.ac b/configure.ac
index d126a9c9..dd2e0bb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,9 +78,9 @@ AC_FUNC_STRERROR_R
AC_CXX_NAMESPACES
AC_CXX_REQUIRE_STL
-AX_CXX_COMPILE_STDCXX([14])
-# Once the code is sanitized, we could include some optional support.
-#AX_CXX_COMPILE_STDCXX([17],,[optional])
+AX_CXX_COMPILE_STDCXX([11])
+AX_CXX_COMPILE_STDCXX([14],,[optional])
+AX_CXX_COMPILE_STDCXX([17],,[optional])
# Boost
BOOST_REQUIRE
diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 0724fba1..96adee88 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -73,6 +73,7 @@ utilinclude_HEADERS = \
util/IPRange.h \
util/PathResolver.h \
util/PropertySet.h \
+ util/ReloadableXMLFile.h \
util/SPConstants.h \
util/TemplateParameters.h \
util/URLEncoder.h
@@ -103,8 +104,6 @@ libshibsp_la_SOURCES = \
handler/impl/AssertionConsumerService.cpp \
handler/impl/AssertionLookup.cpp \
handler/impl/AttributeCheckerHandler.cpp \
- handler/impl/ChainingLogoutInitiator.cpp \
- handler/impl/ChainingSessionInitiator.cpp \
handler/impl/DiscoveryFeed.cpp \
handler/impl/LocalLogoutInitiator.cpp \
handler/impl/LogoutHandler.cpp \
@@ -146,6 +145,7 @@ libshibsp_la_SOURCES = \
util/DOMPropertySet.cpp \
util/IPRange.cpp \
util/PathResolver.cpp \
+ util/ReloadableXMLFile.cpp \
util/SPConstants.cpp \
util/TemplateParameters.cpp \
util/URLEncoder.cpp
diff --git a/shibsp/config_pub.h.in b/shibsp/config_pub.h.in
index 80ee9997..4ca01720 100644
--- a/shibsp/config_pub.h.in
+++ b/shibsp/config_pub.h.in
@@ -1,20 +1,11 @@
-/* if you have the gssapi libraries */
-#undef SHIBSP_HAVE_GSSAPI
+/* define if the compiler supports basic C++11 syntax */
+#undef HAVE_CXX11
-/* if you have the GNU gssapi libraries */
-#undef SHIBSP_HAVE_GSSGNU
+/* define if the compiler supports basic C++14 syntax */
+#undef HAVE_CXX14
-/* if you have the Heimdal gssapi libraries */
-#undef SHIBSP_HAVE_GSSHEIMDAL
-
-/* if you have the MIT gssapi libraries */
-#undef SHIBSP_HAVE_GSSMIT
-
-/* Define to 1 if log4cpp library is used. */
-#undef SHIBSP_LOG4CPP
-
-/* Define to 1 if log4shib library is used. */
-#undef SHIBSP_LOG4SHIB
+/* define if the compiler supports basic C++17 syntax */
+#undef HAVE_CXX17
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef SHIBSP_HAVE_SYS_SOCKET_H
diff --git a/shibsp/config_pub_win32.h b/shibsp/config_pub_win32.h
index d8c83add..229b8041 100644
--- a/shibsp/config_pub_win32.h
+++ b/shibsp/config_pub_win32.h
@@ -1,37 +1,23 @@
/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-/* if you have the gssapi libraries */
-#undef SHIBSP_HAVE_GSSAPI
-
-/* if you have the GNU gssapi libraries */
-#undef SHIBSP_HAVE_GSSGNU
-
-/* if you have the Heimdal gssapi libraries */
-#undef SHIBSP_HAVE_GSSHEIMDAL
+/* define if the compiler supports basic C++11 syntax */
+#define HAVE_CXX11 1
-/* if you have the MIT gssapi libraries */
-#undef SHIBSP_HAVE_GSSMIT
+/* define if the compiler supports basic C++14 syntax */
+#define HAVE_CXX14 1
-/* Define to 1 if log4cpp library is used. */
-#undef SHIBSP_LOG4CPP
+/* define if the compiler supports basic C++17 syntax */
+#define HAVE_CXX17 1
-/* Define to 1 if log4shib library is used. */
-#define SHIBSP_LOG4SHIB 1
diff --git a/shibsp/handler/LogoutInitiator.h b/shibsp/handler/LogoutInitiator.h
index b50049df..f1505670 100644
--- a/shibsp/handler/LogoutInitiator.h
+++ b/shibsp/handler/LogoutInitiator.h
@@ -48,9 +48,6 @@ namespace shibsp {
/** LogoutInitiator that supports administrative logout. */
#define ADMIN_LOGOUT_INITIATOR "Admin"
- /** LogoutInitiator that iterates through a set of protocol-specific versions. */
- #define CHAINING_LOGOUT_INITIATOR "Chaining"
-
/** LogoutInitiator that supports SAML 2.0 LogoutRequests. */
#define SAML2_LOGOUT_INITIATOR "SAML2"
diff --git a/shibsp/handler/SessionInitiator.h b/shibsp/handler/SessionInitiator.h
index ec233c92..0b093557 100644
--- a/shibsp/handler/SessionInitiator.h
+++ b/shibsp/handler/SessionInitiator.h
@@ -94,9 +94,6 @@ namespace shibsp {
/** Registers SessionInitiator implementations. */
void SHIBSP_API registerSessionInitiators();
- /** SessionInitiator that iterates through a set of protocol-specific versions. */
- #define CHAINING_SESSION_INITIATOR "Chaining"
-
/** SessionInitiator that supports SAML 2.0 AuthnRequests. */
#define SAML2_SESSION_INITIATOR "SAML2"
diff --git a/shibsp/handler/impl/ChainingLogoutInitiator.cpp b/shibsp/handler/impl/ChainingLogoutInitiator.cpp
deleted file mode 100644
index 31caf0c0..00000000
--- a/shibsp/handler/impl/ChainingLogoutInitiator.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * ChainingLogoutInitiator.cpp
- *
- * Chains together multiple LogoutInitiator handlers in sequence.
- */
-
-#include "internal.h"
-#include "exceptions.h"
-#include "handler/AbstractHandler.h"
-#include "handler/LogoutInitiator.h"
-#include "util/SPConstants.h"
-
-#define BOOST_BIND_GLOBAL_PLACEHOLDERS
-#include <boost/bind.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xmltooling/util/XMLHelper.h>
-
-using namespace shibsp;
-using namespace xmltooling;
-using namespace boost;
-using namespace std;
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 )
-#endif
-
- class SHIBSP_DLLLOCAL ChainingLogoutInitiator : public AbstractHandler, public LogoutInitiator
- {
- public:
- ChainingLogoutInitiator(const DOMElement* e, const char* appId, bool deprecationSupport=true);
- virtual ~ChainingLogoutInitiator() {}
-
- pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
-
- private:
- ptr_vector<Handler> m_handlers;
- };
-
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
- static const XMLCh _LogoutInitiator[] = UNICODE_LITERAL_15(L,o,g,o,u,t,I,n,i,t,i,a,t,o,r);
- static const XMLCh _type[] = UNICODE_LITERAL_4(t,y,p,e);
-
- class SHIBSP_DLLLOCAL LogoutInitiatorNodeFilter : public DOMNodeFilter
- {
- public:
- FilterAction acceptNode(const DOMNode* node) const {
- if (XMLString::equals(node->getLocalName(), _LogoutInitiator))
- return FILTER_REJECT;
- return FILTER_ACCEPT;
- }
- };
-
- static SHIBSP_DLLLOCAL LogoutInitiatorNodeFilter g_LINFilter;
-
- Handler* SHIBSP_DLLLOCAL ChainingLogoutInitiatorFactory(const pair<const DOMElement*,const char*>& p, bool deprecationSupport)
- {
- return new ChainingLogoutInitiator(p.first, p.second, deprecationSupport);
- }
-};
-
-ChainingLogoutInitiator::ChainingLogoutInitiator(const DOMElement* e, const char* appId, bool deprecationSupport)
- : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".LogoutInitiator.Chaining"), &g_LINFilter)
-{
- SPConfig& conf = SPConfig::getConfig();
-
- // Load up the chain of handlers.
- e = XMLHelper::getFirstChildElement(e, _LogoutInitiator);
- while (e) {
- string t(XMLHelper::getAttrString(e, nullptr, _type));
- if (!t.empty()) {
- try {
- auto_ptr<Handler> np(conf.LogoutInitiatorManager.newPlugin(t.c_str(), make_pair(e, appId), deprecationSupport));
- m_handlers.push_back(np.get());
- np.release();
- m_handlers.back().setParent(this);
- }
- catch (std::exception& ex) {
- m_log.error("caught exception processing embedded LogoutInitiator element: %s", ex.what());
- }
- }
- e = XMLHelper::getNextSiblingElement(e, _LogoutInitiator);
- }
-}
-
-pair<bool,long> ChainingLogoutInitiator::run(SPRequest& request, bool isHandler) const
-{
- // Defer to base class first.
- pair<bool,long> ret = LogoutHandler::run(request, isHandler);
- if (ret.first)
- return ret;
-
- for (ptr_vector<Handler>::const_iterator i = m_handlers.begin(); i != m_handlers.end(); ++i) {
- ret = i->run(request, isHandler);
- if (ret.first)
- return ret;
- }
- throw ConfigurationException("None of the configured LogoutInitiators handled the request.");
-}
diff --git a/shibsp/handler/impl/ChainingSessionInitiator.cpp b/shibsp/handler/impl/ChainingSessionInitiator.cpp
deleted file mode 100644
index c9231c68..00000000
--- a/shibsp/handler/impl/ChainingSessionInitiator.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * ChainingSessionInitiator.cpp
- *
- * Chains together multiple SessionInitiator handlers in sequence.
- */
-
-#include "internal.h"
-#include "exceptions.h"
-#include "handler/AbstractHandler.h"
-#include "handler/SessionInitiator.h"
-#include "util/SPConstants.h"
-
-#define BOOST_BIND_GLOBAL_PLACEHOLDERS
-#include <boost/bind.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xmltooling/util/XMLHelper.h>
-
-using namespace shibsp;
-using namespace xmltooling;
-using namespace boost;
-using namespace std;
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 )
-#endif
-
- class SHIBSP_DLLLOCAL ChainingSessionInitiator : public SessionInitiator, public AbstractHandler
- {
- public:
- ChainingSessionInitiator(const DOMElement* e, const char* appId, bool deprecationSupport=true);
- virtual ~ChainingSessionInitiator() {}
-
- pair<bool,long> run(SPRequest& request, string& entityID, bool isHandler=true) const;
-
- private:
- ptr_vector<SessionInitiator> m_handlers;
- };
-
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
- static const XMLCh _SessionInitiator[] = UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);
- static const XMLCh _type[] = UNICODE_LITERAL_4(t,y,p,e);
-
- class SHIBSP_DLLLOCAL SessionInitiatorNodeFilter : public DOMNodeFilter
- {
- public:
- FilterAction acceptNode(const DOMNode* node) const {
- if (XMLString::equals(node->getLocalName(), _SessionInitiator))
- return FILTER_REJECT;
- return FILTER_ACCEPT;
- }
- };
-
- static SHIBSP_DLLLOCAL SessionInitiatorNodeFilter g_SINFilter;
-
- SessionInitiator* SHIBSP_DLLLOCAL ChainingSessionInitiatorFactory(const pair<const DOMElement*,const char*>& p, bool deprecationSupport)
- {
- return new ChainingSessionInitiator(p.first, p.second, deprecationSupport);
- }
-};
-
-ChainingSessionInitiator::ChainingSessionInitiator(const DOMElement* e, const char* appId, bool deprecationSupport)
- : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator.Chaining"), &g_SINFilter)
-{
- SPConfig& conf = SPConfig::getConfig();
-
- // Load up the chain of handlers.
- e = e ? XMLHelper::getFirstChildElement(e, _SessionInitiator) : nullptr;
- while (e) {
- string t(XMLHelper::getAttrString(e, nullptr, _type));
- if (!t.empty()) {
- try {
- auto_ptr<SessionInitiator> np(conf.SessionInitiatorManager.newPlugin(t.c_str(), make_pair(e, appId), deprecationSupport));
- m_handlers.push_back(np.get());
- np.release();
- m_handlers.back().setParent(this);
- }
- catch (std::exception& ex) {
- m_log.error("caught exception processing embedded SessionInitiator element: %s", ex.what());
- }
- }
- e = XMLHelper::getNextSiblingElement(e, _SessionInitiator);
- }
-
- m_supportedOptions.insert("isPassive");
-}
-
-pair<bool,long> ChainingSessionInitiator::run(SPRequest& request, string& entityID, bool isHandler) const
-{
- if (!checkCompatibility(request, isHandler))
- return make_pair(false, 0L);
-
- pair<bool,long> ret;
- for (ptr_vector<SessionInitiator>::const_iterator i = m_handlers.begin(); i != m_handlers.end(); ++i) {
- ret = i->run(request, entityID, isHandler);
- if (ret.first)
- return ret;
- }
- throw ConfigurationException("None of the configured SessionInitiators handled the request.");
-}
diff --git a/shibsp/handler/impl/LogoutInitiator.cpp b/shibsp/handler/impl/LogoutInitiator.cpp
index 30ee28a1..202c3936 100644
--- a/shibsp/handler/impl/LogoutInitiator.cpp
+++ b/shibsp/handler/impl/LogoutInitiator.cpp
@@ -33,7 +33,6 @@ using namespace std;
namespace shibsp {
SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory AdminLogoutInitiatorFactory;
- SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory ChainingLogoutInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory SAML2LogoutInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< Handler,string,pair<const DOMElement*,const char*> >::Factory LocalLogoutInitiatorFactory;
};
@@ -42,7 +41,6 @@ void SHIBSP_API shibsp::registerLogoutInitiators()
{
SPConfig& conf=SPConfig::getConfig();
conf.LogoutInitiatorManager.registerFactory(ADMIN_LOGOUT_INITIATOR, AdminLogoutInitiatorFactory);
- conf.LogoutInitiatorManager.registerFactory(CHAINING_LOGOUT_INITIATOR, ChainingLogoutInitiatorFactory);
conf.LogoutInitiatorManager.registerFactory(SAML2_LOGOUT_INITIATOR, SAML2LogoutInitiatorFactory);
conf.LogoutInitiatorManager.registerFactory(LOCAL_LOGOUT_INITIATOR, LocalLogoutInitiatorFactory);
}
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index 67605c3a..bef97f0c 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -36,7 +36,6 @@ using namespace std;
namespace shibsp {
- SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory ChainingSessionInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory SAML2SessionInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory SAMLDSSessionInitiatorFactory;
};
@@ -44,7 +43,6 @@ namespace shibsp {
void SHIBSP_API shibsp::registerSessionInitiators()
{
SPConfig& conf=SPConfig::getConfig();
- conf.SessionInitiatorManager.registerFactory(CHAINING_SESSION_INITIATOR, ChainingSessionInitiatorFactory);
conf.SessionInitiatorManager.registerFactory(SAML2_SESSION_INITIATOR, SAML2SessionInitiatorFactory);
conf.SessionInitiatorManager.registerFactory(SAMLDS_SESSION_INITIATOR, SAMLDSSessionInitiatorFactory);
}
diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index 8662973f..e7dae096 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -79,15 +79,9 @@ namespace shibsp {
return new StatusHandler(p.first, p.second);
}
-#ifndef XMLTOOLING_NO_XMLSEC
- vector<XSECCryptoX509*> g_NoCerts;
-#else
- vector<string> g_NoCerts;
-#endif
-
static char _x2c(const char *what)
{
- register char digit;
+ char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
diff --git a/shibsp/impl/ChainingAccessControl.cpp b/shibsp/impl/ChainingAccessControl.cpp
index 1cd3c5a6..01d86c0c 100644
--- a/shibsp/impl/ChainingAccessControl.cpp
+++ b/shibsp/impl/ChainingAccessControl.cpp
@@ -31,14 +31,15 @@
#include "SPRequest.h"
#include <algorithm>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
+#include <vector>
+
#include <xmltooling/unicode.h>
#include <xmltooling/util/XMLHelper.h>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace shibsp;
using namespace xmltooling;
-using namespace boost;
using namespace std;
namespace shibsp {
@@ -51,18 +52,22 @@ namespace shibsp {
~ChainingAccessControl() {}
Lockable* lock() {
- for_each(m_ac.begin(), m_ac.end(), mem_fun_ref<Lockable*,Lockable>(&Lockable::lock));
+ for (auto& i : m_ac) {
+ i->lock();
+ }
return this;
}
void unlock() {
- for_each(m_ac.begin(), m_ac.end(), mem_fun_ref<void,Lockable>(&Lockable::unlock));
+ for (auto& i : m_ac) {
+ i->unlock();
+ }
}
aclresult_t authorized(const SPRequest& request, const Session* session) const;
private:
enum operator_t { OP_AND, OP_OR } m_op;
- ptr_vector<AccessControl> m_ac;
+ vector<unique_ptr<AccessControl>> m_ac;
};
AccessControl* SHIBSP_DLLLOCAL ChainingAccessControlFactory(const DOMElement* const & e, bool deprecationSupport)
@@ -84,7 +89,6 @@ void SHIBSP_API shibsp::registerAccessControls()
SPConfig& conf=SPConfig::getConfig();
conf.AccessControlManager.registerFactory(CHAINING_ACCESS_CONTROL, ChainingAccessControlFactory);
conf.AccessControlManager.registerFactory(XML_ACCESS_CONTROL, XMLAccessControlFactory);
- conf.AccessControlManager.registerFactory("edu.internet2.middleware.shibboleth.sp.provider.XMLAccessControl", XMLAccessControlFactory);
}
AccessControl::AccessControl()
@@ -108,9 +112,9 @@ ChainingAccessControl::ChainingAccessControl(const DOMElement* e, bool deprecati
string t(XMLHelper::getAttrString(e, nullptr, _type));
if (!t.empty()) {
Category::getInstance(SHIBSP_LOGCAT ".AccessControl.Chaining").info("building AccessControl provider of type (%s)...", t.c_str());
- auto_ptr<AccessControl> np(SPConfig::getConfig().AccessControlManager.newPlugin(t.c_str(), e, deprecationSupport));
- m_ac.push_back(np.get());
- np.release();
+ m_ac.push_back(unique_ptr<AccessControl>(
+ SPConfig::getConfig().AccessControlManager.newPlugin(t.c_str(), e, deprecationSupport)
+ ));
}
e = XMLHelper::getNextSiblingElement(e, _AccessControl);
}
@@ -123,7 +127,7 @@ AccessControl::aclresult_t ChainingAccessControl::authorized(const SPRequest& re
switch (m_op) {
case OP_AND:
{
- for (ptr_vector<AccessControl>::const_iterator i = m_ac.begin(); i != m_ac.end(); ++i) {
+ for (const auto& i : m_ac) {
if (i->authorized(request, session) != shib_acl_true) {
request.log(SPRequest::SPDebug, "embedded AccessControl plugin unsuccessful, denying access");
return shib_acl_false;
@@ -134,7 +138,7 @@ AccessControl::aclresult_t ChainingAccessControl::authorized(const SPRequest& re
case OP_OR:
{
- for (ptr_vector<AccessControl>::const_iterator i = m_ac.begin(); i != m_ac.end(); ++i) {
+ for (const auto& i : m_ac) {
if (i->authorized(request,session) == shib_acl_true)
return shib_acl_true;
}
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index b12d8a30..7f09b76e 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -367,7 +367,7 @@ Override::Override(bool unicodeAware, const DOMElement* e, Category& log, const
static char _x2c(const char *what)
{
- register char digit;
+ char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
diff --git a/shibsp/remoting/impl/ddf.cpp b/shibsp/remoting/impl/ddf.cpp
index 6a14d48b..166e8616 100644
--- a/shibsp/remoting/impl/ddf.cpp
+++ b/shibsp/remoting/impl/ddf.cpp
@@ -1012,7 +1012,7 @@ SHIBSP_API ostream& shibsp::operator<<(ostream& os, const DDF& obj)
static char x2c(char *what)
{
- register char digit;
+ char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
@@ -1045,7 +1045,7 @@ DDF deserialize(istream& is)
return obj;
}
// Walk the string and decode any %XX sequences.
- register int x,y;
+ int x,y;
for(x=0,y=0; dup[y]; ++x,++y) {
if((dup[x] = dup[y]) == '%' && isxdigit(dup[y+1]) && isxdigit(dup[y+2])) {
dup[x] = x2c(&dup[y+1]);
@@ -1095,7 +1095,7 @@ DDF deserialize(istream& is)
}
// Walk the string and decode any %XX sequences.
- register int x,y;
+ int x,y;
for(x=0,y=0; dup[y]; ++x,++y) {
if((dup[x] = dup[y]) == '%' && isxdigit(dup[y+1]) && isxdigit(dup[y+2])) {
dup[x] = x2c(&dup[y+1]);
diff --git a/shibsp/util/BoostPropertySet.cpp b/shibsp/util/BoostPropertySet.cpp
index 2afcf09f..50388d97 100644
--- a/shibsp/util/BoostPropertySet.cpp
+++ b/shibsp/util/BoostPropertySet.cpp
@@ -69,7 +69,7 @@ void BoostPropertySet::load(const property_tree::ptree& pt, const char* unsetter
// Check for unsetter, pull out and split.
if (unsetter) {
- const optional<string> val = pt.get_optional<string>(unsetter);
+ const boost::optional<string> val = pt.get_optional<string>(unsetter);
if (val) {
split(m_unset, val.get(), is_space(), algorithm::token_compress_on);
}
@@ -80,7 +80,7 @@ bool BoostPropertySet::getBool(const char* name, bool defaultValue) const
{
if (m_pt) {
// Check for a child node with the target name and return its value as a bool.
- const optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
+ const boost::optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
if (child) {
const string& val = child->data();
return val == "1" || val == "true";
@@ -100,7 +100,7 @@ const char* BoostPropertySet::getString(const char* name, const char* defaultVal
{
if (m_pt) {
// Check for a child node with the target name and return its value as a C string.
- const optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
+ const boost::optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
if (child) {
return child->data().c_str();
}
@@ -119,7 +119,7 @@ unsigned int BoostPropertySet::getUnsignedInt(const char* name, unsigned int def
{
if (m_pt) {
// Check for a child node with the target name and return its value as a C string.
- const optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
+ const boost::optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
if (child) {
try {
return lexical_cast<unsigned int>(child->data());
@@ -142,7 +142,7 @@ int BoostPropertySet::getInt(const char* name, int defaultValue) const
{
if (m_pt) {
// Check for a child node with the target name and return its value as a C string.
- const optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
+ const boost::optional<const property_tree::ptree&> child = m_pt->get_child_optional(name);
if (child) {
try {
return lexical_cast<int>(child->data());
diff --git a/shibsp/util/CGIParser.cpp b/shibsp/util/CGIParser.cpp
index 9b143777..c351e355 100644
--- a/shibsp/util/CGIParser.cpp
+++ b/shibsp/util/CGIParser.cpp
@@ -89,7 +89,7 @@ namespace {
void plustospace(char *str)
{
- register int x;
+ int x;
for(x=0;str[x];x++)
if(str[x] == '+') str[x] = ' ';
diff --git a/shibsp/util/URLEncoder.cpp b/shibsp/util/URLEncoder.cpp
index 02f101a9..59caffb5 100644
--- a/shibsp/util/URLEncoder.cpp
+++ b/shibsp/util/URLEncoder.cpp
@@ -28,7 +28,7 @@ using namespace std;
static char x2c(char *what)
{
- register char digit;
+ char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
@@ -46,7 +46,7 @@ URLEncoder::~URLEncoder()
void URLEncoder::decode(char* s) const
{
- register int x,y;
+ int x,y;
for(x=0,y=0;s[y];++x,++y)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list