From 94be140cc8597228b2b7e07fbb85027fd0993b92 Mon Sep 17 00:00:00 2001 From: Daniel Stefan Haischt Date: Tue, 15 Aug 2006 15:06:54 +0000 Subject: initial version of a FreeNAS package --- packages/freenas/www/diag_ad_infos.php | 156 ++++++ packages/freenas/www/diag_ataidle_infos.php | 145 ++++++ packages/freenas/www/diag_disk_infos.php | 141 ++++++ packages/freenas/www/diag_fn_logs_daemon.php | 109 +++++ packages/freenas/www/diag_fn_logs_ftp.php | 109 +++++ packages/freenas/www/diag_fn_logs_rsyncd.php | 108 +++++ packages/freenas/www/diag_fn_logs_samba.php | 165 +++++++ packages/freenas/www/diag_fn_logs_settings.php | 296 ++++++++++++ packages/freenas/www/diag_fn_logs_smartd.php | 109 +++++ packages/freenas/www/diag_fn_logs_sshd.php | 108 +++++ packages/freenas/www/diag_iscsi_infos.php | 133 +++++ packages/freenas/www/diag_mounts_infos.php | 128 +++++ packages/freenas/www/diag_part_infos.php | 134 +++++ packages/freenas/www/diag_raid_infos.php | 135 ++++++ packages/freenas/www/diag_smart_infos.php | 133 +++++ packages/freenas/www/diag_space_infos.php | 128 +++++ packages/freenas/www/disks_manage.php | 203 ++++++++ packages/freenas/www/disks_manage_edit.php | 276 +++++++++++ packages/freenas/www/disks_manage_init.php | 294 +++++++++++ packages/freenas/www/disks_manage_iscsi.php | 199 ++++++++ packages/freenas/www/disks_mount.php | 208 ++++++++ packages/freenas/www/disks_mount_edit.php | 279 +++++++++++ packages/freenas/www/disks_raid_gmirror.php | 223 +++++++++ packages/freenas/www/disks_raid_gmirror_edit.php | 267 ++++++++++ packages/freenas/www/disks_raid_gmirror_infos.php | 132 +++++ packages/freenas/www/disks_raid_gmirror_init.php | 167 +++++++ packages/freenas/www/disks_raid_gmirror_tools.php | 184 +++++++ packages/freenas/www/disks_raid_gvinum.php | 222 +++++++++ packages/freenas/www/disks_raid_gvinum_edit.php | 266 ++++++++++ packages/freenas/www/disks_raid_gvinum_infos.php | 132 +++++ packages/freenas/www/disks_raid_gvinum_init.php | 169 +++++++ packages/freenas/www/disks_raid_gvinum_tools.php | 207 ++++++++ packages/freenas/www/services_afp.php | 190 ++++++++ packages/freenas/www/services_ftp.php | 347 +++++++++++++ packages/freenas/www/services_nfs.php | 219 +++++++++ packages/freenas/www/services_rsyncd.php | 263 ++++++++++ packages/freenas/www/services_rsyncd_client.php | 565 ++++++++++++++++++++++ packages/freenas/www/services_samba.php | 416 ++++++++++++++++ packages/freenas/www/status_disks.php | 119 +++++ 39 files changed, 7784 insertions(+) create mode 100644 packages/freenas/www/diag_ad_infos.php create mode 100644 packages/freenas/www/diag_ataidle_infos.php create mode 100644 packages/freenas/www/diag_disk_infos.php create mode 100644 packages/freenas/www/diag_fn_logs_daemon.php create mode 100644 packages/freenas/www/diag_fn_logs_ftp.php create mode 100644 packages/freenas/www/diag_fn_logs_rsyncd.php create mode 100644 packages/freenas/www/diag_fn_logs_samba.php create mode 100644 packages/freenas/www/diag_fn_logs_settings.php create mode 100644 packages/freenas/www/diag_fn_logs_smartd.php create mode 100644 packages/freenas/www/diag_fn_logs_sshd.php create mode 100644 packages/freenas/www/diag_iscsi_infos.php create mode 100644 packages/freenas/www/diag_mounts_infos.php create mode 100644 packages/freenas/www/diag_part_infos.php create mode 100644 packages/freenas/www/diag_raid_infos.php create mode 100644 packages/freenas/www/diag_smart_infos.php create mode 100644 packages/freenas/www/diag_space_infos.php create mode 100644 packages/freenas/www/disks_manage.php create mode 100644 packages/freenas/www/disks_manage_edit.php create mode 100644 packages/freenas/www/disks_manage_init.php create mode 100644 packages/freenas/www/disks_manage_iscsi.php create mode 100644 packages/freenas/www/disks_mount.php create mode 100644 packages/freenas/www/disks_mount_edit.php create mode 100644 packages/freenas/www/disks_raid_gmirror.php create mode 100644 packages/freenas/www/disks_raid_gmirror_edit.php create mode 100644 packages/freenas/www/disks_raid_gmirror_infos.php create mode 100644 packages/freenas/www/disks_raid_gmirror_init.php create mode 100644 packages/freenas/www/disks_raid_gmirror_tools.php create mode 100644 packages/freenas/www/disks_raid_gvinum.php create mode 100644 packages/freenas/www/disks_raid_gvinum_edit.php create mode 100644 packages/freenas/www/disks_raid_gvinum_infos.php create mode 100644 packages/freenas/www/disks_raid_gvinum_init.php create mode 100644 packages/freenas/www/disks_raid_gvinum_tools.php create mode 100644 packages/freenas/www/services_afp.php create mode 100644 packages/freenas/www/services_ftp.php create mode 100644 packages/freenas/www/services_nfs.php create mode 100644 packages/freenas/www/services_rsyncd.php create mode 100644 packages/freenas/www/services_rsyncd_client.php create mode 100644 packages/freenas/www/services_samba.php create mode 100644 packages/freenas/www/status_disks.php (limited to 'packages/freenas/www') diff --git a/packages/freenas/www/diag_ad_infos.php b/packages/freenas/www/diag_ad_infos.php new file mode 100644 index 00000000..b877c514 --- /dev/null +++ b/packages/freenas/www/diag_ad_infos.php @@ -0,0 +1,156 @@ +. + 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("Diagnostics"), + gettext("Active Directory Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ AD Authentication disable
"; + } else { + echo "
";
+            	echo "Accessiblity test to MS domain:
"; + echo htmlspecialchars("Results for net rpc testjoin:") . "
"; + + exec("/usr/local/bin/net rpc testjoin",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($rawdata); + + echo "
"; + echo htmlspecialchars("Ping winbindd to see if it is alive:") . "
"; + + exec("/usr/local/bin/wbinfo -p",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($rawdata); + + echo "
"; + echo htmlspecialchars("Check shared secret:") . "
"; + + exec("/usr/local/bin/wbinfo -t",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($rawdata); + + echo "
"; + echo "
"; + } + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_ataidle_infos.php b/packages/freenas/www/diag_ataidle_infos.php new file mode 100644 index 00000000..cffccc8f --- /dev/null +++ b/packages/freenas/www/diag_ataidle_infos.php @@ -0,0 +1,145 @@ +. + 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("Diagnostics"), + gettext("ATAidle Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + $disklist=get_ata_disks_list(); + + echo "List of Advanced ATA capabilities on all ATA disk:
"; + foreach ($disklist as $disknamek => $disknamev) + { + + /* Found the channel and device number from the /dev name */ + /* Divise the number by 2, the interger is the channel number, the rest is the device */ + + echo htmlspecialchars("Results for $disknamek:") . "
"; + $value=trim($disknamek,'ad'); + + $value=intval($value); + $channel = $value/2; + $device=$value % 2; + $channel=intval($channel); + + exec("/usr/local/sbin/ataidle $channel $device",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($rawdata); + } + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_disk_infos.php b/packages/freenas/www/diag_disk_infos.php new file mode 100644 index 00000000..7cf1d71a --- /dev/null +++ b/packages/freenas/www/diag_disk_infos.php @@ -0,0 +1,141 @@ +. + 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("Diagnostics"), + gettext("Disk Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + + echo "List of detected ATA disks:
"; + foreach ($iderawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + + unset ($line); + + exec("/sbin/camcontrol devlist",$scsirawdata); + + echo "List of detected SCSI disks:
"; + foreach ($scsirawdata as $line) + { + echo htmlspecialchars($line) . "
"; + + } + + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_daemon.php b/packages/freenas/www/diag_fn_logs_daemon.php new file mode 100644 index 00000000..d320caa9 --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_daemon.php @@ -0,0 +1,109 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("Daemon")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) +{ + exec("/usr/sbin/clog -i -s 262144 /var/log/daemon.log"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_logs_daemon.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ Last Daemon log entries +
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_ftp.php b/packages/freenas/www/diag_fn_logs_ftp.php new file mode 100644 index 00000000..6f29e986 --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_ftp.php @@ -0,0 +1,109 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("FTP")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) +{ + exec("/usr/sbin/clog -i -s 262144 /var/log/ftp.log"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_fn_logs_ftp.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ Last FTP log entries +
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_rsyncd.php b/packages/freenas/www/diag_fn_logs_rsyncd.php new file mode 100644 index 00000000..ac3b458a --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_rsyncd.php @@ -0,0 +1,108 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("RSYNCD")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) { + exec("/usr/sbin/clog -i -s 262144 /var/log/rsyncd.log"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_fn_logs_rsyncd.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ Last RSYNCD log entries +
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_samba.php b/packages/freenas/www/diag_fn_logs_samba.php new file mode 100644 index 00000000..679c8826 --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_samba.php @@ -0,0 +1,165 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("Samba")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) { + exec("/bin/cp /dev/null /var/log/samba/log.nmbd"); + exec("/bin/cp /dev/null /var/log/samba/log.smbd"); + exec("/bin/cp /dev/null /var/log/samba/log.winbindd"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_fn_logs_samba.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Last nmbd service log entries +
+
+
 
+ Last smbd service log entries +
+
+
 
+ Last winbindd service log entries +
+
+
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_settings.php b/packages/freenas/www/diag_fn_logs_settings.php new file mode 100644 index 00000000..1f4ada67 --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_settings.php @@ -0,0 +1,296 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("Settings")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$pconfig['reverse'] = isset($config['syslog']['reverse']); +$pconfig['nentries'] = $config['syslog']['nentries']; +$pconfig['remoteserver'] = $config['syslog']['remoteserver']; +$pconfig['filter'] = isset($config['syslog']['filter']); +$pconfig['dhcp'] = isset($config['syslog']['dhcp']); +$pconfig['portalauth'] = isset($config['syslog']['portalauth']); +$pconfig['vpn'] = isset($config['syslog']['vpn']); +$pconfig['system'] = isset($config['syslog']['system']); +$pconfig['enable'] = isset($config['syslog']['enable']); +$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']); +$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']); +$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']); +$pconfig['webservlogs'] = isset($config['syslog']['webservlogs']); + +$pconfig['sshd'] = isset($config['syslog']['sshd']); +$pconfig['ftp'] = isset($config['syslog']['ftp']); +$pconfig['rsyncd'] = isset($config['syslog']['rsyncd']); +$pconfig['smartd'] = isset($config['syslog']['smartd']); +$pconfig['daemon'] = isset($config['syslog']['daemon']); + +if (!$pconfig['nentries']) + $pconfig['nentries'] = 50; + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) { + $input_errors[] = gettext("A valid IP address must be specified."); + } + if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) { + $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000."); + } + + if (!$input_errors) { + $config['syslog']['reverse'] = $_POST['reverse'] ? true : false; + $config['syslog']['nentries'] = (int)$_POST['nentries']; + $config['syslog']['remoteserver'] = $_POST['remoteserver']; + $config['syslog']['filter'] = $_POST['filter'] ? true : false; + $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false; + $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false; + $config['syslog']['vpn'] = $_POST['vpn'] ? true : false; + $config['syslog']['system'] = $_POST['system'] ? true : false; + $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false; + $config['syslog']['enable'] = $_POST['enable'] ? true : false; + $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']); + $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true; + $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false; + $config['syslog']['webservlogs'] = $_POST['webservlogs'] ? true : false; + $config['syslog']['sshd'] = $_POST['sshd'] ? true : false; + $config['syslog']['ftp'] = $_POST['ftp'] ? true : false; + $config['syslog']['rsyncd'] = $_POST['rsyncd'] ? true : false; + $config['syslog']['smartd'] = $_POST['smartd'] ? true : false; + $config['syslog']['daemon'] = $_POST['daemon'] ? true : false; + if($config['syslog']['enable'] == false) + unset($config['syslog']['remoteserver']); + + write_config(); + + $retval = 0; + config_lock(); + $retval = system_syslogd_start(); + if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) + $retval |= filter_configure(); + config_unlock(); + $savemsg = get_std_save_message($retval); + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +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)" /> +
  onclick="enable_change(false)" /> +
