diff options
author | Seth Mos <seth.mos@dds.nl> | 2010-12-20 21:06:33 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2010-12-20 21:06:33 +0100 |
commit | 81afb50916235853a9b3046796199a443d27c224 (patch) | |
tree | f25e1acd56748f178699a1edc33c123bd2182f20 /etc/inc/util.inc | |
parent | 172007f50c215acf458340773a32052c28556aaa (diff) | |
parent | 49659e1cc6f78af1287590fca7b64791fd6da6f1 (diff) | |
download | pfsense-81afb50916235853a9b3046796199a443d27c224.zip pfsense-81afb50916235853a9b3046796199a443d27c224.tar.gz |
Merge remote branch 'upstream/master'
Conflicts:
etc/inc/interfaces.inc
etc/inc/vslb.inc
usr/local/www/interfaces.php
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 718a22b..494f81b 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -38,7 +38,7 @@ /* kill a process by pid file */ function killbypid($pidfile) { - sigkillbypid($pidfile, "TERM"); + return sigkillbypid($pidfile, "TERM"); } function isvalidpid($pid) { @@ -716,10 +716,16 @@ function get_configured_ip_addresses() { require_once("interfaces.inc"); $ip_array = array(); $interfaces = get_configured_interface_list(); - foreach($interfaces as $int) { - $ipaddr = get_interface_ip($int); - $ip_array[$int] = $ipaddr; + if(is_array($interfaces)) { + foreach($interfaces as $int) { + $ipaddr = get_interface_ip($int); + $ip_array[$int] = $ipaddr; + } } + $interfaces = get_configured_carp_interface_list(); + if(is_array($interfaces)) + foreach($interfaces as $int => $ipaddr) + $ip_array[$int] = $ipaddr; return $ip_array; } @@ -851,6 +857,23 @@ function log_error($error) { return; } +/****f* util/log_auth +* NAME +* log_error - Sends a string to syslog as LOG_AUTH facility +* INPUTS +* $error - string containing the syslog message. +* RESULT +* null +******/ +function log_auth($error) { + global $g; + $page = $_SERVER['SCRIPT_NAME']; + syslog(LOG_AUTH, "$page: $error"); + if ($g['debug']) + syslog(LOG_WARNING, var_dump(debug_backtrace())); + return; +} + /****f* util/exec_command * NAME * exec_command - Execute a command and return a string of the result. @@ -869,17 +892,16 @@ function exec_command($command) { /* wrapper for exec() */ function mwexec($command, $mute = false) { - global $g; - $oarr = array(); - $retval = 0; + if ($g['debug']) { if (!$_SERVER['REMOTE_ADDR']) echo "mwexec(): $command\n"; - exec("$command 2>&1", $oarr, $retval); - } else { - exec("$command 2>&1", $oarr, $retval); } + $oarr = array(); + $retval = 0; + $garbage = exec("$command 2>&1", $oarr, $retval); + if(isset($config['system']['developerspew'])) $mute = false; if(($retval <> 0) && ($mute === false)) { |