[cpp-sp] branch main updated: More fixes to tree processing.

Scott Cantor cantor.2 at osu.edu
Wed Dec 18 20:29:10 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=f2102feb62ff7b970d7ba873d7bde33e3b4363d6

The following commit(s) were added to refs/heads/main by this push:
     new f2102feb More fixes to tree processing.
f2102feb is described below

commit f2102feb62ff7b970d7ba873d7bde33e3b4363d6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 18 15:29:06 2024 -0500

    More fixes to tree processing.
---
 shibsp/impl/XMLAccessControl.cpp | 21 ++++++++-------------
 shibsp/impl/XMLRequestMapper.cpp | 14 ++++++++------
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/shibsp/impl/XMLAccessControl.cpp b/shibsp/impl/XMLAccessControl.cpp
index d65a7454..25777409 100644
--- a/shibsp/impl/XMLAccessControl.cpp
+++ b/shibsp/impl/XMLAccessControl.cpp
@@ -32,7 +32,6 @@
 #include <algorithm>
 #include <memory>
 #include <regex>
-#define BOOST_BIND_GLOBAL_PLACEHOLDERS
 #include <boost/algorithm/string.hpp>
 #include <boost/property_tree/ptree.hpp>
 
@@ -42,7 +41,6 @@
 
 using namespace shibsp;
 using namespace boost::property_tree;
-using namespace boost;
 using namespace std;
 
 namespace {
@@ -150,8 +148,8 @@ Rule::Rule(const ptree& pt) : m_alias(pt.get(REQUIRE_PROP_PATH, ""))
         return;
     }
 
-    trim(vals);
-    split(m_vals, vals, boost::is_space(), algorithm::token_compress_on);
+    boost::trim(vals);
+    split(m_vals, vals, boost::is_space(), boost::algorithm::token_compress_on);
     if (m_vals.empty())
         throw ConfigurationException("Rule did not contain any usable values.");
 }
@@ -417,16 +415,13 @@ pair<bool,ptree*> XMLAccessControl::load() noexcept
             }
         }
 
-        if (authz) {
         // Perform the swap inside a lock.
-#ifdef HAVE_CXX14
-            unique_lock<ReloadableXMLFile> locker(*this);
-#endif
-            m_rootAuthz.swap(authz);
-            return make_pair(false, raw.second);
-        }
-    } catch (const std::exception& e) {
-        m_log.error("exception processing XML configuration: %s", e.what());
+        unique_lock<ReloadableXMLFile> locker(*this);
+        m_rootAuthz.swap(authz);
+        return make_pair(false, raw.second);
+    }
+    catch (const exception& e) {
+        m_log.error("exception processing AccessControl configuration: %s", e.what());
     }
 
     return make_pair(false, nullptr);
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index 99f587fe..9416e876 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -653,23 +653,25 @@ pair<bool,ptree*> XMLRequestMapper::load() noexcept
         // If we own it, wrap it.
         unique_ptr<ptree> treejanitor(raw.first ? raw.second : nullptr);
 
-        unique_ptr<XMLRequestMapperImpl> impl(new XMLRequestMapperImpl(*raw.second, m_log));
+        // We need to navigate down to the properly named child that should have been checked
+        // by the base class.
+        unique_ptr<XMLRequestMapperImpl> impl(
+            new XMLRequestMapperImpl(raw.second->get_child(REQUEST_MAP_PROP_PATH), m_log));
 
         // If we held the document, transfer it to the impl. If we didn't, it's a no-op.
         impl->setTree(treejanitor.release());
 
-    // Perform the swap inside a lock.
-#ifdef HAVE_CXX14
+        // Perform the swap inside a lock.
         unique_lock<ReloadableXMLFile> locker(*this);
-#endif
         m_impl.swap(impl);
 
         return make_pair(false, raw.second);
     }
-    catch (exception& e) {
+    catch (const exception& e) {
         m_log.error("exception loading RequestMapper: %s", e.what());
-        return make_pair(false, nullptr);
     }
+
+    return make_pair(false, nullptr);
 }
 
 RequestMapper::Settings XMLRequestMapper::getSettings(const HTTPRequest& request) const

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list