Remote syslog + server + +
+

+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+ /> +
+
  +
 :
+ +
+
+
+
+ + + + diff --git a/packages/freenas/www/diag_fn_logs_smartd.php b/packages/freenas/www/diag_fn_logs_smartd.php new file mode 100644 index 00000000..c5e9cb88 --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_smartd.php @@ -0,0 +1,109 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("SMARTD")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) +{ + exec("/usr/sbin/clog -i -s 262144 /var/log/smartd.log"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_fn_logs_smartd.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ Last SmartD log entries +
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_fn_logs_sshd.php b/packages/freenas/www/diag_fn_logs_sshd.php new file mode 100644 index 00000000..56c6147a --- /dev/null +++ b/packages/freenas/www/diag_fn_logs_sshd.php @@ -0,0 +1,108 @@ +. + 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("Diagnostics"), + gettext("System logs"), + gettext("SSHD")); + +require("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) { + exec("/usr/sbin/clog -i -s 262144 /var/log/sshd.log"); + /* redirect to avoid reposting form data on refresh */ + pfSenseHeader("diag_logs_sshd.php"); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + +
+
+ + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ Last SSHD log entries +
 
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_iscsi_infos.php b/packages/freenas/www/diag_iscsi_infos.php new file mode 100644 index 00000000..e90bf8ed --- /dev/null +++ b/packages/freenas/www/diag_iscsi_infos.php @@ -0,0 +1,133 @@ +. + 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("Diagnostics"), + gettext("iSCSI Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ iSCSI initiator disabled
"; + } else { + echo "
";
+            	echo "Show the list of available target Name on the iSCSI target
"; + + exec("/usr/local/sbin/iscontrol -d targetaddress={$freenas_config['iscsi']['targetaddress']}",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($rawdata); + echo "
"; + } + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_mounts_infos.php b/packages/freenas/www/diag_mounts_infos.php new file mode 100644 index 00000000..36bbec52 --- /dev/null +++ b/packages/freenas/www/diag_mounts_infos.php @@ -0,0 +1,128 @@ +. + 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("Diagnostics"), + gettext("Mount Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + echo "List of mounted point:
"; + exec("/sbin/mount",$mountrawdata); + foreach ($mountrawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($line); + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_part_infos.php b/packages/freenas/www/diag_part_infos.php new file mode 100644 index 00000000..7201f11c --- /dev/null +++ b/packages/freenas/www/diag_part_infos.php @@ -0,0 +1,134 @@ +. + 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("Diagnostics"), + gettext("Partition Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + + $disklist = get_physical_disks_list(); + + echo "List of partition on all detected disk:
"; + foreach ($disklist as $disknamek => $disknamev) + { + exec("/sbin/fdisk $disknamek",$fdiskrawdata); + foreach ($fdiskrawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($fdiskrawdata); + } + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_raid_infos.php b/packages/freenas/www/diag_raid_infos.php new file mode 100644 index 00000000..b469aa52 --- /dev/null +++ b/packages/freenas/www/diag_raid_infos.php @@ -0,0 +1,135 @@ +. + 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("Diagnostics"), + gettext("RAID Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + echo "Software RAID - gmirror status:
"; + exec("/sbin/gmirror list",$rawdata); + foreach ($rawdata as $line) { + echo htmlspecialchars($line) . "
"; + } + unset ($line); + unset ($rawdata); + + echo "Software RAID - gvinum status:
"; + exec("/sbin/gvinum list",$rawdata); + foreach ($rawdata as $line) { + echo htmlspecialchars($line) . "
"; + } + unset ($line); + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_smart_infos.php b/packages/freenas/www/diag_smart_infos.php new file mode 100644 index 00000000..9a43e210 --- /dev/null +++ b/packages/freenas/www/diag_smart_infos.php @@ -0,0 +1,133 @@ +. + 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("Diagnostics"), + gettext("SMART Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + $disklist = get_physical_disks_list(); + + echo "List of SMART capabilities on all detected disk:
"; + foreach ($disklist as $disknamek => $disknamev) + { + exec("/usr/local/sbin/smartctl -a /dev/$disknamek",$fdiskrawdata); + foreach ($fdiskrawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($fdiskrawdata); + } + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/diag_space_infos.php b/packages/freenas/www/diag_space_infos.php new file mode 100644 index 00000000..f30688e1 --- /dev/null +++ b/packages/freenas/www/diag_space_infos.php @@ -0,0 +1,128 @@ +. + 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("Diagnostics"), + gettext("Space Infos")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + +
+ "; + exec("/bin/df -h",$rawdata); + + echo "Free Space:
"; + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_manage.php b/packages/freenas/www/disks_manage.php new file mode 100644 index 00000000..ee2e6dc0 --- /dev/null +++ b/packages/freenas/www/disks_manage.php @@ -0,0 +1,203 @@ +#!/usr/local/bin/php +. + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper . + All rights reserved. + + Copyright (C) 2003-2005 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("System"), + gettext("Disks"), + gettext("Management")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['disks']['disk'])) + $freenas_config['disks']['disk'] = array(); + +disks_sort(); + +$a_disk_conf = &$freenas_config['disks']['disk']; + +if ($_POST) { + + unset($input_errors); + + /* input validation */ + + if ($_POST['apply']) { + $retval = 0; + if (! file_exists($d_sysrebootreqd_path)) { + config_lock(); + /* reload all components that mount disk */ + // disks_mount_all(); + /* Is formated?: If not create FS */ + /* $retval = disk_disks_create_ufs(); */ + + config_unlock(); + } + $savemsg = get_std_save_message($retval); + if ($retval == 0) { + if (file_exists($d_diskdirty_path)) { + unlink($d_diskdirty_path); + } + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + /* No errors detected, so update the config */ + } +} + +if ($_GET['act'] == "del") { + if ($a_disk_conf[$_GET['id']]) { + unset($a_disk_conf[$_GET['id']]); + write_config(); + touch($d_diskdirty_path); + pfSenseHeader("disks_manage.php"); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +" . + gettext("You must apply the changes in order for them to take effect."));?> + + +
+ + + + + +
+ +
+ +
+
+ + + diff --git a/packages/freenas/www/disks_manage_edit.php b/packages/freenas/www/disks_manage_edit.php new file mode 100644 index 00000000..416d9bc6 --- /dev/null +++ b/packages/freenas/www/disks_manage_edit.php @@ -0,0 +1,276 @@ +. + 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("System"), + gettext("Disks"), + gettext("Management"), + gettext("Edit")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +/* get disk list (without CDROM) */ +$disklist = get_physical_disks_list(); + +if (!is_array($freenas_config['disks']['disk'])) + $freenas_config['disks']['disk'] = array(); + +disks_sort(); + +$a_disk = &$freenas_config['disks']['disk']; + +if (isset($id) && $a_disk[$id]) +{ + $pconfig['name'] = $a_disk[$id]['name']; + $pconfig['harddiskstandby'] = $a_disk[$id]['harddiskstandby']; + $pconfig['acoustic'] = $a_disk[$id]['acoustic']; + $pconfig['fstype'] = $a_disk[$id]['fstype']; + $pconfig['apm'] = $a_disk[$id]['apm']; + $pconfig['udma'] = $a_disk[$id]['udma']; + +} + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = split(" ", "name"); + $reqdfieldsn = split(",", "Name"); + + do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket); + $pconfig = $_POST; + + /* check for name conflicts */ + foreach ($a_disk as $disk) + { + if (isset($id) && ($a_disk[$id]) && ($a_disk[$id] === $disk)) + continue; + + if ($disk['name'] == $_POST['name']) + { + $error_bucket[] = array("error" => gettext("This disk already exists in the disk list."), + "field" => "name"); + break; + } + } + + 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) + { + $disks = array(); + + $devname = $_POST['name']; + $devharddiskstandby = $_POST['harddiskstandby']; + $harddiskacoustic = $_POST['acoustic']; + $harddiskapm = $_POST['apm']; + $harddiskudma = $_POST['udma']; + $harddiskfstype = $_POST['fstype']; + + $disks['name'] = $devname; + $disks['harddiskstandby'] = $devharddiskstandby ; + $disks['acoustic'] = $harddiskacoustic ; + if ($harddiskfstype) $disks['fstype'] = $harddiskfstype ; + $disks['apm'] = $harddiskapm ; + $disks['udma'] = $harddiskudma ; + $disks['type'] = $disklist[$devname]['type']; + $disks['desc'] = $disklist[$devname]['desc']; + $disks['size'] = $disklist[$devname]['size']; + + if (isset($id) && $a_disk[$id]) + $a_disk[$id] = $disks; + else + $a_disk[] = $disks; + + touch($d_diskdirty_path); + + disks_set_ataidle(); + write_config(); + + pfSenseHeader("disks_manage.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ Do not set this for CF cards."); ?> +
+ +
+ Do not set this for CF cards."); ?> +
+ +
+ Do not set this for CF cards."); ?> +
+ +
+ + Leave \"unformated\" for unformated disk and then use Format menu."); ?> +
  + " /> + + + +
