diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2009-03-10 02:40:08 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2009-03-10 02:40:08 +0100 |
commit | ac33db20c510fcdd8b810b0fed0aa8e1867beaf5 (patch) | |
tree | 58ce50afc5ede89d03a11f3a4a6909961ed45b81 | |
parent | b92305a60cb133ed0fdce310111d12a60527f109 (diff) | |
download | pfsense-ac33db20c510fcdd8b810b0fed0aa8e1867beaf5.zip pfsense-ac33db20c510fcdd8b810b0fed0aa8e1867beaf5.tar.gz |
Fix check for running ftp proxy.
PHP bug, when running exec() the output array will _not_ be cleared before using it again.
This means that one needs to clear it before reusing it. Otherwise the contents of the previous command will be used.
-rw-r--r-- | etc/inc/config.inc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 9cda38b..5ec1e96 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -2834,8 +2834,9 @@ function system_start_ftp_helpers() { if($g['debug']) log_error("Config: FTP proxy disabled for interface {$ifent}"); - exec("/bin/ps awwux | /usr/bin/grep \"[/]ftp-proxy\" | /usr/bin/grep {$port} | /usr/bin/awk '{ print $2 }'", $helpers); - if(count($helpers[0]) > 0) + $helpers = array(); + exec("/bin/ps awwux | /usr/bin/grep \"[/]ftp-proxy\" | /usr/bin/grep \"{$port}\" | /usr/bin/awk '{ print $2 }'", $helpers); + if(count($helpers > 0) mwexec("/bin/kill {$helpers[0]}"); $interface_counter++; } else { @@ -2873,8 +2874,10 @@ function system_start_ftp_helpers() { } } /* if ftp-proxy is already running then do not launch it again */ - if($g['debug']) + if($g['debug']) { log_error("Config: FTP proxy port ($port) enabled for interface {$ifname}"); + } + $helpers = array(); exec("/bin/ps awwux | /usr/bin/grep \"[/]ftp-proxy\" | /usr/bin/grep \"{$port}\" | /usr/bin/grep \"{$pftpxsourceaddr}\" | /usr/bin/awk '{ print $2 }'", $helpers); if(!$helpers && $ip) mwexec("/usr/local/sbin/ftp-proxy {$shaper_queue} -p {$port} {$pftpxsourceaddr} {$ip} -T PFFTPPROXY"); |