if ($_POST['proto'] != "tcp") { $input_errors[] = sprintf(gettext("%s is only valid with protocol TCP."), $_POST['statetype']); } if ($_POST['statetype'] == "synproxy state" && $_POST['gateway'] != "") { $input_errors[] = sprintf(gettext("%s is only valid if the gateway is set to 'default'."), $_POST['statetype']); } } if (isset($a_filter[$id]['associated-rule-id']) === false && !(is_specialnet($_POST['srctype']) || $_POST['srctype'] == "single")) { $reqdfields[] = "srcmask"; $reqdfieldsn[] = "Source bit count"; } if (isset($a_filter[$id]['associated-rule-id']) === false && !(is_specialnet($_POST['dsttype']) || $_POST['dsttype'] == "single")) { $reqdfields[] = "dstmask"; $reqdfieldsn[] = gettext("Destination bit count"); } do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); if (!$_POST['srcbeginport']) { $_POST['srcbeginport'] = 0; $_POST['srcendport'] = 0; } if (!$_POST['dstbeginport']) { $_POST['dstbeginport'] = 0; $_POST['dstendport'] = 0; } if ($_POST['srcbeginport'] && !is_portoralias($_POST['srcbeginport'])) { $input_errors[] = sprintf(gettext("%s is not a valid start source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcbeginposrt']); } if ($_POST['srcendport'] && !is_portoralias($_POST['srcendport'])) { $input_errors[] = sprintf(gettext("%s is not a valid end source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcendport']); } if ($_POST['dstbeginport'] && !is_portoralias($_POST['dstbeginport'])) {
##|*IDENT=page-diagnostics-ping ##|*NAME=Diagnostics: Ping page ##|*DESCR=Allow access to the 'Diagnostics: Ping' page. ##|*MATCH=diag_ping.php* ##|-PRIV $pgtitle = array(gettext("Diagnostics"), gettext("Ping")); require "guiconfig.inc"; define('MAX_COUNT', 10); define('DEFAULT_COUNT', 3); if ($_POST || $_REQUEST['host']) { unset($input_errors); unset($do_ping); /* input validation */ $reqdfields = explode(" ", "host count"); $reqdfieldsn = array(gettext("Host"), gettext("Count")); do_input_validation($_REQUEST, $reqdfields, $reqdfieldsn, &$input_errors); if ($_REQUEST['count'] < 1 || $_REQUEST['count'] > MAX_COUNT) { $input_errors[] = sprintf(gettext("Count must be between 1 and %s"), MAX_COUNT); } if (!$input_errors) { $do_ping = true; $host = $_REQUEST['host']; $interface = $_REQUEST['interface']; $count = $_POST['count']; if (preg_match('/[^0-9]/', $count)) { $count = DEFAULT_COUNT; } } } if (!isset($do_ping)) { $do_ping = false;
$reqdfieldsn[] = gettext("Bind Password"); } } if ($pconfig['type'] == "radius") { $reqdfields = explode(" ", "name type radius_host radius_srvcs"); $reqdfieldsn = array(gettext("Descriptive name"), gettext("Type"), gettext("Hostname or IP"), gettext("Services")); if ($pconfig['radisu_srvcs'] == "both" || $pconfig['radisu_srvcs'] == "auth") { $reqdfields[] = "radius_auth_port"; $reqdfieldsn[] = gettext("Authentication port value"); } if ($id == null) { $reqdfields[] = "radius_secret"; $reqdfieldsn[] = gettext("Shared Secret"); } } do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors); if (!empty($pconfig['ldap_host']) && preg_match("/[^a-zA-Z0-9\\.\\-_]/", $pconfig['ldap_host'])) { $input_errors[] = gettext("The host name contains invalid characters."); } if (!empty($pconfig['radius_host']) && preg_match("/[^a-zA-Z0-9\\.\\-_]/", $pconfig['radius_host'])) { $input_errors[] = gettext("The host name contains invalid characters."); } if (auth_get_authserver($pconfig['name']) && !isset($id)) { $input_errors[] = gettext("An authentication server with the same name already exists."); } if ($pconfig['type'] == "radius" && isset($pconfig['radius_timeout']) && !empty($pconfig['radius_timeout']) && (!is_numeric($pconfig['radius_timeout']) || is_numeric($pconfig['radius_timeout']) && $pconfig['radius_timeout'] <= 0)) { $input_errors[] = gettext("RADIUS Timeout value must be numeric and positive."); } if (count($input_errors) == 0) { $server = array(); $server['refid'] = uniqid();
if ($_POST) { unset($input_errors); $pconfig = $_POST; if (isset($_POST['Cancel']) && $_POST['Cancel']) { header("Location: services_nfs_share.php"); exit; } // Input validation. $reqdfields = explode(" ", "path"); $reqdfieldsn = array(gettext("Path")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); foreach ($_POST['network'] as $id => $network) { $post_en = array('network' => $network, 'mask' => $_POST['mask'][$id]); $reqdfields = explode(" ", "network mask"); $reqdfieldsn = array(gettext("Authorised network"), gettext("Network mask")); do_input_validation($post_en, $reqdfields, $reqdfieldsn, $input_errors); } // remove last slash and check alldirs option $path = $_POST['path']; if (strlen($path) > 1 && $path[strlen($path) - 1] == "/") { $path = substr($path, 0, strlen($path) - 1); } if ($path == "/") { // allow alldirs } else { if (isset($_POST['quiet'])) { // might be delayed mount } else { if (isset($_POST['alldirs']) && !ismounted_or_dataset($path)) { $input_errors[] = sprintf(gettext("All dirs requires mounted path, but Path %s is not mounted."), $path); }