diff options
author | Phil Davis <phil.davis@inf.org> | 2014-12-30 18:40:52 +0545 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-12-30 23:14:45 +0000 |
commit | 68f0da5990327d8308d1775e36d89c41ff30bd7e (patch) | |
tree | 25baecabc4a03f62563f158541fc6f06325a2c31 /etc | |
parent | 83650c94af92417f74caf1f386767db0547d4b15 (diff) | |
download | pfsense-68f0da5990327d8308d1775e36d89c41ff30bd7e.zip pfsense-68f0da5990327d8308d1775e36d89c41ff30bd7e.tar.gz |
ipsec_smp_dump_status get out of loop if error
when reading response from socket.
Otherwise it would be in a loop and end up like: https://forum.pfsense.org/index.php?topic=86039.msg471848#msg471848
PHP Fatal error: Maximum execution time of 900 seconds exceeded in /etc/inc/ipsec.inc on line 383
This code runs on my system, but I do not know how to induce the possible loop condition to actually test if it would really break out and return nicely.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/ipsec.inc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index 349ce43..d6e2669 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -382,10 +382,17 @@ function ipsec_smp_dump_status() { $response = ""; while (!strstr($sread, "</message>")) { $sread = fgets($fd); + if ($sread === false) + break; $response .= $sread; } fclose($fd); + if ($sread === false) { + log_error("Error during reading of status from IPsec"); + return; + } + @file_put_contents("{$g['tmp_path']}/smp_status.xml", $response); unset($response, $sread); |