[Phpremoteshell-commits] r162 - trunk
esaracco at users.labs.libre-entreprise.org
esaracco at users.labs.libre-entreprise.org
Thu Mar 27 00:53:02 CET 2008
Author: esaracco
Date: 2008-03-26 23:53:01 +0000 (Wed, 26 Mar 2008)
New Revision: 162
Modified:
trunk/ChangeLog
trunk/prs.php
Log:
- Fixed a problem with some particular servers and tmpdir detection.
Some servers allow directory creation, but not directory
deletion... So, now zombies management should work on these
servers too.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-03-26 22:06:22 UTC (rev 161)
+++ trunk/ChangeLog 2008-03-26 23:53:01 UTC (rev 162)
@@ -1,3 +1,12 @@
+2008-03-27 Emmanuel Saracco <esaracco at users.labs.libre-entreprise.org>
+
+ * Other:
+
+ - Fixed a problem with some particular servers and tmpdir detection.
+ Some servers allow directory creation, but not directory
+ deletion... So, now zombies management should work on these
+ servers too.
+
2008-03-26 Emmanuel Saracco <esaracco at users.labs.libre-entreprise.org>
* Other:
@@ -2,3 +11,3 @@
- - Fixed a logic problem, which could prevent PRS to detect the
+ - Fixed a logic error, which could prevent PRS to detect the
correct storage mode.
Modified: trunk/prs.php
===================================================================
--- trunk/prs.php 2008-03-26 22:06:22 UTC (rev 161)
+++ trunk/prs.php 2008-03-26 23:53:01 UTC (rev 162)
@@ -20,7 +20,7 @@
*/
define ('APP_NAME', 'phpRemoteShell');
- define ('APP_VERSION', '0.8.1svn2008032600');
+ define ('APP_VERSION', '0.8.1svn2008032700');
/* Main configuration array */
$config = array ();
@@ -1807,7 +1807,11 @@
function get_zombie_location_by_name ($name)
{
$infos = explode ('|', base64_decode ($name));
- return $infos[0] . '://' . $infos[1] . $infos[2];
+ $scheme = $infos[0];
+ $host = $infos[1];
+ $port = (count ($infos) == 4) ? ':' . $infos[2] : '';
+ $path = (count ($infos) == 4) ? $infos[3] : $infos[2];
+ return "$scheme://$host$port$path";
}
function normalize_profiles ()
@@ -2507,14 +2511,22 @@
$tmpdir = @getenv ('TMPDIR');
$current = @getenv ('PWD');
if (!$tmpdir) $tmpdir = '/tmp';
- if (@mkdir ("$tmpdir/.0"))
- {@rmdir ("$tmpdir/.0"); return "$tmpdir";}
- if (@mkdir ("$current/tmp/.0"))
- {@rmdir ("$current/tmp/.0");return "$current/tmp";}
- if (@mkdir ("$current/.0"))
- {@rmdir ("$current/.0"); return "$current";}
- if (@mkdir ("./.0"))
- {@rmdir ("./.0"); return ".";}
+
+ if ($h = @fopen ("$tmpdir/.0", 'w'))
+ {@fclose ($h);@unlink ("$tmpdir/.0");return "$tmpdir";}
+
+ if ($current)
+ {
+ if ($h = @fopen ("$current/tmp/.0", 'w'))
+ {@fclose ($h);@unlink ("$current/tmp/.0");return "$current/tmp";}
+ if ($h = @fopen ("$current/.0", 'w'))
+ {@fclose ($h);@unlink ("$current/.0");return "$current";}
+ }
+
+ $current = dirname ($_SERVER['SCRIPT_FILENAME']);
+ if ($h = @fopen ("$current/.0", 'w'))
+ {@fclose ($h);@unlink ("$current/.0"); return "$current";}
+
return '';
}
@@ -2524,10 +2536,19 @@
$current = @getenv ('PWD');
$name = md5 (microtime ());
if (!$tmpdir) $tmpdir = '/tmp';
- if (@mkdir ("$tmpdir/.$name")) return "$tmpdir/.$name";
- if (@mkdir ("$current/tmp/.$name")) return "$current/tmp/.$name";
- if (@mkdir ("$current/.$name")) return "$current/.$name";
- if (@mkdir ("./.$name")) return "./.$name";
+
+ if (@mkdir ("$tmpdir/.$name"))
+ return "$tmpdir/.$name";
+
+ if ($current)
+ {
+ if (@mkdir ("$current/tmp/.$name")) return "$current/tmp/.$name";
+ if (@mkdir ("$current/.$name")) return "$current/.$name";
+ }
+
+ if (@mkdir (".$name"))
+ return ".$name";
+
return '';
}
@@ -3113,7 +3134,8 @@
else
$data = date ('Y-m-d H:i:s') . '|~|' . $data . "\n";
- $file = $this->get_base_tmpdir () . '/.z_' . $action . '_' . $id;
+ $file = $this->get_base_tmpdir ();
+ $file = (($tmp) ? '/' : '') . '.z_' . $action . '_' . $id;
$this->write_file ($file, $data, 'a');
if (!$local_action)
More information about the Phpremoteshell-commits
mailing list