+
+ + + + diff --git a/packages/freenas/www/disks_manage_init.php b/packages/freenas/www/disks_manage_init.php new file mode 100644 index 00000000..b6fce877 --- /dev/null +++ b/packages/freenas/www/disks_manage_init.php @@ -0,0 +1,294 @@ +. + 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("System"), + gettext("Disks"), + gettext("Initialize")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['disks']['disk'])) + $freenas_config['disks']['disk'] = array(); + +disks_sort(); + +$a_disk = &$freenas_config['disks']['disk']; + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + unset($do_format); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "disk type"); + $reqdfieldsn = explode(",", "Disk,Type"); + + do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket); + + 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) + { + $do_format = true; + $disk = $_POST['disk']; + $type = $_POST['type']; + $diskid = $_POST['id']; + $notinitmbr= $_POST['notinitmbr']; + + /* found the name in the config: Must be a better way for did that */ + + $id=0; + $i=0; + foreach ($a_disk as $disks) + { + $diskname=$disks['name']; + if (strcmp($diskname,$disk)==0) + $id=$i; + $i++; + } + + if ($type == "ufs" || $type == "ufsgpt" || $type == "ufs_no_su" || $type == "ufsgpt_no_su") + $a_disk[$id]['fstype'] = "ufs"; + else + $a_disk[$id]['fstype'] = $type; + write_config(); + } +} + +if (!isset($do_format)) +{ + $do_format = false; + $disk = ''; + $type = ''; +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
  + " /> +
+ '); + ob_end_flush(); + + /* Erase MBR if not checked*/ + + if (!$notinitmbr) { + echo "Erasing MBR\n"; + system("dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . " bs=32k count=640"); + + } + else + echo "Keeping the MBR\n"; + + switch ($type) + { + case "ufs": + /* Initialize disk */ + system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk)); + echo "\"fdisk: Geom not found\"is not an error message!\n"; + /* Initialise the partition (optional) */ + system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16"); + /* Create s1 label */ + system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"); + // Create filesystem + system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "s1"); + break; + case "ufs_no_su": + /* Initialize disk */ + system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk)); + /* Initialise the partition (optional) */ + system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16"); + /* Create s1 label */ + system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"); + // Create filesystem + system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "s1"); + break; + case "ufsgpt": + /* Create GPT partition table */ + system("/sbin/gpt destroy " . escapeshellarg($disk)); + system("/sbin/gpt create -f " . escapeshellarg($disk)); + system("/sbin/gpt add -t ufs " . escapeshellarg($disk)); + // Create filesystem + system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "p1"); + break; + case "ufsgpt_no_su": + /* Create GPT partition table */ + system("/sbin/gpt destroy " . escapeshellarg($disk)); + system("/sbin/gpt create -f " . escapeshellarg($disk)); + system("/sbin/gpt add -t ufs " . escapeshellarg($disk)); + // Create filesystem + system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "p1"); + break; + case "gmirror": + /* Initialize disk */ + system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk)); + /* Initialise the partition (optional) */ + system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16"); + /* Create s1 label */ + //system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"); + /* Delete old gmirror information */ + system("/sbin/gmirror clear /dev/" . escapeshellarg($disk)); + break; + case "raid": + /* Initialize disk */ + system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk)); + echo "\"fdisk: Geom not found\"is not an error message!\n"; + /* Initialise the partition (optional) */ + system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16"); + /* Create s1 label */ + system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"); + break; + case "msdos": + /* Initialize disk */ + system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk)); + echo "\"fdisk: Geom not found\"is not an error message!\n"; + /* Initialise the partition (optional) */ + system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16"); + /* Create s1 label */ + system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"); + // Create filesystem + system("/sbin/newfs_msdos -F 32 /dev/" . escapeshellarg($disk) . "s1"); + break; + } + + echo(''); + } + ?> +
+ + WARNING: + +
+ + + + +
+
+
+
+ + + + diff --git a/packages/freenas/www/disks_manage_iscsi.php b/packages/freenas/www/disks_manage_iscsi.php new file mode 100644 index 00000000..4a156ee7 --- /dev/null +++ b/packages/freenas/www/disks_manage_iscsi.php @@ -0,0 +1,199 @@ +. + 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("System"), + gettext("Disks"), + gettext("iSCSI Initiator")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! is_array($freenas_config['iscsi'])) +{ + $freenas_config['iscsi'] = array(); +} + +$pconfig['enable'] = isset($freenas_config['iscsi']['enable']); +$pconfig['targetaddress'] = $freenas_config['iscsi']['targetaddress']; +$pconfig['targetname'] = $freenas_config['iscsi']['targetname']; + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + unset($do_format); + $pconfig = $_POST; + + /* input validation */ + if ($_POST['enable']) + { + $reqdfields = array_merge($reqdfields, explode(" ", "targetaddress targetname")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "targetaddress,targetname")); + } + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['enable'] && !is_ipaddr($_POST['targetaddress'])){ + $error_bucket[] = array("error" => gettext("A valid IP address must be specified."), + "field" => "targetaddress"); + } + + 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['iscsi']['enable'] = $_POST['enable'] ? true : false; + $freenas_config['iscsi']['targetaddress'] = $_POST['targetaddress']; + $freenas_config['iscsi']['targetname'] = $_POST['targetname']; + + write_config(); + + $retval = 0; + if (! file_exists($d_sysrebootreqd_path)) + { + /* nuke the cache file */ + config_lock(); + services_iscsi_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)" />  + +
+ +
+
+ +
+
  + " /> +
