aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freenas/www/services_nfs.php
diff options
context:
space:
mode:
authorDaniel Stefan Haischt <dsh@pfsense.org>2007-01-04 12:35:03 +0000
committerDaniel Stefan Haischt <dsh@pfsense.org>2007-01-04 12:35:03 +0000
commita6cb09d6671e4dee123e76bb82f15cc897f919ad (patch)
treecde6ece42e080f01514b32fed97c137f3ea1d947 /packages/freenas/www/services_nfs.php
parente77957a17655ceb1dfb6648473884576c49f148e (diff)
downloadpfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.tar.gz
pfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.tar.bz2
pfsense-packages-a6cb09d6671e4dee123e76bb82f15cc897f919ad.zip
* synced freenas package to current FreeNAS trunk
* unison package file needs to be added to pfsense.com * rc script needs to be tested
Diffstat (limited to 'packages/freenas/www/services_nfs.php')
-rw-r--r--packages/freenas/www/services_nfs.php154
1 files changed, 81 insertions, 73 deletions
diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php
index b99dd11e..70351bf1 100644
--- a/packages/freenas/www/services_nfs.php
+++ b/packages/freenas/www/services_nfs.php
@@ -1,36 +1,44 @@
<?php
/* $Id$ */
+/* ========================================================================== */
/*
- disks_manage_edit.php
- part of FreeNAS (http://www.freenas.org)
- Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
- All rights reserved.
-
- Based on m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
- 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.
-*/
+ services_nfs.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name>
+ All rights reserved.
+
+ Based on FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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("NFS"));
@@ -42,14 +50,14 @@ require_once("freenas_functions.inc");
if (!is_array($freenas_config['nfs']))
{
- $freenas_config['nfs'] = array();
+ $freenas_config['nfs'] = array();
}
$pconfig['enable'] = isset($freenas_config['nfs']['enable']);
$pconfig['mapall'] = $freenas_config['nfs']['mapall'];
list($pconfig['network'],$pconfig['network_subnet']) =
- explode('/', $freenas_config['nfs']['nfsnetwork']);
+ explode('/', $freenas_config['nfs']['nfsnetwork']);
if (! empty($_POST))
{
@@ -58,26 +66,26 @@ if (! empty($_POST))
/* simple error list */
unset($input_errors);
$pconfig = $_POST;
-
+
/* input validation */
- $reqdfields = explode(" ", "network network_subnet");
- $reqdfieldsn = explode(",", "Destination network,Destination network bit count");
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ $reqdfields = explode(" ", "network network_subnet");
+ $reqdfieldsn = explode(",", "Destination network,Destination network bit count");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- if (($_POST['network'] && !is_ipaddr($_POST['network']))) {
+ 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']))) {
+ }
+
+ 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 = 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"];
@@ -88,23 +96,23 @@ if (! empty($_POST))
exit;
}
- if (!$input_errors)
- {
- $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false;
- $freenas_config['nfs']['mapall'] = $_POST['mapall'];
- $freenas_config['nfs']['nfsnetwork'] = $osn;
- write_config();
-
- $retval = 0;
- if (!file_exists($d_sysrebootreqd_path))
- {
- /* nuke the cache file */
- config_lock();
- services_nfs_configure();
- config_unlock();
- }
- $savemsg = get_std_save_message($retval);
- }
+ if (!$input_errors)
+ {
+ $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['nfs']['mapall'] = $_POST['mapall'];
+ $freenas_config['nfs']['nfsnetwork'] = $osn;
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_nfs_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
}
include("head.inc");
@@ -115,17 +123,17 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
<!--
function enable_change(enable_change) {
- var endis;
-
- endis = !(document.iform.enable.checked || enable_change);
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.mapall.disabled = endis;
- document.iform.network.disabled = endis;
+ document.iform.mapall.disabled = endis;
+ document.iform.network.disabled = endis;
document.iform.network_subnet.disabled = endis;
/* color adjustments */
- document.iform.mapall.style.backgroundColor = color;
- document.iform.network.style.backgroundColor = color;
+ document.iform.mapall.style.backgroundColor = color;
+ document.iform.network.style.backgroundColor = color;
document.iform.network_subnet.style.backgroundColor = color;
}
//-->
@@ -157,10 +165,10 @@ echo $pfSenseHead->getHTML();
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("map all user to root");?></td>
<td width="78%" class="vtable">
- <select name="mapall" class="formselect" id="mapall">
+ <select name="mapall" class="formselect" id="mapall">
<?php
$types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
+ $vals = explode(" ", "yes no");
$j = 0;
for ($j = 0; $j < count($vals); $j++):
@@ -178,7 +186,7 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?=gettext("Authorised network");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
<input name="network" type="text" class="formfld host" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
- /
+ /
<select name="network_subnet" class="formselect" id="network_subnet">
<?php for ($i = 32; $i >= 1; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>