mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°2154: Fix security breach (scratch install usecase)
This commit is contained in:
@@ -1893,19 +1893,26 @@ class Config
|
|||||||
{
|
{
|
||||||
$sFileName = $this->m_sFile;
|
$sFileName = $this->m_sFile;
|
||||||
}
|
}
|
||||||
$oHandle = fopen($this->m_sFile, 'r');
|
$oHandle = null;
|
||||||
$index = 0;
|
if (is_file($this->m_sFile))
|
||||||
while (!flock($oHandle, LOCK_SH))
|
|
||||||
{
|
{
|
||||||
if ($index > 50){
|
$oHandle = fopen($this->m_sFile, 'r');
|
||||||
throw new ConfigException("Could not read to configuration file", array('file' => $this->m_sFile));
|
$index = 0;
|
||||||
|
while (!flock($oHandle, LOCK_SH))
|
||||||
|
{
|
||||||
|
if ($index > 50)
|
||||||
|
{
|
||||||
|
throw new ConfigException("Could not read to configuration file", array('file' => $this->m_sFile));
|
||||||
|
}
|
||||||
|
usleep(100000);
|
||||||
|
$index++;
|
||||||
}
|
}
|
||||||
usleep(100000);
|
|
||||||
$index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oItopConfigParser = new iTopConfigParser(file_get_contents($this->m_sFile));
|
$this->oItopConfigParser = new iTopConfigParser(file_get_contents($this->m_sFile));
|
||||||
flock($oHandle, LOCK_UN);
|
if ($oHandle !==null)
|
||||||
|
{
|
||||||
|
flock($oHandle, LOCK_UN);
|
||||||
|
}
|
||||||
|
|
||||||
$hFile = @fopen($sFileName, 'w');
|
$hFile = @fopen($sFileName, 'w');
|
||||||
if ($hFile !== false)
|
if ($hFile !== false)
|
||||||
|
|||||||
Reference in New Issue
Block a user