[cpp-sp] branch main updated: Handle XML indirection automatically in BoostPropertySet.

Scott Cantor cantor.2 at osu.edu
Thu Jan 9 17:42:33 UTC 2025


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=b1e2f320221a91f98aebad7c24a8603eb595c121

The following commit(s) were added to refs/heads/main by this push:
     new b1e2f320 Handle XML indirection automatically in BoostPropertySet.
b1e2f320 is described below

commit b1e2f320221a91f98aebad7c24a8603eb595c121
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 9 12:42:29 2025 -0500

    Handle XML indirection automatically in BoostPropertySet.
---
 shibsp/impl/XMLRequestMapper.cpp |  9 +++------
 shibsp/util/BoostPropertySet.cpp | 11 +++++++++--
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index fbab4711..f05ebc54 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -210,11 +210,8 @@ void Override::loadACL(ptree& pt, Category& log)
 Override::Override(bool unicodeAware, ptree& pt, Category& log, const Override* base)
     : m_unicodeAware(unicodeAware)
 {
-    // Load the <xmlattr> tree as a property set.
-    const boost::optional<ptree&> xmlattr = pt.get_child_optional("<xmlattr>");
-    if (xmlattr) {
-        load(xmlattr.get(), "unset");
-    }
+    // Load the property set and point it at our parent.
+    load(pt, "unset");
     setParent(base);
 
     // Load any AccessControl provider.
@@ -497,7 +494,7 @@ XMLRequestMapperImpl::XMLRequestMapperImpl(ptree& pt, Category& log)
     }
 
     // Load the property set.
-    load(pt.get_child("<xmlattr>"), "unset");
+    load(pt, "unset");
 
     // Load any AccessControl provider.
     loadACL(pt, log);
diff --git a/shibsp/util/BoostPropertySet.cpp b/shibsp/util/BoostPropertySet.cpp
index 7a4de6c3..f0e5d922 100644
--- a/shibsp/util/BoostPropertySet.cpp
+++ b/shibsp/util/BoostPropertySet.cpp
@@ -59,11 +59,18 @@ void BoostPropertySet::setParent(const PropertySet* parent)
 
 void BoostPropertySet::load(const ptree& pt, const char* unsetter)
 {
-    m_pt = &pt;
+    // Check for <xmlattr> in case this was an XML-based tree.
+    const boost::optional<const ptree&> xmlattr = pt.get_child_optional("<xmlattr>");
+    if (xmlattr) {
+        m_pt = &xmlattr.get();
+    }
+    else {
+        m_pt = &pt;
+    }
 
     // Check for unsetter, pull out and split.
     if (unsetter) {
-        const boost::optional<string> val = pt.get_optional<string>(unsetter);
+        const boost::optional<string> val = m_pt->get_optional<string>(unsetter);
         if (val) {
             boost::split(m_unset, val.get(), boost::is_space(), boost::algorithm::token_compress_on);
         }

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


More information about the commits mailing list