Ticket #295 (closed bug: fixed)
/tmp/fs_sessions no good with multiple users
| Reported by: | srl@… | Owned by: | omry |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | FireStats | Version: | 1.2 |
| Severity: | Normal | Keywords: | |
| Cc: |
Description
Hello,
I have multiple users using firestats in wordpress. I made this patch so that they don't collide.
patch against 1.2.1-RC1
diff -Nur firestats.orig/php/session.php firestats/php/session.php
--- firestats.orig/php/session.php 2007-03-24 17:56:56.000000000 -0700
+++ firestats/php/session.php 2007-03-26 09:43:11.000000000 -0700
@@ -194,7 +194,7 @@
function fs_initialize_session_dir()
{
- $temp_dir = sys_get_temp_dir();
+ $temp_dir = sys_get_temp_dir() . "/" . get_current_user();
if($temp_dir === false)
{
// can't detect temp directory or php is running in safe mode.
@@ -205,11 +205,20 @@
// make sure the dir ends with /
+ $help_url = "http://firestats.cc/wiki/ErrorInitializingSessionsDir";
+ $text = sprintf("<h3>Error initializing sessions directory, read <a href='$help_url'>this<a/> for help</h3><br/><span style='color:red'>%%s<span>");
$last = substr($temp_dir, strlen( $temp_dir ) - 1 );
if ($last != "/" && $last != '\\') $temp_dir .= "/";
+ if (!is_dir($temp_dir))
+ {
+ if (!mkdir($temp_dir, 0700))
+ {
+ die(sprintf($text,"Failed to create '<b>$temp_dir</b>'"));
+ }
+ }
$temp_dir .= SESSIONS_DIR;
- $help_url = "http://firestats.cc/wiki/ErrorInitializingSessionsDir";
- $text = sprintf("<h3>Error initializing sessions directory, read <a href='$help_url'>this<a/> for help</h3><br/><span style='color:red'>%%s<span>");
+ $last = substr($temp_dir, strlen( $temp_dir ) - 1 );
+ if ($last != "/" && $last != '\\') $temp_dir .= "/";
if (!is_dir($temp_dir))
{
if (!mkdir($temp_dir, 0700))
@@ -217,6 +226,8 @@
die(sprintf($text,"Failed to create '<b>$temp_dir</b>'"));
}
}
+
+
if (!fs_is_writable($temp_dir))
{
die(sprintf($text,"Directory ,'<b>$temp_dir</b>' must be writable"));
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