+
+
+
+ + + + + diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php new file mode 100644 index 00000000..c5bd6f2b --- /dev/null +++ b/packages/freenas/www/disks_mount.php @@ -0,0 +1,208 @@ +. + 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("System"), + gettext("Disks"), + gettext("Mount Point")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['mounts']['mount'])) + $freenas_config['mounts']['mount'] = array(); + +mount_sort(); + +$a_mount = &$freenas_config['mounts']['mount']; + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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 ($_POST['apply']) { + $retval = 0; + + if (!file_exists($d_sysrebootreqd_path)) { + config_lock(); + /* reload all components that mount disk */ + disks_mount_all(); + /* reload all components that use mount */ + services_samba_configure(); + services_nfs_configure(); + services_rsyncd_configure(); + services_afpd_configure(); + config_unlock(); + } + $savemsg = get_std_save_message($retval); + if ($retval == 0) { + if (file_exists($d_mountdirty_path)) + unlink($d_mountdirty_path); + } + } +} + +if ($_GET['act'] == "del") +{ + if ($a_mount[$_GET['id']]) { + disks_umount_adv($a_mount[$_GET['id']]); + unset($a_mount[$_GET['id']]); + write_config(); + touch($d_mountdirty_path); + pfSenseHeader("disks_mount.php"); + exit; + } +} + +if ($_GET['act'] == "ret") +{ + if ($a_mount[$_GET['id']]) { + disks_mount($a_mount[$_GET['id']]); + pfSenseHeader("disks_mount.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + + +
+ +" . + gettext("You must apply the changes in order for them to take effect."));?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+   + +   + +   + +   + +   + + retry"; + else + echo $stat; + } + ?>  + + + " width="17" height="17" border="0" alt="" /> + + + ');" title="" width="17" height="17" border="0" alt="" /> + +
+ + " width="17" height="17" border="0" alt="" /> + +
+ + Note: + +
+ + + +
+ + previously configured disk + +
+
+ + + + diff --git a/packages/freenas/www/disks_mount_edit.php b/packages/freenas/www/disks_mount_edit.php new file mode 100644 index 00000000..31221570 --- /dev/null +++ b/packages/freenas/www/disks_mount_edit.php @@ -0,0 +1,279 @@ +. + 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("System"), + gettext("Disks"), + gettext("Mount Point"), + gettext("Edit")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['mounts']['mount'])) + $freenas_config['mounts']['mount'] = array(); + +mount_sort(); + +if (!is_array($freenas_config['disks']['disk'])) + $freenas_config['disks']['disk'] = array(); + +disks_sort(); + +if (!is_array($freenas_config['raid']['vdisk'])) + $freenas_config['raid']['vdisk'] = array(); + +gvinum_sort(); + +if (!is_array($freenas_config['gmirror']['vdisk'])) + $freenas_config['gmirror']['vdisk'] = array(); + +gmirror_sort(); + +$a_mount = &$freenas_config['mounts']['mount']; + +$a_disk = array_merge($freenas_config['disks']['disk'],$freenas_config['raid']['vdisk'],$freenas_config['gmirror']['vdisk']); + +/* Load the cfdevice file*/ +$filename=$g['varetc_path']."/cfdevice"; +if (file_exists($filename)) + $cfdevice = trim(file_get_contents("$filename")); + + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +if (isset($id) && $a_mount[$id]) { + $pconfig['mdisk'] = $a_mount[$id]['mdisk']; + $pconfig['partition'] = $a_mount[$id]['partition']; + $pconfig['fstype'] = $a_mount[$id]['fstype']; + $pconfig['sharename'] = $a_mount[$id]['sharename']; + $pconfig['desc'] = $a_mount[$id]['desc']; +} + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = split(" ", "partition mdisk fstype"); + $reqdfieldsn = split(",", "Partition,Mdisk,Fstype"); + + do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket); + + if (($_POST['sharename'] && !is_validsharename($_POST['sharename']))) + { + $error_bucket[] = array("error" => gettext("The share name may only consist of the characters a-z, A-Z, 0-9, _ , -."), + "field" => "sharename"); + } + + + if (($_POST['desc'] && !is_validdesc($_POST['desc']))) + { + $error_bucket[] = array("error" => gettext("The description name contain invalid characters."), + "field" => "desc"); + + } + $device=$_POST['mdisk'].$_POST['partition']; + + if ($device == $cfdevice ) + { + $error_bucket[] = array("error" => gettext("Can't mount the system partition 1, the DATA partition is the 2."), + "field" => "mdisk"); + + } + + /* check for name conflicts */ + foreach ($a_mount as $mount) + { + if (isset($id) && ($a_mount[$id]) && ($a_mount[$id] === $mount)) + continue; + + /* Remove the duplicate disk use + if ($mount['mdisk'] == $_POST['mdisk']) + { + $input_errors[] = "This device already exists in the mount point list."; + break; + } + */ + + if (($_POST['sharename']) && ($mount['sharename'] == $_POST['sharename'])) + { + $error_bucket[] = array("error" => gettext("Duplicate Share Name."), + "field" => "sharename"); + break; + } + + + } + + 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) + { + $mount = array(); + $mount['mdisk'] = $_POST['mdisk']; + $mount['partition'] = $_POST['partition']; + $mount['fstype'] = $_POST['fstype']; + $mount['desc'] = $_POST['desc']; + /* if not sharename given, create one */ + if (!$_POST['sharename']) + $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partition']}"; + else + $mount['sharename'] = $_POST['sharename']; + if (isset($id) && $a_mount[$id]) + $a_mount[$id] = $mount; + else + $a_mount[] = $mount; + + touch($d_mountdirty_path); + + write_config(); + + pfSenseHeader("disks_mount.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
  + " /> + + + +
+ + : + +
    +
  1. + + + + + +
  2. +
  3. +
+
+
+ + + + diff --git a/packages/freenas/www/disks_raid_gmirror.php b/packages/freenas/www/disks_raid_gmirror.php new file mode 100644 index 00000000..4d51ba0f --- /dev/null +++ b/packages/freenas/www/disks_raid_gmirror.php @@ -0,0 +1,223 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Mirror"), + gettext("RAID")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['gmirror']['vdisk'])) + $freenas_config['gmirror']['vdisk'] = array(); + +gmirror_sort(); + +$raidstatus=get_sraid_disks_list(); + +$a_raid = &$freenas_config['gmirror']['vdisk']; + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $pconfig = $_POST; + + 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 ($_POST['apply']) { + $retval = 0; + if (!file_exists($d_sysrebootreqd_path)) + { + config_lock(); + /* reload all components that create raid device */ + disks_raid_gmirror_configure(); + config_unlock(); + write_config(); + } + $savemsg = get_std_save_message($retval); + if ($retval == 0) { + if (file_exists($d_raidconfdirty_path)) + unlink($d_raidconfdirty_path); + } + } +} + +if ($_GET['act'] == "del") { + if ($a_raid[$_GET['id']]) { + $raidname=$a_raid[$_GET['id']]['name']; + disks_raid_gmirror_delete($raidname); + unset($a_raid[$_GET['id']]); + write_config(); + pfSenseHeader("disks_raid_gmirror.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +" . + gettext("You must apply the changes in order for them to take effect."));?> + + +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + +   + +   + + + " width="17" height="17" border="0" alt="" /> + + + " width="17" height="17" border="0" alt="" /> + +
+ + " width="17" height="17" border="0" alt="" /> + +
+ + + +
+ +
+ +
+ + +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gmirror_edit.php b/packages/freenas/www/disks_raid_gmirror_edit.php new file mode 100644 index 00000000..4fba1242 --- /dev/null +++ b/packages/freenas/www/disks_raid_gmirror_edit.php @@ -0,0 +1,267 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Mirror"), + gettext("RAID"), + gettext("Edit")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['gmirror']['vdisk'])) + $freenas_config['gmirror']['vdisk'] = array(); + +gmirror_sort(); + +if (!is_array($freenas_config['disks']['disk'])) + $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST; +else + disks_sort(); + +$a_raid = &$freenas_config['gmirror']['vdisk']; + +$a_disk = &$freenas_config['disks']['disk']; + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +if (isset($id) && $a_raid[$id]) { + $pconfig['name'] = $a_raid[$id]['name']; + $pconfig['type'] = $a_raid[$id]['type']; + $pconfig['balance'] = $a_raid[$id]['balance']; + $pconfig['diskr'] = $a_raid[$id]['diskr']; +} + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "name"); + $reqdfieldsn = explode(",", "Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if (($_POST['name'] && !is_validaliasname($_POST['name']))) + { + $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."), + "field" => "name"); + } + + + /* check for name conflicts */ + foreach ($a_raid as $raid) + { + if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid)) + continue; + + if ($raid['name'] == $_POST['name']) + { + $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."), + "field" => "name"); + break; + } + } + + /* check the number of RAID disk for volume */ + + if (count($_POST['diskr']) != 2) + $error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."), + "field" => "diskr"); + + 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) { + $raid = array(); + $raid['name'] = $_POST['name']; + $raid['balance'] = $_POST['balance']; + $raid['type'] = 1; + $raid['diskr'] = $_POST['diskr']; + $raid['desc'] = "Software RAID {$_POST['type']}"; + + if (isset($id) && $a_raid[$id]) + $a_raid[$id] = $raid; + else + $a_raid[] = $raid; + + $fd = @fopen("$d_raidconfdirty_path", "a"); + if (!$fd) { + echo "ERR Could not save RAID configuration.\n"; + exit(0); + } + fwrite($fd, "$raid[name]\n"); + fclose($fd); + + write_config(); + + pfSenseHeader("disks_raid_gmirror.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ RAID 1 () +
+ +
+
+ $diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "
\n"; + } + + $i++; + } + + if ($disable_script) + echo "\n"; + ?> +
  + + + + +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gmirror_infos.php b/packages/freenas/www/disks_raid_gmirror_infos.php new file mode 100644 index 00000000..e6b208e7 --- /dev/null +++ b/packages/freenas/www/disks_raid_gmirror_infos.php @@ -0,0 +1,132 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Mirror"), + gettext("Information")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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) { + } +} +if (!isset($do_action)) { +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + +
