Add a redundant safety check to insert
authorScott Cantor <cantor.2@osu.edu>
Wed, 21 Jan 2015 18:20:06 +0000 (18:20 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 21 Jan 2015 18:20:06 +0000 (18:20 +0000)
shibsp/impl/StorageServiceSessionCache.cpp

index b816624..0c5ffe8 100644 (file)
@@ -1040,8 +1040,14 @@ void SSCache::test()
 
 void SSCache::insert(const char* key, time_t expires, const char* name, const char* index, short attempts)
 {
 
 void SSCache::insert(const char* key, time_t expires, const char* name, const char* index, short attempts)
 {
-    if (attempts > 10)
+    if (attempts > 10) {
         throw IOException("Exceeded retry limit.");
         throw IOException("Exceeded retry limit.");
+    }
+
+    if (!name || !*name) {
+        m_log.warn("NameID value was empty or null, ignoring request to store for logout");
+        return;
+    }
 
     string dup;
     unsigned int storageLimit = m_storage_lite->getCapabilities().getKeySize();
 
     string dup;
     unsigned int storageLimit = m_storage_lite->getCapabilities().getKeySize();