[cpp-sp] branch main updated: Adjustments to remote interface.

Codeberg noreply at shibboleth.net
Wed Dec 10 19:41:17 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/497b35f9bb995f40f8d596fea50f1e52e36e1c9f

The following commit(s) were added to refs/heads/main by this push:
     new 497b35f9 Adjustments to remote interface.
497b35f9 is described below

commit 497b35f9bb995f40f8d596fea50f1e52e36e1c9f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 10 12:40:57 2025 -0700

    Adjustments to remote interface.
---
 shibsp/session/impl/StorageServiceSessionCache.cpp | 46 ++++++++++++++++------
 1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/shibsp/session/impl/StorageServiceSessionCache.cpp b/shibsp/session/impl/StorageServiceSessionCache.cpp
index bd92ada3..96b0725c 100644
--- a/shibsp/session/impl/StorageServiceSessionCache.cpp
+++ b/shibsp/session/impl/StorageServiceSessionCache.cpp
@@ -259,14 +259,18 @@ bool StorageServiceSessionCache::cache_update(SPRequest* request, const char* ke
 
     DDFJanitor outjanitor(out);
 
-    long newver = out["ver"].integer();
-    if (newver <= version) {
+    DDF newver = out["ver"];
+    if (newver.isnull()) {
+        log(INFO_MARK, "session (%s) no longer exists", key);
+        throw IOException("Session no longer exists.");
+    }
+    else if (newver.integer() <= (long) version) {
         log(ERROR_MARK, "missing/unexpected version returned from Hub from update of session (%s)", key);
         throw IOException("Missing/unexpected version returned from Hub from session update.");
     }
 
     // Ensure the new version is set accurately.
-    sessionData.addmember("ver").integer(newver);
+    sessionData.addmember("ver").integer(newver.integer());
     return true;
 }
 
@@ -290,13 +294,19 @@ bool StorageServiceSessionCache::cache_touch(SPRequest* request, const char* key
     catch (const OperationException& e) {
         // Check for policy events.
         const char* event = e.getProperty(AgentException::EVENT_PROP_NAME);
-        if (event && !strcmp(event, "InvalidSession")) {
-            log(WARN_MARK, "stored session (%s) was invalid", key);
-            return false;
-        }
-        else if (event && !strcmp(event, "ExpiredSession")) {
-            log(WARN_MARK, "session (%s) expired due to lifetime or inactivity", key);
-            return false;
+        if (event) {
+            if (!strcmp(event, "MissingSession")) {
+                log(INFO_MARK, "stored session (%s) went missing", key);
+                return false;
+            }
+            else if (!strcmp(event, "InvalidSession")) {
+                log(WARN_MARK, "stored session (%s) was invalid", key);
+                return false;
+            }
+            else if (!strcmp(event, "ExpiredSession")) {
+                log(WARN_MARK, "session (%s) expired due to lifetime or inactivity", key);
+                return false;
+            }
         }
         log(ERROR_MARK, "exception attempting to touch session (%s) via Hub: %s", key, e.what());
         throw;
@@ -308,10 +318,10 @@ bool StorageServiceSessionCache::cache_touch(SPRequest* request, const char* key
 
     DDFJanitor outjanitor(out);
 
-    if (out.getmember("ver").integer() < version) {
-        return false;
+    if (out.getmember("key").isstring()) {
+        return true;
     }
-    return true;
+    return false;
 }
 
 void StorageServiceSessionCache::cache_remove(SPRequest* request, const char* key)
@@ -327,6 +337,16 @@ void StorageServiceSessionCache::cache_remove(SPRequest* request, const char* ke
         out.destroy();
         log(DEBUG_MARK, "removed session from storage via Hub (%s)", key);
     }
+    catch (const OperationException& e) {
+        // Check for policy events.
+        const char* event = e.getProperty(AgentException::EVENT_PROP_NAME);
+        if (event && !strcmp(event, "MissingSession")) {
+            log(DEBUG_MARK, "stored session (%s) went missing", key);
+            return;
+        }
+        log(ERROR_MARK, "exception attempting to touch session (%s) via Hub: %s", key, e.what());
+        throw;
+    }
     catch (const exception& e) {
         log(ERROR_MARK, "exception attempting to delete session via hub: %s", e.what());
         throw;

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


More information about the commits mailing list