aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/freenas/pkg/freenas_guiconfig.inc1
-rw-r--r--packages/freenas/pkg/freenas_services.inc64
-rw-r--r--packages/freenas/www/services_nfs.php703
-rw-r--r--packages/freenas/www/services_samba.php2
-rw-r--r--packages/freenas/www/services_samba_share.php8
-rw-r--r--packages/freenas/www/services_samba_share_edit.php5
6 files changed, 105 insertions, 678 deletions
diff --git a/packages/freenas/pkg/freenas_guiconfig.inc b/packages/freenas/pkg/freenas_guiconfig.inc
index 1464b147..2dec5a42 100644
--- a/packages/freenas/pkg/freenas_guiconfig.inc
+++ b/packages/freenas/pkg/freenas_guiconfig.inc
@@ -36,6 +36,7 @@ $d_raidconfdirty_path = $g['varrun_path'] . "/raid.conf.dirty";
$d_userconfdirty_path = $g['varrun_path'] . "/user.conf.dirty";
$d_groupconfdirty_path = $g['varrun_path'] . "/group.conf.dirty";
$d_smbshareconfdirty_path = $g['varrun_path'] . "/smbshare.conf.dirty";
+$d_nfsexportconfdirty_path = $g['varrun_path'] . "/nfsexport.conf.dirty";
$d_upnpconfdirty_path = $g['varrun_path'] . "/upnp.conf.dirty";
/* ============================================================================= */
diff --git a/packages/freenas/pkg/freenas_services.inc b/packages/freenas/pkg/freenas_services.inc
index 1bd9b980..e32ff24f 100644
--- a/packages/freenas/pkg/freenas_services.inc
+++ b/packages/freenas/pkg/freenas_services.inc
@@ -399,6 +399,9 @@ function services_nfs_configure() {
if (isset($freenas_config['nfs']['enable'])) {
if ($g['booting']) { echo "Starting NFS... "; }
+
+ $nfsconf = "";
+ $a_nfsconf = array();
/* If no share configured, exit */
if (!is_array($freenas_config['mounts']['mount'])) { return 1; }
@@ -412,47 +415,44 @@ function services_nfs_configure() {
}
$a_mount = &$freenas_config['mounts']['mount'];
-
- /* TODO: ATM network authorization does not work on a per mount basis */
- if (is_array($freenas_config['nfs']['nfsnetwork'])) {
- $a_nfsnetworks = array();
- $pfnetworks = array();
-
- foreach ($freenas_config['nfs']['nfsnetwork'] as $netel) {
- list($network,$subnet) =
- explode('/', $netel);
- $subnet = gen_subnet_mask($subnet);
- $a_nfsnetworks[] = "-network {$network} -mask {$subnet}";
- $pfnetworks[] = $network;
- }
-
- $nfsnetworks_str = implode(' ', $a_nfsnetworks);
- services_setup_transparency_for("nfs", implode(" ", $pfnetworks));
- }
-
foreach ($a_mount as $mount) {
/* -mapall and -maproot mutually exclusive */
- $mapping = $freenas_config['nfs']['mapall'] == "yes" ? "-mapall=root" : "-maproot=root";
+ $mapping = $mount['nfs']['mapall'] == "yes" ? "-mapall=root" : "-maproot=root";
+ $networks = isset($mount['nfs']['networks']) ? $mount['nfs']['networks'] : "";
- $nfsconf .= <<<EOD
-/mnt/{$mount['sharename']} -alldirs {$mapping}
-EOD;
-
- $nfsconf .= <<<EOD
-{$nfsnetworks_str}
-
-EOD;
-
- } // end foreach
+ $nfsconf = "/mnt/{$mount['sharename']} -alldirs {$mapping}";
+
+ if ($networks <> "") {
+ $pfnetworks = array();
+
+ foreach (explode(",", $networks) as $netel) {
+ list($network,$subnet) =
+ explode('/', $netel);
+
+ $subnet = gen_subnet_mask($subnet);
+ $pfnetworks[] = $network;
+
+ $tmp_nfsconf .= "{$nfsconf} -network {$network} -mask {$subnet}\n";
+ }
+
+ $nfsconf = $tmp_nfsconf;
+ } else {
+ $nfsconf .= "\n";
+ }
+ }
-
fwrite($fd, $nfsconf);
fclose($fd);
+ $nfsdbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? " -a" : " -h {$freenas_config['nfs']['bindto']}";
+ $rpcbbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? "" : " -h {$freenas_config['nfs']['bindto']}";
+ $servetcp = isset($freenas_config['nfs']['servetcp']) ? " -t" : "";
+ $serveudp = isset($freenas_config['nfs']['serveudp']) ? " -u" : "";
+
/* run rpcbind, nfsd and mountd */
- mwexec("/usr/sbin/rpcbind -h {$freenas_config['nfs']['bindto']}");
- mwexec("/usr/sbin/nfsd -h {$freenas_config['nfs']['bindto']} -u -t -n 4");
+ mwexec("/usr/sbin/rpcbind{$rpcbbindto}");
+ mwexec("/usr/sbin/nfsd{$nfsdbindto}{$serveudp}{$servetcp} -n 4");
mwexec("/usr/sbin/mountd -r {$g['varetc_path']}/exports");
mwexec("/usr/sbin/rpc.lockd");
mwexec("/usr/sbin/rpc.statd");
diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php
index ea5bbf92..7b4b9a18 100644
--- a/packages/freenas/www/services_nfs.php
+++ b/packages/freenas/www/services_nfs.php
@@ -54,8 +54,9 @@ if (!is_array($freenas_config['nfs']))
}
$pconfig['enable'] = isset($freenas_config['nfs']['enable']);
-$pconfig['mapall'] = $freenas_config['nfs']['mapall'];
$pconfig['bindto'] = $freenas_config['nfs']['bindto'];
+$pconfig['serveudp'] = isset($freenas_config['nfs']['serveudp']);
+$pconfig['servetcp'] = isset($freenas_config['nfs']['servetcp']);
if (! empty($_POST))
{
@@ -66,29 +67,11 @@ if (! empty($_POST))
$pconfig = $_POST;
/* input validation */
- $reqdfields = explode(" ", "authnetworks bindto");
- $reqdfieldsn = explode(",", "Destination network, IP address to bind to");
+ $reqdfields = explode(" ", "bindto");
+ $reqdfieldsn = explode(",", "IP address to bind to");
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- 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'];
- }
- }
-
if (is_array($error_bucket))
foreach($error_bucket as $elem)
$input_errors[] =& $elem["error"];
@@ -101,10 +84,19 @@ 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']['bindto'] = $_POST['bindto'];
+ if (isset($_POST['servetcp'])) {
+ $freenas_config['nfs']['servetcp'] = $_POST['servetcp'];
+ } else {
+ unset($freenas_config['nfs']['servetcp']);
+ }
+ if (isset($_POST['serveudp'])) {
+ $freenas_config['nfs']['serveudp'] = $_POST['serveudp'];
+ } else {
+ unset($freenas_config['nfs']['serveudp']);
+ }
+
write_config();
$retval = 0;
@@ -127,548 +119,22 @@ 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 = <<<EOD
<script type="text/javascript">
<!--
-function network_exists(myValue) {
- for (i = 0; i < $('authnetworks').options.length; i++) {
- if ($('authnetworks').options[i].value == myValue) {
- return true;
- }
- }
-
- return false;
-}
-function selectnetel() {
- for (i = 0; i < $('authnetworks').options.length; i++) {
- $('authnetworks').options[i].selected = true;
- }
-}
-function get_selected_listitems() {
- var selected = new Array();
-
- if (!$('authnetworks')) { return; }
-
- for (i = 0; i < $('authnetworks').options.length; i++) {
- if ($('authnetworks').childNodes[i].selected == true) {
- selected.push($('authnetworks').options[i]);
- }
- }
-
- return selected;
-}
-
-function add_selnetwork(net, mask) {
- var newOption = document.createElement("option");
- var newOptionText = document.createTextNode(net + '/' + mask);
- var selectSize = $('authnetworks').size;
-
- if (!net || !mask) { return; }
-
- if (network_exists(net + '/' + mask)) {
- alert('Element already exist in the network list');
- return;
- }
-
- newOption.setAttribute('value', net + '/' + mask);
- newOption.appendChild(newOptionText);
-
- /* add the option to the select element */
- $('authnetworks').appendChild(newOption);
- $('authnetworks').setAttribute('size', '3');
-
- /* clear values from HTML fields */
- if ($('network')) { $('network').value = ''; }
- if ($('network_subnet')) { $('network_subnet').selectedIndex = 0; }
-}
-
-function remove_selnetwork() {
- var selectedItems = get_selected_listitems();
-
- if (selectedItems.length <= 0) {
- alert('No element selected!');
- return;
- }
-
- for (i = 0; i < selectedItems.length; i++) {
- $('authnetworks').removeChild(selectedItems[i]);
- }
-}
-
-function create_authnetworks_tr() {
- var newTR = document.createElement("tr");
- newTR.setAttribute('id', 'authNetworksTR');
-
- var newImageTR = document.createElement("tr");
- newImageTR.setAttribute('id', 'authNetworksImageTR');
-
- var descTD = document.createElement("td");
- descTD.setAttribute('align', 'left');
- descTD.setAttribute('valign', 'top');
- descTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;');
-
- var selectTD = document.createElement("td");
- selectTD.setAttribute('align', 'left');
- selectTD.setAttribute('valign', 'middle');
- selectTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;');
-
- var typehintTD = document.createElement("td");
- typehintTD.setAttribute('align', 'left');
- typehintTD.setAttribute('valign', 'middle');
- typehintTD.setAttribute('colspan', '2');
- typehintTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;');
-
- var blankTD = document.createElement("td");
- blankTD.setAttribute('align', 'left');
- blankTD.setAttribute('valign', 'top');
-
- var imageTD = document.createElement("td");
- imageTD.setAttribute('align', 'left');
- imageTD.setAttribute('valign', 'middle');
- imageTD.setAttribute('style', 'vertical-align: middle;');
- imageTD.setAttribute('colspan', '3');
-
- var newSpan = document.createElement("span");
- newSpan.setAttribute('style', 'padding-left: 5px; vertical-align: middle;');
-
- var newTypehintSpan = document.createElement("span");
- newTypehintSpan.setAttribute('style', 'padding-left: 5px; vertical-align: middle;');
-
- var newDescription = document.createTextNode('{$currentnetTransString}:');
- var newImgDescription = document.createTextNode('{$minusimgDescTransString}');
- var typehint = document.createTextNode('{$networksTypehintTransString}');
-
- var newSelect = document.createElement("select");
- newSelect.setAttribute('name', 'authnetworks[]');
- newSelect.setAttribute('class', 'formselect');
- newSelect.setAttribute('id', 'authnetworks');
- newSelect.setAttribute('multiple', 'multiple');
- newSelect.setAttribute('size', '{$networkCount}');
-
- /* divs are used to achieve proper alignement */
- newImageDiv = document.createElement("div");
- newImageDiv.setAttribute('style', 'float: left;');
-
- newImageDescDiv = document.createElement("div");
- newImageDescDiv.setAttribute('style', 'padding-top: 1px;');
-
- /* try to add each network to the select element */
-
-EOD;
-
-if (is_array($freenas_config['nfs']['nfsnetwork'])) {
- foreach ($freenas_config['nfs']['nfsnetwork'] as $networkel) {
- list($netaddress, $netmask) = explode('/', $networkel);
- $networkSanitized = htmlspecialchars($netaddress);
-
- $jscriptstr .= <<<EOD
- var newOption = document.createElement("option");
- var newOptionText = document.createTextNode('{$networkSanitized}/{$netmask}');
-
- newOption.setAttribute('value', '{$networkSanitized}/{$netmask}');
- newOption.appendChild(newOptionText);
-
- /* add the option to the select element */
- newSelect.appendChild(newOption);
-
-EOD;
- } // end if
-} // end foreach
-
-$jscriptstr .= <<<EOD
- var newImage = document.createElement("img");
- newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_minus.png');
- newImage.setAttribute('alt', 'remove network');
- newImage.setAttribute('border', '0');
- newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;');
- newImage.setAttribute('onclick', 'remove_selnetwork();');
-
- /* assemble everything */
- newTypehintSpan.appendChild(typehint);
-
- descTD.appendChild(newDescription);
- selectTD.appendChild(newSelect);
- typehintTD.appendChild(newTypehintSpan);
-
- newImageDiv.appendChild(newImage);
- newImageDescDiv.appendChild(newImgDescription);
-
- imageTD.appendChild(newImageDiv);
- imageTD.appendChild(newImageDescDiv);
-
- newTR.appendChild(descTD);
- newTR.appendChild(selectTD);
- newTR.appendChild(typehintTD);
-
- newImageTR.appendChild(blankTD);
- newImageTR.appendChild(imageTD);
-
- $('networkopttab').appendChild(newTR);
- $('networkopttab').appendChild(newImageTR);
-}
-
-function create_network_tr() {
- var newTR = document.createElement("tr");
- newTR.setAttribute('id', 'typeDetailsTR');
-
- var descTD = document.createElement("td");
- descTD.setAttribute('align', 'left');
- descTD.setAttribute('valign', 'top');
-
- var inputTD = document.createElement("td");
- inputTD.setAttribute('align', 'left');
- inputTD.setAttribute('valign', 'top');
-
- var selectTD = document.createElement("td");
- selectTD.setAttribute('align', 'left');
- selectTD.setAttribute('valign', 'middle');
-
- var imageTD = document.createElement("td");
- imageTD.setAttribute('align', 'left');
- imageTD.setAttribute('valign', 'middle');
-
- var newDescription = document.createTextNode('{$addressTransString}:');
- var newImgDescription = document.createTextNode('{$plusimgDescTransString}');
-
- var newInput = document.createElement("input");
- newInput.setAttribute('name', 'network');
- newInput.setAttribute('type', 'text');
- newInput.setAttribute('class', 'formfld host');
- newInput.setAttribute('id', 'network');
- newInput.setAttribute('size', '20');
- newInput.setAttribute('value', '');
-
- var newSelect = document.createElement("select");
- newSelect.setAttribute('name', 'network_subnet');
- newSelect.setAttribute('class', 'formselect');
- newSelect.setAttribute('id', 'network_subnet');
-
- var newImage = document.createElement("img");
- newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png');
- newImage.setAttribute('alt', 'add network');
- newImage.setAttribute('border', '0');
- newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;');
- newImage.setAttribute('onclick', 'add_selnetwork($("network").value, $("network_subnet").value);');
-
- /* divs are used to achieve proper alignement */
- newImageDiv = document.createElement("div");
- newImageDiv.setAttribute('style', 'float: left;');
-
- newImageDescDiv = document.createElement("div");
- newImageDescDiv.setAttribute('style', 'padding-top: 1px;');
-
- /* add options to select */
- for (i = 31; i > 0; i--) {
- var newOption = document.createElement("option");
- var newOptionText = document.createTextNode(i.toString());
-
- newOption.setAttribute('value', i);
- newOption.appendChild(newOptionText);
-
- /* add the option to the select element */
- newSelect.appendChild(newOption);
- }
-
- /* assemble everything */
- descTD.appendChild(newDescription);
- inputTD.appendChild(newInput);
- selectTD.appendChild(newSelect);
-
- newImageDiv.appendChild(newImage);
- newImageDescDiv.appendChild(newImgDescription);
-
- imageTD.appendChild(newImageDiv);
- imageTD.appendChild(newImageDescDiv);
-
- newTR.appendChild(descTD);
- newTR.appendChild(inputTD);
- newTR.appendChild(selectTD);
- newTR.appendChild(imageTD);
-
- $('networkopttab').appendChild(newTR);
-}
-
-function create_wan_tr() {
- var wanSubnet = '{$config['interfaces']['wan']['subnet']}';
-
- var newTR = document.createElement("tr");
- newTR.setAttribute('id', 'typeDetailsTR');
-
- var descTD = document.createElement("td");
- descTD.setAttribute('align', 'left');
- descTD.setAttribute('valign', 'top');
-
- var nettextTD = document.createElement("td");
- nettextTD.setAttribute('align', 'left');
- nettextTD.setAttribute('valign', 'top');
-
- var imageTD = document.createElement("td");
- imageTD.setAttribute('align', 'left');
- imageTD.setAttribute('valign', 'middle');
- imageTD.setAttribute('colspan', '2');
-
- var newDescription = document.createTextNode('{$addressTransString}:');
- var newWanDescription = document.createTextNode('{$generatedWANSubnet}/' + wanSubnet);
-
- var newNetTextSpan = document.createElement("span");
- newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;');
-
- var newImage = document.createElement("img");
- newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png');
- newImage.setAttribute('alt', 'add network');
- newImage.setAttribute('border', '0');
- newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;');
- newImage.setAttribute('onclick', 'add_selnetwork("{$generatedWANSubnet}", ' + wanSubnet + ');');
-
- /* divs are used to achieve proper alignement */
- newImageDiv = document.createElement("div");
- newImageDiv.setAttribute('style', 'float: left;');
-
- newImageDescDiv = document.createElement("div");
- newImageDescDiv.setAttribute('style', 'padding-top: 1px;');
-
- var newImgDescription = document.createTextNode('{$plusimgDescTransString}');
-
- /* assemble everything */
- newNetTextSpan.appendChild(newWanDescription);
-
- descTD.appendChild(newDescription);
- nettextTD.appendChild(newNetTextSpan);
-
- newImageDiv.appendChild(newImage);
- newImageDescDiv.appendChild(newImgDescription);
-
- imageTD.appendChild(newImageDiv);
- imageTD.appendChild(newImageDescDiv);
-
- newTR.appendChild(descTD);
- newTR.appendChild(nettextTD);
- newTR.appendChild(imageTD);
-
- $('networkopttab').appendChild(newTR);
-}
-
-function create_lan_tr() {
- var lanSubnet = '{$config['interfaces']['lan']['subnet']}';
-
- var newTR = document.createElement("tr");
- newTR.setAttribute('id', 'typeDetailsTR');
-
- var descTD = document.createElement("td");
- descTD.setAttribute('align', 'left');
- descTD.setAttribute('valign', 'top');
-
- var nettextTD = document.createElement("td");
- nettextTD.setAttribute('align', 'left');
- nettextTD.setAttribute('valign', 'top');
-
- var imageTD = document.createElement("td");
- imageTD.setAttribute('align', 'left');
- imageTD.setAttribute('valign', 'middle');
- imageTD.setAttribute('colspan', '2');
-
- var newDescription = document.createTextNode('{$addressTransString}:');
- var newLanDescription = document.createTextNode('{$generatedLANSubnet}/' + lanSubnet);
-
- var newNetTextSpan = document.createElement("span");
- newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;');
-
- var newImage = document.createElement("img");
- newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png');
- newImage.setAttribute('alt', 'add network');
- newImage.setAttribute('border', '0');
- newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;');
- newImage.setAttribute('onclick', 'add_selnetwork("{$generatedLANSubnet}", ' + lanSubnet + ');');
-
- /* divs are used to achieve proper alignement */
- newImageDiv = document.createElement("div");
- newImageDiv.setAttribute('style', 'float: left;');
-
- newImageDescDiv = document.createElement("div");
- newImageDescDiv.setAttribute('style', 'padding-top: 1px;');
-
- var newImgDescription = document.createTextNode('{$plusimgDescTransString}');
-
- /* assemble everything */
- newNetTextSpan.appendChild(newLanDescription);
-
- descTD.appendChild(newDescription);
- nettextTD.appendChild(newNetTextSpan);
-
- newImageDiv.appendChild(newImage);
- newImageDescDiv.appendChild(newImgDescription);
-
- imageTD.appendChild(newImageDiv);
- imageTD.appendChild(newImageDescDiv);
-
- newTR.appendChild(descTD);
- newTR.appendChild(nettextTD);
- newTR.appendChild(imageTD);
-
- $('networkopttab').appendChild(newTR);
-}
-
-function get_optnetwork() {
- var slashIndex= $('opt_iface_desc').firstChild.nodeValue.indexOf('/');
- var myNetwork = $('opt_iface_desc').firstChild.nodeValue.substring(0, slashIndex);
-
- return myNetwork;
-}
-
-function get_optsubnet() {
- var slashIndex= $('opt_iface_desc').firstChild.nodeValue.indexOf('/');
- var mySubnet = $('opt_iface_desc').firstChild.nodeValue.substring(slashIndex + 1, $('opt_iface_desc').firstChild.nodeValue.length);
-
- return mySubnet;
-}
-
-function create_opt_tr() {
- var newTR = document.createElement("tr");
- newTR.setAttribute('id', 'typeDetailsTR');
-
- var descTD = document.createElement("td");
- descTD.setAttribute('align', 'left');
- descTD.setAttribute('valign', 'top');
-
- var nettextTD = document.createElement("td");
- nettextTD.setAttribute('align', 'left');
- nettextTD.setAttribute('valign', 'top');
-
- var imageTD = document.createElement("td");
- imageTD.setAttribute('align', 'left');
- imageTD.setAttribute('valign', 'middle');
- imageTD.setAttribute('colspan', '2');
-
- var newDescription = document.createTextNode('{$addressTransString}:');
- var newImgDescription = document.createTextNode('{$plusimgDescTransString}');
-
- var newImage = document.createElement("img");
- newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png');
- newImage.setAttribute('alt', 'add network');
- newImage.setAttribute('border', '0');
- newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;');
- newImage.setAttribute('onclick', 'add_selnetwork(get_optnetwork(), get_optsubnet());');
-
- /* divs are used to achieve proper alignement */
- newImageDiv = document.createElement("div");
- newImageDiv.setAttribute('style', 'float: left;');
-
- newImageDescDiv = document.createElement("div");
- newImageDescDiv.setAttribute('style', 'padding-top: 1px;');
-
- /* add options to select */
-
-EOD;
-
-for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- $optSubnet = $config['interfaces']['opt' . $i]['subnet'];
- $generatedOPTSubnet = gen_subnet($config['interfaces']['opt' . $i]['ipaddr'],
- $config['interfaces']['opt' . $i]['subnet']);
-
- if (empty($optSubnet) || empty($generatedOPTSubnet)) { continue; }
-
- $jscriptstr .= <<<EOD
- var selOptIndex = $('authnettype').selectedIndex;
- var optNumber = $('authnettype').options[selOptIndex].value.substr(3, $('authnettype').options[selOptIndex].value.length);
- var newOptDescription = null;
- var newNetTextSpan = null;
-
- if (optNumber == {$i}) {
- newOptDescription = document.createTextNode('{$generatedOPTSubnet}/{$optSubnet}');
-
- newNetTextSpan = document.createElement("span");
- newNetTextSpan.setAttribute('id', 'opt_iface_desc');
- newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;');
- }
-
-EOD;
-}
-
-$jscriptstr .= <<<EOD
- /* assemble everything */
- if (newNetTextSpan)
- newNetTextSpan.appendChild(newOptDescription);
-
- descTD.appendChild(newDescription);
- if (newNetTextSpan)
- nettextTD.appendChild(newNetTextSpan);
-
- newImageDiv.appendChild(newImage);
- newImageDescDiv.appendChild(newImgDescription);
-
- imageTD.appendChild(newImageDiv);
- imageTD.appendChild(newImageDescDiv);
-
- newTR.appendChild(descTD);
- newTR.appendChild(nettextTD);
- newTR.appendChild(imageTD);
-
- $('networkopttab').appendChild(newTR);
-}
-
-function authnet_change() {
- if ($('typeDetailsTR')) { $('networkopttab').removeChild($('typeDetailsTR')); }
- if ($('authNetworksTR')) { $('networkopttab').removeChild($('authNetworksTR')); }
- if ($('authNetworksImageTR')) { $('networkopttab').removeChild($('authNetworksImageTR')); }
-
- switch ($('authnettype').selectedIndex) {
- case 0:
- /* Network */
- create_network_tr();
- break;
- case 1:
- /* WAN subnet */
- create_wan_tr();
- break;
- case 2:
- /* LAN subnet */
- create_lan_tr();
- break;
-
-EOD;
-
-for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- $case_count = 2 + $i;
-
- $jscriptstr .= <<<EOD
- case {$case_count}:
- /* OPT subnet */
- create_opt_tr();
- break;
-
-EOD;
-
-} // end for
-
-$jscriptstr .= <<<EOD
- } // end switch
-
- create_authnetworks_tr();
-} // end function authnet_change
-
function enable_change(enable_change) {
var endis;
endis = !(document.iform.enable.checked || enable_change);
endis ? color = '#D4D0C8' : color = '#FFFFFF';
- document.iform.mapall.disabled = endis;
- document.iform.authnettype.disabled = endis;
+ document.iform.servetcp.disabled = endis;
+ document.iform.serveudp.disabled = endis;
+ document.iform.bindto.disabled = endis;
/* color adjustments */
- document.iform.mapall.style.backgroundColor = color;
- document.iform.authnettype.style.backgroundColor = color;
+ document.iform.servetcp.style.backgroundColor = color;
+ document.iform.serveudp.style.backgroundColor = color;
+ document.iform.bindto.style.backgroundColor = color;
}
//-->
</script>
@@ -683,11 +149,25 @@ echo $pfSenseHead->getHTML();
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
<?php include("fbegin.inc"); ?>
+<form id="iform" name="iform" action="services_nfs.php" method="post">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
- <div id="inputerrors"></div>
- <form id="iform" name="iform" action="services_nfs.php" method="post">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Settings"), true, "services_nfs.php");
+ $tab_array[1] = array(gettext("Exports"), false, "services_nfs_export.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="100%" valign="middle" class="listtopic" colspan="2">
<span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("NFS Server");?></span>
@@ -700,16 +180,19 @@ echo $pfSenseHead->getHTML();
<td width="22%" valign="top" class="vncellreq"><?=gettext("Bind to IP address");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
<select name="bindto" id="bindto" class="formselect">
- <option value="<?= $config['interfaces']['lan'][ipaddr] ?>">
+ <option value="(ANY)"<?php if ($pconfig['bindto'] == "(ANY)") { echo " selected=\"selected\""; } ?>>
+ (ANY)
+ </option>
+ <option value="<?= $config['interfaces']['wan'][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['wan'][ipaddr]) { echo " selected=\"selected\""; } ?>>
<?= $config['interfaces']['wan'][ipaddr] ?>
</option>
- <option value="<?= $config['interfaces']['lan'][ipaddr] ?>">
+ <option value="<?= $config['interfaces']['lan'][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['lan'][ipaddr]) { echo " selected=\"selected\""; } ?>>
<?= $config['interfaces']['lan'][ipaddr] ?>
</option>
<?php
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++):
?>
- <option value="<?= $config['interfaces']['opt' . $i][ipaddr] ?>">
+ <option value="<?= $config['interfaces']['opt' . $i][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['opt' . $i][ipaddr]) { echo " selected=\"selected\""; } ?>>
<?= $config['interfaces']['opt' . $i][ipaddr] ?>
</option>
<?php endfor; ?>
@@ -719,97 +202,41 @@ echo $pfSenseHead->getHTML();
</td>
</tr>
<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">
- <?php
- $types = explode(",", "Yes,No");
- $vals = explode(" ", "yes no");
- $j = 0;
-
- for ($j = 0; $j < count($vals); $j++):
- ?>
- <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['mapall']) echo "selected=\"selected\"";?>>
- <?=htmlspecialchars($types[$j]);?>
- </option>
- <?php endfor; ?>
- </select>
- <br />
- <?= gettext("All users will have the root privilege."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Authorised network");?></td>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Client Types");?></td>
<td width="78%" class="vtable" align="left" valign="middle">
- <table border="0" cellspacing="0" cellpadding="4" id="networkopttab">
- <tr>
- <td align="left" valign="middle"><?=gettext("Type");?>:</td>
- <td align="left" valign="middle" colspan="4">
- <select name="authnettype" id="authnettype" class="formselect" onchange="authnet_change();">
- <option value="network">
- <?=gettext("Network")?>
- </option>
- <option value="wan">
- <?=gettext("WAN subnet");?>
- </option>
- <option value="lan">
- <?=gettext("LAN subnet");?>
- </option>
- <?php
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++):
- ?>
- <option value="opt<?=$i;?>">
- <?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?>
- <?=gettext("subnet");?>
- </option>
- <?php endfor; ?>
- </select>
- </td>
- </tr>
- </table>
+ <p>
+ <input type="checkbox" name="servetcp" id="servetcp" value="on"<?php if ($pconfig['servetcp']) { echo " checked=\"checked\""; } ?>/>
+ <label for="servetcp"><?= gettext("Serve TCP NFS clients"); ?></label>
+ </p>
+ <p>
+ <input type="checkbox" name="serveudp" id="serveudp" value="on"<?php if ($pconfig['serveudp']) { echo " checked=\"checked\""; } ?>/>
+ <label for="serveudp"><?= gettext("Serve UDP NFS clients"); ?></label>
+ </p>
+ <p>
+ <span class="red"><strong><?= gettext("Note"); ?>: </strong></span>
+ <span class="vexpl">
+ <?= gettext("Usually it's save to enable support for both, UDP and TCP client types."); ?>
+ </span>
+ </p>
</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <!-- Note: Cause Prototype is observing the onclick event, we are using onmousedown and onkeydown instead -->
- <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onmousedown="selectnetel();" onkeydown="selectnetel();" />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <span class="red">
- <strong><?= gettext("NOTE"); ?>:</strong>
- </span>
- <br />
- <ul>
- <li>
- <span class="vexpl">
- <?= gettext("The name of each exported directory is: /mnt/sharename"); ?>
- </span>
- </li>
- <li>
- <span class="vexpl">
- <?= gettext("Try adding networks to the 'current networks' list to authorize each particular network."); ?>
- </span>
- </li>
- <li>
- <span class="vexpl">
- <?= gettext("Use ctrl-click (or command-click on the Mac) to select and de-select elements from the 'current networks' list."); ?>
- </span>
- </li>
- </ul>
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
</td>
</tr>
</table>
- </form>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
<?php include("fend.inc"); ?>
<?= checkForInputErrors(); ?>
<script type="text/javascript">
<!--
enable_change(false);
-authnet_change();
//-->
</script>
</body>
diff --git a/packages/freenas/www/services_samba.php b/packages/freenas/www/services_samba.php
index 06a0291d..afd90a08 100644
--- a/packages/freenas/www/services_samba.php
+++ b/packages/freenas/www/services_samba.php
@@ -234,8 +234,6 @@ echo $pfSenseHead->getHTML();
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <?php if ($input_errors) print_input_errors($input_errors); ?>
- <?php if ($savemsg) print_info_box($savemsg); ?>
<tr>
<td width="100%" valign="middle" class="listtopic" colspan="2">
<span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("CIFS share");?></span>
diff --git a/packages/freenas/www/services_samba_share.php b/packages/freenas/www/services_samba_share.php
index 95f1fe0b..1545df97 100644
--- a/packages/freenas/www/services_samba_share.php
+++ b/packages/freenas/www/services_samba_share.php
@@ -143,11 +143,11 @@ echo $pfSenseHead->getHTML();
</tr>
<?php $i = 0; foreach($a_mount as $mountv): ?>
<tr>
- <td class="listr"><?=htmlspecialchars($mountv['sharename']);?>&nbsp;</td>
- <td class="listr"><?=htmlspecialchars($mountv['desc']);?>&nbsp;</td>
- <td class="listbg"><?=htmlspecialchars((is_array($config['samba']['hidemount']) && in_array($mountv['sharename'],$config['samba']['hidemount']))? gettext("No") : gettext("Yes"));?></td>
+ <td class="listr"><?=htmlspecialchars($mountv['sharename']);?></td>
+ <td class="listr"><?=htmlspecialchars($mountv['desc']);?></td>
+ <td class="listbg"><?=htmlspecialchars((is_array($freenas_config['samba']['hidemount']) && in_array($mountv['sharename'],$freenas_config['samba']['hidemount']))? gettext("No") : gettext("Yes"));?></td>
<td valign="middle" nowrap class="list">
- <?php if(isset($config['samba']['enable']))
+ <?php if(isset($freenas_config['samba']['enable']))
echo("<a href='services_samba_share_edit.php?id={$i}'><img src='./themes/" . $g['theme'] . "/images/icons/icon_e.gif' title='" . gettext("Edit Share") . "' width='17' height='17' border='0'></a>");
?>
</td>
diff --git a/packages/freenas/www/services_samba_share_edit.php b/packages/freenas/www/services_samba_share_edit.php
index 02efc98d..d417fa4c 100644
--- a/packages/freenas/www/services_samba_share_edit.php
+++ b/packages/freenas/www/services_samba_share_edit.php
@@ -81,7 +81,8 @@ if (! empty($_POST))
if (!$input_errors)
{
- if(!$_POST['browseable']) {
+ /* TODO: This logic needs to be tested! */
+ if($_POST['browseable'] == gettext("No")) {
$freenas_config['samba']['hidemount'] = array_merge($freenas_config['samba']['hidemount'],array($freenas_config['mounts']['mount'][$id]['sharename']));
} else {
if(is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'],$freenas_config['samba']['hidemount'])) {
@@ -109,7 +110,7 @@ echo $pfSenseHead->getHTML();
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<div id="inputerrors"></div>
- <form id="iform" name="iform" action="disks_mount_edit.php" method="post">
+ <form id="iform" name="iform" action="services_samba_share_edit.php" method="post">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="22%" valign="top" class="vncellreq"><?= gettext("Share Name"); ?></td>