escapeshellarg adds quotes, which is bad. Use escapeshellcmd on the whole string instead.

This commit is contained in:
Isaac Connor 2017-04-18 12:31:20 -04:00
parent c4164cda07
commit f2920c37e0
1 changed files with 7 additions and 5 deletions

View File

@ -832,12 +832,13 @@ function packageControl( $command ) {
function daemonControl( $command, $daemon=false, $args=false ) {
$string = ZM_PATH_BIN."/zmdc.pl $command";
if ( $daemon ) {
$string .= escapeshellarg(" $daemon");
$string .= ' ' . $daemon;
if ( $args ) {
$string .= escapeshellarg(" $args");
$string .= ' ' . $args;
}
}
$string .= " 2>/dev/null >&- <&- >/dev/null";
$string = escapeshellcmd( $string );
$string .= ' 2>/dev/null >&- <&- >/dev/null';
exec( $string );
}
@ -944,10 +945,11 @@ function zmaStatus( $monitor ) {
function daemonCheck( $daemon=false, $args=false ) {
$string = ZM_PATH_BIN."/zmdc.pl check";
if ( $daemon ) {
$string .= escapeshellarg(" $daemon");
$string .= ' ' . $daemon;
if ( $args )
$string .= escapeshellarg(" $args");
$string .= ' '. $args;
}
$string = escapeshellcmd( $string );
$result = exec( $string );
return( preg_match( '/running/', $result ) );
}