From 27507d2b3de7577bcbc5ab3b10fbc73a72152231 Mon Sep 17 00:00:00 2001 From: Christian A. Weber Date: Thu, 22 Jun 2023 15:43:58 +0200 Subject: quote it::exec() args, use timeout for gm convert to avoid checking for ultratimeout --- it.class | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index d55c5a7..0efe3b4 100644 --- a/it.class +++ b/it.class @@ -299,7 +299,7 @@ static function error($p = array(), $extra = null) $body .= $_POST ? "\$_POST: " . var_export($_POST, true) . "\n\n" : ""; $body .= $reqbody ? "\$reqbody: " . var_export($reqbody, true) . "\n\n" : ""; $body .= $_COOKIE ? "\$_COOKIE: " . var_export($_COOKIE, true) . "\n\n" : ""; - $body .= $_SERVER['REMOTE_ADDR'] ? "" : "Pstree:\n" . it::exec("pstree -als " . getmypid() . " | head -n -3") . "\n"; + $body .= $_SERVER['REMOTE_ADDR'] ? "" : "Pstree:\n" . it::exec("pstree -als {pid} | head -n -3", ['pid' => getmypid()]) . "\n"; $body .= $_SERVER ? "\$_SERVER: " . var_export($_SERVER, true) . "\n\n" : ""; $body .= $_FILES ? "\$_FILES: " . var_export($_FILES, true) . "\n\n" : ""; $body .= "Processes:\n" . it::exec('ps auxf | egrep -v "rotatelogs|getbanner|logaction|httpd|systemd|sd-pam"|egrep "^www|^cron"') . "\n"; @@ -857,10 +857,8 @@ static function imageconvert($p) if (!$p['keepalpha']) $p['-opts'] = array_merge(array('-flatten' => true), $p['-opts']); # Option -flatten must be first - $ultratimeout = file_exists("/opt/ultra/bin/ultratimeout") ? "/opt/ultra/bin/ultratimeout 30 " : ""; - if (in_array($type, explode(',', $p['types']))) # Valid type? - $cmdoutput = it::exec('( ' . $ultratimeout . 'gm convert -limit threads 2 +profile "*" 2>&1 {-opts} {in} {type}:{out} || echo "SHELL ERROR $?" ) | grep -Ev "( iCCP: | Invalid SOS parameters for sequential JPEG | profile matches .* but writing .* instead | inconsistent chromacities )"', $p); + $cmdoutput = it::exec('( timeout 30s gm convert -limit threads 2 +profile "*" 2>&1 {-opts} {in} {type}:{out} || echo "SHELL ERROR $?" ) | grep -Ev "( iCCP: | Invalid SOS parameters for sequential JPEG | profile matches .* but writing .* instead | inconsistent chromacities )"', $p); if ($p['pngcrush'] && $p['type'] == "png") it::exec('pngcrush.sh 2>/dev/null {out} {out}.tmp && mv {out}.tmp {out} || rm {out}.tmp', $p); -- cgit v1.2.3