From a4f7ab6ec229d15aa6b7606516090b73ba50ff2a Mon Sep 17 00:00:00 2001 From: Daniel Stefan Haischt Date: Sun, 21 Jan 2007 00:06:40 +0000 Subject: * results of a coding binge ... --- packages/freenas/www/services_nfs.php | 658 ++++++++++++++++++++++++++++++++-- 1 file changed, 621 insertions(+), 37 deletions(-) (limited to 'packages/freenas/www/services_nfs.php') diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php index 092f71a6..ea5bbf92 100644 --- a/packages/freenas/www/services_nfs.php +++ b/packages/freenas/www/services_nfs.php @@ -55,9 +55,7 @@ if (!is_array($freenas_config['nfs'])) $pconfig['enable'] = isset($freenas_config['nfs']['enable']); $pconfig['mapall'] = $freenas_config['nfs']['mapall']; - -list($pconfig['network'],$pconfig['network_subnet']) = - explode('/', $freenas_config['nfs']['nfsnetwork']); +$pconfig['bindto'] = $freenas_config['nfs']['bindto']; if (! empty($_POST)) { @@ -68,24 +66,29 @@ if (! empty($_POST)) $pconfig = $_POST; /* input validation */ - $reqdfields = explode(" ", "network network_subnet"); - $reqdfieldsn = explode(",", "Destination network,Destination network bit count"); + $reqdfields = explode(" ", "authnetworks bindto"); + $reqdfieldsn = explode(",", "Destination network, IP address to bind to"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if (($_POST['network'] && !is_ipaddr($_POST['network']))) { - $error_bucket[] = array("error" => gettext("A valid network must be specified."), - "field" => "network"); - } - - if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) { - $error_bucket[] = array("error" => gettext("A valid network bit count must be specified."), - "field" => "network_subnet"); - + if (isset($_POST['authnetworks']) && is_array($_POST['authnetworks'])) { + foreach ($_POST['authnetworks'] as $netel) { + list($_POST['network'], $_POST['network_subnet']) = explode('/', $netel); + + if (($_POST['network'] && !is_ipaddr($_POST['network']))) { + $error_bucket[] = array("error" => gettext("A valid network must be specified."), + "field" => "network"); + } + + if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) { + $error_bucket[] = array("error" => gettext("A valid network bit count must be specified."), + "field" => "network_subnet"); + } + + $osn['nfsnetwork'][] = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; + } } - $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; - if (is_array($error_bucket)) foreach($error_bucket as $elem) $input_errors[] =& $elem["error"]; @@ -98,9 +101,10 @@ if (! empty($_POST)) if (!$input_errors) { + $freenas_config['nfs'] = $osn; $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false; $freenas_config['nfs']['mapall'] = $_POST['mapall']; - $freenas_config['nfs']['nfsnetwork'] = $osn; + $freenas_config['nfs']['bindto'] = $_POST['bindto']; write_config(); $retval = 0; @@ -123,9 +127,537 @@ include("head.inc"); /* put your custom HTML head content here */ /* using some of the $pfSenseHead function calls */ +$addressTransString = gettext("Address"); +$plusimgDescTransString = gettext("add to network list"); +$minusimgDescTransString = gettext("remove from network list"); +$currentnetTransString = gettext("Current networks"); +$networksTypehintTransString = gettext("Network that is authorised to access NFS shares"); + +$networkCount = count($freenas_config['nfs']['nfsnetwork']); +$generatedWANSubnet = gen_subnet($config['interfaces']['wan']['ipaddr'], + $config['interfaces']['wan']['subnet']); +$generatedLANSubnet = gen_subnet($config['interfaces']['lan']['ipaddr'], + $config['interfaces']['lan']['subnet']); + $jscriptstr = << @@ -166,6 +696,28 @@ echo $pfSenseHead->getHTML(); + + + + +
+ + + @@ -189,34 +741,65 @@ echo $pfSenseHead->getHTML(); - - / - -
- + + + + + +
: + +
  - " /> + + " onmousedown="selectnetel();" onkeydown="selectnetel();" />   - - - - + : +
+ @@ -226,6 +809,7 @@ echo $pfSenseHead->getHTML(); -- cgit v1.2.3