diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-02-03 14:55:01 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-02-04 12:43:18 -0200 |
commit | 46b12609e51b9b3113abc9c22a1b0ad5a2b37d11 (patch) | |
tree | 0cadd8627871d2e8f159d093852e665a02e39777 /etc/inc/util.inc | |
parent | 44f2ef9b486fc3e4e2a183ae157a86a9e8ac9018 (diff) | |
download | pfsense-46b12609e51b9b3113abc9c22a1b0ad5a2b37d11.zip pfsense-46b12609e51b9b3113abc9c22a1b0ad5a2b37d11.tar.gz |
Add escapeshellarg() calls on exec parameters. While I'm here, replace some exec() calls by php functions like symlink, copy, unlink, mkdir
Conflicts:
etc/inc/filter_log.inc
etc/inc/interfaces.inc
etc/inc/pfsense-utils.inc
etc/inc/pkg-utils.inc
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index b23c5a3..8f57553 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -52,7 +52,7 @@ function isvalidpid($pidfile) { function is_process_running($process) { $output = ""; - exec("/bin/pgrep -anx {$process}", $output, $retval); + exec("/bin/pgrep -anx " . escapeshellarg($process), $output, $retval); return (intval($retval) == 0); } @@ -65,7 +65,7 @@ function isvalidproc($proc) { /* return 1 for success and 0 for a failure */ function sigkillbypid($pidfile, $sig) { if (file_exists($pidfile)) - return mwexec("/bin/pkill -{$sig} -F {$pidfile}", true); + return mwexec("/bin/pkill " . escapeshellarg("-{$sig}") . " -F {$pidfile}", true); return 0; } @@ -73,7 +73,7 @@ function sigkillbypid($pidfile, $sig) { /* kill a process by name */ function sigkillbyname($procname, $sig) { if(isvalidproc($procname)) - return mwexec("/usr/bin/killall -{$sig} " . escapeshellarg($procname), true); + return mwexec("/usr/bin/killall " . escapeshellarg("-{$sig}") . " " . escapeshellarg($procname), true); } /* kill a process by name */ @@ -1070,7 +1070,7 @@ function log_auth($error) { ******/ function exec_command($command) { $output = array(); - exec($command . ' 2>&1 ', $output); + exec($command . ' 2>&1', $output); return(implode("\n", $output)); } @@ -1296,9 +1296,9 @@ function verify_digital_signature($fname) { /* obtain MAC address given an IP address by looking at the ARP table */ function arp_get_mac_by_ip($ip) { - mwexec("/sbin/ping -c 1 -t 1 {$ip}", true); + mwexec("/sbin/ping -c 1 -t 1 " . escapeshellarg($ip), true); $arpoutput = ""; - exec("/usr/sbin/arp -n {$ip}", $arpoutput); + exec("/usr/sbin/arp -n " . escapeshellarg($ip), $arpoutput); if ($arpoutput[0]) { $arpi = explode(" ", $arpoutput[0]); |