+ "; + echo "" . gettext("Software RAID information and status") . "
"; + + exec("/sbin/gmirror list",$rawdata); + foreach ($rawdata as $line){ + echo htmlspecialchars($line) . "
"; + } + + unset ($line); + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gmirror_init.php b/packages/freenas/www/disks_raid_gmirror_init.php new file mode 100644 index 00000000..c849be52 --- /dev/null +++ b/packages/freenas/www/disks_raid_gmirror_init.php @@ -0,0 +1,167 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Mirror"), + gettext("Initialize")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "disk"); + $reqdfieldsn = explode(",", "Disk"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + 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) { + $do_format = true; + $disk = $_POST['disk']; + } +} + +if (! isset($do_format)) { + $do_format = false; + $disk = ''; +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + +
+ +
  + + + + +
+ " . gettext("Disk format UFS output:") . "
"); + echo('
');
+    					ob_end_flush();
+    					
+    					/* Create filesystem */
+    					system("/sbin/newfs -U /dev/mirror/" . escapeshellarg($disk));
+    										
+    					echo('
'); + } + ?> +
+ + WARNING:
+
+ + + +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gmirror_tools.php b/packages/freenas/www/disks_raid_gmirror_tools.php new file mode 100644 index 00000000..714dea7f --- /dev/null +++ b/packages/freenas/www/disks_raid_gmirror_tools.php @@ -0,0 +1,184 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Mirror"), + gettext("Tools")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "action object"); + $reqdfieldsn = explode(",", "Action,Object"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + 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) { + $do_action = true; + $action = $_POST['action']; + $object = $_POST['object']; + } +} +if (!isset($do_action)) { + $do_action = false; + $action = ''; + $object = ''; +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ +
  + + + + +
+ " . gettext("GMIRROR command output:") . "
"); + echo('
');
+    					  ob_end_flush();
+    					
+    					  system("/sbin/gmirror $action " . escapeshellarg($object));
+    				
+    					  echo('
'); + } + ?> +
+ + WARNING:
+
+
    +
  1. +
  2. +
+
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gvinum.php b/packages/freenas/www/disks_raid_gvinum.php new file mode 100644 index 00000000..260fae14 --- /dev/null +++ b/packages/freenas/www/disks_raid_gvinum.php @@ -0,0 +1,222 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Vinum"), + gettext("RAID")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['raid']['vdisk'])) + $freenas_config['raid']['vdisk'] = array(); + +gvinum_sort(); + +$raidstatus=get_sraid_disks_list(); + +$a_raid = &$freenas_config['raid']['vdisk']; + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $pconfig = $_POST; + + 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 ($_POST['apply']) { + $retval = 0; + if (!file_exists($d_sysrebootreqd_path)) + { + config_lock(); + /* reload all components that create raid device */ + disks_raid_configure(); + config_unlock(); + write_config(); + } + $savemsg = get_std_save_message($retval); + if ($retval == 0) { + if (file_exists($d_raidconfdirty_path)) + unlink($d_raidconfdirty_path); + } + } +} + +if ($_GET['act'] == "del") { + if ($a_raid[$_GET['id']]) { + $raidname=$a_raid[$_GET['id']]['name']; + disks_raid_gvinum_delete($raidname); + unset($a_raid[$_GET['id']]); + write_config(); + pfSenseHeader("disks_raid_gvinum.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ +" . + gettext("You must apply the changes in order for them to take effect."));?> + + +
+ + + + + + + + + + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + +   + +   + + + " width="17" height="17" border="0" alt="" /> + + + " width="17" height="17" border="0" alt="" /> + +
+ + " width="17" height="17" border="0" alt="" /> + +
+ + + +
+ +
+ +
+ +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gvinum_edit.php b/packages/freenas/www/disks_raid_gvinum_edit.php new file mode 100644 index 00000000..45cbac88 --- /dev/null +++ b/packages/freenas/www/disks_raid_gvinum_edit.php @@ -0,0 +1,266 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Vinum"), + gettext("RAID"), + gettext("Edit")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['raid']['vdisk'])) + $freenas_config['raid']['vdisk'] = array(); + +gvinum_sort(); + +if (!is_array($freenas_config['disks']['disk'])) + $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST; +else + disks_sort(); + +$a_raid = &$freenas_config['raid']['vdisk']; + +$a_disk = &$freenas_config['disks']['disk']; + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +if (isset($id) && $a_raid[$id]) { + $pconfig['name'] = $a_raid[$id]['name']; + $pconfig['type'] = $a_raid[$id]['type']; + $pconfig['diskr'] = $a_raid[$id]['diskr']; +} + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "name type"); + $reqdfieldsn = explode(",", "Name,Type"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if (($_POST['name'] && !is_validaliasname($_POST['name']))) + { + $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."), + "field" => "name"); + } + + /* check for name conflicts */ + foreach ($a_raid as $raid) + { + if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid)) + continue; + + if ($raid['name'] == $_POST['name']) + { + $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."), + "field" => "name"); + break; + } + } + + /* check the number of RAID disk for volume */ + + /* check the number of RAID disk for volume */ + + switch ($_POST['type']) + { + case 0: + if (count($_POST['diskr']) < 2) + $error_bucket[] = array("error" => gettext("There must be a minimum of 2 disks in a RAID 0 volume."), + "field" => "diskr"); + break; + case 1: + if (count($_POST['diskr']) != 2) + $error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."), + "field" => "diskr"); + break; + case 5: + if (count($_POST['diskr']) < 3) + $error_bucket[] = array("error" => gettext("There must be a minimum of 3 disks in a RAID 5 volume."), + "field" => "diskr"); + break; + } + + 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) { + $raid = array(); + $raid['name'] = $_POST['name']; + $raid['type'] = $_POST['type']; + $raid['diskr'] = $_POST['diskr']; + $raid['desc'] = "Software RAID {$_POST['type']}"; + + if (isset($id) && $a_raid[$id]) + $a_raid[$id] = $raid; + else + $a_raid[] = $raid; + + $fd = @fopen("$d_raidconfdirty_path", "a"); + if (!$fd) { + echo "_DISKSRAIDEDITPHP_MSGERROR"; + exit(0); + } + fwrite($fd, "$raid[name]\n"); + fclose($fd); + + write_config(); + + pfSenseHeader("disks_raid_gvinum.php"); + exit; + } +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+ +
+ $diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "
\n"; + } + $i++; + } + if ($disable_script) echo "\n"; + ?> +
  + + + + +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gvinum_infos.php b/packages/freenas/www/disks_raid_gvinum_infos.php new file mode 100644 index 00000000..7b9cfcb2 --- /dev/null +++ b/packages/freenas/www/disks_raid_gvinum_infos.php @@ -0,0 +1,132 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Vinum"), + gettext("Information")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + 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) { + } +} +if (!isset($do_action)) { +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + +
