Fix: limit to dolibarr session and current entity

This commit is contained in:
Regis Houssin 2009-09-15 15:37:48 +00:00
parent f8c8df1096
commit b301340102

View File

@ -496,6 +496,8 @@ function listOfSessions()
*/ */
function purgeSessions($mysessionid) function purgeSessions($mysessionid)
{ {
global $conf;
$arrayofSessions = array(); $arrayofSessions = array();
$sessPath = ini_get("session.save_path")."/"; $sessPath = ini_get("session.save_path")."/";
dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath);
@ -509,13 +511,18 @@ function purgeSessions($mysessionid)
$fullpath = $sessPath.$file; $fullpath = $sessPath.$file;
if(! @is_dir($fullpath)) if(! @is_dir($fullpath))
{ {
$tmp=split('_', $file); $sessValues = file_get_contents($fullpath); // get raw session data
$idsess=$tmp[1];
// We remove session if it's not ourself if (eregi('dol_login',$sessValues) && eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues)) // limit to dolibarr session and current entity
if ($idsess != $mysessionid)
{ {
$res=@unlink($fullpath); $tmp=split('_', $file);
if (! $res) $error++; $idsess=$tmp[1];
// We remove session if it's not ourself
if ($idsess != $mysessionid)
{
$res=@unlink($fullpath);
if (! $res) $error++;
}
} }
} }
} }