[cpp-sp] branch main updated: Fix blatant mistake converting attribute values.

Codeberg noreply at shibboleth.net
Mon Dec 8 18:03:34 UTC 2025


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository cpp-sp.

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/62c5e0b7a2f56d58f61d3bde5b637d2ebf89d2f2

The following commit(s) were added to refs/heads/main by this push:
     new 62c5e0b7 Fix blatant mistake converting attribute values.
62c5e0b7 is described below

commit 62c5e0b7a2f56d58f61d3bde5b637d2ebf89d2f2
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Dec 8 13:02:18 2025 -0500

    Fix blatant mistake converting attribute values.
---
 shibsp/attribute/impl/DefaultAttributeConfiguration.cpp | 6 +++---
 tests/session/impl/MemorySessionCacheTests.cpp          | 9 +++++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
index 8130f374..a9d7e771 100644
--- a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
+++ b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
@@ -224,7 +224,7 @@ bool DefaultAttributeConfiguration::processAttributes(DDF& attributes) const
                 }
                 else if (value.isint()) {
                     try {
-                        string s(boost::lexical_cast<string>(attr.integer()));
+                        string s(boost::lexical_cast<string>(value.integer()));
                         value.string(s.c_str());
                     } catch (const boost::bad_lexical_cast&) {
                         value.destroy();
@@ -233,11 +233,11 @@ bool DefaultAttributeConfiguration::processAttributes(DDF& attributes) const
                 }
                 else if (value.islong()) {
                     try {
-                        string s(boost::lexical_cast<string>(attr.longinteger()));
+                        string s(boost::lexical_cast<string>(value.longinteger()));
                         value.string(s.c_str());
                     } catch (const boost::bad_lexical_cast&) {
                         value.destroy();
-                        m_log.warn("attribute '%s' value could not be converted from int to string", attr.name());
+                        m_log.warn("attribute '%s' value could not be converted from long to string", attr.name());
                     }
                 }
                 else {
diff --git a/tests/session/impl/MemorySessionCacheTests.cpp b/tests/session/impl/MemorySessionCacheTests.cpp
index 4262a41d..75634c1f 100644
--- a/tests/session/impl/MemorySessionCacheTests.cpp
+++ b/tests/session/impl/MemorySessionCacheTests.cpp
@@ -59,6 +59,11 @@ struct MemoryFixture
         issuer.add(DDF(nullptr).string("https://idp.example.org"));
         attrs.add(issuer);
 
+        DDF authts("Shib-Authentication-Instant");
+        authts.list();
+        authts.add(DDF(nullptr).longinteger(1765202451));
+        attrs.add(authts);
+
         DDF affiliation("affiliation");
         affiliation.list();
         affiliation.add(DDF(nullptr).string("member"));
@@ -103,6 +108,10 @@ BOOST_FIXTURE_TEST_CASE(MemorySessionCache_tests, MemoryFixture)
     unique_lock<Session> session = cache->find(request, true, false);
     BOOST_CHECK(session);
     if (session) {
+        const DDF& attr = session.mutex()->getAttributes().at("Shib-Authentication-Instant");
+        DDF val = const_cast<DDF&>(attr).first();
+        BOOST_CHECK(val.isstring());
+        BOOST_CHECK_EQUAL(val.string(), "1765202451");
         session.unlock();
     }
 

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


More information about the commits mailing list