[cpp-sp COMMIT] /branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp

noreply at shibboleth.net noreply at shibboleth.net
Tue Sep 20 22:49:01 BST 2011


Author: scantor
Date: Tue Sep 20 22:49:01 2011
New Revision: 3518

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3518&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-391

Modified:
    branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp

Modified: branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp?rev=3518&r1=3517&r2=3518&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp Tue Sep 20 22:49:01 2011
@@ -290,10 +290,12 @@
 #ifndef SHIBSP_LITE
                     StorageService* storage = application.getServiceProvider().getStorageService(mech.second);
                     if (storage) {
+                        // Use a random key
                         string rsKey;
-                        generateRandomHex(rsKey,32);
+                        SAMLConfig::getConfig().generateRandomBytes(rsKey,32);
+                        rsKey = SAMLArtifact::toHex(rsKey);
                         if (!storage->createString("RelayState", rsKey.c_str(), relayState.c_str(), time(nullptr) + 600))
-                            throw IOException("Attempted to insert duplicate storage key.");
+                            throw IOException("Collision generating in-memory relay state key.");
                         relayState = string(mech.second-3) + ':' + rsKey;
                     }
                     else {
@@ -302,6 +304,8 @@
                         log(SPRequest::SPError, msg);
                         relayState.erase();
                     }
+#else
+                    throw ConfigurationException("Lite version of library cannot be used out of process.");
 #endif
                 }
                 else if (SPConfig::getConfig().isEnabled(SPConfig::InProcess)) {
@@ -643,6 +647,8 @@
             else {
                 m_log.error("storage-backed PostData mechanism with invalid StorageService ID (%s)", mech.second);
             }
+#else
+            throw ConfigurationException("Lite version of library cannot be used out of process.");
 #endif
         }
         else if (SPConfig::getConfig().isEnabled(SPConfig::InProcess)) {



More information about the commits mailing list