]> git.mjollnir.org Git - s9y.git/commitdiff
Fix bad prev/next permalinks when using wrapper.php embedding
authorgarvinhicking <garvinhicking>
Thu, 5 Apr 2007 09:33:48 +0000 (09:33 +0000)
committergarvinhicking <garvinhicking>
Thu, 5 Apr 2007 09:33:48 +0000 (09:33 +0000)
docs/NEWS
include/functions_permalinks.inc.php
index.php
serendipity_config.inc.php

index 1160d18c6ca795a49a3f96140b4c2573c2785079..3166a7c0365908b334d19986af69b805a0f5907a 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,12 @@
 Version 1.2 ()
 ------------------------------------------------------------------------
 
+    * Fix wrong next/previous page links when using wrapper.php indexFile
+      option. (garvinhicking)
+
+    * Prevent cookie-based session fixation by regenerationg server-side
+      session ID. Major thanks to David Vieira-Kurz.
+
     * Display theme's preview_fullsize.jpg image when existing. Added
       screenshots by williamts99.
 
index 3bef5fc946ee231f36d0faeab48aa30a790f9f8b..8d07ff6c7539d49f2c5c9670cec0a02aa08a764f 100644 (file)
@@ -753,12 +753,18 @@ function serendipity_currentURL($strict = false) {
  */
 function serendipity_getUriArguments($uri, $wildcard = false) {
 global $serendipity;
+static $indexFile = null;
+
+    if ($indexFile === null) {
+        $_indexFile = explode('.', $serendipity['indexFile']);
+        $indexFile = $_indexFile[0];
+    }
 
     /* Explode the path into sections, to later be able to check for arguments and add our own */
     preg_match('/^'. preg_quote($serendipity['serendipityHTTPPath'], '/') . '(' . preg_quote($serendipity['indexFile'], '/') . '\?\/)?(' . ($wildcard ? '.+' : '[;,_a-z0-9\-*\/%\+]+') . ')/i', $uri, $_res);
     if (strlen($_res[2]) != 0) {
         $args = explode('/', $_res[2]);
-        if ($args[0] == 'index') {
+        if ($args[0] == $indexFile || $args[0] == $serendipity['indexFile']) {
             unset($args[0]);
         }
         return $args;
index e93440ee86dae7e3706aeaeff3852d0c3c727e23..5e53d54de1cf60d0046d2718d65c5a9658f9467a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,6 +3,7 @@
 # All rights reserved.  See LICENSE file for licensing details
 
 $global_debug = false;
+
 if ($global_debug) {
     #apd_set_pprof_trace();
 
index 339c24430375c8bb7eab0c0d8670c6c1d29edb3d..7e0d5d0b7e3d0e0d4e6ac875f2bea4bb2747d486 100644 (file)
@@ -10,6 +10,16 @@ if (defined('S9Y_FRAMEWORK')) {
 
 if (!headers_sent()) {
     session_start();
+    
+    // Prevent session fixation by only allowing sessions that have been sent by the server.
+    // Any session that does not contain our unique token will be regarded as foreign/fixated
+    // and be regenerated with a system-generated SID.
+    // Patch by David Vieira-Kurz of majorsecurity.de
+    if (!isset($_SESSION['SERVER_GENERATED_SID'])) {
+        session_destroy();
+        session_regenerate_id();
+        $_SESSION['SERVER_GENERATED_SID'] = true;
+    }
 }
 
 if (!defined('S9Y_INCLUDE_PATH')) {