+ "; + echo "" . gettext("Software RAID information and status") . "
"; + + exec("/sbin/gvinum list",$rawdata); + foreach ($rawdata as $line) + { + echo htmlspecialchars($line) . "
"; + } + unset ($line); + echo ""; + ?> +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gvinum_init.php b/packages/freenas/www/disks_raid_gvinum_init.php new file mode 100644 index 00000000..2befcaa0 --- /dev/null +++ b/packages/freenas/www/disks_raid_gvinum_init.php @@ -0,0 +1,169 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Vinum"), + gettext("Initialize")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "disk"); + $reqdfieldsn = explode(",", "Disk"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + 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) { + $do_format = true; + $disk = $_POST['disk']; + } +} + +if (! isset($do_format)) { + $do_format = false; + $disk = ''; +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + +
+ +
  + + + + +
+ _DISKSRAIDINITPHP_INFO
"); + echo('
');
+      					ob_end_flush();
+      					
+      					/* Create filesystem */
+      					system("/sbin/newfs -U /dev/gvinum/" . escapeshellarg($disk));
+      					/* Do it twice for test the RAID5 bug at reboot*/
+      					system("/sbin/newfs -U /dev/gvinum/" . escapeshellarg($disk));
+      										
+      					echo('
'); + } + ?> +
+ + WARNING:
+
+ + + +
+
+
+
+ + + diff --git a/packages/freenas/www/disks_raid_gvinum_tools.php b/packages/freenas/www/disks_raid_gvinum_tools.php new file mode 100644 index 00000000..97853e29 --- /dev/null +++ b/packages/freenas/www/disks_raid_gvinum_tools.php @@ -0,0 +1,207 @@ +. + 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("System"), + gettext("Disks"), + gettext("GEOM Vinum"), + gettext("Tools")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + + $reqdfields = explode(" ", "action object"); + $reqdfieldsn = explode(",", "Action,Object"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + 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) { + $do_action = true; + $action = $_POST['action']; + $object = $_POST['object']; + } +} +if (!isset($do_action)) { + $do_action = false; + $action = ''; + $object = ''; +} + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ +
  + + + + +
+ " . gettext("GVINUM command output:") . "
"); + echo('
');
+      					ob_end_flush();
+      					
+      					switch ($action)
+      					{
+      					case "remove":					
+      						/* Remove recursivly object */
+      						system("/sbin/gvinum rm -r " . escapeshellarg($object));
+      						break;
+      					case "start":
+      						/* Start object */
+      						system("/sbin/gvinum start " . escapeshellarg($object));
+      						break;
+      					case "rebuild":
+      						/* Rebuild RAID 5 parity */
+      						system("/sbin/gvinum rebuildparity " . escapeshellarg($object));
+      						break;
+      					case "list":
+      						/* Disaply a detailed list of object */
+      						system("/sbin/gvinum list " . escapeshellarg($object));
+      						break;
+      					case "forceup":					
+      						/* Force object state up */
+      						system("/sbin/gvinum setstate -f up " . escapeshellarg($object));
+      						break;
+      					case "saveconfig":					
+      						/* Save config */
+      						system("/sbin/gvinum saveconfig");
+      						break;
+      					}
+      					
+      					echo('
'); + } + ?> +
+ + WARNING:
+
+
    +
  1. +
  2. +
+
+
+
+
+ + + diff --git a/packages/freenas/www/services_afp.php b/packages/freenas/www/services_afp.php new file mode 100644 index 00000000..c3648b9f --- /dev/null +++ b/packages/freenas/www/services_afp.php @@ -0,0 +1,190 @@ +. + 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("AFP")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['afp'])) { + $freenas_config['afp'] = array(); +} + + +$pconfig['enable'] = isset($freenas_config['afp']['enable']); +$pconfig['afpname'] = $freenas_config['afp']['afpname']; +$pconfig['guest'] = isset($freenas_config['afp']['guest']); +$pconfig['local'] = isset($freenas_config['afp']['local']); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = split(" ", "afpname"); + $reqdfieldsn = split(",", "Afpname"); + + do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket); + + if ($_POST['enable'] && !$_POST['guest']) + { + if (!$_POST['local']) + $error_bucket[] = array("error" => gettext("You must select at least one authentication method."), + "field" => "local"); + } + if ($_POST['enable'] && !$_POST['local']) + { + if (!$_POST['guest']) + $error_bucket[] = array("error" => gettext("You must select at least one authentication method."), + "field" => "name"); + } + + 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['afp']['enable'] = $_POST['enable'] ? true : false; + $freenas_config['afp']['guest'] = $_POST['guest'] ? true : false; + $freenas_config['afp']['local'] = $_POST['local'] ? true : false; + $freenas_config['afp']['afpname'] = $_POST['afpname']; + + write_config(); + + $retval = 0; + if (!file_exists($d_sysrebootreqd_path)) + { + /* nuke the cache file */ + config_lock(); + services_afpd_configure(); + services_mdnsresponder_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)" />  + +
+ +
+ /> +
+ /> + +
  + " /> +
