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

noreply at shibboleth.net noreply at shibboleth.net
Tue Jun 26 20:37:30 BST 2012


Author: scantor
Date: Tue Jun 26 15:37:30 2012
New Revision: 3719

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

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=3719&r1=3718&r2=3719&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/AbstractHandler.cpp Tue Jun 26 15:37:30 2012
@@ -245,7 +245,7 @@
     if (!strncmp(mech.second, "cookie", 6)) {
         // Here we store the state in a cookie and send a fixed
         // value so we can recognize it on the way back.
-        if (relayState.find("cookie:") != 0) {
+        if (relayState.find("cookie:") != 0 && relayState.find("ss:") != 0) {
             pair<string,const char*> shib_cookie = application.getCookieNameProps("_shibstate_");
             string stateval = XMLToolingConfig::getConfig().getURLEncoder()->encode(relayState.c_str()) + shib_cookie.second;
             // Generate a random key for the cookie name instead of the fixed name.
@@ -258,7 +258,7 @@
         }
     }
     else if (!strncmp(mech.second, "ss:", 3)) {
-        if (relayState.find("ss:") != 0) {
+        if (relayState.find("cookie:") != 0 && relayState.find("ss:") != 0) {
             mech.second+=3;
             if (*mech.second) {
                 if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
@@ -302,8 +302,9 @@
             }
         }
     }
-    else
+    else {
         throw ConfigurationException("Unsupported relayState mechanism ($1).", params(1,mech.second));
+    }
 }
 
 void Handler::recoverRelayState(
@@ -314,7 +315,7 @@
 
     // Look for StorageService-backed state of the form "ss:SSID:key".
     const char* state = relayState.c_str();
-    if (strstr(state,"ss:")==state) {
+    if (strstr(state,"ss:") == state) {
         state += 3;
         const char* key = strchr(state,':');
         if (key) {
@@ -372,7 +373,8 @@
     }
 
     // Look for cookie-backed state of the form "cookie:timestamp_key".
-    if (strstr(state,"cookie:")==state) {
+    state = relayState.c_str();
+    if (strstr(state,"cookie:") == state) {
         state += 7;
         if (*state) {
             // Pull the value from the "relay state" cookie.



More information about the commits mailing list