. All rights reserved. Based on m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2006 Manuel Kasper . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $pgtitle = array(gettext("Services"), gettext("FTP")); require_once("freenas_config.inc"); require_once("guiconfig.inc"); require_once("freenas_guiconfig.inc"); require_once("freenas_functions.inc"); if (!is_array($freenas_config['ftp'])) { $freenas_config['ftp'] = array(); } $pconfig['enable'] = isset($freenas_config['ftp']['enable']); $pconfig['port'] = $freenas_config['ftp']['port']; $pconfig['authbackend'] = $freenas_config['ftp']['authentication_backend']; $pconfig['numberclients'] = $freenas_config['ftp']['numberclients']; $pconfig['maxconperip'] = $freenas_config['ftp']['maxconperip']; $pconfig['timeout'] = $freenas_config['ftp']['timeout']; $pconfig['anonymous'] = isset($freenas_config['ftp']['anonymous']); $pconfig['localuser'] = isset($freenas_config['ftp']['localuser']); $pconfig['pasv_max_port'] = $freenas_config['ftp']['pasv_max_port']; $pconfig['pasv_min_port'] = $freenas_config['ftp']['pasv_min_port']; $pconfig['pasv_address'] = $freenas_config['ftp']['pasv_address']; $pconfig['banner'] = $freenas_config['ftp']['banner']; $pconfig['natmode'] = isset($freenas_config['ftp']['natmode']); $pconfig['passiveip'] = $freenas_config['ftp']['passiveip']; $pconfig['fxp'] = isset($freenas_config['ftp']['fxp']); if (! empty($_POST)) { /* hash */ unset($error_bucket); /* simple error list */ unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { $reqdfields = array_merge($reqdfields, explode(" ", "numberclients maxconperip timeout port")); $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Numberclients,Maxconperip,Timeout,Port")); } do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if ($_POST['enable'] && !is_port($_POST['port'])) { $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."), "field" => "port"); } if ($_POST['enable'] && !is_numericint($_POST['numberclients'])) { $error_bucket[] = array("error" => gettext("The maximum Number of client must be a number."), "field" => "numberclients"); } if ($_POST['enable'] && !is_numericint($_POST['maxconperip'])) { $error_bucket[] = array("error" => gettext("The max con per ip must be a number."), "field" => "maxconperip"); } if ($_POST['enable'] && !is_numericint($_POST['timeout'])) { $error_bucket[] = array("error" => gettext("The maximum idle time be a number."), "field" => "timeout"); } if ($_POST['enable'] && ($_POST['pasv_address'])) { if (!is_ipaddr($_POST['pasv_address'])) $error_bucket[] = array("error" => gettext("The pasv address must be a public IP address."), "field" => "pasv_address"); } if ($_POST['enable'] && ($_POST['pasv_max_port'])) { if (!is_port($_POST['pasv_max_port'])) $error_bucket[] = array("error" => gettext("The pasv_max_port port must be a valid port number."), "field" => "pasv_max_port"); } if ($_POST['enable'] && ($_POST['pasv_min_port'])) { if (!is_port($_POST['pasv_min_port'])) $error_bucket[] = array("error" => gettext("The pasv_min_port port must be a valid port number."), "field" => "pasv_min_port"); } if (($_POST['passiveip'] && !is_ipaddr($_POST['passiveip']))) { $error_bucket[] = array("error" => gettext("A valid IP address must be specified."), "field" => "passiveip"); } if (!($_POST['anonymous']) && !($_POST['localuser'])) { $input_errors[] = _SRVFTP_MSGVALIDAUTH; $error_bucket[] = array("error" => gettext("You must select at minium anonymous or/and local user authentication."), "field" => "localuser"); } if (is_array($error_bucket)) foreach($error_bucket as $elem) $input_errors[] =& $elem["error"]; /* if this is an AJAX caller then handle via JSON */ if(isAjax() && is_array($error_bucket)) { input_errors2Ajax(NULL, $error_bucket); exit; } if (!$input_errors) { $freenas_config['ftp']['numberclients'] = $_POST['numberclients']; $freenas_config['ftp']['maxconperip'] = $_POST['maxconperip']; $freenas_config['ftp']['timeout'] = $_POST['timeout']; $freenas_config['ftp']['port'] = $_POST['port']; $freenas_config['ftp']['authentication_backend'] = $_POST['authbackend']; $freenas_config['ftp']['anonymous'] = $_POST['anonymous'] ? true : false; $freenas_config['ftp']['localuser'] = $_POST['localuser'] ? true : false; $freenas_config['ftp']['pasv_max_port'] = $_POST['pasv_max_port']; $freenas_config['ftp']['pasv_min_port'] = $_POST['pasv_min_port']; $freenas_config['ftp']['pasv_address'] = $_POST['pasv_address']; $freenas_config['ftp']['banner'] = $_POST['banner']; $freenas_config['ftp']['passiveip'] = $_POST['passiveip']; $freenas_config['ftp']['fxp'] = $_POST['fxp'] ? true : false; $freenas_config['ftp']['natmode'] = $_POST['natmode'] ? true : false; $freenas_config['ftp']['enable'] = $_POST['enable'] ? true : false; write_config(); $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { /* nuke the cache file */ config_lock(); services_wzdftpd_configure(); services_zeroconf_configure(); config_unlock(); } $savemsg = get_std_save_message($retval); } } include("head.inc"); /* put your custom HTML head content here */ /* using some of the $pfSenseHead function calls */ $jscriptstr = << EOD; $pfSenseHead->addScript($jscriptstr); echo $pfSenseHead->getHTML(); ?>
onClick="enable_change(false)" /> 




/>
/>

/>
/>
  " />