+
+ + + + + diff --git a/packages/freenas/www/services_ftp.php b/packages/freenas/www/services_ftp.php new file mode 100644 index 00000000..da144349 --- /dev/null +++ b/packages/freenas/www/services_ftp.php @@ -0,0 +1,347 @@ +. + 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("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['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']['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_ftpd_configure(); + services_mdnsresponder_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)" />  + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ /> + +
+ /> + +
+ +
+ +
+ /> + +
+ +
+ /> + +
+ +
+ + +
+ + +
+ + +
  + " /> +
+
+ + + + + diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php new file mode 100644 index 00000000..403ea17c --- /dev/null +++ b/packages/freenas/www/services_nfs.php @@ -0,0 +1,219 @@ +. + 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("NFS")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['nfs'])) +{ + $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']); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* 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); + + 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 = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; + + 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['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"); +/* 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)" />  + +
+ +
+ +
+ + / + +
+ +
  + " /> +
  + + + + + + +
+
+ + + + + diff --git a/packages/freenas/www/services_rsyncd.php b/packages/freenas/www/services_rsyncd.php new file mode 100644 index 00000000..b28bca34 --- /dev/null +++ b/packages/freenas/www/services_rsyncd.php @@ -0,0 +1,263 @@ +. + 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("RSYNCD"), + gettext("Server")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +/* TODO: use pfSense users/groups. */ +if (!is_array($freenas_config['access']['user'])) + $freenas_config['access']['user'] = array(); + +users_sort(); + +$a_user = &$freenas_config['access']['user']; + +if (!is_array($freenas_config['rsync'])) +{ + $freenas_config['rsync'] = array(); +} + +$pconfig['readonly'] = $freenas_config['rsyncd']['readonly']; +$pconfig['port'] = $freenas_config['rsyncd']['port']; +$pconfig['motd'] = $freenas_config['rsyncd']['motd']; +$pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon']; +$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user']; +$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + unset($do_format); + $pconfig = $_POST; + + /* input validation */ + if ($_POST['enable']) + { + $reqdfields = array_merge($reqdfields, explode(" ", "readonly port")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Readonly,Port")); + } + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['enable']) { + if (!is_port($_POST['port'])) + $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."), + "field" => "port"); + else if (!is_numericint($_POST['maxcon'])) + $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"), + "field" => "maxcon"); + } + + 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['rsyncd']['readonly'] = $_POST['readonly']; + $freenas_config['rsyncd']['port'] = $_POST['port']; + $freenas_config['rsyncd']['motd'] = $_POST['motd']; + $freenas_config['rsyncd']['maxcon'] = $_POST['maxcon']; + $freenas_config['rsyncd']['enable'] = $_POST['enable'] ? true : false; + $freenas_config['rsyncd']['rsyncd_user'] = $_POST['rsyncd_user']; + + write_config(); + + $retval = 0; + if (!file_exists($d_sysrebootreqd_path)) + { + /* nuke the cache file */ + config_lock(); + services_rsyncd_configure(); + services_mdnsresponder_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)" />  + +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
  + " /> +
+
+
+
+ + + + + diff --git a/packages/freenas/www/services_rsyncd_client.php b/packages/freenas/www/services_rsyncd_client.php new file mode 100644 index 00000000..f5e86e07 --- /dev/null +++ b/packages/freenas/www/services_rsyncd_client.php @@ -0,0 +1,565 @@ +. + 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("RSYNCD"), + gettext("Client")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +/* TODO: use pfSense users/groups. */ +if (!is_array($freenas_config['access']['user'])) + $freenas_config['access']['user'] = array(); + +users_sort(); + +$a_user = &$freenas_config['access']['user']; + +if (!is_array($freenas_config['rsync'])) +{ + $freenas_config['rsync'] = array(); +} + +$a_months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); +$a_weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); + +$pconfig['readonly'] = $freenas_config['rsyncd']['readonly']; +$pconfig['port'] = $freenas_config['rsyncd']['port']; +$pconfig['motd'] = $freenas_config['rsyncd']['motd']; +$pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon']; +$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user']; +$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']); + +if (! empty($_POST)) +{ + /* hash */ + unset($error_bucket); + /* simple error list */ + unset($input_errors); + unset($do_format); + $pconfig = $_POST; + + /* input validation */ + if ($_POST['enable']){ + $reqdfields = array_merge($reqdfields, explode(" ", "rsyncserverip sharetosync")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Rsyncserverip,Sharetosync")); + } + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['enable']) { + if (!is_port($_POST['port'])) + $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."), + "field" => "port"); + else if (!is_numericint($_POST['maxcon'])) + $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"), + "field" => "maxcon"); + } + + if (!is_array($freenas_config['mounts']['mount'])) { + $error_bucket[] = array("error" => gettext("You must configure mount point first."), + "field" => "none"); + } + + 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['rsyncclient']['opt_delete'] = $_POST['opt_delete'] ? true : false;; + $freenas_config['rsyncclient']['rsyncserverip'] = $_POST['rsyncserverip']; + $freenas_config['rsyncclient']['minute'] = $_POST['minutes']; + $freenas_config['rsyncclient']['hour'] = $_POST['hours']; + $freenas_config['rsyncclient']['day'] = $_POST['days']; + $freenas_config['rsyncclient']['month'] = $_POST['months']; + $freenas_config['rsyncclient']['weekday'] = $_POST['weekdays']; + $freenas_config['rsyncclient']['rsyncshare'] = $_POST['rsyncshare']; + $freenas_config['rsyncclient']['enable'] = $_POST['enable'] ? true : false; + $freenas_config['rsyncclient']['sharetosync'] = $_POST['sharetosync']; + $freenas_config['rsyncclient']['all_mins'] = $_POST['all_mins']; + $freenas_config['rsyncclient']['all_hours'] = $_POST['all_hours']; + $freenas_config['rsyncclient']['all_days'] = $_POST['all_days']; + $freenas_config['rsyncclient']['all_months'] = $_POST['all_months']; + $freenas_config['rsyncclient']['all_weekdays'] = $_POST['all_weekdays']; + + write_config(); + + $retval = 0; + + if (!file_exists($d_sysrebootreqd_path)){ + /* nuke the cache file */ + config_lock(); + services_rsyncclient_configure(); + services_cron_configure(); + config_unlock(); + } + + $savemsg = get_std_save_message($retval); + } +} + +if (is_array($freenas_config['mounts']['mount'])) { + mount_sort(); + $a_mount = &$freenas_config['mounts']['mount']; + + $pconfig['opt_delete'] = isset($freenas_config['rsyncclient']['opt_delete']); + $pconfig['enable'] = isset($freenas_config['rsyncclient']['enable']); + $pconfig['rsyncserverip'] = $freenas_config['rsyncclient']['rsyncserverip']; + $pconfig['rsyncshare'] = $freenas_config['rsyncclient']['rsyncshare']; + $pconfig['minute'] = $freenas_config['rsyncclient']['minute']; + $pconfig['hour'] = $freenas_config['rsyncclient']['hour']; + $pconfig['day'] = $freenas_config['rsyncclient']['day']; + $pconfig['month'] = $freenas_config['rsyncclient']['month']; + $pconfig['weekday'] = $freenas_config['rsyncclient']['weekday']; + $pconfig['sharetosync'] = $freenas_config['rsyncclient']['sharetosync']; + $pconfig['all_mins'] = $freenas_config['rsyncclient']['all_mins']; + $pconfig['all_hours'] = $freenas_config['rsyncclient']['all_hours']; + $pconfig['all_days'] = $freenas_config['rsyncclient']['all_days']; + $pconfig['all_months'] = $freenas_config['rsyncclient']['all_months']; + $pconfig['all_weekdays'] = $freenas_config['rsyncclient']['all_weekdays']; + + if ($pconfig['all_mins'] == 1){ + $all_mins_all = " checked"; + } else { + $all_mins_selected = " checked"; + } + + if ($pconfig['all_hours'] == 1){ + $all_hours_all = " checked"; + } else { + $all_hours_selected = " checked"; + } + + if ($pconfig['all_days'] == 1){ + $all_days_all = " checked"; + } else { + $all_days_selected = " checked"; + } + + if ($pconfig['all_months'] == 1){ + $all_months_all = " checked"; + } else { + $all_months_selected = " checked"; + } + + if ($pconfig['all_weekdays'] == 1){ + $all_weekdays_all = " checked"; + } else { + $all_weekdays_selected = " checked"; + } +} + +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)" />  + +
+ +
+ +
+ /> + +
+ "; + echo $mountv['sharename'] . " (" . $mountv['desc'] . ")
\n"; + $i++; + } + } + else + echo "You must configure mount point before!"; + ?> +
+ +
+ + + + + + + + + + + + + + + + + + +
+
+ /> +
+ /> + +
+
+ + + +
+
+
+ /> +
+ /> + +
+
+ +
+
+
+ /> +
+ /> + +
+
+ + +
+
+
+ /> +
+ /> + +
+
+ +
+
+
+ /> +
+ /> + +
+
+ +
+
+ +
+
  + " /> +
