diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-11-08 00:37:12 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-11-08 00:37:12 +0000 |
commit | b1f2356868d2f64059109c2daf0cfff6376fd984 (patch) | |
tree | d160349f0a1e199d96f33bc772e57679318e179b /etc/inc | |
parent | 0c7b834e31d6160d434e806fcc468b2f0401b36d (diff) | |
download | pfsense-b1f2356868d2f64059109c2daf0cfff6376fd984.zip pfsense-b1f2356868d2f64059109c2daf0cfff6376fd984.tar.gz |
MFC 7463
FTP Proxy helper changes
Submitted-by: Dan Swartzendruber <dswartz_AT_druber.com>
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/config.inc | 9 | ||||
-rw-r--r-- | etc/inc/filter.inc | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index abc5d22..bdd58b4 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -1210,16 +1210,17 @@ function system_start_ftp_helpers() { * running for this instance. */ $helpers = exec("ps ax | grep \"/usr/local/sbin/pftpx -c {$port}\" | grep -v grep | sed \"s/ */ /g\" | cut -f2 -d\" \""); - mwexec("/usr/bin/kill {$helpers}"); + if($helpers) + mwexec("/bin/kill {$helpers}"); $interface_counter++; continue; } else { /* grab the current interface IP address */ $ip = find_interface_ip(convert_friendly_interface_to_real_interface_name($ifname)); /* if pftpx is already running then do not launch it again */ - $helpers = exec("ps ax | grep \"/usr/local/sbin/pftpx -c {$port}\" | grep -v grep | grep {$ip}"); - if(!$helpers) - mwexec("/usr/local/sbin/pftpx -c {$port} -g 8021 {$ip}"); + $helpers = exec("ps ax | grep \"/usr/local/sbin/pftpx -c {$port}\" | grep -v grep | sed \"s/ */ /g\""); + if(!$helpers && $ip) + mwexec("/usr/local/sbin/pftpx -c {$port} -g 8021 {$ip}"); $interface_counter++; } } diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index b283297..8cdea78 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -626,13 +626,13 @@ function filter_nat_rules_generate() { */ if($target <> "") { if($extport[0] == "21" and !isset($config['system']['disableftpproxy'])) { - $helpers = exec("ps awux | grep pftpx | grep -v grep | grep {$target} | cut -d\" \" -f5"); + $helpers = exec("ps ax | grep /usr/local/sbin/pftpx | grep -v grep | sed \"s/ */ /g\" | grep {$target} | cut -f2 -d\" \""); if(!$helpers) { $external_address = $rule['external-address']; if($external_address == "") $external_address = find_interface_ip(get_real_wan_interface()); /* install a pftpx helper, do not set a rule */ - mwexec_bg("/usr/local/sbin/pftpx -b {$external_address} -c 21 -f {$target} -g 21"); + mwexec_bg("/usr/local/sbin/pftpx -f {$target} -b {$external_address} -c 21 -g 21"); continue; } } |