[cpp-sp] branch main updated: Add rebind test to unit test, fix a bug.
Scott Cantor
cantor.2 at osu.edu
Tue Sep 16 18:01:06 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=3e51934f85ec938f7bb231c20fc1e5e9068fd4fb
The following commit(s) were added to refs/heads/main by this push:
new 3e51934f Add rebind test to unit test, fix a bug.
3e51934f is described below
commit 3e51934f85ec938f7bb231c20fc1e5e9068fd4fb
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 16 14:01:02 2025 -0400
Add rebind test to unit test, fix a bug.
---
shibsp/session/impl/MemorySessionCache.cpp | 2 +-
tests/session/impl/MemorySessionCacheTests.cpp | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/shibsp/session/impl/MemorySessionCache.cpp b/shibsp/session/impl/MemorySessionCache.cpp
index 8828df5f..626f23ee 100644
--- a/shibsp/session/impl/MemorySessionCache.cpp
+++ b/shibsp/session/impl/MemorySessionCache.cpp
@@ -224,7 +224,7 @@ DDF MemorySessionCache::cache_read(
// Fill in the new address and attempt the update.
entry->second.first.addmember(family).string(client_addr);
unsigned int oldver = entry->second.first.getmember("ver").integer();
- entry->second.first.getmember("ver").integer(oldver == 0 ? 2 : oldver + 1);
+ entry->second.first.addmember("ver").integer(oldver == 0 ? 2 : oldver + 1);
}
}
diff --git a/tests/session/impl/MemorySessionCacheTests.cpp b/tests/session/impl/MemorySessionCacheTests.cpp
index d80f680f..403a81f4 100644
--- a/tests/session/impl/MemorySessionCacheTests.cpp
+++ b/tests/session/impl/MemorySessionCacheTests.cpp
@@ -104,6 +104,19 @@ BOOST_FIXTURE_TEST_CASE(MemorySessionCache_tests, MemoryFixture)
// Clear old response headers.
request.m_responseHeaders.clear();
+ // Force an address re-bind, which should revise the session version.
+ request.m_addr = "::1";
+
+ session = cache->find(request, true, false);
+ BOOST_CHECK(session);
+ if (session) {
+ BOOST_CHECK_EQUAL(session.mutex()->getVersion(), 2);
+ header = cookieName + '=' + key + ".2";
+ header += "; Path=/; Secure=1; HttpOnly=1; SameSite=None";
+ BOOST_CHECK_EQUAL(request.m_responseHeaders["Set-Cookie"], header);
+ session.unlock();
+ }
+
cache->remove(request);
header = cookieName;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list