+
+
+
+ + + + + diff --git a/packages/freenas/www/services_samba.php b/packages/freenas/www/services_samba.php new file mode 100644 index 00000000..1703b645 --- /dev/null +++ b/packages/freenas/www/services_samba.php @@ -0,0 +1,416 @@ +. + 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("CIFS")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['samba'])) +{ + $freenas_config['samba'] = array(); +} + +if (!is_array($freenas_config['mounts']['mount'])) + $freenas_config['mounts']['mount'] = array(); + +mount_sort(); + +$a_mount = &$freenas_config['mounts']['mount']; + +$pconfig['netbiosname'] = $freenas_config['samba']['netbiosname']; +$pconfig['workgroup'] = $freenas_config['samba']['workgroup']; +$pconfig['serverdesc'] = $freenas_config['samba']['serverdesc']; +$pconfig['security'] = $freenas_config['samba']['security']; +$pconfig['localmaster'] = $freenas_config['samba']['localmaster']; +$pconfig['winssrv'] = $freenas_config['samba']['winssrv']; +$pconfig['hidemount'] = $freenas_config['samba']['hidemount']; +$pconfig['timesrv'] = $freenas_config['samba']['timesrv']; +$pconfig['unixcharset'] = $freenas_config['samba']['unixcharset']; +$pconfig['doscharset'] = $freenas_config['samba']['doscharset']; +$pconfig['loglevel'] = $freenas_config['samba']['loglevel']; +$pconfig['sndbuf'] = $freenas_config['samba']['sndbuf']; +$pconfig['rcvbuf'] = $freenas_config['samba']['rcvbuf']; +$pconfig['enable'] = isset($freenas_config['samba']['enable']); +$pconfig['recyclebin'] = isset($freenas_config['samba']['recyclebin']); + +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(" ", "netbiosname workgroup security localmaster")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Netbiosname,Workgroup,Security, Localmaster")); + } + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if (($_POST['netbiosname'] && !is_domain($_POST['netbiosname']))) { + $error_bucket[] = array("error" => gettext("The Netbios name contains invalid characters."), + "field" => "netbiosname"); + } + if (($_POST['workgroup'] && !is_domain($_POST['workgroup']))) { + $error_bucket[] = array("error" => gettext("The Workgroup name contains invalid characters."), + "field" => "workgroup"); + } + if (($_POST['winssrv'] && !is_ipaddr($_POST['winssrv']))) { + $error_bucket[] = array("error" => gettext("The WINS server must be an IP address."), + "field" => "winssrv"); + } + + if (!is_numericint($_POST['sndbuf'])) { + $error_bucket[] = array("error" => gettext("PediaXThe SND Buffer value must be a number."), + "field" => "sndbuf"); + } + + if (!is_numericint($_POST['rcvbuf'])) { + $error_bucket[] = array("error" => gettext("The RCV Buffer value must be a number."), + "field" => "rcvbuf"); + } + + 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['samba']['netbiosname'] = $_POST['netbiosname']; + $freenas_config['samba']['workgroup'] = $_POST['workgroup']; + $freenas_config['samba']['serverdesc'] = $_POST['serverdesc']; + $freenas_config['samba']['security'] = $_POST['security']; + $freenas_config['samba']['localmaster'] = $_POST['localmaster']; + $freenas_config['samba']['winssrv'] = $_POST['winssrv']; + $freenas_config['samba']['hidemount'] = $_POST['hidemount']; + $freenas_config['samba']['timesrv'] = $_POST['timesrv']; + $freenas_config['samba']['doscharset'] = $_POST['doscharset']; + $freenas_config['samba']['unixcharset'] = $_POST['unixcharset']; + $freenas_config['samba']['loglevel'] = $_POST['loglevel']; + $freenas_config['samba']['sndbuf'] = $_POST['sndbuf']; + $freenas_config['samba']['rcvbuf'] = $_POST['rcvbuf']; + $freenas_config['samba']['recyclebin'] = $_POST['recyclebin'] ? true : false; + $freenas_config['samba']['enable'] = $_POST['enable'] ? true : false; + + write_config(); + + $retval = 0; + if (!file_exists($d_sysrebootreqd_path)) { + /* nuke the cache file */ + config_lock(); + services_samba_configure(); + services_mdnsresponder_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)" />  + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ /> +
+ +
+ $mountv[sharename]
\n"; + $i++; + } + ?> +
+ +
+ +
+ +
+ +
+ +
  + " /> +
+
+ + + + + diff --git a/packages/freenas/www/status_disks.php b/packages/freenas/www/status_disks.php new file mode 100644 index 00000000..478d2e89 --- /dev/null +++ b/packages/freenas/www/status_disks.php @@ -0,0 +1,119 @@ +. + 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("Status"), + gettext("Disks")); + +require_once("guiconfig.inc"); +require_once("freenas_guiconfig.inc"); +require_once("freenas_functions.inc"); + +if (!is_array($freenas_config['disks']['disk'])) + $freenas_config['disks']['disk'] = array(); + +disks_sort(); + +$raidstatus=get_sraid_disks_list(); + +$a_disk_conf = &$freenas_config['disks']['disk']; + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + + + + + + +
+
+ + + + + + + + + + + + + + + + + $diskv): ?> + + + + + + + + +
DiskSizeDescriptionStatus
+ + + + +   + +   +
+ + + + + +   + +   +
+
+ + + + + -- cgit v1.2.3