[cpp-sp COMMIT] /branches/REL_2/shibsp/ServiceProvider.cpp

noreply at shibboleth.net noreply at shibboleth.net
Mon Oct 15 11:06:43 EDT 2012


Author: scantor
Date: Mon Oct 15 11:06:43 2012
New Revision: 3786

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

Modified:
    branches/REL_2/shibsp/ServiceProvider.cpp

Modified: branches/REL_2/shibsp/ServiceProvider.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/ServiceProvider.cpp?rev=3786&r1=3785&r2=3786&view=diff
==============================================================================
--- branches/REL_2/shibsp/ServiceProvider.cpp (original)
+++ branches/REL_2/shibsp/ServiceProvider.cpp Mon Oct 15 11:06:43 2012
@@ -287,7 +287,7 @@
 
         Session* session = nullptr;
         try {
-            session = request.getSession();
+            session = request.getSession(true, false, false);   // don't cache it
         }
         catch (exception& e) {
             log.warn("error during session lookup: %s", e.what());
@@ -296,6 +296,7 @@
                 throw;
         }
 
+        Locker slocker(session, false); // pop existing lock on exit
         if (session) {
             // Check for logout interception.
             if (requireLogoutWith.first) {
@@ -370,7 +371,8 @@
     Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
 
     const Application* app = nullptr;
-    const Session* session = nullptr;
+    Session* session = nullptr;
+    Locker slocker;
     string targetURL = request.getRequestURL();
 
     try {
@@ -392,7 +394,9 @@
         // Do we have an access control plugin?
         if (settings.second) {
             try {
-                session = request.getSession(false);
+                session = request.getSession(false, false, false);  // ignore timeout and do not cache
+                if (session)
+                    slocker.assign(session, false); // assign to lock popper
             }
             catch (exception& e) {
                 log.warn("unable to obtain session to pass to access control provider: %s", e.what());
@@ -437,7 +441,8 @@
     Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
 
     const Application* app = nullptr;
-    const Session* session = nullptr;
+    Session* session = nullptr;
+    Locker slocker;
     string targetURL = request.getRequestURL();
 
     try {
@@ -445,7 +450,9 @@
         app = &(request.getApplication());
 
         try {
-            session = request.getSession(false);
+            session = request.getSession(false, false, false);  // ignore timeout and do not cache
+            if (session)
+                slocker.assign(session, false); // assign to lock popper
         }
         catch (exception& e) {
             log.warn("unable to obtain session to export to request: %s", e.what());
@@ -665,12 +672,13 @@
     }
     catch (exception& e) {
         request.log(SPRequest::SPError, e.what());
-        const Session* session = nullptr;
+        Session* session = nullptr;
         try {
-            session = request.getSession(false, true);
+            session = request.getSession(false, true, false);   // do not cache
         }
         catch (exception&) {
         }
+        Locker slocker(session, false); // pop existing lock on exit
         TemplateParameters tp(&e, nullptr, session);
         tp.m_map["requestURL"] = targetURL.substr(0, targetURL.find('?'));
         tp.m_request = &request;



More information about the commits mailing list