Revision: 3025
Author:   olavmrk
Date:     Sun Jan 29 23:35:49 2012
Log: Session: Don't attempt to fetch new sessions from session handlers.

Thanks to Synacor, Inc. for providing this patch!
http://code.google.com/p/simplesamlphp/source/detail?r=3025

Modified:
 /trunk/lib/SimpleSAML/Session.php
 /trunk/lib/SimpleSAML/SessionHandlerCookie.php
 /trunk/lib/SimpleSAML/SessionHandlerPHP.php

=======================================
--- /trunk/lib/SimpleSAML/Session.php   Tue Jul 26 08:07:05 2011
+++ /trunk/lib/SimpleSAML/Session.php   Sun Jan 29 23:35:49 2012
@@ -956,6 +956,15 @@
                return $ret;
        }

+       /**
+        * Create a new session and cache it.
+        *
+        * @param string $sessionId  The new session we should create.
+        */
+       public static function createSession($sessionId) {
+               assert('is_string($sessionId)');
+               self::$sessions[$sessionId] = NULL;
+       }

        /**
         * Load a session from the session handler.
@@ -975,7 +984,7 @@
                        $checkToken = FALSE;
                }

-               if (isset(self::$sessions[$sessionId])) {
+               if (array_key_exists($sessionId, self::$sessions)) {
                        return self::$sessions[$sessionId];
                }

=======================================
--- /trunk/lib/SimpleSAML/SessionHandlerCookie.php      Wed Aug 10 08:00:15 2011
+++ /trunk/lib/SimpleSAML/SessionHandlerCookie.php      Sun Jan 29 23:35:49 2012
@@ -55,6 +55,7 @@
                        if(!self::isValidSessionID($this->session_id)) {
                                /* We don't have a valid session. Create a new 
session id. */
                                $this->session_id = self::createSessionID();
+                               
SimpleSAML_Session::createSession($this->session_id);
                                $this->setCookie($this->cookie_name, 
$this->session_id);
                        }
                }
=======================================
--- /trunk/lib/SimpleSAML/SessionHandlerPHP.php Wed Aug 10 05:07:54 2011
+++ /trunk/lib/SimpleSAML/SessionHandlerPHP.php Sun Jan 29 23:35:49 2012
@@ -73,7 +73,9 @@
                                }

/* Session cookie unset - session id not set. Generate new (secure) session id. */ - session_id(SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(16))); + $sessionId = SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(16));
+                               SimpleSAML_Session::createSession($sessionId);
+                               session_id($sessionId);
                        }

                        session_start();

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to simplesamlphp-commits@googlegroups.com.
To unsubscribe from this group, send email to 
simplesamlphp-commits+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to