diff options
Diffstat (limited to 'packages/freenas')
88 files changed, 0 insertions, 22170 deletions
diff --git a/packages/freenas/bin/ext2fs.ko b/packages/freenas/bin/ext2fs.ko Binary files differdeleted file mode 100644 index 042b4bb8..00000000 --- a/packages/freenas/bin/ext2fs.ko +++ /dev/null diff --git a/packages/freenas/bin/geom_concat.ko b/packages/freenas/bin/geom_concat.ko Binary files differdeleted file mode 100644 index f1c40215..00000000 --- a/packages/freenas/bin/geom_concat.ko +++ /dev/null diff --git a/packages/freenas/bin/geom_gpt.ko b/packages/freenas/bin/geom_gpt.ko Binary files differdeleted file mode 100644 index 308b017b..00000000 --- a/packages/freenas/bin/geom_gpt.ko +++ /dev/null diff --git a/packages/freenas/bin/geom_mirror.ko b/packages/freenas/bin/geom_mirror.ko Binary files differdeleted file mode 100644 index 50a5f5ac..00000000 --- a/packages/freenas/bin/geom_mirror.ko +++ /dev/null diff --git a/packages/freenas/bin/geom_stripe.ko b/packages/freenas/bin/geom_stripe.ko Binary files differdeleted file mode 100644 index dd8e6a4d..00000000 --- a/packages/freenas/bin/geom_stripe.ko +++ /dev/null diff --git a/packages/freenas/bin/geom_vinum.ko b/packages/freenas/bin/geom_vinum.ko Binary files differdeleted file mode 100644 index c550fc83..00000000 --- a/packages/freenas/bin/geom_vinum.ko +++ /dev/null diff --git a/packages/freenas/bin/iscontrol b/packages/freenas/bin/iscontrol Binary files differdeleted file mode 100644 index f2e3f409..00000000 --- a/packages/freenas/bin/iscontrol +++ /dev/null diff --git a/packages/freenas/bin/iscsi_initiator.ko b/packages/freenas/bin/iscsi_initiator.ko Binary files differdeleted file mode 100644 index 94a07423..00000000 --- a/packages/freenas/bin/iscsi_initiator.ko +++ /dev/null diff --git a/packages/freenas/bin/kernel.gz b/packages/freenas/bin/kernel.gz Binary files differdeleted file mode 100644 index 9d9eb3f2..00000000 --- a/packages/freenas/bin/kernel.gz +++ /dev/null diff --git a/packages/freenas/bin/mountd b/packages/freenas/bin/mountd Binary files differdeleted file mode 100644 index 55682c7b..00000000 --- a/packages/freenas/bin/mountd +++ /dev/null diff --git a/packages/freenas/bin/nfsd b/packages/freenas/bin/nfsd Binary files differdeleted file mode 100644 index 311f1fca..00000000 --- a/packages/freenas/bin/nfsd +++ /dev/null diff --git a/packages/freenas/bin/ntfs.ko b/packages/freenas/bin/ntfs.ko Binary files differdeleted file mode 100644 index 1e923dac..00000000 --- a/packages/freenas/bin/ntfs.ko +++ /dev/null diff --git a/packages/freenas/bin/rpc.lockd b/packages/freenas/bin/rpc.lockd Binary files differdeleted file mode 100644 index 906a8641..00000000 --- a/packages/freenas/bin/rpc.lockd +++ /dev/null diff --git a/packages/freenas/bin/rpc.statd b/packages/freenas/bin/rpc.statd Binary files differdeleted file mode 100644 index c630a05a..00000000 --- a/packages/freenas/bin/rpc.statd +++ /dev/null diff --git a/packages/freenas/bin/rpcbind b/packages/freenas/bin/rpcbind Binary files differdeleted file mode 100644 index 882d9c4d..00000000 --- a/packages/freenas/bin/rpcbind +++ /dev/null diff --git a/packages/freenas/conf.default/config.xml b/packages/freenas/conf.default/config.xml deleted file mode 100644 index 74ed6186..00000000 --- a/packages/freenas/conf.default/config.xml +++ /dev/null @@ -1,179 +0,0 @@ -<?xml version="1.0"?> -<!-- FreeNAS default system configuration --> -<freenas> - <version>1.1</version> - <lastchange/> - <system> - <hostname>freenas</hostname> - <domain>local</domain> - <dnsserver/> - <dnsallowoverride/> - <username>admin</username> - <password>$1$KLfrklGE$9mMLCl/tNeqZJzdCJw6Gb0</password> - <timezone>Etc/UTC</timezone> - <time-update-interval>300</time-update-interval> - <timeservers>pool.ntp.org</timeservers> - <webgui> - <protocol>http</protocol> - <!-- - <port></port> - <certificate></certificate> - <private-key></private-key> - <noassigninterfaces/> - <expanddiags/> - <noantilockout></noantilockout> - --> - </webgui> - <!-- <disableconsolemenu/> --> - <!-- <disablefirmwarecheck/> --> - <!-- <shellcmd></shellcmd> --> - <!-- <earlyshellcmd></earlyshellcmd> --> - <!-- <harddiskstandby></harddiskstandby> --> - <!-- <polling/> --> - </system> - <interfaces> - <lan> - <if>sis0</if> - <ipaddr>192.168.1.250</ipaddr> - <subnet>24</subnet> - <media/> - <mediaopt/> - <!-- - <wireless> - *see below (opt[n])* - </wireless> - --> - </lan> - <!-- - <opt[n]> - <enable/> - <descr></descr> - <if></if> - <ipaddr></ipaddr> - <subnet></subnet> - <media></media> - <mediaopt></mediaopt> - <bridge>lan|wan|opt[n]</bridge> - <wireless> - <standard>11a|11b|11g</standard> - <mode>hostap *or* bss *or* ibss</mode> - <ssid></ssid> - <channel></channel> - <wep> - <enable/> - <key> - <txkey/> - <value></value> - </key> - </wep> - </wireless> - </opt[n]> - --> - </interfaces> - <!-- - <vlans> - <vlan> - <tag></tag> - <if></if> - <descr></descr> - </vlan> - </vlans> - --> - <staticroutes> - <!-- - <route> - <interface>lan|opt[n]|pptp</interface> - <network>xxx.xxx.xxx.xxx/xx</network> - <gateway>xxx.xxx.xxx.xxx</gateway> - <descr></descr> - </route> - --> - </staticroutes> - <disks> - <!-- - <disk> - <device>xxx</device> - <type>IDE|SCSI</type> - <position>master|slave|number</position> - <desc>xxx</desc> - <status>ok|new|missing</status> - </disk> - --> - - </disks> - <mounts> - <!-- - <mount> - <device>xxx</device> - <fstype>msdosfs|ufs|ntfs|etc...</fstype> - <options>xxx</options> - </mount> - --> - </mounts> - <samba> - <!-- <enable/> --> - <netbiosname>freenas</netbiosname> - <workgroup>WORKGROUP</workgroup> - <serverdesc>FreeNAS Server</serverdesc> - <security>share</security> - <localmaster>yes</localmaster> - </samba> - <ftp> - <!-- <enable/> --> - <numberclients>5</numberclients> - <maxconperip>2</maxconperip> - <timeout>300</timeout> - <port>21</port> - <anonymous>yes</anonymous> - <localuser>yes</localuser> - <pasv_max_port>0</pasv_max_port> - <pasv_min_port>0</pasv_min_port> - </ftp> - <afp> - <!-- <enable/> --> - </afp> - <rsyncd> - <!-- <enable/> --> - <readonly>no</readonly> - <port>873</port> - </rsyncd> - <sshd> - <!-- <enable/> --> - <port>22</port> - </sshd> - - <nfs> - <!-- <enable/> --> - </nfs> - <snmpd> - <!-- <enable/> --> - <syslocation/> - <syscontact/> - <rocommunity>public</rocommunity> - </snmpd> - <diag> - <ipv6nat> - <!-- <enable/> --> - <ipaddr/> - </ipv6nat> - <!-- <ipfstatentries></ipfstatentries> --> - </diag> - <bridge> - <!-- <filteringbridge/> --> - </bridge> - <syslog> - <!-- - <reverse/> - <enable/> - <remoteserver>xxx.xxx.xxx.xxx</remoteserver> - <system/> - <nologdefaultblock/> - <resolve/> - --> - </syslog> - <access> - <userid>1002</userid> - <groupid>1002</groupid> - </access> - -</freenas>
\ No newline at end of file diff --git a/packages/freenas/conf.kernel/pfSense.6.freenas b/packages/freenas/conf.kernel/pfSense.6.freenas deleted file mode 100644 index aee11302..00000000 --- a/packages/freenas/conf.kernel/pfSense.6.freenas +++ /dev/null @@ -1,433 +0,0 @@ -# -# GENERIC -- Generic kernel configuration file for FreeBSD/i386 -# -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.429.2.7.2.2 2006/05/01 00:15:12 scottl Exp $ - -machine i386 -cpu I486_CPU -cpu I586_CPU -cpu I686_CPU -ident pfSense - -# To statically compile in device wiring instead of /boot/device.hints -#hints "GENERIC.hints" # Default places to look for devices. - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols - -#FREENAS ADD lines: -options NO_SWAPPING -options HZ=1000 - -#options SCHED_ULE # ULE scheduler -options SCHED_4BSD # 4BSD scheduler -options PREEMPTION # Enable kernel thread preemption -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options MD_ROOT # MD is a potential root device -options NFSCLIENT # Network Filesystem Client -options NFSSERVER # Network Filesystem Server -options NFS_ROOT # NFS usable as /, requires NFSCLIENT -options MSDOSFS # MSDOS Filesystem -options MSDOSFS_LARGE # MSDOS Filesystem for FAT32 > 128GB -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options GEOM_GPT # GUID Partition Tables. -options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -options COMPAT_FREEBSD4 # Compatible with FreeBSD4 -options COMPAT_FREEBSD5 # Compatible with FreeBSD5 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options AHC_REG_PRETTY_PRINT # Print register bitfields in debug - # output. Adds ~128k to driver. -options AHD_REG_PRETTY_PRINT # Print register bitfields in debug - # output. Adds ~215k to driver. -options ADAPTIVE_GIANT # Giant mutex is adaptive. - -#FreeNAS include ACPI in the kernel: -device acpi # acpi -- Advanced Configuration and Power Management support - -device apic # I/O APIC - -# Bus support. -device eisa -device pci - -# Floppy drives -device fdc - -# ATA and ATAPI devices -device ata -device atadisk # ATA disk drives -device ataraid # ATA RAID drives -device atapicd # ATAPI CDROM drives -device atapifd # ATAPI floppy drives -#device atapifd # ATAPI floppy drives -device atapist # ATAPI tape drives -options ATA_STATIC_ID # Static device numbering - -# SCSI Controllers -device ahb # EISA AHA1742 family -device ahc # AHA2940 and onboard AIC7xxx devices -device ahd # AHA39320/29320 and onboard AIC79xx devices -device amd # AMD 53C974 (Tekram DC-390(T)) -device isp # Qlogic family -device ispfw # Firmware for QLogic HBAs- normally a module -device mpt # LSI-Logic MPT-Fusion -#device ncr # NCR/Symbios Logic -device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') -device trm # Tekram DC395U/UW/F DC315U adapters - -device adv # Advansys SCSI adapters -device adw # Advansys wide SCSI adapters -device aha # Adaptec 154x SCSI adapters -device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. -device bt # Buslogic/Mylex MultiMaster SCSI adapters - -device ncv # NCR 53C500 -device nsp # Workbit Ninja SCSI-3 -device stg # TMC 18C30/18C50 - -#FREENAS ADD SPECIAL DRIVERSAdding special IOI-A100U2W drivers: -device ihb # IOI-A100U2W drivers - -# SCSI peripherals -device scbus # SCSI bus (required for SCSI) -device ch # SCSI media changers -device da # Direct Access (disks) -device sa # Sequential Access (tape etc) -device cd # CD -device pass # Passthrough device (direct SCSI access) -device ses # SCSI Environmental Services (and SAF-TE) - -# RAID controllers interfaced to the SCSI subsystem -device amr # AMI MegaRAID -device arcmsr # Areca SATA II RAID -device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID -device ciss # Compaq Smart RAID 5* -device dpt # DPT Smartcache III, IV - See NOTES for options -device hptmv # Highpoint RocketRAID 182x -device rr232x # Highpoint RocketRAID 232x -device iir # Intel Integrated RAID -device ips # IBM (Adaptec) ServeRAID -device mly # Mylex AcceleRAID/eXtremeRAID -device twa # 3ware 9000 series PATA/SATA RAID - -# RAID controllers -device aac # Adaptec FSA RAID -device aacp # SCSI passthrough for aac (requires CAM) -device ida # Compaq Smart RAID -device mfi # LSI MegaRAID SAS -device mlx # Mylex DAC960 family -device pst # Promise Supertrak SX6000 -device twe # 3ware ATA RAID - -# atkbdc0 controls both the keyboard and the PS/2 mouse -device atkbdc # AT keyboard controller -device atkbd # AT keyboard -device psm # PS/2 mouse - -device kbdmux # keyboard multiplexer - -device vga # VGA video card driver - -device splash # Splash screen and screen saver support - -# syscons is the default console driver, resembling an SCO console -device sc - -# Enable this for the pcvt (VT220 compatible) console driver -#device vt -#options XSERVER # support for X server on a vt console -#options FAT_CURSOR # start with block cursor - -device agp # support several AGP chipsets - -# Power management support (see NOTES for more options) -#device apm -# Add suspend/resume support for the i8254. -device pmtimer - -# PCCARD (PCMCIA) support -# PCMCIA and cardbus bridge support -device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus -device cardbus # CardBus (32-bit) bus - -# Serial (COM) ports -device sio # 8250, 16[45]50 based serial ports - -# Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device ppi # Parallel port interface device -#device vpo # Requires scbus and da - -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to the sio and/or ppc drivers): -#device puc - -# PCI Ethernet NICs. -device de # DEC/Intel DC21x4x (``Tulip'') -device em # Intel PRO/1000 adapter Gigabit Ethernet Card -device ixgb # Intel PRO/10GbE Ethernet Card -device txp # 3Com 3cR990 (``Typhoon'') -device vx # 3Com 3c590, 3c595 (``Vortex'') - -# PCI Ethernet NICs that use the common MII bus controller code. -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! -device miibus # MII bus support -device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet -device bfe # Broadcom BCM440x 10/100 Ethernet -device bge # Broadcom BCM570xx Gigabit Ethernet -device dc # DEC/Intel 21143 and various workalikes -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device lge # Level 1 LXT1001 gigabit Ethernet -device nge # NatSemi DP83820 gigabit Ethernet -device nve # nVidia nForce MCP on-board Ethernet Networking -device pcn # AMD Am79C97x PCI 10/100(precedence over 'lnc') -device re # RealTek 8139C+/8169/8169S/8110S -device rl # RealTek 8129/8139 -device sf # Adaptec AIC-6915 (``Starfire'') -device sis # Silicon Integrated Systems SiS 900/SiS 7016 -device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet -device ste # Sundance ST201 (D-Link DFE-550TX) -device ti # Alteon Networks Tigon I/II gigabit Ethernet -device tl # Texas Instruments ThunderLAN -device tx # SMC EtherPower II (83c170 ``EPIC'') -device vge # VIA VT612x gigabit Ethernet -device vr # VIA Rhine, Rhine II -device wb # Winbond W89C840F -device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') - -# ISA Ethernet NICs. pccard NICs included. -device cs # Crystal Semiconductor CS89x0 NIC -# 'device ed' requires 'device miibus' -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards -device ex # Intel EtherExpress Pro/10 and Pro/10+ -device ep # Etherlink III based cards -device fe # Fujitsu MB8696x based cards -device ie # EtherExpress 8/16, 3C507, StarLAN 10 etc. -device le # NE2100, NE32-VL Lance Ethernet cards -device sn # SMC's 9000 series of Ethernet chips -device xe # Xircom pccard Ethernet - -# Wireless NIC cards -device wlan # 802.11 support -device an # Aironet 4500/4800 802.11 wireless NICs. -device awi # BayStack 660 and others -device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. -#device wl # Older non 802.11 Wavelan wireless NIC. - -# Pseudo devices. -device loop # Network loopback -device random # Entropy device -device ether # Ethernet support -device sl # Kernel SLIP -device ppp # Kernel PPP -device tun # Packet tunnel. -device pty # Pseudo-ttys (telnet etc) -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device faith # IPv6-to-IPv4 relaying (translation) - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -device uhci # UHCI PCI->USB interface -device ohci # OHCI PCI->USB interface -device ehci # EHCI PCI->USB interface (USB 2.0) -device usb # USB Bus (required) -#device udbp # USB Double Bulk Pipe devices -device ugen # Generic -device uhid # "Human Interface Devices" -device ukbd # Keyboard -device ulpt # Printer -device umass # Disks/Mass storage - Requires scbus and da -device ums # Mouse -device ural # Ralink Technology RT2500USB wireless NICs -device urio # Diamond Rio 500 MP3 player -device uscanner # Scanners -# USB Ethernet, requires miibus -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet - -# FireWire support -device firewire # FireWire bus code -device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) -device fwip - -# pfSense addons - -# Wireless NIC cards -device wlan # 802.11 support -device wlan_wep -device wlan_ccmp -device wlan_tkip -device wlan_xauth -device wlan_acl -device ath -device ath_rate_sample -device ath_hal -device an # Aironet 4500/4800 802.11 wireless NICs. -device awi # BayStack 660 and others -device iwi # Intel PRO/Wireless 2200BG -device ipw -device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. -device wl # Older non 802.11 Wavelan wireless NIC. - -options COMPAT_FREEBSD5 - -options UNIONFS # Union filesystem - -device bktr - -#options IPFIREWALL -#options DUMMYNET -#options IPDIVERT -options IPFIREWALL_DEFAULT_TO_ACCEPT -options IPFIREWALL_FORWARD -options IPFIREWALL_VERBOSE -options IPFIREWALL_VERBOSE_LIMIT - -device carp -device pf -device pflog -device pfsync -device vlan -device gre - -options IPSTEALTH -options TCP_DROP_SYNFIN #drop TCP packets with SYN+FIN -options GEOM_UZIP -options GEOM_LABEL - -options INCLUDE_CONFIG_FILE - -#options BRIDGE -options NETGRAPH #netgraph(4) system -options NETGRAPH_ASYNC -options NETGRAPH_BPF -options NETGRAPH_BRIDGE -options NETGRAPH_CISCO -options NETGRAPH_ECHO -options NETGRAPH_ETHER -options NETGRAPH_FRAME_RELAY -options NETGRAPH_HOLE -options NETGRAPH_IFACE -options NETGRAPH_KSOCKET - -options NETGRAPH_LMI -options NETGRAPH_MPPC_ENCRYPTION -options NETGRAPH_ONE2MANY -options NETGRAPH_PPP -options NETGRAPH_PPPOE -options NETGRAPH_PPTPGRE -options NETGRAPH_RFC1490 -options NETGRAPH_SOCKET -options NETGRAPH_TEE -options NETGRAPH_TTY -options NETGRAPH_UI -options NETGRAPH_VJC - -device ubsa -device ucom - -options FAST_IPSEC -#options IPSEC_NAT_T -device enc - -device crypto # core crypto support -device cryptodev # /dev/crypto for access to h/w -device rndtest # FIPS 140-2 entropy tester -device hifn # Hifn 7951, 7781, etc. -options HIFN_DEBUG # enable debugging support: hw.hifn.debug -options HIFN_RNDTEST # enable rndtest support -device ubsec # Broadcom 5501, 5601, 58xx - -options ALTQ -options ALTQ_CBQ -options ALTQ_RED -options ALTQ_RIO -options ALTQ_HFSC -options ALTQ_PRIQ -options ALTQ_NOPCC # Required for SMP builds !! - - -# Bridging -device if_bridge - -options MSGMNB=8192 # max # of bytes in a queue -options MSGMNI=40 # number of message queue identifiers -options MSGSEG=512 # number of message segments per queue -options MSGSSZ=32 # size of a message segment -options MSGTQL=2048 # max messages in system - -device tap -device hme - -# Needed for FreeSBIE 2 -options NULLFS - -# Kbdmux -device kbdmux - -device speaker - -options DEVICE_POLLING - -options ZERO_COPY_SOCKETS - -#device natpt - -device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet - -options TCP_SIGNATURE - -# To make an SMP kernel, the next two lines are needed -options SMP # Symmetric MultiProcessor Kernel -device apic # I/O APIC - -# Allow gmirror to function -options GEOM_MIRROR -options GEOM_MBR - -options PREEMPTION - - diff --git a/packages/freenas/diffs/netatalk-2.0.3-afpd-zeroconf.patch b/packages/freenas/diffs/netatalk-2.0.3-afpd-zeroconf.patch deleted file mode 100644 index 74ee8795..00000000 --- a/packages/freenas/diffs/netatalk-2.0.3-afpd-zeroconf.patch +++ /dev/null @@ -1,1386 +0,0 @@ -? etc/afpd/afp_avahi.c -? etc/afpd/afp_avahi.c.org -? etc/afpd/afp_avahi.h -? etc/afpd/afp_avahi.h.org -? etc/afpd/afp_bonjour.c -? etc/afpd/afp_bonjour.c.org -? etc/afpd/afp_bonjour.h -? etc/afpd/afp_bonjour.h.org -? etc/afpd/afp_howl.c -? etc/afpd/afp_howl.c.org -? etc/afpd/afp_howl.h -? etc/afpd/afp_howl.h.org -? etc/afpd/afp_zeroconf.c -? etc/afpd/afp_zeroconf.c.org -? etc/afpd/afp_zeroconf.h -? etc/afpd/afp_zeroconf.h.org -? macros/zeroconf.m4 -? macros/zeroconf.m4.org -Index: configure.in -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/configure.in,v -retrieving revision 1.203 -diff -u -r1.203 configure.in ---- configure.in 28 Apr 2005 20:49:17 -0000 1.203 -+++ configure.in 5 May 2006 10:46:30 -0000 -@@ -398,6 +398,9 @@ - dnl Check for optional server location protocol support (used by MacOS X) - NETATALK_SRVLOC - -+dnl Check for optional Zeroconf support -+NETATALK_ZEROCONF -+ - dnl Check for PAM libs - netatalk_cv_use_pam=no - AC_PATH_PAM([ -Index: config/afpd.conf.tmpl -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/config/afpd.conf.tmpl,v -retrieving revision 1.16 -diff -u -r1.16 afpd.conf.tmpl ---- config/afpd.conf.tmpl 28 Apr 2005 20:49:20 -0000 1.16 -+++ config/afpd.conf.tmpl 5 May 2006 10:46:31 -0000 -@@ -51,6 +51,8 @@ - # empty string. - # -noslp Don't register this server with the Service - # Location Protocol. -+# -nozeroconf Don't register this server with the Multicats -+# DNS Protocol. - # - # - # Authentication Methods: -Index: contrib/a2boot/Makefile.am -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/contrib/a2boot/Makefile.am,v -retrieving revision 1.5 -diff -u -r1.5 Makefile.am ---- contrib/a2boot/Makefile.am 28 Apr 2005 20:49:21 -0000 1.5 -+++ contrib/a2boot/Makefile.am 5 May 2006 10:46:32 -0000 -@@ -10,7 +10,7 @@ - EXTRA_DIST = COPYRIGHT VERSION - - CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/sys \ -- @CFLAGS@ @SLP_CFLAGS@ \ -+ @CFLAGS@ @SLP_CFLAGS@ @ZEROCONF_CFLAGS@ \ - -D_PATH_A_GS_BLOCKS=\"$(PKGCONFDIR)/a2boot/ProDOS16\ Boot\ Blocks\" \ - -D_PATH_A_2E_BLOCKS=\"$(PKGCONFDIR)/a2boot/Apple\ :2f:2fe\ Boot\ Blocks\" \ - -D_PATH_P16_IMAGE=\"$(PKGCONFDIR)/a2boot/ProDOS16\ Image\" -Index: etc/afpd/Makefile.am -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/etc/afpd/Makefile.am,v -retrieving revision 1.38 -diff -u -r1.38 Makefile.am ---- etc/afpd/Makefile.am 30 Apr 2005 21:33:41 -0000 1.38 -+++ etc/afpd/Makefile.am 5 May 2006 10:46:33 -0000 -@@ -8,19 +8,21 @@ - file.c enumerate.c desktop.c filedir.c fork.c appl.c gettok.c \ - mangle.c status.c afp_options.c afp_asp.c afp_dsi.c messages.c \ - afp_config.c nfsquota.c quota.c uam.c afs.c uid.c afp_util.c \ -- catsearch.c afprun.c -+ catsearch.c afprun.c \ -+ afp_zeroconf.c afp_avahi.c afp_bonjour.c afp_howl.c - - afpd_LDADD = $(top_builddir)/libatalk/cnid/libcnid.la $(top_builddir)/libatalk/libatalk.la - afpd_LDFLAGS = -export-dynamic - - noinst_HEADERS = auth.h afp_config.h desktop.h directory.h file.h \ - filedir.h fork.h globals.h icon.h mangle.h misc.h status.h switch.h \ -- uam_auth.h uid.h unix.h volume.h -+ uam_auth.h uid.h unix.h volume.h \ -+ afp_zeroconf.h afp_avahi.h afp_bonjour.h afp_howl.h - --LIBS = @LIBS@ @PAM_LIBS@ @QUOTA_LIBS@ @SLP_LIBS@ @WRAP_LIBS@ -+LIBS = @LIBS@ @PAM_LIBS@ @QUOTA_LIBS@ @SLP_LIBS@ @ZEROCONF_LIBS@ @WRAP_LIBS@ - - CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/sys \ -- @CFLAGS@ @SLP_CFLAGS@ \ -+ @CFLAGS@ @SLP_CFLAGS@ @ZEROCONF_CFLAGS@ \ - -D_PATH_AFPDDEFVOL=\"$(pkgconfdir)/AppleVolumes.default\" \ - -D_PATH_AFPDSYSVOL=\"$(pkgconfdir)/AppleVolumes.system\" \ - -D_PATH_AFPDPWFILE=\"$(pkgconfdir)/afppasswd\" \ -Index: etc/afpd/afp_config.c -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/etc/afpd/afp_config.c,v -retrieving revision 1.23 -diff -u -r1.23 afp_config.c ---- etc/afpd/afp_config.c 28 Apr 2005 20:49:39 -0000 1.23 -+++ etc/afpd/afp_config.c 5 May 2006 10:46:35 -0000 -@@ -50,6 +50,9 @@ - #ifdef USE_SRVLOC - #include <slp.h> - #endif /* USE_SRVLOC */ -+#ifdef USE_ZEROCONF -+#include "afp_zeroconf.h" -+#endif /* USE_ZEROCONF */ - - #include "globals.h" - #include "afp_config.h" -@@ -154,9 +157,9 @@ - } - #endif /* USE_SRVLOC */ - --#ifdef USE_SRVLOC - static void dsi_cleanup(const AFPConfig *config) - { -+#ifdef USE_SRVLOC - SLPError err; - SLPError callbackerr; - SLPHandle hslp; -@@ -189,8 +192,16 @@ - srvloc_dereg_err: - dsi->srvloc_url[0] = '\0'; - SLPClose(hslp); --} -+#elif defined (USE_ZEROCONF) -+ DSI *dsi = (DSI *)config->obj.handle; -+ -+ /* Do nothing if we didn't register. */ -+ if (!dsi || dsi->zeroconf_registered == 0) -+ return; -+ -+ zeroconf_deregister(); - #endif /* USE_SRVLOC */ -+} - - #ifndef NO_DDP - static void asp_cleanup(const AFPConfig *config) -@@ -355,6 +366,10 @@ - struct servent *afpovertcp; - int afp_port = 548; - char *srvloc_hostname, *hostname; -+#elif defined (USE_ZEROCONF) -+ struct servent *afpovertcp; -+ int afp_port = 548; -+ char *hostname = NULL; - #endif /* USE_SRVLOC */ - - if ((config = (AFPConfig *) calloc(1, sizeof(AFPConfig))) == NULL) { -@@ -449,6 +464,36 @@ - } - #endif /* USE_SRVLOC */ - -+#ifdef USE_ZEROCONF -+ dsi->zeroconf_registered = 0; /* Mark that we haven't registered. */ -+ -+ if (!(options->flags & OPTION_NOZEROCONF)) { -+ /* XXX We don't want to tack on the port number if we don't have to. -+ * Why? -+ * Well, this seems to break MacOS < 10. If the user _really_ wants to -+ * use a non-default port, they can, but be aware, this server might -+ * not show up int the Network Browser. -+ */ -+ afpovertcp = getservbyname("afpovertcp", "tcp"); -+ if (afpovertcp != NULL) { -+ afp_port = ntohs(afpovertcp->s_port); -+ } -+ -+ /* If specified use the FQDN to register with srvloc, otherwise use IP. */ -+ p = NULL; -+ if (options->fqdn) { -+ hostname = options->fqdn; -+ p = strchr(hostname, ':'); -+ } -+ else -+ hostname = inet_ntoa(dsi->server.sin_addr); -+ -+ if (!(options->flags & OPTION_NOSLP)) { -+ zeroconf_register(afp_port, hostname); -+ dsi->zeroconf_registered = 1; /* Mark that we have registered. */ -+ } -+ } -+#endif /* USE_ZEROCONF */ - - config->fd = dsi->serversock; - config->obj.handle = dsi; -@@ -469,6 +514,9 @@ - #ifdef USE_SRVLOC - config->server_cleanup = dsi_cleanup; - #endif -+#ifdef USE_ZEROCONF -+ config->server_cleanup = dsi_cleanup; -+#endif - return config; - } - -Index: etc/afpd/afp_options.c -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/etc/afpd/afp_options.c,v -retrieving revision 1.35 -diff -u -r1.35 afp_options.c ---- etc/afpd/afp_options.c 28 Apr 2005 20:49:39 -0000 1.35 -+++ etc/afpd/afp_options.c 5 May 2006 10:46:39 -0000 -@@ -202,10 +202,15 @@ - /* parse toggles */ - if (strstr(buf, " -nodebug")) - options->flags &= ~OPTION_DEBUG; -+ - #ifdef USE_SRVLOC - if (strstr(buf, " -noslp")) - options->flags |= OPTION_NOSLP; - #endif /* USE_SRVLOC */ -+#ifdef USE_ZEROCONF -+ if (strstr(buf, " -nozeroconf")) -+ options->flags |= OPTION_NOZEROCONF; -+#endif - - if (strstr(buf, " -nouservolfirst")) - options->flags &= ~OPTION_USERVOLFIRST; -@@ -578,6 +583,12 @@ - puts( "No" ); - #endif - -+#ifdef USE_ZEROCONF -+ puts( "Yes" ); -+#else -+ puts( "No" ); -+#endif -+ - printf( " TCP wrappers support:\t" ); - #ifdef TCPWRAP - puts( "Yes" ); -Index: etc/afpd/globals.h -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/etc/afpd/globals.h,v -retrieving revision 1.21 -diff -u -r1.21 globals.h ---- etc/afpd/globals.h 28 Apr 2005 20:49:43 -0000 1.21 -+++ etc/afpd/globals.h 5 May 2006 10:46:39 -0000 -@@ -40,6 +40,7 @@ - #define OPTION_CUSTOMICON (1 << 4) - #define OPTION_NOSLP (1 << 5) - #define OPTION_ANNOUNCESSH (1 << 6) -+#define OPTION_NOZEROCONF (1 << 7) - - #ifdef FORCE_UIDGID - /* set up a structure for this */ -Index: include/atalk/dsi.h -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/include/atalk/dsi.h,v -retrieving revision 1.6 -diff -u -r1.6 dsi.h ---- include/atalk/dsi.h 3 May 2005 14:55:12 -0000 1.6 -+++ include/atalk/dsi.h 5 May 2006 10:46:41 -0000 -@@ -85,6 +85,10 @@ - char srvloc_url[512]; - #endif - -+#ifdef USE_ZEROCONF -+ int zeroconf_registered; -+#endif -+ - /* buffer for OSX deadlock */ - int noblocking; - char *buffer; -Index: macros/summary.m4 -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/macros/summary.m4,v -retrieving revision 1.2 -diff -u -r1.2 summary.m4 ---- macros/summary.m4 28 Apr 2005 20:50:05 -0000 1.2 -+++ macros/summary.m4 5 May 2006 10:46:46 -0000 -@@ -44,6 +44,7 @@ - AC_MSG_RESULT([ Options:]) - AC_MSG_RESULT([ CUPS support: $netatalk_cv_use_cups]) - AC_MSG_RESULT([ SLP support: $netatalk_cv_srvloc]) -+ AC_MSG_RESULT([ Zeroconf support: $netatalk_cv_zeroconf]) - AC_MSG_RESULT([ tcp wrapper support: $netatalk_cv_tcpwrap]) - dnl if test x"$netatalk_cv_linux_sendfile" != x; then - dnl AC_MSG_RESULT([ Linux sendfile support: $netatalk_cv_linux_sendfile]) -Index: man/man5/afpd.conf.5.tmpl -=================================================================== -RCS file: /cvsroot/netatalk/netatalk/man/man5/afpd.conf.5.tmpl,v -retrieving revision 1.4 -diff -u -r1.4 afpd.conf.5.tmpl ---- man/man5/afpd.conf.5.tmpl 28 Apr 2005 20:50:06 -0000 1.4 -+++ man/man5/afpd.conf.5.tmpl 5 May 2006 10:46:48 -0000 -@@ -210,6 +210,9 @@ - Protocol (if SLP support was compiled in). This is useful if you are - running multiple servers and want one to be hidden, perhaps because - it is advertised elsewhere, ie. by a SLP Directory Agent. -+\-noslp -+Do not register this server using the Multicast DNS -+Protocol (if Zeroconf support was compiled in). - .SH "MISCELLANEOUS OPTIONS" - .TP - \-admingroup \fI[group]\fR ---- etc/afpd/afp_avahi.c.org 2006-04-21 10:29:22.000000000 +0200 -+++ etc/afpd/afp_avahi.c 2006-04-22 08:34:34.000000000 +0200 -@@ -0,0 +1,500 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Avahi based Zeroconf support -+ * Docs: http://avahi.org/download/doxygen/ -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include <config.h> -+#endif -+ -+#ifdef HAVE_AVAHI -+ -+#include "afp_avahi.h" -+ -+static void publish_reply(AvahiEntryGroup *g, -+ AvahiEntryGroupState state, -+ void *userdata); -+ -+/* -+ * This function tries to register the AFP DNS -+ * SRV service type. -+ */ -+static void register_stuff(struct context *ctx) { -+ char r[128]; -+ int ret; -+ -+ assert(ctx->client); -+ -+ if (!ctx->group) { -+ -+ if (!(ctx->group = avahi_entry_group_new(ctx->client, -+ publish_reply, -+ ctx))) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create entry group: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } -+ -+ } -+ -+ LOG(log_info, logtype_afpd, "Adding service '%s'\n", ctx->name); -+ -+ if (avahi_entry_group_is_empty(ctx->group)) { -+ /* Register our service */ -+ -+ if (avahi_entry_group_add_service(ctx->group, -+ AVAHI_IF_UNSPEC, -+ AVAHI_PROTO_UNSPEC, -+ 0, -+ ctx->name, -+ AFP_DNS_SERVICE_TYPE, -+ NULL, -+ NULL, -+ ctx->port, -+ NULL) < 0) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to add service: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } -+ -+ if (avahi_entry_group_commit(ctx->group) < 0) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to commit entry group: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } -+ } -+ -+ return; -+ -+ fail: -+ avahi_client_free (ctx->client); -+#ifndef HAVE_AVAHI_THREADED_POLL -+ avahi_simple_poll_quit(ctx->simple_poll); -+#else -+ avahi_threaded_poll_quit(ctx->threaded_poll); -+#endif -+} -+ -+/* Called when publishing of service data completes */ -+static void publish_reply(AvahiEntryGroup *g, -+ AvahiEntryGroupState state, -+ AVAHI_GCC_UNUSED void *userdata) -+{ -+ struct context *ctx = userdata; -+ -+ assert(g == ctx->group); -+ -+ switch (state) { -+ -+ case AVAHI_ENTRY_GROUP_ESTABLISHED : -+ /* The entry group has been established successfully */ -+ break; -+ -+ case AVAHI_ENTRY_GROUP_COLLISION: { -+ char *n; -+ -+ /* Pick a new name for our service */ -+ -+ n = avahi_alternative_service_name(ctx->name); -+ assert(n); -+ -+ avahi_free(ctx->name); -+ ctx->name = n; -+ -+ register_stuff(ctx); -+ break; -+ } -+ -+ case AVAHI_ENTRY_GROUP_FAILURE: { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to register service: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ avahi_client_free (avahi_entry_group_get_client(g)); -+#ifndef HAVE_AVAHI_THREADED_POLL -+ avahi_simple_poll_quit(ctx->simple_poll); -+#else -+ avahi_threaded_poll_quit(ctx->threaded_poll); -+#endif -+ break; -+ } -+ -+ case AVAHI_ENTRY_GROUP_UNCOMMITED: -+ case AVAHI_ENTRY_GROUP_REGISTERING: -+ ; -+ } -+} -+ -+static void client_callback(AvahiClient *client, -+ AvahiClientState state, -+ void *userdata) -+{ -+ struct context *ctx = userdata; -+ -+ ctx->client = client; -+ -+ switch (state) { -+ -+ case AVAHI_CLIENT_S_RUNNING: -+ -+ /* The server has startup successfully and registered its host -+ * name on the network, so it's time to create our services */ -+ if (!ctx->group) -+ register_stuff(ctx); -+ break; -+ -+ case AVAHI_CLIENT_S_COLLISION: -+ -+ if (ctx->group) -+ avahi_entry_group_reset(ctx->group); -+ break; -+ -+ case AVAHI_CLIENT_FAILURE: { -+ -+ if (avahi_client_errno(client) == AVAHI_ERR_DISCONNECTED) { -+ int error; -+ -+ avahi_client_free(ctx->client); -+ ctx->client = NULL; -+ ctx->group = NULL; -+ -+ /* Reconnect to the server */ -+ -+#ifndef HAVE_AVAHI_THREADED_POLL -+ if (!(ctx->client = avahi_client_new(avahi_simple_poll_get(ctx->simple_poll), -+#else -+ if (!(ctx->client = avahi_client_new(avahi_threaded_poll_get(ctx->threaded_poll), -+#endif -+ AVAHI_CLIENT_NO_FAIL, -+ client_callback, -+ ctx, -+ &error))) { -+ -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to contact server: %s\n", -+ avahi_strerror(error)); -+ -+ avahi_client_free (ctx->client); -+#ifndef HAVE_AVAHI_THREADED_POLL -+ avahi_simple_poll_quit(ctx->simple_poll); -+#else -+ avahi_threaded_poll_quit(ctx->threaded_poll); -+#endif -+ } -+ -+ } else { -+ LOG(log_error, -+ logtype_afpd, -+ "Client failure: %s\n", -+ avahi_strerror(avahi_client_errno(client))); -+ -+ avahi_client_free (ctx->client); -+#ifndef HAVE_AVAHI_THREADED_POLL -+ avahi_simple_poll_quit(ctx->simple_poll); -+#else -+ avahi_threaded_poll_quit(ctx->threaded_poll); -+#endif -+ } -+ -+ break; -+ } -+ -+ case AVAHI_CLIENT_S_REGISTERING: -+ case AVAHI_CLIENT_CONNECTING: -+ ; -+ } -+} -+ -+static void* thread(void *userdata) { -+#ifndef HAVE_AVAHI_THREADED_POLL -+ struct context *ctx = userdata; -+ sigset_t mask; -+ int r; -+ -+ /* Make sure that signals are delivered to the main thread */ -+ sigfillset(&mask); -+ pthread_sigmask(SIG_BLOCK, &mask, NULL); -+ -+ pthread_mutex_lock(&ctx->mutex); -+ -+ /* Run the main loop */ -+ LOG(log_info, logtype_afpd, "Starting avahi loop..."); -+ r = avahi_simple_poll_loop(ctx->simple_poll); -+ -+ /* Cleanup some stuff */ -+ if (ctx->client) -+ avahi_client_free(ctx->client); -+ ctx->client = NULL; -+ ctx->group = NULL; -+ -+ pthread_mutex_unlock(&ctx->mutex); -+#endif -+ return NULL; -+} -+ -+static int poll_func(struct pollfd *ufds, -+ unsigned int nfds, -+ int timeout, -+ void *userdata) { -+#ifndef HAVE_AVAHI_THREADED_POLL -+ pthread_mutex_t *mutex = userdata; -+ int r; -+ -+ /* Before entering poll() we unlock the mutex, so that -+ * avahi_simple_poll_quit() can succeed from another thread. */ -+ -+ pthread_mutex_unlock(mutex); -+ r = poll(ufds, nfds, timeout); -+ pthread_mutex_lock(mutex); -+ -+ return r; -+#else -+ return 0; -+#endif -+} -+ -+/* -+ * Tries to setup the Zeroconf thread and any -+ * neccessary config setting. -+ */ -+void* av_zeroconf_setup(unsigned long port, const char *name) { -+ struct context *ctx = NULL; -+ -+ /* default service name, if there's none in -+ * the config file. -+ */ -+ char service[256] = "AFP Server on "; -+ int error, ret; -+ -+ /* initialize the struct that holds our -+ * config settings. -+ */ -+ ctx = malloc(sizeof(struct context)); -+ assert(ctx); -+ ctx->client = NULL; -+ ctx->group = NULL; -+#ifndef HAVE_AVAHI_THREADED_POLL -+ ctx->simple_poll = NULL; -+ pthread_mutex_init(&ctx->mutex, NULL); -+#else -+ ctx->threaded_poll = NULL; -+#endif -+ ctx->thread_running = 0; -+ -+ LOG(log_info, -+ logtype_afpd, -+ "Setting port for Zeroconf service to: %i.\n", -+ port); -+ ctx->port = port; -+ -+ /* Prepare service name */ -+ if (!name) { -+ LOG(log_info, -+ logtype_afpd, -+ "Assigning default service name.\n"); -+ gethostname(service+14, sizeof(service)-15); -+ service[sizeof(service)-1] = 0; -+ -+ ctx->name = strdup(service); -+ } -+ else { -+ ctx->name = strdup(name); -+ } -+ -+ assert(ctx->name); -+ -+/* first of all we need to initialize our threading env */ -+#ifdef HAVE_AVAHI_THREADED_POLL -+ if (!(ctx->threaded_poll = avahi_threaded_poll_new())) { -+ goto fail; -+ } -+#else -+ if (!(ctx->simple_poll = avahi_simple_poll_new())) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create event loop object.\n"); -+ goto fail; -+ } -+ -+ avahi_simple_poll_set_func(ctx->simple_poll, poll_func, &ctx->mutex); -+#endif -+ -+/* now we need to acquire a client */ -+#ifdef HAVE_AVAHI_THREADED_POLL -+ if (!(ctx->client = avahi_client_new(avahi_threaded_poll_get(ctx->threaded_poll), -+ AVAHI_CLIENT_NO_FAIL, -+ client_callback, -+ ctx, -+ &error))) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create client object: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } -+#else -+ if (!(ctx->client = avahi_client_new(avahi_simple_poll_get(ctx->simple_poll), -+ AVAHI_CLIENT_NO_FAIL, -+ client_callback, -+ ctx, -+ &error))) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create client object: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } -+#endif -+ -+ return ctx; -+ -+fail: -+ -+ if (ctx) -+ av_zeroconf_unregister(ctx); -+ -+ return NULL; -+} -+ -+/* -+ * This function finally runs the loop impl. -+ */ -+int av_zeroconf_run(void *u) { -+ struct context *ctx = u; -+ int ret; -+ -+#ifdef HAVE_AVAHI_THREADED_POLL -+ /* Finally, start the event loop thread */ -+ if (avahi_threaded_poll_start(ctx->threaded_poll) < 0) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create thread: %s\n", -+ avahi_strerror(avahi_client_errno(ctx->client))); -+ goto fail; -+ } else { -+ LOG(log_info, logtype_afpd, "Successfully started avahi loop.\n"); -+ } -+#else -+ /* Create the mDNS event handler */ -+ if ((ret = pthread_create(&ctx->thread_id, NULL, thread, ctx)) < 0) { -+ LOG(log_error, -+ logtype_afpd, -+ "Failed to create thread: %s\n", strerror(ret)); -+ goto fail; -+ } else { -+ LOG(log_info, logtype_afpd, "Successfully started avahi loop.\n"); -+ } -+#endif -+ -+ ctx->thread_running = 1; -+ -+ return 0; -+ -+fail: -+ -+ if (ctx) -+ av_zeroconf_unregister(ctx); -+ -+ return -1; -+} -+ -+/* -+ * Used to lock access to the loop. -+ * Currently unused. -+ */ -+void av_zeroconf_lock(void *u) { -+#ifdef HAVE_AVAHI_THREADED_POLL -+ struct context *ctx = u; -+ -+ avahi_threaded_poll_lock(ctx->threaded_poll); -+#endif -+} -+ -+/* -+ * Used to unlock access to the loop. -+ * Currently unused. -+ */ -+void av_zeroconf_unlock(void *u) { -+#ifdef HAVE_AVAHI_THREADED_POLL -+ struct context *ctx = u; -+ -+ avahi_threaded_poll_unlock(ctx->threaded_poll); -+#endif -+} -+ -+/* -+ * Tries to shutdown this loop impl. -+ * Call this function from outside this thread. -+ */ -+void av_zeroconf_shutdown(void *u) { -+ struct context *ctx = u; -+ -+ /* Call this when the app shuts down */ -+#ifdef HAVE_AVAHI_THREADED_POLL -+ avahi_threaded_poll_stop(ctx->threaded_poll); -+ avahi_free(ctx->name); -+ avahi_client_free(ctx->client); -+ avahi_threaded_poll_free(ctx->threaded_poll); -+#else -+ av_zeroconf_unregister(ctx); -+#endif -+} -+ -+/* -+ * Tries to shutdown this loop impl. -+ * Call this function from inside this thread. -+ */ -+int av_zeroconf_unregister(void *u) { -+ struct context *ctx = u; -+ -+ if (ctx->thread_running) { -+#ifndef HAVE_AVAHI_THREADED_POLL -+ pthread_mutex_lock(&ctx->mutex); -+ avahi_simple_poll_quit(ctx->simple_poll); -+ pthread_mutex_unlock(&ctx->mutex); -+ -+ pthread_join(ctx->thread_id, NULL); -+#else -+ /* First, block the event loop */ -+ avahi_threaded_poll_lock(ctx->threaded_poll); -+ -+ /* Than, do your stuff */ -+ avahi_threaded_poll_quit(ctx->threaded_poll); -+ -+ /* Finally, unblock the event loop */ -+ avahi_threaded_poll_unlock(ctx->threaded_poll); -+#endif -+ ctx->thread_running = 0; -+ } -+ -+ avahi_free(ctx->name); -+ -+ if (ctx->client) -+ avahi_client_free(ctx->client); -+ -+#ifndef HAVE_AVAHI_THREADED_POLL -+ if (ctx->simple_poll) -+ avahi_simple_poll_free(ctx->simple_poll); -+ -+ pthread_mutex_destroy(&ctx->mutex); -+#else -+ if (ctx->threaded_poll) -+ avahi_threaded_poll_free(ctx->threaded_poll); -+#endif -+ -+ free(ctx); -+ -+ return 0; -+} -+ -+#endif /* USE_AVAHI */ ---- etc/afpd/afp_avahi.h.org 2006-04-21 10:29:23.000000000 +0200 -+++ etc/afpd/afp_avahi.h 2006-04-22 07:40:05.000000000 +0200 -@@ -0,0 +1,58 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Avahi based Zeroconf support -+ * Docs: http://avahi.org/download/doxygen/ -+ * -+ */ -+ -+#ifndef AFPD_AVAHI_H -+#define AFPD_AVAHI_H -+ -+#include <stdlib.h> -+#include <assert.h> -+#include <string.h> -+ -+#include <avahi-client/client.h> -+#include <avahi-client/publish.h> -+ -+#include <avahi-common/alternative.h> -+ -+#ifndef HAVE_AVAHI_THREADED_POLL -+#include <avahi-common/simple-watch.h> -+#include <signal.h> /* SIG_BLOCK */ -+#else -+#include <avahi-common/thread-watch.h> -+#endif -+ -+#include <avahi-common/malloc.h> -+#include <avahi-common/error.h> -+ -+#include <atalk/logger.h> -+ -+#define AFP_DNS_SERVICE_TYPE "_afpovertcp._tcp" -+ -+struct context { -+ int thread_running; -+ pthread_t thread_id; -+ pthread_mutex_t mutex; -+ char *name; -+#ifndef HAVE_AVAHI_THREADED_POLL -+ AvahiSimplePoll *simple_poll; -+#else -+ AvahiThreadedPoll *threaded_poll; -+#endif -+ AvahiClient *client; -+ AvahiEntryGroup *group; -+ unsigned long port; -+}; -+ -+/* prototype definitions */ -+void* av_zeroconf_setup(unsigned long, const char *); -+int av_zeroconf_run(void*); -+int av_zeroconf_unregister(void*); -+void av_zeroconf_shutdown(void*); -+void av_zeroconf_lock(void *); -+void av_zeroconf_unlock(void *); -+ -+#endif /* AFPD_AVAHI_H */ ---- etc/afpd/afp_bonjour.h.org 2006-04-21 10:29:30.000000000 +0200 -+++ etc/afpd/afp_bonjour.h 2006-04-21 07:37:05.000000000 +0200 -@@ -0,0 +1,27 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Bonjour based Zeroconf support -+ * Docs: http://developer.apple.com/documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd/ -+ * -+ */ -+ -+#ifndef AFPD_BONJOUR_H -+#define AFPD_BONJOUR_H -+ -+#include <stdlib.h> -+#include <assert.h> -+#include <string.h> -+ -+#include <dns_sd.h> /* DNSServiceRegister(), DNSServiceDiscoveryDeallocate() */ -+ -+#include <atalk/logger.h> -+ -+#define AFP_DNS_SERVICE_TYPE "_afpovertcp._tcp" -+ -+/* prototype definitions */ -+void* bo_zeroconf_setup(unsigned long, const char *); -+int bo_zeroconf_unregister(void); -+int bo_zeroconf_run(void); -+ -+#endif /* AFPD_BONJOUR_H */ ---- etc/afpd/afp_bonjour.c.org 2006-04-21 10:29:28.000000000 +0200 -+++ etc/afpd/afp_bonjour.c 2006-04-21 09:45:13.000000000 +0200 -@@ -0,0 +1,112 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Bonjour based Zeroconf support -+ * Docs: http://developer.apple.com/documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd/ -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include <config.h> -+#endif -+ -+#ifdef HAVE_BONJOUR -+ -+#include "afp_bonjour.h" -+ -+DNSServiceRef publish_session = NULL; -+ -+static void DNSSD_API -+publish_reply(DNSServiceRef, -+ const DNSServiceFlags, -+ DNSServiceErrorType, -+ const char *, -+ const char *, -+ const char *, -+ void *); -+ -+static void DNSSD_API -+publish_reply (DNSServiceRef sdRef, -+ const DNSServiceFlags flags, -+ DNSServiceErrorType errorCode, -+ const char *name, -+ const char *regtype, -+ const char *domain, -+ void *context) -+{ -+} -+ -+void* bo_zeroconf_setup(unsigned long port, const char *name) { -+ DNSServiceErrorType err; -+ char service[256] = "AFP Server on "; -+ -+ /* Prepare service name */ -+ if (!name) { -+ LOG(log_info, logtype_afpd,, "Assigning default service name.\n"); -+ gethostname(service+14, sizeof(service)-15); -+ service[sizeof(service)-1] = 0; -+ -+ name = strdup(service); -+ } -+ -+ assert(name); -+ assert(port); -+ -+ err = DNSServiceRegister (&publish_session, -+ 0, /* flags */ -+ 0, /* interface; 0 for all */ -+ name, /* name */ -+ AFP_DNS_SERVICE_TYPE, /* type */ -+ NULL, /* domain */ -+ NULL, /* hostname */ -+ htons (port), /* port in network byte order */ -+ 0, /* text record length */ -+ NULL, /* text record */ -+ publish_reply, /* callback */ -+ NULL); /* context */ -+ -+ if (err == kDNSServiceErr_NoError) { -+ LOG(log_info, logtype_afpd, "Adding service '%s'\n", name); -+ } else { -+ LOG(log_error, logtype_afpd, "Adding service '%s' failed\n", name); -+ bo_zeroconf_unregister(); -+ } -+} -+ -+int bo_zeroconf_run(void) { -+ fd_set set; -+ int fd; -+ struct timeval timeout; -+ -+ /* Initialize the file descriptor set. */ -+ FD_ZERO (&set); -+ FD_SET (fd, &set); -+ -+ /* Initialize the timeout data structure. */ -+ /* TODO: Should the value for sec be configurable? */ -+ timeout.tv_sec = 10; -+ timeout.tv_usec = 0; -+ -+ if (publish_session != NULL) { -+ fd = DNSServiceRefSockFD(publish_session); -+ -+ if (select(FD_SETSIZE, -+ &set, NULL, NULL, -+ &timeout) > 0) { -+ DNSServiceProcessResult(publish_session); -+ } -+ } -+ -+ return 0; -+} -+ -+int bo_zeroconf_unregister(void) { -+ if (publish_session != NULL) { -+ DNSServiceRefDeallocate(publish_session); -+ publish_session = NULL; -+ } -+ -+ return 0; -+} -+ -+#endif /* HAVE_BONJOUR */ ---- etc/afpd/afp_howl.c.org 2006-04-21 10:29:34.000000000 +0200 -+++ etc/afpd/afp_howl.c 2006-04-21 09:46:11.000000000 +0200 -@@ -0,0 +1,92 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Howl based Zeroconf support -+ * Doc: http://www.porchdogsoft.com/products/howl/docs/ -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include <config.h> -+#endif -+ -+#ifdef HAVE_HOWL -+ -+#include "afp_howl.h" -+ -+sw_discovery discovery = NULL; -+ -+static sw_result HOWL_API publish_reply(sw_discovery, -+ sw_discovery_oid, -+ sw_discovery_publish_status, -+ sw_opaque); -+ -+static sw_result HOWL_API publish_reply(sw_discovery discovery, -+ sw_discovery_oid oid, -+ sw_discovery_publish_status status, -+ sw_opaque extra) { -+ static sw_string -+ status_text[] = -+ { -+ "Started", -+ "Stopped", -+ "Name Collision", -+ "Invalid" -+ }; -+ -+ LOG(log_info, logtype_afpd, "publish reply: %s\n", status_text[status]); -+ return SW_OKAY; -+} -+ -+void* ho_zeroconf_setup(unsigned long port, const char *name) { -+ sw_result result; -+ sw_discovery_publish_id id; -+ char service[256] = "AFP Server on "; -+ -+ if (sw_discovery_init (&discovery) != SW_OKAY) { -+ LOG(log_error, -+ logtype_afpd, -+ "AFPD could not be started. \nTry running mDNSResponder."); -+ return; -+ } -+ -+ /* Prepare service name */ -+ if (!name) { -+ LOG(log_info, logtype_afpd, "Assigning default service name.\n"); -+ gethostname(service+14, sizeof(service)-15); -+ service[sizeof(service)-1] = 0; -+ -+ name = strdup(service); -+ } -+ -+ assert(name); -+ -+ if (!(result = sw_discovery_publish (discovery, -+ 0, -+ name, -+ AFP_DNS_SERVICE_TYPE, -+ NULL, -+ NULL, -+ port, -+ NULL, -+ 0, -+ publish_reply, -+ NULL, -+ &id)) != SW_OKAY) { -+ LOG(log_info, logtype_afpd, "Adding service '%s'\n", name); -+ } else { -+ LOG(log_error, logtype_afpd, "Adding service '%s' failed\n", name); -+ ho_zeroconf_unregister(); -+ } -+} -+ -+void* ho_zeroconf_run(void) { -+ sw_discovery_run(discovery); -+} -+ -+void* ho_zeroconf_unregister(void) { -+ sw_discovery_stop_run(discovery); -+ sw_discovery_fina(discovery); -+} -+ -+#endif /* USE_HOWL */ ---- etc/afpd/afp_howl.h.org 2006-04-21 10:29:33.000000000 +0200 -+++ etc/afpd/afp_howl.h 2006-04-21 07:37:11.000000000 +0200 -@@ -0,0 +1,27 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Howl based Zeroconf support -+ * Doc: http://www.porchdogsoft.com/products/howl/docs/ -+ * -+ */ -+ -+#ifndef AFPD_HOWL_H -+#define AFPD_HOWL_H -+ -+#include <stdlib.h> -+#include <assert.h> -+#include <string.h> -+ -+#include <howl.h> -+ -+#include <atalk/logger.h> -+ -+#define NTP_DNS_SERVICE_TYPE "_afpovertcp._tcp" -+ -+/* prototype definitions */ -+void* ho_zeroconf_setup(unsigned long, const char *); -+void* ho_zeroconf_unregister(void); -+void* ho_zeroconf_run(void); -+ -+#endif /* AFPD_HOWL_H */ ---- etc/afpd/afp_zeroconf.h.org 2006-04-21 10:29:39.000000000 +0200 -+++ etc/afpd/afp_zeroconf.h 2006-04-21 11:39:20.000000000 +0200 -@@ -0,0 +1,40 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Zeroconf facade, that abstracts access to a -+ * particular Zeroconf implementation -+ * Doc: http://www.dns-sd.org/ -+ * -+ */ -+ -+#ifndef AFPD_ZEROCONF_H -+#define AFPD_ZEROCONF_H -+ -+#include <netinet/in.h> /* htons() */ -+#include <atalk/logger.h> -+ -+# ifdef HAVE_BONJOUR -+# include "afp_bonjour.h" -+# elif defined (HAVE_HOWL) -+# include "afp_howl.h" -+# elif defined (HAVE_AVAHI) -+# include "afp_avahi.h" -+# endif -+ -+#define AFP_PORT 548 -+ -+/* -+ * Prototype Definitions -+ */ -+ -+/* -+ * registers the ntpd service with a particular Zerconf implemenation. -+ */ -+void zeroconf_register(int port, char *hostname); -+ -+/* -+ * de-registers the ntpd service with a particular Zerconf implemenation. -+ */ -+void zeroconf_deregister(void); -+ -+#endif AFPD_ZEROCONF_H ---- etc/afpd/afp_zeroconf.c.org 2006-04-21 10:29:38.000000000 +0200 -+++ etc/afpd/afp_zeroconf.c 2006-04-21 13:12:38.000000000 +0200 -@@ -0,0 +1,97 @@ -+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ -+/* -+ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> -+ * Purpose: Zeroconf facade, that abstracts access to a -+ * particular Zeroconf implementation -+ * Doc: http://www.dns-sd.org/ -+ * -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include <config.h> -+#endif -+ -+#include "afp_zeroconf.h" -+ -+/* -+ * Global Definitions -+ */ -+#ifdef HAVE_AVAHI -+struct context *ctx = NULL; -+#endif -+ -+/* -+ * Functions (actually they are just facades) -+ */ -+void zeroconf_register(int port, char *hostname) -+{ -+#ifdef HAVE_BONJOUR -+ LOG(log_info, -+ logtype_afpd, -+ "Attempting to register with mDNS using Apple's Bonjour\n"); -+ if (hostname && strlen(hostname) > 0 && port) -+ { -+ bo_zeroconf_setup(port, hostname); -+ } -+ else if (hostname && strlen(hostname) > 0) -+ { -+ bo_zeroconf_setup(AFP_PORT, hostname); -+ } -+ else -+ { -+ bo_zeroconf_setup(AFP_PORT, NULL); -+ } -+ bo_zeroconf_run(); -+#elif defined (HAVE_HOWL) -+ LOG(log_info, -+ logtype_afpd, -+ "Attempting to register with mDNS using Porchdog's Howl\n"); -+ if (hostname && strlen(hostname) > 0 && port) -+ { -+ ho_zeroconf_setup(port, hostname); -+ } -+ else if (hostname && strlen(hostname) > 0) -+ { -+ ho_zeroconf_setup(AFP_PORT, hostname); -+ } -+ else -+ { -+ ho_zeroconf_setup(AFP_PORT, NULL); -+ } -+ bo_zeroconf_run(); -+#elif defined (HAVE_AVAHI) -+ LOG(log_info, logtype_afpd, "Attempting to register with mDNS using Avahi\n"); -+ if (hostname && strlen(hostname) > 0 && port) -+ { -+ ctx = av_zeroconf_setup(port, hostname); -+ } -+ else if (hostname && strlen(hostname) > 0) -+ { -+ ctx = av_zeroconf_setup(AFP_PORT, hostname); -+ } -+ else -+ { -+ ctx = av_zeroconf_setup(AFP_PORT, NULL); -+ } -+ av_zeroconf_run(ctx); -+#endif -+} -+ -+void zeroconf_deregister(void) -+{ -+#ifdef HAVE_BONJOUR -+ LOG(log_error, -+ logtype_afpd, -+ "Attempting to de-register mDNS using Apple's Bonjour\n"); -+ bo_zeroconf_unregister(); -+#elif defined (HAVE_HOWL) -+ LOG(log_error, -+ logtype_afpd, -+ "Attempting to de-register mDNS using Porchdog's Howl\n"); -+ ho_zeroconf_unregister(); -+#elif defined (HAVE_AVAHI) -+ LOG(log_error, logtype_afpd, "Attempting to de-register mDNS using Avahi\n"); -+ if (ctx) -+ av_zeroconf_shutdown(ctx); -+#endif -+} ---- macros/zeroconf.m4.org 2006-04-21 10:29:51.000000000 +0200 -+++ macros/zeroconf.m4 2006-04-22 07:26:56.000000000 +0200 -@@ -0,0 +1,101 @@ -+dnl Check for optional Zeroconf support -+ -+dnl $Id$ -+ -+AC_DEFUN([NETATALK_ZEROCONF], [ -+ -+ ZEROCONF_LIBS="" -+ ZEROCONF_CFLAGS="" -+ found_zeroconf=no -+ zeroconf_dir="" -+ -+ AC_ARG_ENABLE(zeroconf, -+ [ --enable-zeroconf[[=DIR]] enable Zeroconf support [[auto]]], -+ [zeroconf=$enableval], -+ [zeroconf=try] -+ ) -+ -+ dnl make sure atalk_libname is defined beforehand -+ [[ -n "$atalk_libname" ]] || AC_MSG_ERROR([internal error, atalk_libname undefined]) -+ -+ if test "x$zeroconf" != "xno"; then -+ -+ savedcppflags="$CPPFLAGS" -+ savedldflags="$LDFLAGS" -+ -+ if test "x$zeroconf" = "xyes" -o "x$zeroconf" = "xtry"; then -+ zeroconf_dir="/usr" -+ else -+ zeroconf_dir="$zeroconf" -+ fi -+ -+ # mDNS support using Apple's Bonjour -+ AC_CHECK_HEADER(dns_sd.h, -+ [AC_CHECK_LIB(dns_sd, -+ DNSServiceRegister, -+ [AC_DEFINE(USE_ZEROCONF, 1, -+ [Use DNS-SD registration])])]) -+ case "$ac_cv_lib_dns_sd_DNSServiceRegister" in -+ yes) -+ ZEROCONF_LIBS="-L$zeroconf_dir/lib -ldns_sd" -+ ZEROCONF_LIBS="-I$zeroconf_dir/include" -+ AC_DEFINE(HAVE_BONJOUR, 1, [Use Bonjour/DNS-SD registration]) -+ found_zeroconf=yes -+ ;; -+ esac -+ # mDNS support using Porchdog's Howl -+ AC_CHECK_HEADER(howl.h, -+ [AC_CHECK_LIB(howl, -+ sw_discovery_publish, -+ [AC_DEFINE(USE_ZEROCONF, 1, -+ [Use DNS-SD registration])])]) -+ case "$ac_cv_lib_howl_sw_discovery_publish" in -+ yes) -+ PKG_CHECK_MODULES(HOWL, [ howl >= 1.0.0 ]) -+ ZEROCONF_LIBS="$HOWL_LIBS" -+ ZEROCONF_CFLAGS="$HOWL_CFLAGS" -+ AC_DEFINE(HAVE_HOWL, 1, [Use Howl/DNS-SD registration]) -+ found_zeroconf=yes -+ ;; -+ esac -+ # mDNS support using Avahi -+ AC_CHECK_HEADER(avahi-client/client.h, -+ [AC_CHECK_LIB(avahi-client, -+ avahi_client_new, -+ [AC_DEFINE(USE_ZEROCONF, 1, -+ [Use DNS-SD registration])])]) -+ case "$ac_cv_lib_avahi_client_avahi_client_new" in -+ yes) -+ PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ]) -+ PKG_CHECK_MODULES(AVAHI_TPOLL, [ avahi-client >= 0.6.4 ], -+ [AC_DEFINE(HAVE_AVAHI_THREADED_POLL, 1, [Uses Avahis threaded poll implementation])], -+ [AC_MSG_WARN(This Avahi implementation is not supporting threaded poll objects. Maybe this is not what you want.)]) -+ ZEROCONF_LIBS="$AVAHI_LIBS" -+ ZEROCONF_CFLAGS="$AVAHI_CFLAGS" -+ AC_DEFINE(HAVE_AVAHI, 1, [Use Avahi/DNS-SD registration]) -+ found_zeroconf=yes -+ ;; -+ esac -+ -+ CPPFLAGS="$savedcppflags" -+ LDFLAGS="$savedldflags" -+ fi -+ -+ netatalk_cv_zeroconf=no -+ AC_MSG_CHECKING([whether to enable Zerconf support]) -+ if test "x$found_zeroconf" = "xyes"; then -+ AC_MSG_RESULT([yes]) -+ AC_DEFINE(USE_ZEROCONF, 1, [Define to enable Zeroconf support]) -+ netatalk_cv_zeroconf=yes -+ else -+ AC_MSG_RESULT([no]) -+ if test "x$zeroconf" != "xno" -a "x$zeroconf" != "xtry"; then -+ AC_MSG_ERROR([Zeroconf installation not found]) -+ fi -+ fi -+ -+ LIB_REMOVE_USR_LIB(ZEROCONF_LIBS) -+ CFLAGS_REMOVE_USR_INCLUDE(ZEROCONF_CFLAGS) -+ AC_SUBST(ZEROCONF_LIBS) -+ AC_SUBST(ZEROCONF_CFLAGS) -+]) diff --git a/packages/freenas/doc/README.txt b/packages/freenas/doc/README.txt deleted file mode 100644 index 8183022f..00000000 --- a/packages/freenas/doc/README.txt +++ /dev/null @@ -1,52 +0,0 @@ -FreeNAS Port for pfSense -=~=~=~=~=~=~=~=~=~=~=~=~ - -This is a port of the FreeNAS PHP sources to pfSense. -It is based on FreeNAS 0.68 and was tested on pfSense -HEAD. - -*** NOTES *** - -You should be aware that this package installes a custom -kernel and some additional kernel modules. - -YOU NEED TO REBOOT YOUR pfSense SYSTEM AFTER HAVING INSTALLED -THIS PACKAGE!!! - -Additionally, if you are going to enable the FTP service, you -need to disable the FTP helper on each interface. - -Maintainer: ------------ - -Daniel S. Haischt <me@daniel.stefan.haischt.name> - -Dependencies: -------------- - -* ataidle-0.9 -* avahi+libdns-0.6.12 -* pkgconfig-0.20 -* perl-5.8.8 -* libiconv-1.9.2_2 -* libxml2-2.6.26 -* libdaemon-0.10_1 -* gettext-0.14.5_2 -* glib-2.10.3 -* expat-2.0.0_1 -* dbus-0.62 -* wzdftpd-0.7.2_1 -* e2fsprogs-1.39_1 -* smartmontools-5.36 -* aaccli-1.0 -* rsync-2.6.8_2 -* scponly-4.6_1 -* unison-2.13.16_1 -* cracklib-2.7_2 -* samba-3.0.23,1 -* db44-4.4.20.2 -* popt-1.7_1 -* cyrus-sasl-2.1.22 -* openldap-sasl-client-2.3.24 -* netatalk-2.0.3_3,1 -* pam_ldap-1.8.2
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas.inc b/packages/freenas/pkg/freenas.inc deleted file mode 100644 index b87ebfe6..00000000 --- a/packages/freenas/pkg/freenas.inc +++ /dev/null @@ -1,297 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -require_once("freenas_config.inc"); - -function sync_package_freenas() { -} - -function oninstall_copy_kernel_binaries($action = "install") { - $binaries = array(); - $binaries[] = array("source" => "/usr/local/pkg/iscsi_initiator.ko", - "target" => "/boot/kernel/iscsi_initiator.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/ext2fs.ko", - "target" => "/boot/kernel/ext2fs.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/geom_concat.ko", - "target" => "/boot/kernel/geom_concat.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/geom_gpt.ko", - "target" => "/boot/kernel/geom_gpt.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/geom_mirror.ko", - "target" => "/boot/kernel/geom_mirror.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/geom_stripe.ko", - "target" => "/boot/kernel/geom_stripe.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/geom_vinum.ko", - "target" => "/boot/kernel/geom_vinum.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/ntfs.ko", - "target" => "/boot/kernel/ntfs.ko", - "backup" => false); - $binaries[] = array("source" => "/usr/local/pkg/kernel.gz", - "target" => "/boot/kernel/kernel.gz", - "backup" => true); - - if ($action == "install") { - while (list(, $val) = each($binaries)) { - $static_output .= "FreeNAS: Moving binary file... "; - update_output_window($static_output); - if ($val['backup'] && file_exists($val['target'])) - rename($val['target'], "{$val['target']}.org"); - rename($val['source'], $val['target']); - $static_output .= "done.\n"; - update_output_window($static_output); - } - } else if ($action == "deinstall") { - while (list($source, $target) = each($binaries)) { - $static_output .= "FreeNAS: Removing binary file... "; - update_output_window($static_output); - unlink($target); - $static_output .= "done.\n"; - update_output_window($static_output); - } - } -} - -function remove_package_contents($pkg = "") { - if ($pkg == "") { return; } - - $pd = popen("pkg_info -rf {$pkg}", "r"); - - if (! pd) { return; } - - while (! feof($pd)) { - $buffer = fgets($pd, 4096); - - if (strpos($buffer, "File:") !== false) { - $file = trim(str_replace("File:", "", $buffer)); - - if (strpos($file, "man/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "share/doc/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "share/aclocal/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "include/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "libdata/pkgconfig/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "info/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "etc/rc.d/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } else if (strpos($file, "etc/") !== false) { - if (strpos($file, ".dist") !== false || - strpos($file, ".sample") !== false || - strpos($file, ".example") !== false || - strpos($file, ".default") !== false || - strpos($file, ".sh") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } - } else if (strpos($file, "share/examples/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } - - /* What about locales? */ - /* - } else if (strpos($file, "share/local/") !== false) { - unlink_if_exists("/usr/local/{$file}"); - } - */ - } - } - - fclose ($pd); -} - -function adjust_package_contents() { - remove_package_contents("avahi+libdns-0.6.12"); - remove_package_contents("ataidle-0.9"); - remove_package_contents("perl-5.8.8"); - remove_package_contents("libiconv-1.9.2_2"); - remove_package_contents("libxml2-2.6.26"); - remove_package_contents("gettext-0.14.5_2"); - remove_package_contents("glib-2.10.3"); - remove_package_contents("expat-2.0.0_1"); - remove_package_contents("wzdftpd-0.7.2_1"); - remove_package_contents("e2fsprogs-1.39_1"); - remove_package_contents("smartmontools-5.36"); - remove_package_contents("aaccli-1.0"); - remove_package_contents("rsync-2.6.8_2"); - remove_package_contents("scponly-4.6_1"); - remove_package_contents("cracklib-2.7_2"); - remove_package_contents("samba-3.0.23,1"); - remove_package_contents("netatalk-2.0.3_3,1"); - remove_package_contents("pam_ldap-1.8.2"); -} - -function oninstall_copy_misc_binaries($action = "install") { - $binaries = array(); - $binaries[] = array("source" => "/usr/local/pkg/iscontrol", - "target" => "/usr/local/sbin/iscontrol"); - $binaries[] = array("source" => "/usr/local/pkg/nfsd", - "target" => "/usr/sbin/nfsd"); - $binaries[] = array("source" => "/usr/local/pkg/nfsd", - "target" => "/usr/sbin/mountd"); - $binaries[] = array("source" => "/usr/local/pkg/rpcbind", - "target" => "/usr/sbin/rpcbind"); - $binaries[] = array("source" => "/usr/local/pkg/rpc.lockd", - "target" => "/usr/sbin/rpc.lockd"); - $binaries[] = array("source" => "/usr/local/pkg/rpc.lockd", - "target" => "/usr/sbin/rpc.lockd"); - - if ($action == "install") { - while (list(, $val) = each($binaries)) { - $static_output .= "FreeNAS: Installing binary file... "; - update_output_window($static_output); - mwexec("install -s {$source} ${target}"); - $static_output .= "done.\n"; - update_output_window($static_output); - } - } else if ($action == "deinstall") { - while (list($val['source'], $val['target']) = each($binaries)) { - $static_output .= "FreeNAS: Removing binary file... "; - update_output_window($static_output); - unlink($target); - $static_output .= "done.\n"; - update_output_window($static_output); - } - } -} - -function oninstall_setup_config() { - global $config; - - $config['system']['zeroconf_disable'] = "yes"; - - $freenas_config =& $config['installedpackages']['freenas']['config'][0]; - - if (!is_array($freenas_config['disks'])) - $freenas_config['disks'] = array(); - if (!is_array($freenas_config['mounts'])) - $freenas_config['mounts'] = array(); - - if (!is_array($freenas_config['samba'])) - $freenas_config['samba'] = array(); - $freenas_config['samba']['netbiosname'] = "freenas"; - $freenas_config['samba']['workgroup'] = "WORKGROUP"; - $freenas_config['samba']['serverdesc'] = "pfSense Server"; - $freenas_config['samba']['security'] = "share"; - $freenas_config['samba']['localmaster'] = "yes"; - - if (!is_array($freenas_config['ftp'])) - $freenas_config['ftp'] = array(); - $freenas_config['ftp']['numberclients'] = "5"; - $freenas_config['ftp']['maxconperip'] = "2"; - $freenas_config['ftp']['timeout'] = "300"; - $freenas_config['ftp']['port'] = "21"; - $freenas_config['ftp']['anonymous'] = "yes"; - $freenas_config['ftp']['pasv_max_port'] = "0"; - $freenas_config['ftp']['pasv_min_port'] = "0"; - - if (!is_array($freenas_config['afp'])) - $freenas_config['afp'] = array(); - - if (!is_array($freenas_config['rsyncd'])) - $freenas_config['rsyncd'] = array(); - $freenas_config['rsyncd']['readonly'] = "no"; - $freenas_config['rsyncd']['port'] = "873"; - - if (!is_array($freenas_config['nfs'])) - $freenas_config['nfs'] = array(); -} - -function custom_php_install_command() { - global $g; - - oninstall_copy_kernel_binaries(); - oninstall_copy_misc_binaries(); - adjust_package_contents(); - oninstall_setup_config(); - - if (! file_exists("/usr/local/etc/rc.d")) - mwexec("mkdir -p /usr/local/etc/rc.d"); - - if (! file_exists("{$g['varrun_path']}/dbus")) - mkdir("{$g['varrun_path']}/dbus"); - - if (! file_exists("{$g['varrun_path']}/avahi-daemon")) - mkdir("{$g['varrun_path']}/avahi-daemon"); - - rename("/usr/local/pkg/rc.freenas", "/usr/local/etc/rc.d/freenas.sh"); - chmod ("/usr/local/etc/rc.d/freenas.sh", 0755); - - mwexec("ln -s /usr/local/etc/uams/uams_passwd.so /usr/local/etc/uams/uams_clrtxt.so"); - mwexec("ln -s /usr/local/etc/uams/uams_dhx_passwd.so /usr/local/etc/uams/uams_dhx.so"); - /* hack cause I linked netatalk against db44 instead of db42 */ - mwexec("ln -s /usr/local/lib/libdb-4.4.so.0 /usr/local/lib/libdb-4.2.so.2"); -} - -function custom_php_deinstall_command() { - global $config, $g; - - oninstall_copy_kernel_binaries("deinstall"); - oninstall_copy_misc_binaries("deinstall"); - - if (! file_exists("/usr/local/etc/rc.d")) - mwexec("rm -rf /usr/local/etc/rc.d"); - - if (! file_exists("{$g['varrun_path']}/dbus")) - mwexec("rm -rf {$g['varrun_path']}/dbus"); - - if (! file_exists("{$g['varrun_path']}/avahi-daemon")) - mwexec("rm -rf {$g['varrun_path']}/avahi-daemon"); - - unlink_if_exists("/usr/local/etc/uams/uams_clrtxt.so"); - unlink_if_exists("/usr/local/etc/uams/uams_dhx.so"); - unlink_if_exists("/usr/local/etc/rc.d/freenas.sh"); - unlink_if_exists("/usr/local/lib/libdb-4.2.so.2"); - - unset($config['installedpackages']['freenas']); - write_config(); - conf_mount_ro(); -} -?> diff --git a/packages/freenas/pkg/freenas.xml b/packages/freenas/pkg/freenas.xml deleted file mode 100644 index edac8085..00000000 --- a/packages/freenas/pkg/freenas.xml +++ /dev/null @@ -1,570 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "../../schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="../../xsl/package.xsl"?> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - authng.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freenas</name> - <version>1.0</version> - <title>System: Disks: Management</title> - <include_file>/usr/local/pkg/freenas.inc</include_file> - <!-- Menu is where this packages menu will appear --> - <menu> - <name>Disks</name> - <section>System</section> - <url>/disks_manage.php</url> - </menu> - <menu> - <name>RAID</name> - <section>System</section> - <url>/disks_raid_gmirror.php</url> - </menu> - <menu> - <name>Mounts</name> - <section>System</section> - <url>/disks_mount.php</url> - </menu> - <menu> - <name>FreeNAS Infos</name> - <section>Diagnostics</section> - <url>/diag_disk_infos.php</url> - </menu> - <menu> - <name>FreeNAS Logs</name> - <section>Diagnostics</section> - <url>/diag_fn_logs_samba.php</url> - </menu> - <menu> - <name>Disk Status</name> - <section>Status</section> - <url>/status_disks.php</url> - </menu> - <menu> - <name>AFP</name> - <section>Services</section> - <url>/services_afp.php</url> - </menu> - <menu> - <name>FTP</name> - <section>Services</section> - <url>/services_ftp.php</url> - </menu> - <menu> - <name>NFS</name> - <section>Services</section> - <url>/services_nfs.php</url> - </menu> - <menu> - <name>Rsync</name> - <section>Services</section> - <url>/services_rsyncd.php</url> - </menu> - <menu> - <name>Samba</name> - <section>Services</section> - <url>/services_samba.php</url> - </menu> - <menu> - <name>Unison</name> - <section>Services</section> - <url>/services_unison.php</url> - </menu> - <!-- - <service> - <name>dspam</name> - <rcfile>/usr/local/etc/rc.d/dspam.sh</rcfile> - </service> - --> - <tabs /> - <!-- - configpath gets expanded out automatically and config items - will be stored in that location - --> - <configpath>['installedpackages']['freenas']['config']</configpath> - <!-- PHP files (disk management) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_init.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_iscsi.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_manage_tools.php</item> - </additional_files_needed> - <!-- PHP files (RAID management) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_infos.php</item> - </additional_files_needed> - <!-- - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_init.php</item> - </additional_files_needed> - --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gmirror_tools.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_infos.php</item> - </additional_files_needed> - <!-- - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_init.php</item> - </additional_files_needed> - --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gvinum_tools.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gconcat_tools.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_gstripe_tools.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_raid_graid5_tools.php</item> - </additional_files_needed> - <!-- PHP files (mount management) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_mount.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_mount_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/disks_mount_tools.php</item> - </additional_files_needed> - <!-- PHP files (diagnostics) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_ad_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_ataidle_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_disk_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_iscsi_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_mounts_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_part_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_raid_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_smart_infos.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_space_infos.php</item> - </additional_files_needed> - <!-- PHP files (logs) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_daemon.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_ftp.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_rsyncd.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_samba.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_settings.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_smartd.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/diag_fn_logs_sshd.php</item> - </additional_files_needed> - <!-- PHP files (services) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_afp.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_ftp.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_nfs.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_nfs_export.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_nfs_export_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_rsyncd.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_rsyncd_client.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_rsyncd_local.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_samba.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_samba_share.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_samba_edit.php</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/services_unison.php</item> - </additional_files_needed> - <!-- PHP files (misc) --> - <additional_files_needed> - <prefix>/usr/local/www/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/www/status_disks.php</item> - </additional_files_needed> - <!-- package files --> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_disks.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_config.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_functions.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_guiconfig.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_services.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_utils.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/freenas_system.inc</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/pkg/rc.freenas</item> - </additional_files_needed> - <!-- kernel binaries --> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/iscsi_initiator.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/ext2fs.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/geom_concat.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/geom_gpt.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/geom_mirror.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/geom_stripe.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/geom_vinum.ko</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/kernel.gz</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/ntfs.ko</item> - </additional_files_needed> - <!-- misc binaries --> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/iscontrol</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/mountd</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/nfsd</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/rpcbind</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/rpc.lockd</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freenas/bin/rpc.statd</item> - </additional_files_needed> - <!-- - fields gets invoked when the user adds or edits a item. The following items - will be parsed and rendered for the user as a gui with input, and selectboxes. - --> - <!-- - Arbitrary PHP Code, that gets executed if a certain event gets triggered. - --> - <custom_php_resync_config_command> - sync_package_freenas(); - </custom_php_resync_config_command> - <custom_php_install_command> - custom_php_install_command(); - </custom_php_install_command> - <custom_php_deinstall_command> - custom_php_deinstall_command(); - </custom_php_deinstall_command> -</packagegui> diff --git a/packages/freenas/pkg/freenas_config.inc b/packages/freenas/pkg/freenas_config.inc deleted file mode 100644 index fc139228..00000000 --- a/packages/freenas/pkg/freenas_config.inc +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_config.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$GLOBALS['custom_listtags'] = array("disk", "mount", "vdisk"); - -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas_disks.inc b/packages/freenas/pkg/freenas_disks.inc deleted file mode 100644 index 0946164f..00000000 --- a/packages/freenas/pkg/freenas_disks.inc +++ /dev/null @@ -1,1256 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_disks.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* include all configuration functions */ -require_once("functions.inc"); -require_once("freenas_functions.inc"); - -$freenas_config =& $config['installedpackages']['freenas']['config'][0]; - -/* Mount all configured disks */ -function disks_mount_all() { - global $freenas_config, $g; - - if ($g['booting']) - echo "Mounting Partitions... "; - - /* For each device configured: */ - if (is_array($freenas_config['mounts']['mount'])) { - foreach ($freenas_config['mounts']['mount'] as $mountent) { - /* Advanced Umount filesystem if not booting mode (mount edition) */ - if (!$g['booting']) - disks_umount_adv($mountent); - - /* mount filesystem */ - disks_mount($mountent); - } // end foreach - } // end if - - if ($g['booting']) - echo "done\n"; - - return 0; -} - -/* Mount using the configured mount given in parameter - * Return 0 if sucessful, 1 if error - */ -function disks_mount($mount) { - global $freenas_config, $g; - - /* Create one directory for each device under mnt */ - - $mountname=escapeshellcmd($mount['sharename']); - - @mkdir ("/mnt/$mountname",0777); - - /* mount the filesystems */ - $devname=escapeshellcmd($mount['fullname']); - - /* check the fileystem only if there is a problem*/ - /* This part is too stupid: I must read the FreBSD - * start script for use the same intelligent method - * for checking hard drive - */ - switch ($mount['fstype']) { - case "ufs": - if (mwexec("/sbin/mount -t ufs -o acls $devname /mnt/$mountname") == 0) { - /* Change this directory into 777 mode */ - mwexec("/bin/chmod 777 /mnt/$mountname"); - $result = 0; - } else { - /* If it's NOK, Check filesystem and do a fsck, answer Yes to all question*/ - mwexec("/sbin/fsck -y -t ufs $devname"); - - /* Re-try to mount the partition */ - if (mwexec("/sbin/mount -t ufs -o acls $devname /mnt/$mountname") == 0) { - /* Change this directory into 777 mode */ - mwexec("/bin/chmod 777 /mnt/$mountname"); - $result = 0; - } else { - /* Not OK, remove the directory, prevent writing on RAM disk*/ - @rmdir ("/mnt/$mountname"); - $result = 1; - } // end if - } // end if - break; - case "msdosfs": - if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) { - $result = 0; - } else { - exec("/sbin/fsck -y -t msdosfs {$devname}"); - - if (mwexec("/sbin/mount_msdosfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) { - $result = 0; - } else { - /* Not OK, remove the directory, prevent writing on RAM disk*/ - @rmdir ("/mnt/$mountname"); - $result = 1; - } - } - break; - case "ntfs": - if (mwexec("/sbin/mount_ntfs -u ftp -g ftp -m 777 $devname /mnt/$mountname") == 0) { - $result = 0; - } else { - /* Not OK, remove the directory, prevent writing on RAM disk */ - @rmdir ("/mnt/$mountname"); - $result = 1; - } - break; - case "ext2fs": - if (mwexec("/sbin/mount_ext2fs $devname /mnt/$mountname") == 0) { - /* Change this directory into 777 mode */ - mwexec("/bin/chmod 777 /mnt/$mountname"); - $result = 0; - } else { - exec("/usr/local/sbin/e2fsck -f -p {$devname}"); - - if (mwexec("/sbin/mount_ext2fs $devname /mnt/$mountname") == 0) { - /* Change this directory into 777 mode */ - mwexec("/bin/chmod 777 /mnt/$mountname"); - $result = 0; - } else { - /* Not OK, remove the directory, prevent writing on RAM */ - @rmdir ("/mnt/$mountname"); - $result= 1; - } - } - break; - } // end switch - - return $result; -} - -/* Mount using fullname (/dev/ad0s1) given in parameter*/ -function disks_mount_fullname($fullname) { - global $freenas_config; - - if (is_array($freenas_config['mounts']['mount'])) { - /* Search the mount list for given disk and partition */ - foreach($freenas_config['mounts']['mount'] as $mountk => $mountv) { - if($mountv['fullname'] == $fullname) { - $mount = $mountv; - } - } - } - - if($mount) { - $result= disks_mount($mount); - } else { - $result=0; - } - - return $result; -} - -/* Umount the specified configured mount point - * Return 0 is successfull, 1 if error - */ -function disks_umount($mount) { - global $freenas_config, $g; - - /* Umout the specified mount point */ - /* The $mount variable is the all config table for the mount point*/ - $mountname=escapeshellcmd($mount['sharename']); - - if (mwexec("/sbin/umount /mnt/$mountname") == 0) { - if (@rmdir ("/mnt/$mountname")) { - return 0; - } else { - return 1; - } - } else { - return 1; - } -} - -/* Advanced unmount the specified mount point without using the sharename value - * Used when changing the 'sharename': Need to umount the old unknow sharename - * Return 0 if successful, 1 if error - */ -function disks_umount_fullname($fullname) { - global $freenas_config; - - /* Search the mount list for given fullname */ - foreach($freenas_config['mounts']['mount'] as $mountk => $mountv) { - if (strcmp($mountv['fullname'],$fullname) == 0) { - $mount = $mountv; - } - } - - if($mount) { - $result = disks_umount($mount); - } else { - $result= 1; - } - - return $result; -} - -/* Advanced unmount the specified mount point without using the sharename value - * Used when changing the 'sharename': Need to umount the old unknow sharename - * Return 0 if successful, 1 if error - */ -function disks_umount_adv($mount) -{ - $fulname="{$mount['fullname']}"; - - // get the mount list - $detmount = get_mounts_list(); - - //Look for the mount point in all mounted point - foreach ($detmount as $detmountk => $detmountv) { - // If we found the mount point on the device - if (strcmp($detmountv['fullname'],$fullname) == 0) { - $mountname="{$detmountv['mp']}"; - } - } - - if ($mountname) { - exec("/sbin/umount $mountname"); - @rmdir ("$mountname"); - return 0; - } else { - $result = 1; - } - - return $result; -} - -function disks_mount_status($mount) { - // This option check if the mount are mounted - global $freenas_config, $g; - $detmount = get_mounts_list(); - $status="ERROR"; - - // Recreate the full system name device+s+partition number - /* mount the filesystems */ - $mountpart="{$mount['partition']}"; - - if ((strcmp($mountpart,"gvinum") == 0) || (strcmp($mountpart,"gmirror") == 0)) { - $complete = "{$mount['mdisk']}"; - } else { - $complete = "{$mount['mdisk']}{$mount['partition']}"; - } - - //echo "debug, display complete: $complete <br>"; - - foreach ($detmount as $detmountk => $detmountv) { - //echo "debug, display detmountv[mdisk]: {$detmountv['mdisk']} <br>"; - - if (strcmp($detmountv['mdisk'],$complete) == 0) { - $status="OK"; - return $status; - } - } - - return $status; -} - -/* This option check if this fullname (/dev/ad0s1) is mounted - * Return 0 if not, 1 if yes - */ -function disks_check_mount_fullname($fullname) { - $detmount = get_mounts_list(); - $status=0; - //print_r($detmount); - - foreach ($detmount as $detmountk => $detmountv) { - if (strpos($detmountv['fullname'],$fullname) !== false) { - $status=1; - break; - } - } - - return $status; -} - -/* This option check if the configured mount is mounted. */ -function disks_check_mount($mount) -{ - return disks_check_mount_fullname($mount['fullname']); -} - -/* This function check if the disk is mounted - * Return 0 if not, 1 if yes - */ -function disks_check_mount_disk($disk) { - $detmount = get_mounts_list(); - $status=0; - - foreach ($detmount as $detmountk => $detmountv) { - /* Must found the $disk (ad0) in result $mdisk (ad0s1) */ - // strpos will return 0 (found at position 0) if found, must check the 'false' value - if (strpos($detmountv['mdisk'], $disk) !== false ) { - $status=1; - break; - } -} -return $status; -} - -/* This option check if the configured disk is online (detected by the system) - * Result: "MISSING", disk don't detected by OS - * Result: "ONLINE", disk is online - * Result: "CHANGED", disk have changed (be replaced ?) - */ -function disks_status($diskname) { - // This option check if the configured disk is online - global $freenas_config, $g; - $detectedlist = get_physical_disks_list(); - $status="MISSING"; - - foreach ($detectedlist as $detecteddisk => $detecteddiskv) { - if ($detecteddisk == $diskname['name']) { - $status="ONLINE"; - if (($detecteddiskv['size'] != $diskname['size']) || ($detecteddiskv['desc'] != $diskname['desc'])) { - $status="CHANGED"; - } - break; - } - } - - return $status; -} - -function disks_addfstab($cfgdev,$cfgtype) { - global $freenas_config, $g; - - /* Open or create fstab in RW */ - $fd = fopen("{$g['etc_path']}/fstab", "w"); - - if ( $fd ) { - /* check for the precence of dev */ - /* ADD (check if it's ADD line or replace) the line for the dev */ - $fstab = "/dev/$cfgdev /mnt/$cfgdev $cfgtype rw 1 1\n"; - - /* write out an fstab */ - fwrite($fd, $fstab); - - /* close file */ - fclose($fd); - } else { - die( "fopen failed for {$g['etc_path']}/fstab" ) ; - } -} - -function disks_umount_all() { - global $freenas_config, $g; - - /* Sync disks*/ - mwexec("/bin/sync"); - - if (is_array($freenas_config['mounts']['mount'])) { - foreach ($freenas_config['mounts']['mount'] as $mountent) { - /* Umount filesystem */ - disks_umount($mountent); - } - } - - return 0; -} - -/* Configure, create and start gvinum volume */ -function disks_raid_gvinum_configure() { - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['gvinum']['vdisk']) { - - foreach ($freenas_config['gvinum']['vdisk'] as $a_raid_conf) { - if (file_exists($g['varrun_path'] . "/raid.conf.dirty") && - !in_array("{$a_raid_conf['name']}\n", file($g['varrun_path'] . "/raid.conf.dirty"))) { continue; } - - /* generate raid.conf */ - $fd = fopen("{$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf", "w"); - if (!$fd) { - printf("Error: cannot open raid.conf in services_raid_configure().\n"); - return 1; - } - - $raidconf=""; - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $raidconf .= <<<EOD -drive disk_{$diskrv} device {$diskrv} - -EOD; - } // end foreach - - $raidconf .= <<<EOD -volume {$a_raid_conf['name']} - -EOD; - - switch ($a_raid_conf['type']) { - case "0": - $raidconf .= <<<EOD -plex org striped 256k - -EOD; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - - $raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - case "1": - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $raidconf .= <<<EOD -plex org concat - -EOD; - - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - $raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - case "5": - $raidconf .= <<<EOD -plex org raid5 256k - -EOD; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - - $raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - } // end switch - - fwrite($fd, $raidconf); - fclose($fd); - - /* Create each volume */ - mwexec("/sbin/gvinum create {$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf"); - } // end foreach - - - /* start each volume */ - - foreach ($freenas_config['gvinum']['vdisk'] as $a_raid_conf) { - exec("/sbin/gvinum lv $raidname",$rawdata); - - if (strpos($rawdata[0],"State: up")>=0) { continue; } - - mwexec("/sbin/gvinum start {$a_raid_conf['name']}"); - } - } // end if - - return 0; -} - -function disks_raid_configure() -{ - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['raid']['vdisk']) { - foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) { - if (file_exists($g['varrun_path'] . "/raid.conf.dirty") && - ! in_array("{$a_raid_conf['name']}\n",file($g['varrun_path'] . "/raid.conf.dirty"))) { continue; } - - /* generate raid.conf */ - $fd = fopen("{$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf", "w"); - - if (!$fd) { - printf("Error: cannot open raid.conf in services_raid_configure().\n"); - return 1; - } - - $raidconf=""; - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $raidconf .= <<<EOD -drive disk_{$diskrv} device /dev/{$diskrv}s1a - -EOD; - - } // end foreach - - $raidconf .= <<<EOD -volume {$a_raid_conf['name']} - -EOD; - - switch ($a_raid_conf['type']) { - case "0": - $raidconf .= <<<EOD -plex org striped 256k - -EOD; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - -$raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - case "1": - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $raidconf .= <<<EOD -plex org concat - -EOD; - - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - - $raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - case "5": - $raidconf .= <<<EOD -plex org raid5 256k - -EOD; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - /* Get the disksize */ - $disksize=get_disks_size($diskrv); - /* Remove the ending 'B' in 'MB' */ - $disksize=rtrim($disksize, 'B'); - /* - $raidconf .= <<<EOD -sd length {$disksize} drive disk_{$diskrv} - -EOD; -*/ - - $raidconf .= <<<EOD -sd length 0 drive disk_{$diskrv} - -EOD; - - } // end foreach - break; - } // end switch - - fwrite($fd, $raidconf); - fclose($fd); - - /* Create each volume */ - mwexec("/sbin/gvinum create {$g['varetc_path']}/raid-{$a_raid_conf['name']}.conf"); - } // end foreach - - /* start each volume */ - foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) { - exec("/sbin/gvinum lv $raidname",$rawdata); - if (strpos($rawdata[0],"State: up")>=0) { continue; } - mwexec("/sbin/gvinum start {$a_raid_conf['name']}"); - } - } // end if - - return 0; -} - -/* Configure, create and start gmirror volume */ -function disks_raid_gmirror_configure() { - global $freenas_config, $g; - - /* Create the gmirror device */ - if ($freenas_config['gmirror']['vdisk']) { - // Load gmirror - mwexec("/sbin/gmirror load"); - - foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) { - /* Create each volume */ - $cmd = "/sbin/gmirror label -b {$a_raid_conf['balance']} {$a_raid_conf['name']} "; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $cmd .= "{$diskrv} "; - } - - mwexec($cmd); - } - } - - return 0; -} - -/* Configure, create and start gconcat volume */ -function disks_raid_gconcat_configure() { - global $freenas_config, $g; - - if ($freenas_config['gconcat']['vdisk']) { - // Load gconcat - mwexec("/sbin/gconcat load"); - - foreach ($freenas_config['gconcat']['vdisk'] as $a_raid_conf) { - /* Create each volume */ - $cmd = "/sbin/gconcat label {$a_raid_conf['name']} "; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $cmd .= "{$diskrv} "; - } - - mwexec($cmd); - - } - } - - return 0; -} - -/* Configure, create and start gstripe volume */ -function disks_raid_gstripe_configure() { - global $freenas_config, $g; - - if ($freenas_config['gstripe']['vdisk']) { - // Load gstripe - mwexec("/sbin/gstripe load"); - - foreach ($freenas_config['gstripe']['vdisk'] as $a_raid_conf) { - /* Create each volume */ - $cmd = "/sbin/gstripe label {$a_raid_conf['name']} "; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $cmd .= "{$diskrv} "; - } - - mwexec($cmd); - } - } - - return 0; -} - -/* Configure, create and start graid5 volume */ - -function disks_raid_graid5_configure() -{ - global $freenas_config, $g; - - if ($freenas_config['graid5']['vdisk']) { - /* Load graid5 */ - mwexec("/sbin/graid5 load"); - - foreach ($freenas_config['graid5']['vdisk'] as $a_raid_conf) { - /* Create each volume */ - $cmd = "/sbin/graid5 label -s 131072 {$a_raid_conf['name']} "; - - foreach ($a_raid_conf['diskr'] as $diskrk => $diskrv) { - $cmd .= "{$diskrv} "; - } - - mwexec($cmd); - } - } - - return 0; -} - -function disks_raid_start() { - global $freenas_config, $g; - - /* WARNING: Must change this code for advanced RAID configuration ex: RAID1+0 - * Geom RAID volume must be started in 'intelligent' sort, for RAID1+0, gmirror must - * be started before gstripe, etc... - */ - disks_raid_gvinum_start(); - disks_raid_gmirror_start(); - disks_raid_gstripe_start(); - disks_raid_gconcat_start(); - disks_raid_graid5_start(); - - return 0; -} - - -function disks_raid_gvinum_start() { - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['raid']['vdisk']) { - if ($g['booting']) - echo "Start gvinum raid... "; - - /* start each volume */ - foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/gvinum start {$a_raid_conf['name']}"); - } - - if ($g['booting']) - echo "done\n"; - } - - return 0; -} - -function disks_raid_gmirror_start() { - global $freenas_config, $g; - - /* Start Geom mirror */ - if ($freenas_config['gmirror']['vdisk']) { - if ($g['booting']) - echo "Start gmirror raid... "; - - // Load geom mirror module - mwexec("/sbin/gmirror load"); - - if ($g['booting']) - echo "done\n"; - } - - return 0; -} - -/* Start geom concat volumes */ -function disks_raid_gconcat_start() { - global $freenas_config, $g; - -/* Start Geom concat */ - if ($freenas_config['gconcat']['vdisk']) { - if ($g['booting']) - echo "Start gconcat raid... "; - - // Load geom concat module - mwexec("/sbin/gconcat load"); - - if ($g['booting']) - echo "done\n"; - } - - return 0; -} - -/* Start geom stripe volumes */ -function disks_raid_gstripe_start() { - global $freenas_config, $g; - - /* Start Geom stripe */ - if ($freenas_config['gstripe']['vdisk']) { - if ($g['booting']) - echo "Start gstripe raid... "; - - // Load geom stripe module - mwexec("/sbin/gstripe load"); - - if ($g['booting']) - echo "done\n"; - } - - return 0; -} - -/* Start geom raid5 volumes */ -function disks_raid_graid5_start() { - global $freenas_config, $g; - - /* Start Geom RAID5 */ - if ($freenas_config['graid5']['vdisk']) { - if ($g['booting']) - echo "Start graid5 raid... "; - - // Load geom raid5 module - mwexec("/sbin/graid5 load"); - - if ($g['booting']) - echo "done\n"; - } - - return 0; -} - -function disks_raid_stop() { - /* WARNING: Must change this code for advanced RAID configuration ex: RAID1+0 - * Geom RAID volume must be started in 'intelligent' sort, for RAID1+0, gmirror must - * be started before gstripe, etc... - */ - disks_raid_gvinum_stop(); - disks_raid_graid5_stop(); - disks_raid_gstripe_stop(); - disks_raid_gconcat_stop(); - disks_raid_gmirror_stop(); - - return 0; -} - -function disks_raid_gvinum_stop() { - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['raid']['vdisk']) { - /* stop each volume */ - foreach ($freenas_config['raid']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/gvinum stop {$a_raid_conf['name']}"); - } - } - - return 0; -} - -function disks_raid_gmirror_stop() { - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['gmirror']['vdisk']) { - /* start each volume */ - foreach ($freenas_config['gmirror']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/gmirror stop {$a_raid_conf['name']}"); - } - } - - return 0; -} - -/* Stop all geom concat volumes */ -function disks_raid_gconcat_stop() { - global $freenas_config, $g; - - /* Stop geom concat */ - if ($freenas_config['gconcat']['vdisk']) { - /* start each volume */ - foreach ($freenas_config['gconcat']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/gconcat stop {$a_raid_conf['name']}"); - } - } - - return 0; -} - -/* Stop all geom stripe volumes */ -function disks_raid_gstripe_stop() { - global $freenas_config, $g; - - /* Stop geom stripe */ - if ($freenas_config['gstripe']['vdisk']) { - /* start each volume */ - foreach ($freenas_config['gstripe']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/gstripe stop {$a_raid_conf['name']}"); - } - } - - return 0; -} - -/* Stop all geom raid5 volumes */ -function disks_raid_graid5_stop() { - global $freenas_config, $g; - - /* Generate the raid.conf file */ - if ($freenas_config['graid5']['vdisk']) { - /* start each volume */ - foreach ($freenas_config['graid5']['vdisk'] as $a_raid_conf) { - mwexec("/sbin/graid5 stop {$a_raid_conf['name']}"); - } - } - - return 0; -} - - -/* Delete geom gvinum volume given in parameter */ -function disks_raid_gvinum_delete($raidname) { - global $freenas_config, $g; - - exec("/sbin/gvinum lv $raidname",$rawdata); - - if (strpos($rawdata[0],"State: up") === false) { - return 0; - } - - mwexec("/sbin/gvinum rm -r $raidname"); - - foreach ($freenas_config['gvinum']['vdisk'] as $a_raid) { - if ($a_raid['name'] == $raidname) { - foreach ($a_raid['diskr'] as $disk) { - mwexec("/sbin/gvinum rm -r disk_{$disk}"); - } - } - } - - return 0; -} - -/* Delete geom mirror volume given in parameter */ -function disks_raid_gmirror_delete($raidname) { - global $freenas_config, $g; - - // Stop the volume - mwexec("/sbin/gmirror stop $raidname"); - - // Clear the gmirror information on the hard drive - foreach ($freenas_config['gmirror']['vdisk'] as $a_raid) { - if ($a_raid['name'] == $raidname) { - foreach ($a_raid['diskr'] as $disk) { - mwexec("/sbin/gmirror clear {$disk}"); - } - } - } - - return 0; -} - -/* Delete geom concat volume given in parameter */ -function disks_raid_gconcat_delete($raidname) { - global $freenas_config, $g; - - // Stop the volume - mwexec("/sbin/gconcat stop $raidname"); - - // Clear the gconcat information on the hard drive - foreach ($freenas_config['gconcat']['vdisk'] as $a_raid) { - if ($a_raid['name'] == $raidname) { - foreach ($a_raid['diskr'] as $disk) { - mwexec("/sbin/gconcat clear {$disk}"); - } - - mwexec("/sbin/gconcat destroy $raidname"); - } - } - - return 0; -} - -/* Delete geom stripe volume given in parameter */ -function disks_raid_gstripe_delete($raidname) { - global $freenas_config, $g; - - // Stop the volume - mwexec("/sbin/gstripe stop $raidname"); - - // Clear the gconcat information on the hard drive - foreach ($freenas_config['gstripe']['vdisk'] as $a_raid) { - if ($a_raid['name'] == $raidname) { - foreach ($a_raid['diskr'] as $disk) { - mwexec("/sbin/gstripe clear {$disk}"); - } - - mwexec("/sbin/gstripe destroy $raidname"); - } - } - - return 0; -} - -/* Delete geom raid5 volume given in parameter */ -function disks_raid_graid5_delete($raidname) { - global $freenas_config, $g; - - // Stop the volume - mwexec("/sbin/graid5 stop $raidname"); - - // The volume can disapear a few second after stop - sleep(2); - - // Clear the graid5 information on the hard drive - foreach ($freenas_config['graid5']['vdisk'] as $a_raid) { - if ($a_raid['name'] == $raidname) { - foreach ($a_raid['diskr'] as $disk) { - mwexec("/sbin/graid5 remove $raidname {$disk}"); - } - - mwexec("/sbin/graid5 destroy $raidname"); - } - } - - return 0; -} - -/* Initialise HARD DRIVE for installing FreeNAS (creating 2 partition) */ -function fdisk_hd_install($harddrive) { - global $freenas_config, $g; - - /* Initialise HARD DRIVE for installing FreeNAS (creating 2 partition) */ - - /* getting disk information */ - $fdisk_info=fdisk_get_info($harddrive); - - /* setting FreeNAS partition size to 32Mb */ - - $part_freenas_size=32; - - /* convert Mb to b */ - $part_freenas_size=$part_freenas_size * 1024 * 1024; - - $part1_size=$part_freenas_size / $fdisk_info['sec_size']; - $part2_size=$fdisk_info['total'] - $part1_size; - - /* Create fdisk config file */ - - /* generate fdisk.conf */ - $fd = fopen("{$g['varetc_path']}/fdisk.conf", "w"); - if (!$fd) { - printf("Error: cannot open fdisk.conf in fdisk_hd_install().\n"); - return 1; - } - -$fdiskconf .= <<<EOD -g c{$fdisk_info['cyl']} h{$fdisk_info['head']} s{$fdisk_info['sect']} -p 1 165 1 $part1_size -p 2 165 $part1_size $part2_size -p 3 0 0 0 -p 4 0 0 0 -a 1 - -EOD; - - fwrite($fd, $fdiskconf); - fclose($fd); - - /* Fdisk the disk */ - - /* Warning: Ask two questions to the user */ - mwexec("/sbin/fdisk -f {$g['varetc_path']}/fdisk.conf /dev/$harddrive"); - - return 0; -} - -function fdisk_get_info($harddrive) { - /* Return information about an harddrive - - $result['total'] : size - $result['cyl'] : cylinders - $result['head'] : heads - $result['sect'] : sectors/track - $result['sec_size'] : Media sector size - - */ - - global $freenas_config, $g; - - exec("/sbin/fdisk /dev/$harddrive",$rawdata); - - $result=array(); - - foreach ($rawdata as $line) { - /* separe the line by space or egal*/ - $aline= preg_split("/[\s,]+|=/", $line); - $first_word = chop($aline[0]); - - if ($aline[0] == "Media") { - $result['sec_size']=chop($aline[4]); - continue ; - } - - if ($aline[0] == "cylinders") { - $result['cyl']=chop($aline[1]); - $result['head']=chop($aline[3]); - $result['sect']=chop($aline[5]); - continue ; - } - } - - $result['total'] = $result['cyl'] * $result['head'] * $result['sect'] ; - - return $result; -} - -/* Is this function still used ??? */ -function disks_bsdlabel($harddrive,$partition,$type) { - global $freenas_config, $g; - - // Generating BSD Label table - passthru("/sbin/bsdlabel " . escapeshellarg($harddrive) ."$partition > {$g['tmp_path']}/label.tmp"); - - // put this file on a array - $tableau = file("{$g['tmp_path']}/label.tmp"); - - // Open this file in add mode - $handle = fopen("{$g['tmp_path']}/label.tmp", 'a'); - - while(list(,$val) = each($tableau)) { - // If the line contain the word "unused" - if (ereg ("unused",$val)) { - // Replacing c: by a: - // Why ??? Must found the web page where I see this method - $val = ereg_replace ("c:","a:", $val); - // Peplacing unused by $type - $val = ereg_replace ("unused",$type, $val); - // Adding this line add the end of the file - fwrite($handle, $val); - } - } - - // Closing file - fclose($handle); - - // Injecting this new partition table - passthru("/sbin/bsdlabel -R -B " . escapeshellarg($harddrive) ."$partition {$g['tmp_path']}/label.tmp"); -} - - -function disks_set_ataidle() { - global $g, $freenas_config; - - if (is_array($freenas_config['disks']['disk'])) { - foreach ($freenas_config['disks']['disk'] as $disk) { - if ($disk['type']=="IDE") { - /* If UDMA mode forced, launch atacontrol */ - if (isset($disk['udma']) && ($disk['udma'] != "auto")) { - mwexec("/sbin/atacontrol mode {$disk['name']} {$disk['udma']}"); - } - - /* Don't use ataidle if all is disabled */ - if (($disk['harddiskstandby'] == 0) && ($disk['apm'] == 0) && ($disk['acoustic'] == 0)) { continue; } - - /* 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 */ - - $value=trim($disk['name'],'ad'); - - $value=intval($value); - $channel = $value/2; - $device=$value % 2; - $channel=intval($channel); - $time=$disk['harddiskstandby']; - $apm=$disk['apm']; - $ac=$disk['acoustic']; - - $cmd = "/usr/local/sbin/ataidle "; - - if ($disk['acoustic'] != 0) { $cmd .= "-A $ac "; } - if ($disk['apm'] != 0) { $cmd .= "-P $apm "; } - if ($disk['harddiskstandby'] !=0) { $cmd .= "-S $time "; } - - $cmd .= "$channel $device"; - mwexec($cmd); - } // end if - } // end foreach - - return 1; - } // end if - - return 0; -} - -/* Is this function still used ??? -Get list of partition information from disk. -Result is in the form: -[1] => Array -( - [start] => 31 - [size] => 409169 - [type] => 0xa5 - [flags] => 0x80 -) - -Called in disks_manage_tools.php -*/ -function disks_get_partition_info($disk) { - exec("/sbin/fdisk -s {$disk}", $rawdata); - array_shift($rawdata); - array_shift($rawdata); - - $result = array(); - - foreach($rawdata as $partinfo) { - $apartinfo = preg_split("/\s+/", $partinfo); - $partid = chop($apartinfo[1],":"); - - $result[$partid] = array(); - $result[$partid]['start'] = chop($apartinfo[2]); - $result[$partid]['size'] = chop($apartinfo[3]); - $result[$partid]['type'] = chop($apartinfo[4]); - $result[$partid]['flags'] = chop($apartinfo[5]); - } - - return $result; -} - -?> diff --git a/packages/freenas/pkg/freenas_functions.inc b/packages/freenas/pkg/freenas_functions.inc deleted file mode 100644 index fcea4478..00000000 --- a/packages/freenas/pkg/freenas_functions.inc +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_functions.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* include all configuration functions */ -require_once ("freenas_disks.inc"); -require_once ("freenas_utils.inc"); -require_once ("freenas_services.inc"); -require_once ("freenas_system.inc"); - -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas_guiconfig.inc b/packages/freenas/pkg/freenas_guiconfig.inc deleted file mode 100644 index 2dec5a42..00000000 --- a/packages/freenas/pkg/freenas_guiconfig.inc +++ /dev/null @@ -1,288 +0,0 @@ -<?php -/* - guiconfig.inc - part of m0n0wall (http://m0n0.ch/wall) - - Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. - All rights reserved. - - Modified for FreeNAS (http://freenas.org) by Olivier Cochard <cochard@gmail.com> - - 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. -*/ - -$d_mountdirty_path = $g['varrun_path'] . "/mount.dirty"; -$d_diskdirty_path = $g['varrun_path'] . "/disk.dirty"; -$d_raidconfdirty_path = $g['varrun_path'] . "/raid.conf.dirty"; -$d_userconfdirty_path = $g['varrun_path'] . "/user.conf.dirty"; -$d_groupconfdirty_path = $g['varrun_path'] . "/group.conf.dirty"; -$d_smbshareconfdirty_path = $g['varrun_path'] . "/smbshare.conf.dirty"; -$d_nfsexportconfdirty_path = $g['varrun_path'] . "/nfsexport.conf.dirty"; -$d_upnpconfdirty_path = $g['varrun_path'] . "/upnp.conf.dirty"; - -/* ============================================================================= */ -/* == Constants used together with executing a UNIX command line tool == */ -/* ============================================================================= */ - -define("DONE_PARAGRAPH", " - <p> - <span class='red' style='font-family: Courier, monospace; font-size: small;'><strong>Done!</strong></span> - </p> - "); - -define("CMDOUT_PARA", " - <p style='font-size: small;'> - <strong>Command output</strong> (use the toggle icon to unveil detailed infos): - </p> - "); - -define("CMDOUT_PARA_WOHINT", " - <p style='font-size: small;'> - <strong>Command output:</strong> - </p> - "); - -define("CMDOUT_TOGGLE_FUNC", " -function toggle_cmdout(image, totoggle) { - var plusSrc = \"/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png\"; - var minusSrc = \"/themes/{$g['theme']}/images/misc/bullet_toggle_minus.png\"; - var currentSrc = image.src; - var newSrc = (currentSrc.indexOf(\"plus\") >= 0) ? minusSrc : plusSrc; - - image.src = newSrc; - Effect.toggle(totoggle, 'appear', { duration: 0.75 }); -} -"); - -define("CMDOUT_AJAX_SCRIPT", " - <script type='text/javascript'> - function execCMD() { - var to_insert = \"<div style='visibility:hidden' id='loading' name='loading'><img src='/themes/nervecenter/images/misc/loader_tab.gif' \/><\/div>\"; - new Insertion.Before('doCMDSubmit', to_insert); - - $('doCMDSubmit').style.visibility = 'hidden'; - $('loading').style.visibility = 'visible'; - $('cmdOutputTD').innerHTML = ''; - - new Ajax.Request( - \"{$_SERVER['SCRIPT_NAME']}\", { - method : 'post', - parameters : Form.serialize($('iform')), - onSuccess : execCMDComplete, - onFailure : execCMDFailure - } - ); - } - - function execCMDFailure(req) { - if($('doCMDSubmit')) $('doCMDSubmit').style.visibility = 'visible'; - if($('loading')) $('loading').style.visibility = 'hidden'; - if($('inputerrors')) window.scrollTo(0, 0); - if($('inputerrors')) new Effect.Shake($('inputerrors')); - if($('inputerrors')) $('inputerrors').innerHTML = req.responseText; - } - - function execCMDComplete(req) { - $('cmdOutputTD').innerHTML = req.responseText; - $('loading').style.visibility = 'hidden'; - $('doCMDSubmit').style.visibility = 'visible'; - $('cmdOutputTD').style.visibility = 'visible'; - } - </script> -"); - -$freenas_config =& $config['installedpackages']['freenas']['config'][0]; - -/* ============================================================================= */ -/* == Functions used together with executing a UNIX command line tool == */ -/* ============================================================================= */ - -function assemble_cmdout($button, $out, $done = false) { - $dopara = DONE_PARAGRAPH; - - $retvalue =<<<EOD -{$button} -{$out} - -EOD; - - if ($done) { $retvalue .= "{$dopara}\n"; } - return $retvalue; -} - -function create_cmdout_container($id = "", $cmd = "") { - $diskinit_str = ""; - - if (is_array($cmd)) { - foreach ($cmd as $cmdline) { - $a_out = exec_command_and_return_text_array($cmdline); - $diskinit_str .= implode("\n", $a_out); - } - } else { - $a_out = exec_command_and_return_text_array($cmd); - $diskinit_str = implode("\n", $a_out); - } - - $returnval =<<<EOD - <div id="{$id}" style="display: none; font-family: Courier, monospace; font-size: small;"> - <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre> - </div> - -EOD; - - return $returnval; -} - -function create_toggle_button($title, $totoggle) { - global $g; - - $returnval =<<<EOD - <table cellpadding="0" cellspacing="0" border="0" style="padding-bottom: 8px;"> - <tr> - <td align="left" valign="middle" style="padding-right: 5px;"> - <img src='/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png' alt='' border='0' style='border: solid 1px silver; cursor: pointer;' onclick='toggle_cmdout(this, "{$totoggle}");' /> - </td> - <td align="left" valign="middle" style='font-family: Courier, monospace; font-size: small;'> - {$title}: - </td> - </tr> - </table> -EOD; - - return $returnval; -} - -function print_error_box_np($msg) { - global $g; - - echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\">\n"; - echo "<tr><td bgcolor=\"#A12A2A\" width=\"36\" align=\"center\" valign=\"top\"><img src=\"/themes/{$g['theme']}/images/icons/icon_error.gif\" width=\"28\" height=\"32\"></td>\n"; - echo "<td bgcolor=\"#FFD9D1\" style=\"padding-left: 8px; padding-top: 6px\">"; - echo "<span class=\"errmsg\">"; - echo $msg; - echo "</span>"; - echo "</td></tr></table>"; -} - -function print_error_box($msg) { - echo "<p>"; - print_error_box_np($msg); - echo "</p>"; -} - -function mount_sort() { - global $g, $freenas_config; - - function mountcmp($a, $b) { - return strcmp($a['mdisk'], $b['mdisk']); - } - - usort($freenas_config['mounts']['mount'], "mountcmp"); -} - -function disks_sort() { - global $g, $freenas_config; - - function diskcmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['disks']['disk'], "diskcmp"); -} - -function gvinum_sort() { - global $g, $freenas_config; - - function gvinumcmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['gvinum']['vdisk'], "gvinumcmp"); - -} - -function gmirror_sort() { - global $g, $freenas_config; - - function gmirrorcmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['gmirror']['vdisk'], "gmirrorcmp"); - -} - -function gconcat_sort() { - global $g, $freenas_config; - - function gconcatcmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['gconcat']['vdisk'], "gconcatcmp"); - -} - -function gstripe_sort() { - global $g, $freenas_config; - - function gstripecmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['gstripe']['vdisk'], "gstripecmp"); - -} - -function graid5_sort() { - global $g, $freenas_config; - - function graid5cmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($freenas_config['graid5']['vdisk'], "graid5cmp"); - -} - -/* TODO: This needs to be changed */ -function users_sort() { - global $g, $config; - - function userscmp($a, $b) { - return strcmp($a['login'], $b['login']); - } - - usort($config['system']['user'], "userscmp"); -} - -/* TODO: This needs to be changed */ -function groups_sort() { - global $g, $config; - - function groupscmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($config['system']['group'], "groupscmp"); -} -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas_services.inc b/packages/freenas/pkg/freenas_services.inc deleted file mode 100644 index 71401211..00000000 --- a/packages/freenas/pkg/freenas_services.inc +++ /dev/null @@ -1,2025 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_services.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -define ("FTP_BACKEND_PAM", "pam"); -define ("FTP_BACKEND_PLAINTEXT", "plaintext"); -define ("NFS_SERVICE_PORTS", "111 2049 4711"); - -$freenas_config =& $config['installedpackages']['freenas']['config'][0]; - -/* Stop samba, Generate the samba configuration - * file and start samba Return 0 if OK, 1 or - * error code if error - */ -function services_samba_configure() { - global $freenas_config, $g; - - /* kill any running samba */ - killbyname("smbd"); - killbyname("winbindd"); - killbyname("nmbd"); - - if (isset($freenas_config['samba']['enable'])) { - if ($g['booting']) { echo "Starting Samba... "; } - - /* make sure any of the required dirs exist */ - if (! file_exists("{$g['varetc_path']}/private")) { - mkdir("{$g['varetc_path']}/private"); - } - if (! file_exists("{$g['varlog_path']}/samba")) { - mkdir("{$g['varlog_path']}/samba"); - } - - /* generate smb.conf */ - $fd = fopen("{$g['varetc_path']}/smb.conf", "w"); - - if (!$fd) { - printf("Error: cannot open smb.conf in services_samba_configure().\n"); - return 1; - } - - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { return 0; } - - $gen_date = date("F j, Y, g:i a"); - $sambaconf = <<<EOD -# -# smb.conf generated by pfSense -# Generated at: {$gen_date} -# -[global] -encrypt passwords = yes -netbios name = {$freenas_config['samba']['netbiosname']} -workgroup = {$freenas_config['samba']['workgroup']} -server string = {$freenas_config['samba']['serverdesc']} -load printers = no -security = {$freenas_config['samba']['security']} -dns proxy = no -socket options = IPTOS_LOWDELAY TCP_NODELAY -EOD; - - if ($freenas_config['samba']['sndbuf']) { - /* below is a continuation of socket options! */ - $sambaconf .= <<<EOD - SO_SNDBUF={$freenas_config['samba']['sndbuf']} -EOD; - } else { - /* below is a continuation of socket options! */ - $sambaconf .= <<<EOD - SO_SNDBUF=16384 -EOD; - } // end if - - if ($freenas_config['samba']['rcvbuf']) { - /* below is a continuation of socket options! */ - $sambaconf .= <<<EOD - SO_RCVBUF={$freenas_config['samba']['rcvbuf']} -EOD; - } else { - /* below is a continuation of socket options! */ - $sambaconf .= <<<EOD - SO_RCVBUF=16384 -EOD; - } // end if - - if ($freenas_config['samba']['winssrv']) { - $sambaconf .= <<<EOD - -wins server = {$freenas_config['samba']['winssrv']} - -EOD; - } - - if (isset ($freenas_config['samba']['unixcharset'])) { - $sambaconf .= <<<EOD - -unix charset = {$freenas_config['samba']['unixcharset']} - -EOD; - } else { - $sambaconf .= <<<EOD - -unix charset = UTF-8 - -EOD; - - } // end if - - $sambaconf .= <<<EOD - -local master = {$freenas_config['samba']['localmaster']} -time server = {$freenas_config['samba']['timesrv']} -guest account = ftp -display charset = UTF-8 -max log size = 10 -syslog only = yes -syslog = {$config['samba']['loglevel']} -load printers = no -printing = bsd -printcap name = /dev/null -disable spoolss = yes -#Test: Try to improve samba performance under FreeBSD: -use sendfile = yes -strict locking = no -#End of performance section -log level = {$freenas_config['samba']['loglevel']} -dos charset = {$freenas_config['samba']['doscharset']} -smb passwd file = {$g['varetc_path']}/private/smbpasswd -private dir = {$g['varetc_path']}/private - -EOD; - - switch ($freenas_config['samba']['security']) { - case "share": - $sambaconf .= <<<EOD -create mask = 0666 -directory mask = 0777 -passdb backend = smbpasswd - -EOD; - - $guestmode = <<<EOD -guest ok = yes - -EOD; - - break; // end case "share" - case "domain": - $sambaconf .= <<<EOD -passdb backend = smbpasswd -allow trusted domains = No -dns proxy = No -ldap ssl = no -idmap backend = rid:{$freenas_config['samba']['workgroup']}=10000-20000 -idmap uid = 10000-20000 -idmap gid = 10000-20000 -winbind enum groups = yes -winbind enum users = yes -winbind use default domain = Yes -template homedir = /mnt -template shell = /bin/sh - -EOD; - - $guestmode = <<<EOD -guest ok = no - -EOD; - break; // end case "domain": - case "user": - $sambaconf .= <<<EOD -passdb backend = smbpasswd - -EOD; - - $guestmode = <<<EOD -guest ok = no - -EOD; - - break; // end case "user": - } // end switch - - foreach ($freenas_config['mounts']['mount'] as $mountent) { - /* Unmount filesystem if not booting mode*/ - $sambaconf .= <<<EOD - -[{$mountent['sharename']}] -comment = {$mountent['desc']} -path = /mnt/{$mountent['sharename']} -public = yes -writeable = yes -printable = no -veto files = /Network Trash Folder/Icon?/:2e*/.AppleDesktop/.AppleDB/.AppleDouble/TheFindByContentFolder/TheVolumeSettingsFolder/Temporary Items/.snap/ -hide dot files = yes -{$guestmode} - -EOD; - - if ( (is_array($freenas_config['samba']['hidemount']) && in_array($mountent['sharename'],$freenas_config['samba']['hidemount']))) { - $sambaconf .= <<<EOD -browseable = no - -EOD; - - } // end if - - if (isset($freenas_config['samba']['recyclebin'])) { - $sambaconf .= <<<EOD -vfs object = recycle -recycle:repository = Recycle Bin -recycle:keeptree = Yes -recycle:versions = Yes - -EOD; - } // end if - } // end foreach - - fwrite($fd, $sambaconf); - fclose($fd); - - /* run nmbd and nmbd */ - if (isset($freenas_config['ad']['enable'])) { - mwexec("/usr/local/bin/net rpc join -S {$freenas_config['ad']['ad_srv_name']} -U {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}"); - } - - $result |= mwexec("/usr/local/sbin/nmbd -D -s {$g['varetc_path']}/smb.conf"); - - if (isset($freenas_config['ad']['enable'])) { - mwexec("/usr/local/sbin/winbindd -s {$g['varetc_path']}/smb.conf"); - //mwexec("/usr/local/sbin/wbinfo --set-auth-user {$freenas_config['ad']['admin_name']}%{$freenas_config['ad']['admin_pass']}"); - } - - $result |= mwexec("/usr/local/sbin/smbd -D -s {$g['varetc_path']}/smb.conf"); - - /* TEST: Wait for samba starting */ - sleep(2); - - /* Generate the samba password file */ - $result |= system_user_samba(); - - if ($g['booting']) { echo "done\n"; } - }// end if - - return $result; -} - -/* Stop rsync, Generate the rsync configuration file and start - * rsync Return 0 if OK, 1 or error code if error - */ -function services_rsyncd_configure() { - global $freenas_config, $g; - - /* kill any running rsync daemon */ - sigkillbypid("{$g['varrun_path']}/rsyncd.pid", "TERM"); - - if (isset($freenas_config['rsyncd']['enable'])) { - if ($g['booting']) { echo "Starting RSYNC daemon... "; } - - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { return 1; } - - /* generate rsyncd.conf */ - $fd = fopen("{$g['varetc_path']}/rsyncd.conf", "w"); - - if (!$fd) { - printf("Error: cannot open rsyncd.conf in services_rsyncd_configure().\n"); - return 1; - } - - $rsyncdconf = <<<EOD -read only = {$freenas_config['rsyncd']['readonly']} -syslog facility = local4 -list = yes -port = {$freenas_config['rsyncd']['port']} -pid file = {$g['varrun_path']}/rsyncd.pid - -EOD; - - if (!empty($freenas_config['rsyncd']['maxcon'])) { - $rsyncdconf .= <<<EOD -max connections = {$freenas_config['rsyncd']['maxcon']} - -EOD; - } - - if (!empty($freenas_config['rsyncd']['motd'])) { - $rsyncdconf .= <<<EOD -motd file = {$g['varetc_path']}/rsyncd.motd - -EOD; - } - - if (isset($freenas_config['rsyncd']['rsyncd_user'])) { - $rsyncdconf .= <<<EOD -uid = {$freenas_config['rsyncd']['rsyncd_user']} - -EOD; - - } else { - $rsyncdconf .= <<<EOD -uid = ftp -gid = ftp - -EOD; - } // end if - - foreach ($freenas_config['mounts']['mount'] as $mountent) { - /* Unmount filesystem if not booting mode*/ - $rsyncdconf .= <<<EOD - -[{$mountent['sharename']}] -comment = {$mountent['desc']} -path = /mnt/{$mountent['sharename']} - -EOD; - } // end foreach - - fwrite($fd, $rsyncdconf); - fclose($fd); - - // Generate MOTD file if configured - if (!empty($freenas_config['rsyncd']['motd'])) { - $fd = fopen("{$g['varetc_path']}/rsyncd.motd", "w"); - - if (!$fd) { - printf("Error: cannot open rsyncd.motd in services_rsyncd_configure().\n"); - return 1; - } - - $motd = <<<EOD -{$freenas_config['rsyncd']['motd']} - -EOD; - - fwrite($fd, $motd); - fclose($fd); - } // end if - - /* run rsync Daemon */ - $result = mwexec("/usr/local/bin/rsync --daemon --config={$g['varetc_path']}/rsyncd.conf"); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return $result; -} - -/* Stop nfs processes, Generate the nfs configuration file and - * start nfsd processes Return 0 if OK, 1 or error code if error - */ -function services_nfs_configure() { - global $freenas_config, $g; - - /* kill any running nfsd */ - killbyname("rpc.statd"); - killbyname("rpc.lockd"); - killbypid("{$g['varrun_path']}/mountd.pid"); - forcekillbyname("nfsd"); - killbyname("rpcbind"); - - if (isset($freenas_config['nfs']['enable'])) { - if ($g['booting']) { echo "Starting NFS... "; } - - $nfsconf = ""; - $a_nfsconf = array(); - - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { return 1; } - - /* generate exports */ - $fd = fopen("{$g['varetc_path']}/exports", "w"); - - if (!$fd) { - printf("Error: cannot open exports in services_nfs_configure().\n"); - return 1; - } - - $a_mount = &$freenas_config['mounts']['mount']; - $pfnetworks = array(); - - foreach ($a_mount as $mount) { - /* -mapall and -maproot mutually exclusive */ - $mapping = $mount['nfs']['mapall'] == "yes" ? "-mapall=root" : "-maproot=root"; - $networks = isset($mount['nfs']['networks']) ? $mount['nfs']['networks'] : ""; - - $nfsconf = "/mnt/{$mount['sharename']} -alldirs {$mapping}"; - - if ($networks <> "") { - foreach (explode(",", $networks) as $netel) { - list($network,$subnet) = - explode('/', $netel); - - $subnet = gen_subnet_mask($subnet); - $pfnetworks[] = $network; - - $tmp_nfsconf .= "{$nfsconf} -network {$network} -mask {$subnet}\n"; - } - - services_setup_transparency_for("nfs", implode(" ", $pfnetworks)); - $nfsconf = $tmp_nfsconf; - } else { - $nfsconf .= "\n"; - } - } - - fwrite($fd, $nfsconf); - fclose($fd); - - $nfsdbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? " -a" : " -h {$freenas_config['nfs']['bindto']}"; - $rpcbbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? "" : " -h {$freenas_config['nfs']['bindto']}"; - $servetcp = isset($freenas_config['nfs']['servetcp']) ? " -t" : ""; - $serveudp = isset($freenas_config['nfs']['serveudp']) ? " -u" : ""; - - /* run rpcbind, nfsd and mountd */ - mwexec("/usr/sbin/rpcbind{$rpcbbindto}"); - mwexec("/usr/sbin/nfsd{$nfsdbindto}{$serveudp}{$servetcp} -n 4"); - mwexec("/usr/sbin/mountd -p 4711 -r {$g['varetc_path']}/exports"); - mwexec("/usr/sbin/rpc.lockd"); - mwexec("/usr/sbin/rpc.statd"); - - if ($g['booting']) { echo "done\n"; } - } else { - services_remove_transparency_for("nfs"); - }// end if - - return 0; -} - -function services_remove_transparency_for($whom) { - global $g; - - $service_result = mwexec ("pfctl -a \"passin-package-freenas-{$whom}\" -F rules"); - if($service_result <> 0) { - file_notice("FREENAS", "There were error(s) flushing the exclude table", "FREENAS", ""); - } - - unlink_if_exists("{$g['pkg_path']}/pf/freenas-{$whom}.sh"); -} - -function services_setup_transparency_for($whom, $networks) { - global $g, $config, $freenas_config; - - if ($whom == "" || $networks == "") { return; } - - $generatedLANSubnet = gen_subnet($config['interfaces']['lan']['ipaddr'], - $config['interfaces']['lan']['subnet']); - $aliases = ""; - - /* stolen from filter.inc */ - $real_wanif = get_real_wan_interface(); - $wanip = find_interface_ip($real_wanif); - - $wan_aliases = " " . link_ip_to_carp_interface($wanip); - - if (link_int_to_bridge_interface("wan")) - $wan_aliases .= " " . link_int_to_bridge_interface("wan"); - - if ($config['interfaces']['wan']['ipaddr'] == "pppoe" or $config['interfaces']['wan']['ipaddr'] == "pptp") { - $aliases .= "ng0 = \"{ {$config['interfaces']['wan']['if']} {$real_wanif} }\" \n"; - $aliases .= "wan = \"{ {$config['interfaces']['wan']['if']} {$wan_aliases} ng0 }\"\n"; - } else { - $aliases .= "wan = \"{ {$real_wanif} {$wan_aliases} }\"\n"; - } - - $trans_file = fopen("/tmp/freenas-{$whom}.rules","w"); - fwrite($trans_file, "{$aliases}\n"); - - switch ($whom) { - case "nfs": - $nfs_ports = explode(" ", NFS_SERVICE_PORTS); - - foreach ($nfs_ports as $port) { - fwrite($trans_file, "pass in quick on \$wan proto { tcp udp } from { {$networks} } to {$freenas_config['nfs']['bindto']} port = {$port} keep state label \"FreeNAS related rule for {$whom}-{$port}\"\n"); - } - break; - } - fclose($trans_file); - $service_result = mwexec ("pfctl -a \"passin-package-freenas-{$whom}\" -f /tmp/freenas-{$whom}.rules"); - if($service_result <> 0) { - file_notice("FREENAS", "There were error(s) loading the transparency rules", "FREENAS", ""); - } - - /* create a shell script to make sure our filter rules - * are getting loaded upon each filter realod cycle. - */ - $scriptstr = "#!/bin/sh\n\n"; - $scriptstr .= "case $1 in\n"; - $scriptstr .= " start)\n"; - $scriptstr .= " if [ -f /tmp/freenas-nfs.rules ]; then\n"; - $scriptstr .= " /sbin/pfctl -a \"passin-package-freenas-{$whom}\" -f /tmp/freenas-{$whom}.rules\n"; - $scriptstr .= " fi\n"; - $scriptstr .= " ;;\n"; - $scriptstr .= " *)\n"; - $scriptstr .= " echo \"Usage: $0 (start|stop|restart|status|log)\"\n"; - $scriptstr .= " exit 1\n"; - $scriptstr .= "esac\n"; - - file_put_contents("{$g['pkg_path']}/pf/freenas-{$whom}.sh", $scriptstr); - chmod("{$g['pkg_path']}/pf/freenas-{$whom}.sh", 0700); -} - -function services_ftpd_configure() { - global $freenas_config, $g; - // services_vsftpd_configure(); - // services_pureftpd_configure(); - services_wzdftpd_configure(); -} - -function services_wzdftpd_configure() { - global $freenas_config, $config, $g; - - /* kill any WZDFTPD */ - killbyname("wzdftpd"); - - if (isset($freenas_config['ftp']['enable'])) { - if ($g['booting']) { echo "Starting FTP server... "; } - - /* create missing dirs if necessary */ - if (! file_exists("/var/log/wzdftpd")) { mkdir("/var/log/wzdftpd"); } - if (! file_exists("/usr/local/etc/wzdftpd")) { mkdir("/usr/local/etc/wzdftpd"); } - - /* generate wzd.cfg */ - chmod("/usr/local/etc/wzdftpd/wzd.cfg", 0600); - $fd = fopen("/usr/local/etc/wzdftpd/wzd.cfg", "w"); - - if (!$fd) { - printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n"); - return 1; - } - - $ftpconf = <<<EOD -[GLOBAL] -config version = 0.7.2 -backup config = true -port = {$freenas_config['ftp']['port']} - -EOD; - - if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) { - $ftpconf .= <<<EOD -pasv_low_range = {$freenas_config['ftp']['pasv_min_port']} -pasv_high_range = {$freenas_config['ftp']['pasv_max_port']} - -EOD; - } - - $ftpconf .= <<<EOD - -pasv_ip = {$freenas_config['ftp']['pasv_address']} -dir_message = .message -logfile = /var/log/wzdftpd/wzd.log -xferlog = /var/log/wzdftpd/xferlog -logdir = /var/log/wzdftpd -max_threads = {$freenas_config['ftp']['numberclients']} - -backend = /usr/local/share/wzdftpd/backends/libwzd{$freenas_config['ftp']['authentication_backend']}.so - -max_ul_speed = 0 -max_dl_speed = 0 -deny_access_files_uploaded = 1 - -tls_certificate = /usr/local/etc/wzdftpd/wzd.pem -sitefile_ginfo = /usr/local/etc/wzdftpd/file_ginfo.txt -sitefile_group = /usr/local/etc/wzdftpd/file_group.txt -sitefile_user = /usr/local/etc/wzdftpd/file_user.txt - -[pre_ip_check] -localhost = allow - -[perms] -site_addip = +O +G -site_adduser = +O +G -site_backend = +O -site_chacl = +O -site_change = +O +G -site_changegrp = +O +G -site_checkperm = +O -site_chgrp = +O -site_chmod = +O -site_chown = +O -site_chpass = * -site_chratio = +O +G -site_close = +O -site_color = !=guest * -site_delip = +O +G -site_deluser = +O +G -site_flags = -admin -site_free = * -site_ginfo = +O +G -site_give = * -site_group = +O -site_groups = +O -site_grpadd = +O -site_grpaddip = +O -site_grpchange = +O -site_grpdel = +O -site_grpdelip = +O -site_grpkill = +O -site_grpratio = +O -site_grpren = +O -site_gsinfo = +O +G -site_help = * - -EOD; - - if (! empty($freenas_config['ftp']['timeout'])) { - $ftpconf .= "site_idle ={$freenas_config['ftp']['timeout']}\n"; - } else { - $ftpconf .= "site_idle = *\n"; - } - - $ftpconf .= <<<EOD -site_invite = !=guest * -site_kick = +O -site_kill = +O -site_link = +O -site_msg = +O -site_perm = +O -site_purge = +O +G -site_readd = +O +G -site_reload = +O -site_reopen = +O -site_rules = * -site_rusage = +O -site_savecfg = +O -site_sections = +O -site_shutdown = +O -site_su = +O -site_swho = +O -site_tagline = !=guest * -site_take = +O -site_unlock = +O -site_uptime = * -site_user = +O +G -site_users = -admin -site_utime = * -site_vars = +O -site_vars_group = +O -site_vars_user = +O -site_version = +O -site_who = !=guest * -site_wipe = +O -site_vfsls = +O -site_vfsadd = +O -site_vfsdel = +O - -[modules] -/usr/local/share/wzdftpd/modules/libwzd_debug.so = deny -/usr/local/share/wzdftpd/modules/libwzd_test.so = deny -/usr/local/share/wzdftpd/modules/libwzd_sfv.so = allow -/usr/local/share/wzdftpd/modules/libwzd_tcl.so = deny -/usr/local/share/wzdftpd/modules/libwzd_perl.so = deny - -EOD; - - if (empty($config['system']['zeroconf_disable'])) { - $ftpconf .= <<<EOD -/usr/local/share/wzdftpd/modules/libwzd_zeroconf.so = allow - -[ZEROCONF] -zeroconf_port = {$freenas_config['ftp']['port']} -zeroconf_username = wzdftpd -zeroconf_password = wzdftpd -zeroconf_path = / - -EOD; - - } - - $ftpconf .= <<<EOD - -[sfv] -progressmeter = [WzD] - %3d%% Complete - [WzD] -del_progressmeter = \[.*] - ...% Complete - \[WzD] -incomplete_indicator = ../(incomplete)-%0 -other_completebar = [WzD] - ( %.0mM %fF - COMPLETE ) - [WzD] - -[plaintext] -param = /usr/local/etc/wzdftpd/users - -[sections] -ALL = /* ^([]\[A-Za-z0-9_.'() \\t+-])*\$ - -[cron] - -[events] - -[custom_commands] -site_rules = !/usr/local/etc/wzdftpd/file_rules.txt - -site_groups = !/usr/local/etc/wzdftpd/file_groups.txt -site_help = !/usr/local/etc/wzdftpd/file_help.txt -site_swho = !/usr/local/etc/wzdftpd/file_swho.txt -site_users = !/usr/local/etc/wzdftpd/file_users.txt -site_vfsls = !/usr/local/etc/wzdftpd/file_vfs.txt -site_who = !/usr/local/etc/wzdftpd/file_who.txt - -[vfs] - -[messages] - -EOD; - - if (isset($freenas_config['ftp']['banner'])) { - $ftpconf .= "200 = {$freenas_config['ftp']['banner']}"; - } else { - $ftpconf .= "200 = Welcome to pfSense FTP service"; - } - - fwrite($fd, $ftpconf); - fclose($fd); - chmod("/usr/local/etc/wzdftpd/wzd.cfg", 0400); - - /* now generate the plaintext users file (if applicable) */ - if ($freenas_config['ftp']['authentication_backend'] == FTP_BACKEND_PLAINTEXT) { - $ftpusers = "[GROUPS]\n"; - $a_group =& $config['system']['group']; - $a_user =& $config['system']['user']; - - for ($i = 0; $i < count($a_group); $i++) { - $group = $a_group[$i]; - $gid = $i + 1; - - $ftpusers .= <<<EOD - -privgroup {$group['name']} -gid={$gid} -default_home=/ - -EOD; - } // end foreach - - /* anonymous group */ - if (! empty($freenas_config['ftp']['anonymous'])) { - $ftpusers .= <<<EOD - -privgroup anonymous -max_idle_time=10 -gid=3 -default_home=/home - -EOD; - } - - /* same for users */ - $ftpusers .= "[USERS]\n"; - for ($i = 0; $i < count($a_user); $i++) { - $user = $a_user[$i]; - $ftpusers .= <<<EOD - -name={$user['name']} -pass={$user['password']} -home=/ -uid={$i} -groups={$user['groupname']} -rights=0xffffffff - -EOD; - } // end foreach - - /* anonymous user */ - if (! empty($freenas_config['ftp']['anonymous'])) { - $ftpusers .= <<<EOD - -name=guest -pass=% -home=/tmp -uid=200 -groups=anonymous -rights=0x10003 -ip_allowed=* -max_dl_speed=20480 -credits=0 -bytes_ul_total=0 -bytes_dl_total=1918812 -num_logins=2 - -EOD; - } // end if - - $ftpusers .= "[HOSTS]\nall = *\n"; - chmod("/usr/local/etc/wzdftpd/users", 0600); - file_put_contents("/usr/local/etc/wzdftpd/users", $ftpusers); - chmod("/usr/local/etc/wzdftpd/users", 0400); - } // end if - - /* run vsftpd */ - mwexec("/usr/local/sbin/wzdftpd -f /usr/local/etc/wzdftpd/wzd.cfg"); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return 0; -} - -/* this function is currently not used */ -function services_vsftpd_configure() { - global $freenas_config, $g; - - /* kill any VSFTPD */ - killbyname("vsftpd"); - - if (isset($freenas_config['ftp']['enable'])) { - if ($g['booting']) { echo "Starting FTP server... "; } - - /* generate vfstpd.conf */ - $fd = fopen("{$g['varetc_path']}/vsftpd.conf", "w"); - - if (!$fd) { - printf("Error: cannot open vsftpd.conf in services_vsftpd_configure().\n"); - return 1; - } - - $ftpconf = <<<EOD -# Standalone mode -listen=YES -background=YES -listen_port={$freenas_config['ftp']['port']} -max_clients={$freenas_config['ftp']['numberclients']} -max_per_ip={$freenas_config['ftp']['maxconperip']} -xferlog_enable=YES -#vsftpd_log_file=/var/log/ftp.log -syslog_enable=YES -# Access rights -anonymous_enable={$freenas_config['ftp']['anonymous']} -local_enable={$freenas_config['ftp']['localuser']} -write_enable=YES -hide_file=.snap -anon_other_write_enable=YES -anon_upload_enable=YES -anon_mkdir_write_enable=YES -chroot_local_user=YES -local_umask=066 -anon_umask=066 -chmod_enable=YES -pasv_address={$freenas_config['ftp']['pasv_address']} -# Features -ls_recurse_enable=YES -# Performance -idle_session_timeout={$freenas_config['ftp']['timeout']} - -EOD; - if (isset($freenas_config['ftp']['banner'])) { - $ftpconf .= <<<EOD -ftpd_banner={$freenas_config['ftp']['banner']} - -EOD; - } else { - $ftpconf .= <<<EOD -ftpd_banner=Welcome to pfSense FTP service - -EOD; - } - - if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) { - $ftpconf .= <<<EOD -pasv_max_port={$freenas_config['ftp']['pasv_max_port']} -pasv_min_port={$freenas_config['ftp']['pasv_min_port']} - -EOD; - } - - if ($freenas_config['ftp']['pasv_address']) { - $ftpconf .= <<<EOD -pasv_address={$freenas_config['ftp']['pasv_address']} - -EOD; - } - - fwrite($fd, $ftpconf); - fclose($fd); - - /* run vsftpd */ - mwexec("/usr/local/sbin/vsftpd {$g['varetc_path']}/vsftpd.conf"); - - if ($g['booting']) { echo "done\n"; } - } - - return 0; -} - -function services_pureftpd_configure() { - global $freenas_config, $g; - - /* kill any Pure-FTPD */ - killbyname("pure-ftpd"); - - if (isset($freenas_config['ftp']['enable'])) { - if ($g['booting']) { echo "Starting FTP server... "; } - - /* Generate the banner file */ - $fd = fopen("/mnt/.banner", "w"); - - if (!$fd) { - printf("Error: cannot open .banner in services_pureftpd_configure().\n"); - return 1; - } - - if (empty($freenas_config['ftp']['banner'])) { - $banner = <<<EOD -Welcome to pfSense FTP service - -EOD; - } else { - $banner = <<<EOD -{$freenas_config['ftp']['banner']} - -EOD; - } // end if - - fwrite($fd, $banner); - fclose($fd); - - /* run pure-ftpd */ - $cmd = "/usr/local/sbin/pure-ftpd -S {$freenas_config['ftp']['port']} -c {$freenas_config['ftp']['numberclients']} -C {$freenas_config['ftp']['maxconperip']} -I {$freenas_config['ftp']['timeout']} -M U 077:077 -B -b "; - - if ( (isset($freenas_config['ftp']['anonymous'])) && (!isset($freenas_config['ftp']['localuser']))) { - $cmd .= "-e "; - } - - if ( (!isset($freenas_config['ftp']['anonymous'])) && (isset($freenas_config['ftp']['localuser']))) { - $cmd .= "-E "; - } - - if ($freenas_config['ftp']['pasv_min_port'] && $freenas_config['ftp']['pasv_max_port']) { - $cmd .= "-p {$freenas_config['ftp']['pasv_min_port']}:{$freenas_config['ftp']['pasv_max_port']} "; - } - - if ($freenas_config['ftp']['pasv_address']) { - $cmd .= "-P {$freenas_config['ftp']['pasv_address']} "; - } - - if ($freenas_config['ftp']['natmode']) { - $cmd .= "-N "; - } - - if ($freenas_config['ftp']['passiveip']) { - $cmd .= "-P {$freenas_config['ftp']['passiveip']} "; - } - - if ($freenas_config['ftp']['fxp']) { - $cmd .= "-W "; - } - - mwexec($cmd); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return 0; -} - -/* Stop smartd, Generate the configuration file and start - * smartd Return 0 if OK, 1 or error code if error - */ -function services_smart_configure() { - global $config, $g; - - /* kill any running smartd */ - killbyname("smartd"); - - if (isset($config['system']['smart'])) { - if ($g['booting']) { echo "Starting smartd... "; } - - /* run smartd */ - mwexec("/usr/local/sbin/smartd --logfacility=local5"); - - if ($g['booting']) { echo "done\n"; } - } - - return 0; -} - -/* Generate the unison configuration - * Return 0 if OK, 1 or error code if error - */ -function services_unison_configure() { - global $freenas_config, $g; - $result = 0 ; - - if ($g['booting']) { echo "Configuring unison... \n"; } - - if (isset($freenas_config['unison']['enable'])) { - /* ensure unison workdir exists */ - $workdir = "/mnt/{$freenas_config['unison']['share']}/{$config['unison']['workdir']}"; - - if (isset($freenas_config['unison']['makedir']) && !file_exists($workdir)) { - if (!mkdir($workdir)) { - printf("Error: cannot mkdir $workdir in services_unison_configure().\n"); - } - - exec("/bin/chmod 775 $workdir"); - } - - if (!file_exists($workdir)) { - printf("Error: cannot open $workdir in services_unison_configure().\n"); - $result = 1 ; - } - - /* add workdir to login.conf UNISON environment variable */ - $logfile = "{$g['etc_path']}/login.conf"; - - if (!file_exists("$logfile")) { - printf("Error: $logfile doesn't exist, in services_unison_configure().\n"); - $result = 1 ; - } - - $tmp = file_get_contents("$logfile"); - $search = "/UNISON=.*?(?=[,:])/"; - - if (!preg_match($search, $tmp)) { - printf("Error: cannot find UNISON in $logfile, in services_unison_configure().\n"); - $result = 1 ; - } - - $tmp = preg_replace($search, "UNISON=$workdir", $tmp); - - if (!file_put_contents($logfile, $tmp)) { - printf("Error: couldn't write $logfile, in services_unison_configure().\n"); - $result = 1 ; - } - } // end if - - $tmp = ""; - - return $result; -} - -/* Stop and start ushare - * Return 0 if OK, 1 or error code if error - */ -function services_ushare_configure() { - global $freenas_config, $g; - - $result = 0 ; - - /* Kill any running uShare */ - killbyname("ushare"); - - /* Delete multicast route. */ - mwexec("/sbin/route delete -net 239.0.0.0"); - - if(isset($freenas_config['upnp']['enable'])) { - if($g['booting']) { echo "Starting UPnP server... "; } - - /* Setup a multicast route for UPnP messages. */ - // TODO: where to get the upnp iface? - $result = mwexec("/sbin/route add -net 239.0.0.0 -netmask 255.0.0.0 -interface " . escapeshellarg($freenas_config['upnp']['if'])); - - $content = ""; - foreach($freenas_config['upnp']['content'] as $contentv) { - $content .= " --content=$contentv"; - } - - /* Run uShare as daemon. */ - // TODO: where to get the upnp iface? - $result |= mwexec("/usr/local/bin/ushare --daemon --no-web --name={$freenas_config['upnp']['name']} --interface={$freenas_config['upnp']['if']} {$content}"); - } // end if - - return $result; -} - -function services_cron_configure() { - global $freenas_config, $g; - - /* kill any running cron */ - killbyname("cron"); - - /* ======================================================================= */ - /* = configure crontab item for rsyncclient = */ - /* ======================================================================= */ - if (isset($freenas_config['rsyncclient']['enable'])) { - if ($g['booting']) { echo "Configuring cron for rsync client... "; } - - if ($freenas_config['rsyncclient']['all_mins'] == "0") { - foreach ($freenas_config['rsyncclient']['minute'] as $minutev) { - if (strlen($cron_min) > 0) { - $cron_min = $cron_min . "," . $minutev; - } else { - $cron_min = $minutev; - } - } // end foreach - } else { - $cron_min = "*"; - } // end if - - if ($freenas_config['rsyncclient']['all_hours'] == "0") { - foreach ($freenas_config['rsyncclient']['hour'] as $hourv) { - if (strlen($cron_hour) > 0) { - $cron_hour = $cron_hour . "," . $hourv; - } else { - $cron_hour = $hourv; - } - } // end foreach - } else { - $cron_hour = "*"; - } // end if - - if ($freenas_config['rsyncclient']['all_days'] == "0") { - foreach ($freenas_config['rsyncclient']['day'] as $dayv) { - if (strlen($cron_day) > 0) { - $cron_day = $cron_day . "," . $dayv; - } else { - $cron_day = $dayv; - } - } // end foreach - } else { - $cron_day = "*"; - } // end if - - if ($freenas_config['rsyncclient']['all_months'] == "0") { - foreach ($freenas_config['rsyncclient']['month'] as $monthv) { - if (strlen($cron_month) > 0) { - $cron_month = $cron_month . "," . $monthv; - } else { - $cron_month = $monthv; - } - } // end foreach - } else { - $cron_month = "*"; - } // end if - - if ($freenas_config['rsyncclient']['all_weekday'] == "0") { - foreach ($freenas_config['rsyncclient']['weekday'] as $weekdayv) { - if (strlen($cron_weekday) > 0) { - $cron_weekday = $cron_weekday . "," . $weekdayv; - } else { - $cron_weekday = $weekdayv; - } - } // end foreach - } else { - $cron_weekday = "*"; - } // end if - - $cron_item = array(); - $cron_item['minute'] = "{$cron_min}"; - $cron_item['hour'] = "{$cron_hour}"; - $cron_item['mday'] = "{$cron_day}"; - $cron_item['month'] = "{$cron_month}"; - $cron_item['wday'] = "{$cron_weekday}"; - $cron_item['who'] = "root"; - $cron_item['command'] = "{$g['varrun_path']}/sync.sh"; - - $config['cron']['item'][] = $cron_item; - - if ($g['booting']) { echo "done\n"; } - } // end if - - /* Erase all variable used previously */ - unset ($cron_min, $cron_hour, $cron_day, $cron_month, $cron_weekday); - - /* ======================================================================= */ - /* = configure crontab item for rsync local part = */ - /* ======================================================================= */ - if (isset($freenas_config['rsync_local']['enable'])) { - if ($g['booting']) { echo "Configuring cron for local rsync... "; } - - if ($freenas_config['rsync_local']['all_mins'] == "0") { - foreach ($freenas_config['rsync_local']['minute'] as $minutev) { - if (strlen($cron_min) > 0) { - $cron_min = $cron_min . "," . $minutev; - } else { - $cron_min = $minutev; - } - } // end foreach - } else { - $cron_min = "*"; - } // end if - - if ($freenas_config['rsync_local']['all_hours'] == "0") { - foreach ($freenas_config['rsync_local']['hour'] as $hourv) { - if (strlen($cron_hour) > 0) { - $cron_hour = $cron_hour . "," . $hourv; - } else { - $cron_hour = $hourv; - } - } // end foreach - } else { - $cron_hour = "*"; - } // end if - - if ($freenas_config['rsync_local']['all_days'] == "0") { - foreach ($freenas_config['rsync_local']['day'] as $dayv) { - if (strlen($cron_day) > 0) { - $cron_day = $cron_day . "," . $dayv; - } else { - $cron_day = $dayv; - } - } // end foreach - } else { - $cron_day = "*"; - } // end if - - if ($freenas_config['rsync_local']['all_months'] == "0") { - foreach ($freenas_config['rsync_local']['month'] as $monthv) { - if (strlen($cron_month) > 0) { - $cron_month = $cron_month . "," . $monthv; - } else { - $cron_month = $monthv; - } - } // end foreach - } else { - $cron_month = "*"; - } // end if - - if ($freenas_config['rsync_local']['all_weekday'] == "0") { - foreach ($freenas_config['rsync_local']['weekday'] as $weekdayv) { - if (strlen($cron_weekday) > 0) { - $cron_weekday = $cron_weekday . "," . $weekdayv; - } else { - $cron_weekday = $weekdayv; - } - } // end foreach - } else { - $cron_weekday = "*"; - } - - $cron_item = array(); - $cron_item['minute'] = "{$cron_min}"; - $cron_item['hour'] = "{$cron_hour}"; - $cron_item['mday'] = "{$cron_day}"; - $cron_item['month'] = "{$cron_month}"; - $cron_item['wday'] = "{$cron_weekday}"; - $cron_item['who'] = "root"; - $cron_item['command'] = "{$g['varrun_path']}/sync.sh"; - - $config['cron']['item'][] = $cron_item; - - if ($g['booting']) { echo "done\n"; } - } - - /* Erase all variable used previously */ - unset ($cron_min, $cron_hour, $cron_day, $cron_month, $cron_weekday); - - /* ======================================================================= */ - /* = configure crontab item shutdown part = */ - /* ======================================================================= */ - if (isset($freenas_config['shutdown']['enable'])) { - if ($g['booting']) { echo "Configuring cron for shutdown... "; } - - if ($freenas_config['shutdown']['all_mins'] == "0") { - foreach ($freenas_config['shutdown']['minute'] as $minutev) { - if (strlen($cron_min) > 0) { - $cron_min = $cron_min . "," . $minutev; - } else { - $cron_min = $minutev; - } - } // end foreach - } else { - $cron_min = "*"; - } // end if - - if ($freenas_config['shutdown']['all_hours'] == "0") { - foreach ($freenas_config['shutdown']['hour'] as $hourv) { - if (strlen($cron_hour) > 0) { - $cron_hour = $cron_hour . "," . $hourv; - } else { - $cron_hour = $hourv; - } - } // end foreach - } else { - $cron_hour = "*"; - } // end if - - if ($freenas_config['shutdown']['all_days'] == "0") { - foreach ($freenas_config['shutdown']['day'] as $dayv) { - if (strlen($cron_day) > 0) { - $cron_day = $cron_day . "," . $dayv; - } else { - $cron_day = $dayv; - } - } // end foreach - } else { - $cron_day = "*"; - } // end if - - if ($freenas_config['shutdown']['all_months'] == "0") { - foreach ($freenas_config['shutdown']['month'] as $monthv) { - if (strlen($cron_month) > 0) { - $cron_month = $cron_month . "," . $monthv; - } else { - $cron_month = $monthv; - } - } // end foreach - } else { - $cron_month = "*"; - } // end if - - if ($freenas_config['shutdown']['all_weekday'] == "0") { - foreach ($freenas_config['shutdown']['weekday'] as $weekdayv) { - if (strlen($cron_weekday) > 0) { - $cron_weekday = $cron_weekday . "," . $weekdayv; - } else { - $cron_weekday = $weekdayv; - } - } // end foreach - } else { - $cron_weekday = "*"; - } // end if - - $cron_item = array(); - $cron_item['minute'] = "{$cron_min}"; - $cron_item['hour'] = "{$cron_hour}"; - $cron_item['mday'] = "{$cron_day}"; - $cron_item['month'] = "{$cron_month}"; - $cron_item['wday'] = "{$cron_weekday}"; - $cron_item['who'] = "root"; - $cron_item['command'] = "{$g['varrun_path']}/sync.sh"; - - $config['cron']['item'][] = $cron_item; - - if ($g['booting']) { echo "done\n"; } - } // end if - - /* call the pfSense configure_cron function */ - configure_cron(); - - /* run cron */ - mwexec("/usr/sbin/cron -s"); - - return 0; -} - -function services_rsyncclient_configure() { - global $freenas_config, $g; - - // Generate a shell script that is used by cron - // Generate crontab works - if (isset($freenas_config['rsyncclient']['enable'])) { - if ($g['booting']) { echo "Generating synchronizing cron script... "; } - - /* generate /var/run/sync.sh script */ - $fd = fopen("{$g['varrun_path']}/sync.sh", "w"); - - if (!$fd) { - printf("Error: cannot open /var/run/sync.sh in services_rsyncclient_configure().\n"); - return 1; - } - - $syncscript = <<<EOD -#!/bin/sh - -if [ -r /var/run/rsync-running ]; then -exit -fi -/usr/bin/touch /var/run/rsync-running - -EOD; - - $opt_delete=""; - if (isset($freenas_config['rsyncclient']['opt_delete'])) { - $opt_delete = "--delete --delete-after "; - } - - foreach ($freenas_config['rsyncclient']['sharetosync'] as $sharek => $sharev) { - $syncscript .= <<<EOD -/usr/local/bin/rsync -rtz {$opt_delete}rsync://{$freenas_config['rsyncclient']['rsyncserverip']}/{$sharev} /mnt/{$sharev} - -EOD; - } // end foreach - - $syncscript .= <<<EOD -/bin/rm -f /var/run/rsync-running - -EOD; - - fwrite($fd,$syncscript); - fclose($fd); - - /* Add exectutive right to the script */ - exec("/bin/chmod 770 {$g['varrun_path']}/sync.sh"); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return 0; -} - -function services_rsync_local_configure() { - global $freenas_config, $g; - - // Generate a shell script that is used by cron - // Generate crontab works - if (isset($freenas_config['rsync_local']['enable'])) { - if ($g['booting']) { echo "Generating local rsync cron script... "; } - - /* generate /var/run/sync_local.sh script */ - $fd = fopen("{$g['varrun_path']}/sync_local.sh", "w"); - - if (!$fd) { - printf("Error: cannot open /var/run/sync_local.sh in services_rsync_local_configure().\n"); - return 1; - } - - $syncscript = <<<EOD -#!/bin/sh - -if [ -r /var/run/rsync_local-running ]; then -exit -fi -/usr/bin/touch /var/run/rsync_local-running - -EOD; - - $opt_delete=""; - if (isset($freenas_config['rsync_local']['opt_delete'])) { - $opt_delete = "--delete --delete-after "; - } - - $syncscript .= <<<EOD -/usr/local/bin/rsync -a {$opt_delete} /mnt/{$freenas_config['rsync_local']['source']} /mnt/{$freenas_config['rsync_local']['destination']} - -EOD; - - $syncscript .= <<<EOD -/bin/rm -f /var/run/rsync_local-running - -EOD; - - fwrite($fd,$syncscript); - fclose($fd); - - /* Add exectutive right to the script */ - exec("/bin/chmod 770 {$g['varrun_path']}/sync_local.sh"); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return 0; -} - -function services_radius_configure() { - global $freenas_config, $g; - - if (isset($config['radius']['enable'])) { - /* generate radius.conf */ - $fd = fopen("{$g['varetc_path']}/radius.conf", "w"); - - if (!$fd) { - printf("Error: cannot open radius.conf in services_radius_configure().\n"); - return 1; - } - - $radiusconf = <<<EOD -auth {$config['radius']['radiusip']}:{$config['radius']['port']} {$config['radius']['secret']} {$config['radius']['timeout']} {$config['radius']['maxretry']} - -EOD; - - fwrite($fd, $radiusconf); - fclose($fd); - } // end if - - return 0; -} - -/* Stop, Generate the config file and start - * AFP Return 0 if OK, 1 or error code if error - */ -function services_afpd_configure() { - global $freenas_config, $config, $g; - - /* kill any afpd */ - killbyname("afpd"); - - if (isset($freenas_config['afp']['enable'])) { - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { return 1; } - if ($g['booting']) { echo "Starting AFP server... "; } - - if (empty($freenas_config['afp']['afpname'])) { - $afpname="-"; - } else { - $afpname=$freenas_config['afp']['afpname']; - } - - /* generate afpd.conf */ - $fd = fopen("{$g['varetc_path']}/afpd.conf", "w"); - - if (!$fd) { - printf("Error: cannot open afpd.conf in services_afpd_configure().\n"); - return 1; - } - - $afpconf = <<<EOD -{$afpname} -transall -uamlist -EOD; - - if (empty($config['system']['zeroconf_disable'])) { - $afpconf .= <<<EOD - -noslp -fqdn {$config['system']['hostname']}.{$config['system']['domain']} -uamlist -EOD; - } else { - $afpconf .= <<<EOD - -noslp -nozeroconf -uamlist -EOD; - } // end if - - if (isset($freenas_config['afp']['guest']) && isset($freenas_config['afp']['local']) ) { - $afpconf .= <<<EOD - uams_guest.so,uams_clrtxt.so,uams_dhx.so -EOD; - } else if (isset($freenas_config['afp']['guest'])) { - $afpconf .= <<<EOD - uams_guest.so -EOD; - } else if (isset($freenas_config['afp']['local'])) { - $afpconf .= <<<EOD - uams_clrtxt.so,uams_dhx.so -EOD; - } - - $afpconf .= <<<EOD - -nosavepassword -defaultvol {$g['varetc_path']}/AppleVolumes.default -systemvol {$g['varetc_path']}/AppleVolumes.system -uampath /etc/uams -guestname ftp - -EOD; - - fwrite($fd, $afpconf); - fclose($fd); - - /* generate AppleVolumes.default */ - $fd = fopen("{$g['varetc_path']}/AppleVolumes.default", "w"); - - if (!$fd) { - printf("Error: cannot open AppleVolumes.default in services_afpd_configure().\n"); - return 1; - } - - $a_mount = &$freenas_config['mounts']['mount']; - - foreach ($a_mount as $mount) { - $AppleVolumes .= <<<EOD -/mnt/{$mount['sharename']} "{$mount['sharename']}" - -EOD; - - } // end foreach - - fwrite($fd, $AppleVolumes); - fclose($fd); - - /* run afpdpd */ - mwexec("/usr/local/sbin/afpd -F {$g['varetc_path']}/afpd.conf"); - - if ($g['booting']) { echo "done\n"; } - } // end if - - return 0; -} - -function services_nis_configure() { - global $freenas_config, $g; - - return 0; -} - -/* Start iscsi initiator - * Return 0 if Ok, 1 or error code if problem - */ -/* TODO: NEED TO STOP IT TOO ??? */ -function services_iscsi_configure() { - global $freenas_config, $g; - - if (isset($freenas_config['iscsi']['enable'])) { - if ($g['booting']) { echo "Starting iSCSI driver... "; } - - $result = mwexec("/sbin/kldload kdload /boot/kernel/iscsi_initiator.ko"); - $result |= mwexec("/sbin/sysctl debug.iscsi=0"); - $result |= mwexec("/usr/local/sbin/iscontrol targetaddress={$freenas_config['iscsi']['targetaddress']} TargetName={$freenas_config['iscsi']['targetname']}"); - - if ($g['booting']) { echo "done\n"; } - } - - if (isset($result)) { return $result; } - return 0; -} - -function services_zeroconf_configure() { - //services_mdnsresponder_configure(); - //services_howl_configure(); - return services_avahi_configure(); -} - -function services_avahi_configure() { - global $freenas_config, $config, $g; - - $service_template = <<<EOD -<?xml version="1.0" standalone='no'?> -<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> -<service-group> - - <name replace-wildcards="yes">@SERVICE_DESC@ on %h</name> - - <service> - <type>@TYPE@</type> - <port>@PORT@</port> - @TXT_RECORDS@ - </service> - -</service-group> - -EOD; - - /* kill any running dbus daemon */ - sigkillbypid("{$g['varrun_path']}/dbus/dbus.pid", "TERM"); - - unlink_if_exists("{$g['varrun_path']}/dbus/dbus.pid"); - - /* kill any running avahi daemons */ - mwexec("/usr/local/sbin/avahi-daemon -k"); - - /* simply return if zeroconf isn't enabled */ - if (isset($config['system']['zeroconf_disable'])) { return 0; } - - /* configure Avahi and it's dependencies */ - if (! file_exists("/usr/local/etc/avahi/services")) { - mwexec("mkdir -p /usr/local/etc/avahi/services"); - } - - /* add HTTP service type */ - $webproto = $config['system']['webgui']['protocol']; - - if (isset($config['system']['webgui']['port'])) { - $webservice = str_replace("@PORT@", - $config['system']['webgui']['port'], - $service_template); - $webservice = str_replace("@TYPE@", - "_{$webproto}._tcp", - $webservice); - $webservice = str_replace("@SERVICE_DESC@", - "pfSense webGUI", - $webservice); - $webservice = str_replace("@TXT_RECORDS@", - "", - $webservice); - - file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice); - } else { - $webservice = str_replace("@PORT@", - "80", - $service_template); - $webservice = str_replace("@TYPE@", - "_{$webproto}._tcp", - $webservice); - $webservice = str_replace("@SERVICE_DESC@", - "pfSense webGUI", - $webservice); - $webservice = str_replace("@TXT_RECORDS@", - "", - $webservice); - - file_put_contents("/usr/local/etc/avahi/services/http.service", $webservice); - } // end if - - /* afp is announcing itself */ - if (isset($freenas_config['afp']['enable'])) { - /* NOP */ - } - - /* add rsync service type */ - if (isset($freenas_config['rsyncd']['enable'])) { - $rsyncservice = str_replace("@PORT@", - $freenas_config['rsyncd']['port'], - $service_template); - $rsyncservice = str_replace("@TYPE@", - "_rsync._tcp", - $rsyncservice); - $rsyncservice = str_replace("@SERVICE_DESC@", - "Remote Sync Daemon", - $rsyncservice); - $rsyncservice = str_replace("@TXT_RECORDS@", - "", - $rsyncservice); - - file_put_contents("/usr/local/etc/avahi/services/rsync.service", $rsyncservice); - } // end if - - /* add ntp service type */ - if ($config['ntpd']['mode'] == "server") { - $ntpdservice = str_replace("@PORT@", - "123", - $service_template); - $ntpdservice = str_replace("@TYPE@", - "_ntp._udp", - $ntpdservice); - $ntpdservice = str_replace("@SERVICE_DESC@", - "Network Time Daemon", - $ntpdservice); - $ntpdservice = str_replace("@TXT_RECORDS@", - "", - $ntpdservice); - - file_put_contents("/usr/local/etc/avahi/services/ntpd.service", $ntpdservice); - } // end if - - if (isset($config['system']['ssh']['enable'])) { - $sshservice = str_replace("@PORT@", - "22", - $service_template); - $sshservice = str_replace("@TYPE@", - "_ssh._tcp", - $sshservice); - $sshservice = str_replace("@SERVICE_DESC@", - "Remote Terminal", - $sshservice); - $sshservice = str_replace("@TXT_RECORDS@", - "", - $sshservice); - - file_put_contents("/usr/local/etc/avahi/services/ssh.service", $sshservice); - - /* do the same for sftp, cause we do enable it by dfeault */ - $sftpservice = str_replace("@PORT@", - "22", - $service_template); - $sftpservice = str_replace("@TYPE@", - "_ssh._tcp", - $sftpservice); - $sftpservice = str_replace("@SERVICE_DESC@", - "Remote Terminal", - $sftpservice); - $sftpservice = str_replace("@TXT_RECORDS@", - "", - $sftpservice); - - file_put_contents("/usr/local/etc/avahi/services/ssh-sftp.service", $sftpservice); - } // end if - - /* we are using wzdftpd, which has the ability to announce itself */ - if (isset($freenas_config['ftp']['enable'])) { - /* NOP */ - } - - if (isset($freenas_config['samba']['enable'])) { - $cifsservice = str_replace("@PORT@", - "139", - $service_template); - $cifsservice = str_replace("@TYPE@", - "_smb._tcp", - $cifsservice); - $cifsservice = str_replace("@SERVICE_DESC@", - "Samba Server", - $cifsservice); - $cifsservice = str_replace("@TXT_RECORDS@", - "", - $cifsservice); - - file_put_contents("/usr/local/etc/avahi/services/cifs.service", $cifsservice); - } - - if (isset($freenas_config['nfs']['enable'])) { - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { break; } - - $a_mount = &$freenas_config['mounts']['mount']; - - foreach ($a_mount as $mount) { - $sharename = str_replace(" ", "", $mount['sharename']); - $sharename = strtolower($sharename); - - $nfsservice = str_replace("@PORT@", - "2049", - $service_template); - $nfsservice = str_replace("@TYPE@", - "_nfs._tcp", - $nfsservice); - $nfsservice = str_replace("@SERVICE_DESC@", - "NFS Mount: {$mount['sharename']}", - $nfsservice); - $nfsservice = str_replace("@TXT_RECORDS@", - "path=/mnt/{$mount['sharename']}", - $nfsservice); - - file_put_contents("/usr/local/etc/avahi/services/{$sharename}_nfs.service", $nfsservice); - } // end foreach - } // end if - - /* run dbus */ - mwexec("/usr/local/bin/dbus-daemon --system"); - /* run avahi */ - mwexec("/usr/local/sbin/avahi-daemon -D"); - - if ($g['booting']) { echo "done\n"; } - - return 0; -} - -/* this function is currently not used */ -function services_howl_configure() { - global $freenas_config, $config, $g; - - /* kill any mDNSResponder */ - killbyname("mDNSResponder"); - - if (isset($config['system']['zeroconf_disable'])) { return 0; } - - $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w"); - - if (!$fd) { - printf("Error: cannot open mDNSResponder.conf in services_howl_configure().\n"); - return 1; - } - - if ($config['system']['webgui']['port']) { - $mDNSResponder = <<<EOD -"{$config['system']['hostname']} Web Admin" _http._tcp local. {$config['system']['webgui']['port']} - -EOD; - } else { - $mDNSResponder = <<<EOD -"{$config['system']['hostname']} Web Admin" _http._tcp local. 80 - -EOD; - } // end if - - if (isset($freenas_config['afp']['enable'])) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} AFP Server" _afpovertcp._tcp local. 548 - -EOD; - } - - if (isset($freenas_config['rsyncd']['enable'])) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} RSYNC Server" _rsync._tcp. local. {$freenas_config['rsyncd']['port']} - -EOD; - } - - if (isset($config['sshd']['enable'])) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} SSH Server" _ssh._tcp local. {$config['sshd']['port']} - -EOD; - } - - if (isset($freenas_config['ftp']['enable'])) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} FTP Server" _ftp._tcp local. {$freenas_config['ftp']['port']} - -EOD; - } - - if (isset($freenas_config['samba']['enable'])) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} Samba Server" _smb._tcp local. 139 - -EOD; - } - - if (isset($freenas_config['nfs']['enable'])) { - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { break; } - - $a_mount = &$freenas_config['mounts']['mount']; - - foreach ($a_mount as $mount) { - $mDNSResponder .= <<<EOD -"{$config['system']['hostname']} NFS: {$mount['sharename']}" _nfs._tcp local. 2049 path=/mnt/{$mount['sharename']} - -EOD; - } // end foreach - } // end if - - fwrite($fd, $mDNSResponder); - fclose($fd); - - - /* run mDNSResponder */ - mwexec("/usr/local/sbin/mDNSResponder -f {$g['varetc_path']}/mDNSResponder.conf"); - - if ($g['booting']) { echo "done\n"; } - - return 0; -} - -/* this function is currently not used */ -function services_mdnsresponder_configure() { - global $freenas_config, $config, $g; - - /* kill any running snmpd */ - sigkillbypid("{$g['varrun_path']}/mDNSResponder.pid", "TERM"); - - if (isset($config['system']['zeroconf_disable'])) { return 0; } - - $fd = fopen("{$g['varetc_path']}/mDNSResponder.conf", "w"); - - if (!$fd) { - printf("Error: cannot open mDNSResponder.conf in services_bonjour_configure().\n"); - return 1; - } - - if ($config['system']['webgui']['port']) { - $mDNSResponder = <<<EOD -"{$config['system']['hostname']} Web Admin" -_http._tcp local. -{$config['system']['webgui']['port']} - -EOD; - } else { - $mDNSResponder = <<<EOD -"{$config['system']['hostname']} Web Admin" -_http._tcp local. -80 - -EOD; - } // end if - - if (isset($freenas_config['afp']['enable'])) { - $mDNSResponder .= <<<EOD - -"{$config['system']['hostname']} AFP Server" -_afpovertcp._tcp local. -548 - -EOD; - } - - if (isset($freenas_config['rsyncd']['enable'])) { - $mDNSResponder .= <<<EOD - -"{$config['system']['hostname']} RSYNC Server" -_rsync._tcp. local. -{$freenas_config['rsyncd']['port']} - -EOD; - } - - if (isset($config['sshd']['enable'])) { - $mDNSResponder .= <<<EOD - -"{$freenas_config['system']['hostname']} SSH Server" -_ssh._tcp local. -{$config['sshd']['port']} - -EOD; - } - - if (isset($freenas_config['ftp']['enable'])) { - $mDNSResponder .= <<<EOD - -"{$config['system']['hostname']} FTP Server" -_ftp._tcp local. -{$freenas_config['ftp']['port']} - -EOD; - } - - if (isset($freenas_config['samba']['enable'])) { - $mDNSResponder .= <<<EOD - -"{$config['system']['hostname']} Samba Server" -_smb._tcp local. -139 - -EOD; - } - - if (isset($freenas_config['nfs']['enable'])) { - /* If no share configured, exit */ - if (!is_array($freenas_config['mounts']['mount'])) { break; } - - $a_mount = &$freenas_config['mounts']['mount']; - - foreach ($a_mount as $mount) { - $mDNSResponder .= <<<EOD - -"{$config['system']['hostname']} NFS: {$mount['sharename']}" -_nfs._tcp local. -2049 path=/mnt/{$mount['sharename']} - -EOD; - } // end foreach - } - - fwrite($fd, $mDNSResponder); - fclose($fd); - - - /* run mDNSResponder */ - mwexec("/usr/local/sbin/mDNSResponderPosix -b -f {$g['varetc_path']}/mDNSResponder.conf"); - - if ($g['booting']) { echo "done\n"; } - - return 0; -} -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas_system.inc b/packages/freenas/pkg/freenas_system.inc deleted file mode 100644 index 2bd0a30a..00000000 --- a/packages/freenas/pkg/freenas_system.inc +++ /dev/null @@ -1,838 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_system.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -require_once("globals.inc"); - -$freenas_config =& $config['installedpackages']['freenas']['config'][0]; - -function system_do_extensions($early = false) { - global $config, $g; - - if (!is_dir("{$g['etc_path']}/inc/ext")) { return; } - - $dh = @opendir("{$g['etc_path']}/inc/ext"); - - if ($dh) { - while (($extd = readdir($dh)) !== false) { - if (($extd === ".") || ($extd === "..")) { continue; } - - $rcfile = "{$g['etc_path']}/inc/ext/" . $extd . "/" . ($early ? "rc.early" : "rc"); - - if (file_exists($rcfile)) { passthru($rcfile); } - } // end while - - closedir($dh); - } // end if -} - -function system_set_termcap() { - global $config; - - if (isset($config['diag']['ipfstatentries'])) { - $lines = $config['diag']['ipfstatentries'] + 6; - } else { - $lines = 306; - } - - /* do not remove the tabs below or replace them using whitespaces */ - $termcap = <<<EOD -cons25w|ansiw|ansi80x25-raw:\ - :am:bs:NP:ms:pt:AX:eo:bw:ut:km:\ - :co#80:li#25:pa#64:Co#8:it#8:\ - :al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :dc=\E[P:dl=\E[M:do=\E[B:bt=\E[Z:ho=\E[H:ic=\E[@:cb=\E[1K:\ - :nd=\E[C:rs=\Ec:so=\E[7m:se=\E[27m:up=\E[A:cr=^M:ta=^I:\ - :AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:sc=\E7:rc=\E8:\ - :k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:k5=\E[Q:k6=\E[R:k7=\E[S:k8=\E[T:\ - :k9=\E[U:k;=\E[V:F1=\E[W:F2=\E[X:K2=\E[E:nw=\E[E:ec=\E[%dX:\ - :kb=^H:kh=\E[H:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:le=^H:sf=\E[S:sr=\E[T:\ - :kN=\E[G:kP=\E[I:@7=\E[F:kI=\E[L:kD=\\177:kB=\E[Z:\ - :IC=\E[%d@:DC=\E[%dP:SF=\E[%dS:SR=\E[%dT:AL=\E[%dL:DL=\E[%dM:\ - :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:cv=\E[%i%dd:ch=\E[%i%d`:\ - :mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:bl=^G:\ - :ve=\E[=S:vi=\E[=1S:vs=\E[=2S: -cons25|ansis|ansi80x25:\ - :ac=l\\332m\\300k\\277j\\331u\\264t\\303v\\301w\\302q\\304x\\263n\\305`^Da\\260f\\370g\\361~\\371.^Y-^Xh\\261i^U0\\333y\\363z\\362:\ - :tc=cons25w: -dumb|su|unknown:\ - :am:co#132:li#$lines:do=^J: -xterm-noapp|xterm with cursor keys in normal mode:\ - :kl=\E[D:kd=\E[B:kr=\E[C:ku=\E[A:ks=\E=:ke=\E>:ti@:te@:tc=xterm: -xterm|xterm-color|X11 terminal emulator:\ - :ti@:te@:tc=xterm-xfree86: -xterm-xfree86|XFree86 xterm:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ - :kH=\EOF:@7=\EOF:kI=\E[2~:\ - :kh=\EOH:*6=\EOF:kP=\E[5~:kN=\E[6~:\ - :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:Km=\E[M:tc=xterm-basic: -xterm-basic|xterm common (XFree86):\ - :li#24:co#80:am:kn#12:km:mi:ms:xn:bl=^G:\ - :is=\E[!p\E[?3;4l\E[4l\E>:rs=\E[!p\E[?3;4l\E[4l\E>:le=^H:\ - :AL=\E[%dL:DL=\E[%dM:DC=\E[%dP:al=\E[L:dc=\E[P:dl=\E[M:\ - :UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :ho=\E[H:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:\ - :im=\E[4h:ei=\E[4l:ks=\E[?1h\E=:ke=\E[?1l\E>:kD=\E[3~:kb=^H:\ - :sf=\n:sr=\EM:st=\EH:ct=\E[3g:sc=\E7:rc=\E8:\ - :eA=\E(B\E)0:as=^N:ae=^O:ml=\El:mu=\Em:up=\E[A:nd=\E[C:\ - :md=\E[1m:me=\E[m^O:mr=\E[7m:so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\ - :ti=\E[?1049h:te=\E[?1049l:vi=\E[?25l:ve=\E[?25h:\ - :ut:Co#8:pa#64:op=\E[39;49m:AB=\E[4%dm:AF=\E[3%dm:\ - -EOD; - - if (!file_exists("/usr/share/misc")) { mkdir("/usr/share/misc"); } - - $fd = @fopen("/usr/share/misc/termcap", "w"); - - if (!$fd) { - printf("Error: cannot open termcap in system_set_termcap().\n"); - return 1; - } - - chmod("/usr/share/misc/termcap", 0644); - fwrite($fd, $termcap); - fclose($fd); - - return 0; -} - -/* TODO: Figure out whether this function can be removed cause - * implements its own user management framework. - */ -function system_users_create() { - /* Create All the passwd file */ - global $config, $g; - - if ($g['booting']) { echo "Generating user database... "; } - - system_user_masterpasswd(); - system_user_group(); - system_user_pwdmkdb(); - - if ($g['booting']) { echo "done\n"; } - - return 0; -} - -/* TODO: Figure out whether this function can be removed cause - * implements its own user management framework. - */ -function system_user_masterpasswd() { - /* Create the master.passwd file*/ - global $config, $g, $userindex, $groupindex; - $root = getUNIXRoot(); - - $masterpasswd = <<<EOD -root:{$root['password']}:0:0::0:0:Charlie &:/root:/bin/sh -toor:*:0:0::0:0:Bourne-again Superuser:/root: -daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin -operator:*:2:5::0:0:System &:/:/usr/sbin/nologin -bin:*:3:7::0:0:Binaries Commands and Source:/:/usr/sbin/nologin -tty:*:4:65533::0:0:Tty Sandbox:/:/usr/sbin/nologin -kmem:*:5:65533::0:0:KMem Sandbox:/:/usr/sbin/nologin -smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin -mailnull:*:26:26::0:0:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin -proxy:*:62:62::0:0:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin -_pflogd:*:64:64::0:0:pflogd privsep user:/var/empty:/usr/sbin/nologin -www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin -nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin -dhcpd:*:1002:1002::0:0:DHCP Daemon:/nonexistent:/sbin/nologin -_dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin -_isakmpd:*:68:68::0:0:isakmpd privsep:/var/empty:/sbin/nologin -ftp:*:21:50::0:0:FTP user:/mnt:/sbin/nologin -sshd:*:22:22::0:0:Secure Shell Daemon:/var/empty:/usr/sbin/nologin - -EOD; - - if (is_array($config['system']['user'])) { - foreach ($config['system']['user'] as $user) { - $password= $user['password']; - $groupname = $user['groupname']; - $group =& $config['system']['group'][$groupindex[$groupname]]; - - if (empty($user['uid'])) { - $newuser = assignUID($user['name']); - $newgroup = assignGID($groupname); - if (! empty($newuser)) { $user = $newuser; } - if (! empty($newgroup)) { $group = $newgroup; } - } - - if (hasShellAccess($user['name'])) { - $masterpasswd .= <<<EOD -{$user['name']}:{$password}:{$user['uid']}:{$group['gid']}::0:0:{$user['fullname']}:/mnt:/etc/rc.initial - -EOD; - } else { - $masterpasswd .= <<<EOD -{$user['name']}:{$password}:{$user['uid']}:{$group['gid']}::0:0:{$user['fullname']}:/mnt:/usr/local/bin/scponly - -EOD; - } // end if - } // end foreach - } // end if - - $fd = fopen("/etc/master.passwd", "w"); - - if (!$fd) { - printf("Error: cannot open master.passwd in system_user_masterpasswd().\n"); - return 1; - } - - fwrite($fd, $masterpasswd); - fclose($fd); - -return 0; -} - -/* TODO: Figure out whether this function can be removed cause - * implements its own user management framework. - */ -function system_user_group() { - /* Create the group file*/ - global $config, $g; - - $groupfile = <<<EOD -wheel:*:0:root -EOD; - - /* If user exist with full shell, put them on the wheel group */ - if (is_array($config['system']['user'])) { - foreach ($config['system']['user'] as $user) { - if (hasShellAccess($user['name']) && isSystemAdmin($user['name'])) { - $groupfile .= <<<EOD -,{$user['name']} -EOD; - } // end if - } // end foreach - } // end if - - $groupfile .= <<<EOD - -daemon:*:1: -kmem:*:2: -sys:*:3: -tty:*:4: -operator:*:5:root -mail:*:6: -bin:*:7: -staff:*:20: -EOD; - - /* If user exist without full shell, put them on the staff group */ - if (is_array($config['system']['user'])) { - foreach ($config['system']['user'] as $user) { - if (hasShellAccess($user['name'])) { - $groupfile .= <<<EOD -{$user['name']}, -EOD; - } // end if - } // end foreach - } // end if - - $groupfile .= <<<EOD - -sshd:*:22: -smmsp:*:25: -mailnull:*:26: -guest:*:31: -proxy:*:62: -_pflogd:*:64: -_dhcp:*:65: -ftp:*:50: -authpf:*:63: -network:*:69: -www:*:80: -nogroup:*:65533: -nobody:*:65534: -admin:*:0: - -EOD; - - if (is_array($config['system']['group'])) { - foreach ($config['system']['group'] as $group) { - if (empty($group['gid'])) { - $newgroup = assignGID($group['name']); - if (! empty($newgroup)) { $group = $newgroup; } - } - - $groupfile .= <<<EOD -{$group['name']}:*:{$group['gid']}: - -EOD; - } // end foreach - } // end if - - $fd = fopen("/etc/group", "w"); - - if (!$fd) { - printf("Error: cannot open group in system_user_group().\n"); - return 1; - } - - fwrite($fd, $groupfile); - fclose($fd); - - return 0; -} - -function system_user_pwdmkdb() { - /* Generate the db of password */ - global $config, $g; - - mwexec("/usr/sbin/pwd_mkdb -p -d /etc /etc/master.passwd"); - - return 0; -} - -function system_user_samba() { - /* Generate the db of password */ - - // TODO: MUST FIND A WAY OF USING UNIX CRYPTED PASSWORD IN THE PLACE OF CLEAR TEXT PASSWORD FOR GENERATING SAMBA DB!!! - - global $config, $g; - - if (is_array($config['system']['user'])) { - foreach ($config['system']['user'] as $user) { - /* TODO: the password in config.xml is already encrypted */ - $password = escapeshellcmd($user['password']); - $login = escapeshellcmd($user['name']); - mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/smbpasswd -s -a {$login}"); - //mwexec("(/bin/echo {$password}; /bin/echo {$password}) | /usr/local/bin/pdbedit -tau {$login}"); - } // end foreach - } // end if - - return 0; - -} - -function system_pam_configure() { - /* Create the pam configuration files*/ - global $config, $g; - - if (!file_exists("{$g['varetc_path']}/pam.d")) { - mkdir("{$g['varetc_path']}/pam.d", 0744); - } - - $system = <<<EOD -# System-wide defaults -# auth -auth sufficient pam_opie.so no_warn no_fake_prompts -auth requisite pam_opieaccess.so no_warn allow_local - -EOD; - - if (isset($config['ad']['enable'])) { - $system .= <<<EOD -#auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $system .= <<<EOD -auth required pam_unix.so no_warn try_first_pass nullok - -# account - -EOD; - - if (isset($config['ad']['enable'])) { - $system .= <<<EOD -#account sufficient /usr/local/lib/pam_winbind.so - -EOD; - } - - $system .= <<<EOD -account required pam_login_access.so -account required pam_unix.so - -# session -session required pam_lastlog.so no_fail - -# password - -EOD; - - if (isset($config['ad']['enable'])) { - $system .= <<<EOD -#password sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $system .= <<<EOD -password required pam_unix.so no_warn try_first_pass - -EOD; - - $fd = fopen("{$g['varetc_path']}/pam.d/system", "w"); - - if (!$fd) { - printf("Error: cannot open /pam.d/system in system_pam_configure().\n"); - return 1; - } - - fwrite($fd, $system); - fclose($fd); - - $sshd .= <<<EOD -# PAM configuration for the "sshd" service - -# auth -auth required pam_nologin.so no_warn -auth sufficient pam_opie.so no_warn no_fake_prompts -auth requisite pam_opieaccess.so no_warn allow_local - -EOD; - - if (isset($config['ad']['enable'])) { - $sshd .= <<<EOD -auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $sshd .= <<<EOD -auth required pam_unix.so no_warn try_first_pass - -# account - -EOD; - - if (isset($config['ad']['enable'])) { - $sshd .= <<<EOD -account sufficient /usr/local/lib/pam_winbind.so - -EOD; - } - - $sshd .= <<<EOD -account required pam_unix.so - -# session -session required pam_permit.so - -# password - -EOD; - - if (isset($config['ad']['enable'])) { - $sshd .= <<<EOD -password sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $sshd .= <<<EOD -password required pam_unix.so no_warn try_first_pass - -EOD; - - unset($fd); - $fd = fopen("{$g['varetc_path']}/pam.d/sshd", "w"); - - if (!$fd) { - printf("Error: cannot open /pam.d/sshd in system_pam_configure().\n"); - return 1; - } - - fwrite($fd, $sshd); - fclose($fd); - - $ftp = <<<EOD -# PAM configuration for the "ftpd" service - -# auth -auth required pam_nologin.so no_warn -auth sufficient pam_opie.so no_warn no_fake_prompts -auth requisite pam_opieaccess.so no_warn allow_local - -EOD; - - if (isset($config['ad']['enable'])) { - $ftp .= <<<EOD -auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $ftp .= <<<EOD -auth required pam_unix.so no_warn try_first_pass - -# account - -EOD; - - if (isset($config['ad']['enable'])) { - $ftp .= <<<EOD -account sufficient /usr/local/lib/pam_winbind.so - -EOD; - } - - $ftp .= <<<EOD -account required pam_login_access.so -account required pam_unix.so - -# session -session required pam_permit.so - -EOD; - - unset($fd); - $fd = fopen("{$g['varetc_path']}/pam.d/ftp", "w"); - - if (!$fd) { - printf("Error: cannot open /pam.d/ftp in system_pam_configure().\n"); - return 1; - } - - fwrite($fd, $ftp); - fclose($fd); - - $login = <<<EOD -# PAM configuration for the "login" service -# - -# auth -auth required pam_nologin.so no_warn - -EOD; - - if (isset($config['ad']['enable'])) { - $login .= <<<EOD -auth sufficient /usr/local/lib/pam_winbind.so debug try_first_pass - -EOD; - } - - $login .= <<<EOD -auth sufficient pam_self.so no_warn -auth include system - -# account - -EOD; - - if (isset($config['ad']['enable'])) { - $login .= <<<EOD -account sufficient /usr/local/lib/pam_winbind.so - -EOD; - } - - $login .= <<<EOD -account requisite pam_securetty.so -account include system - -# session -session include system - -# password -password include system - -EOD; - - unset($fd); - $fd = fopen("{$g['varetc_path']}/pam.d/login", "w"); - - if (!$fd) { - printf("Error: cannot open /pam.d/login in system_pam_configure().\n"); - return 1; - } - - fwrite($fd, $login); - fclose($fd); - - unset($fd); - - /* Create the nsswitch.conf file*/ - if (isset($config['ad']['enable'])) { - $nsswitch = <<<EOD -group: files winbind -group_compat: nis -hosts: files dns wins -networks: files -passwd: files winbind -passwd_compat: nis -shells: files - -EOD; - } else { - $nsswitch = <<<EOD -group: compat -group_compat: nis -hosts: files dns -networks: files -passwd: compat -passwd_compat: nis -shells: files - -EOD; - } // end if - - $fd = fopen("{$g['varetc_path']}/nsswitch.conf", "w"); - - if (!$fd) { - printf("Error: cannot open /var/etc/nsswitch.conf in system_pam_configure().\n"); - return 1; - } - - fwrite($fd, $nsswitch); - fclose($fd); - - unset($fd); - - return 0; -} - -function system_tuning() { - /* fine tune kernel value */ - global $config, $g; - - if (isset($config['system']['tune'])) { - if ($g['booting']) { echo 'Tuning the system... '; } - - mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=0'); - mwexec('/sbin/sysctl net.inet.tcp.sendspace=65536'); - mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536'); - mwexec('/sbin/sysctl net.inet.udp.recvspace=65536'); - mwexec('/sbin/sysctl net.inet.udp.maxdgram=57344'); - mwexec('/sbin/sysctl net.local.stream.recvspace=65535'); - mwexec('/sbin/sysctl net.local.stream.sendspace=65535'); - mwexec('/sbin/sysctl kern.ipc.maxsockbuf=2097152'); - mwexec('/sbin/sysctl kern.ipc.somaxconn=8192'); - /* This variable can be set on the boot conf file only: */ - /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */ - mwexec('/sbin/sysctl kern.ipc.nmbclusters=60000'); - mwexec('/sbin/sysctl kern.maxfiles=65536'); - mwexec('/sbin/sysctl kern.maxfilesperproc=32768'); - mwexec('/sbin/sysctl net.inet.tcp.inflight.enable=0'); - - if ($g['booting']) { echo "done\n"; } - return 0; - } else { - /* Set the default value (if previously changed) if not booting mode */ - if (!$g['booting']) { - mwexec('/sbin/sysctl net.inet.tcp.delayed_ack=1'); - mwexec('/sbin/sysctl net.inet.tcp.sendspace=32768'); - mwexec('/sbin/sysctl net.inet.tcp.recvspace=65536'); - mwexec('/sbin/sysctl net.inet.udp.recvspace=42080'); - mwexec('/sbin/sysctl net.inet.udp.maxdgram=9216'); - mwexec('/sbin/sysctl net.local.stream.recvspace=8192'); - mwexec('/sbin/sysctl net.local.stream.sendspace=8192'); - mwexec('/sbin/sysctl kern.ipc.maxsockbuf=262144'); - mwexec('/sbin/sysctl kern.ipc.somaxconn=128'); - /* mwexec('/sbin/sysctl kern.ipc.maxsockets=16424'); */ - mwexec('/sbin/sysctl kern.ipc.nmbclusters=3072'); - mwexec('/sbin/sysctl kern.maxfiles=1064'); - mwexec('/sbin/sysctl kern.maxfilesperproc=957'); - } // end if - - return 0; - } // end if -} - -/* TODO: Probably a function that is not needed */ -function system_install_mount_cd($cdrom) { - /* Part of install process: Mount the CDROM */ - global $config, $g; - - /* Creating tempo directory for cdrom*/ - echo "Creating Mount point for the CDROM:\n"; - if (mwexec("/bin/mkdir /mnt/cdrom_fr_0507")) { return 1; } - - /* Mounting the CDROM */ - echo "Mount CDROM:\n"; - if (mwexec("/sbin/mount_cd9660 /dev/$cdrom /mnt/cdrom_fr_0507")) { return 1; } - - return 0; -} - -/* TODO: Probably a function that is not needed */ -function system_install_init_fulldisk($harddrive) { - /* Part of install process: Initialize the destination disk with one partition */ - global $config, $g; - - echo "Erasing partitions:\n"; - if (mwexec("/bin/dd if=/dev/zero of=/dev/$harddrive bs=1k count=20")) { return 1; } - - echo "Creating the primary partition and install simple MBR:\n"; - if (mwexec("/sbin/fdisk -BI -b /boot/mbr $harddrive")) { return 1; } - - /* Must wait that the /dev is upatded with the new information */ - /* There should be a more intelligent code here than this stupid timer... */ - echo "Waiting for system update.."; - $devtotest="/dev/$harddrive". "s1"; - $i=0; - - while (!file_exists($devtotest)) { - sleep(1); - echo "."; - $i++; - - if ($i==20) { return 1; } - } - echo "\n"; - - echo "Erasing primary partition:\n"; - if (mwexec("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($harddrive) . "s1 bs=32k count=16")) { - return 1; - } - - echo "Creating FreeBSD partition:\n"; - if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto")) { - return 1; - } - - echo "Setting BSDlabel:\n"; - - disks_bsdlabel($harddrive,"s1","4.2BSD"); - - echo "Creating UFS filesystem:\n"; - if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1")) { return 1; } - - return 0; -} - -/* TODO: Probably a function that is not needed */ -function system_install_init_halfdisk($harddrive) { - /* Part of install process: Initialize the destination disk with 2 partitions */ - global $config, $g; - - /* Create the partitions */ - fdisk_hd_install($harddrive); - - if (mwexec("(/bin/echo y; /bin/echo y) | /sbin/fdisk -B -b /boot/mbr $harddrive")) { return 0; } - - /* Must wait that the /dev is upatded with the new information */ - echo "Waiting for system update.."; - - $devtotest="/dev/$harddrive". "s2"; - $i=0; - while (!file_exists($devtotest)) { - sleep(1); - echo "."; - $i++; - - if ($i==20) { return 1; } - } - echo "\n"; - - echo "Creating BSD Label:\n"; - if (mwexec("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($harddrive) ."s1 auto")) { - return 1; - } - if (mwexec("/sbin/bsdlabel -w " . escapeshellarg($harddrive) ."s2 auto")) { - return 1; - } - - echo "Modify BSD Label information:\n"; - - disks_bsdlabel($harddrive,"s1","4.2BSD"); - disks_bsdlabel($harddrive,"s2","4.2BSD"); - - echo "Creating filesystem:\n"; - if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s1")) { - return 1; - } - if (mwexec("/sbin/newfs -U /dev/" . escapeshellarg($harddrive) . "s2")) { - return 1; - } - - return 0; -} - -/* TODO: Probably a function that is not needed */ -function system_install_mount_destdisk($harddrive) { - /* Part of install process: Mount the destination disk */ - global $config, $g; - - echo "Creation tempory mouting point:\n"; - if (mwexec("/bin/mkdir /mnt/install_fr_0507")) { return 1; } - - echo "Mount destination disk:\n"; - if (mwexec("/sbin/mount /dev/" . escapeshellarg($harddrive) . "s1 /mnt/install_fr_0507")) { - return 1; - } - - return 0; -} - -/* TODO: Probably a function that is not needed */ -function system_install_unmount() { - /* Part of install process: Unmounting the disk */ - global $config, $g; - - /* Unmounting disk */ - if (mwexec("/sbin/umount /mnt/install_fr_0507")) { return 1; } - if (mwexec("/sbin/umount /mnt/cdrom_fr_0507")) { return 1; } - - /* using 'rm -rf' for deleting the temp directory is too dangerous here... */ - /* - if (mwexec("/bin/rm -rf /mnt/cdrom_fr_0507")) { return 1; } - if (mwexec("/bin/rm -rf /mnt/install_fr_0507")) { return 1; } - */ - - /* Test: replace with PHP function rmdir */ - @rmdir ("/mnt/cdrom_fr_0507"); - @rmdir ("/mnt/install_fr_0507"); - - return 0; -} - -/* TODO: Probably a function that is not needed */ -function system_install_installation($harddrive) { - /* Part of install process: dd image file on the destination disk */ - global $config, $g; - - echo "Installation:\n"; - if (mwexec("/usr/bin/gunzip -S \"\" -c /mnt/cdrom_fr_0507/FreeNAS-generic-pc.gz | dd of=/dev/" . escapeshellarg($harddrive) . " bs=16k > /dev/null 2>&1")) { - return 1; - } - - return 0; -} - -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/freenas_utils.inc b/packages/freenas/pkg/freenas_utils.inc deleted file mode 100644 index 6e5d8872..00000000 --- a/packages/freenas/pkg/freenas_utils.inc +++ /dev/null @@ -1,1049 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - freenas_utils.inc - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* returns true if $desc is a valid description (alphanum and space, _ , - , .)*/ -function is_validdesc($desc) { - if (!is_string($desc)) { return false; } - - if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $desc)) { - return true; - } else { - return false; - } -} - -/* returns true if $login is a valid login name (alphanum,dot, _ , -)*/ -function is_validlogin($login) { - if (!is_string($login)) { return false; } - - if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $login)) { - return true; - } else { - return false; - } -} - -/* returns true if $password is a valid password (not used of special : character)*/ -function is_validpassword($password) { - if (!is_string($password)) { return false; } - - if (strstr($password, ':')) { - return false; - } else { - return true; - } -} - -/* returns true if $login is a valid share name (alphanum,dot, _ , -)*/ -function is_validsharename($sharename) { - if (!is_string($sharename)) { return false; } - - if (preg_match("/^[A-Za-z0-9]([A-Za-z0-9_\-\.\s]*[A-Za-z0-9])*$/", $sharename)){ - return true; - } else { - return false; - } -} - -/* Returns true if $workgroup is a valid workgroup name */ -/* A workgroup name can contain up to 15 characters, including letters, numbers, */ -/* and the following characters: ! @ # $ % ^ & ( ) _ - ; : ' " , . */ -/* It cannot contain any spaces, and must begin with a letter or number. */ -function is_workgroup($workgroup) { - if (!is_string($workgroup)) { return false; } - - if (preg_match("/^[\w\d]+[\w\d\!\@\#\$\%\^\&\(\)\_\-\;\:\'\"\,\.]*$/", $workgroup)) { - return true; - } else { - return false; - } -} - -function get_mounts_list() -{ - // Return list of mounted disk - //example: Array - // [0] => Array - // ( - // [mp] => /mnt/ad0s1 - // [mdisk] => ad0s1 - // ) - global $g; - - exec("/sbin/mount",$rawdata); - - $mountlist = array(); - $i=0; - - foreach ($rawdata as $line) { - $aline = explode(" ", $line); - - if ((chop($aline[0]) == "/dev/md0") || (chop($aline[0]) == "devfs") || (chop($aline[0]) == "/dev/fd0")) { - continue; - } - - $mountlist[$i]['fullname'] = chop($aline[0]); - $mountlist[$i]['mp'] = chop($aline[2]); - - // Get the complete name /dev/devicename - $complete = explode("/",chop($aline[0])); - $devname = $complete[2]; - - // Test if it's a gvinum or gmirror device - if ((strcmp($devname,"gvinum") == 0) || (strcmp($devname,"mirror") == 0)) { - $devname = $complete[3]; - } - - $mountlist[$i]['mdisk']=$devname; - $i++; - } // end foreach - - return $mountlist; -} - -function get_mount_use() { - // Return list of mounted use - // example: Array - // [mount_point_name] => Array - // ( - // [capacity] => 48% - // [used] => 2.4G - // [avail] => 2.6G - // [size] => 5.4G - // ) - global $freenas_config, $g; - - exec("/bin/df -h",$rawdata); - - $result = array(); - - foreach ($rawdata as $line) { - /* separe the line by space*/ - $aline = preg_split("/[\s,]+/", $line); - $tmp = explode("/",chop($aline[5])); - $mounted_on = $tmp[2]; - $capacity = chop($aline[4]); - $avail = chop($aline[3]); - $used = chop($aline[2]); - $size = chop($aline[1]); - - if (is_array($freenas_config['mounts']['mount'])) { - foreach ($freenas_config['mounts']['mount'] as $mountcfg) { - if (strcmp($mounted_on,$mountcfg['sharename']) == 0) { - $result[$mounted_on] = array(); - $result[$mounted_on]['capacity'] = $capacity; - $result[$mounted_on]['avail'] = $avail; - $result[$mounted_on]['used'] = $used; - $result[$mounted_on]['size'] = $size; - } - } // end foreach - } else { - return 0; - } // end if - } // end foreach - - //print_r($result); - - return $result; -} - -function get_sraid_disks_list() { - /* Return list of ALL software volume: gvinum, gmirror */ - $disklist = array_merge((array)get_gvinum_disks_list(),(array)get_gmirror_disks_list(),(array)get_gconcat_disks_list(),(array)get_gstripe_disks_list(),(array)get_graid5_disks_list()); - return $disklist; -} - -function get_gvinum_disks_list() { - /* Get information about gvinum volume */ - global $g; - - /* Return list of Software RAID disk */ - //[volumename] => Array - // ( - // [type] => Software RAID - gvinum - // [desc] => UP - // [size] => 6149 MB - // ) - - /* on envoie la commande d'affichage de la liste des volumes*/ - exec("/sbin/gvinum list",$rawdata); - - foreach ($rawdata as $line) { - /* Split the line using the space as separator */ - $aline = preg_split("/\s+/", $line); - - /* Get the line that begin with the letter 'V' */ - if ($aline[0] != "V") { continue ; } - - $diskname = chop($aline[1]); - $disklist[$diskname] = array(); - - $disklist[$diskname]['name'] = $diskname; - $disklist[$diskname]['fullname'] = "/dev/gvinum/" . $diskname; - $disklist[$diskname]['type'] = "Software RAID - gvinum"; - $disklist[$diskname]['size'] = "$aline[7] $aline[8]" ; - $disklist[$diskname]['desc'] = $aline[3]; - } // end foreach - - return $disklist; -} - -function get_gmirror_disks_list() { - /* Get information about gmirror volume */ - global $g; - - //[volumename] => Array - // ( - // [type] => Software RAID - gmirror - // [desc] => COMPLETE - // [size] => 6149M - // ) - - /* Display all configured gmirror volume */ - exec("/sbin/gmirror list", $rawdata); - - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - foreach ($rawdata as $line) { - /* Use space for break the line */ - $aline = preg_split("/\s+/", $line); - - // First Step: Getting the array name - // look for this output: - // Geom name: pouet - if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) { - $diskname = $aline[2]; - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/mirror/" . $diskname; - $foundname = 1 ; - continue ; - } - - // Second Step: Getting the array status - // look for this output: - // State: COMPLETE - if ( (strcmp($aline[0],"State:") == 0) && $foundname) { - $desc = $aline[1]; - $disklist[$diskname]['desc'] = $desc; - $founddesc=1; - continue ; - } - - // Third Step: Getting the array Size - // look for this output: - // Name: mirror/pouet - // Mediasize: 107373568 (102M) - if (preg_match("/Name: mirror\/(.*)$/", $line, $matches)) { - if ($matches[1]=$diskname) { - $goodname=1; - continue ; - } - } - - if (($aline[0] = "Mediasize:") && $goodname) { - // extract the size between the ( ) - preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match); - $disklist[$diskname]['size'] = $match[1]; - $disklist[$diskname]['type'] = "Software RAID - gmirror"; - - // init the check variable for the next RAID volume - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - continue ; - - } - } // end foreach - - return $disklist; -} - -function get_gconcat_disks_list() { - /* Get information about gconcat volume */ - global $g; - - //[volumename] => Array - // ( - // [type] => Software RAID - gconcat - // [desc] => COMPLETE - // [size] => 6149M - // [name] => concat1 - // [fullname] => /dev/concat/concat1 - // ) - - /* Display all configured gconcat volume*/ - exec("/sbin/gconcat list",$rawdata); - - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - foreach ($rawdata as $line) { - /* Use space for break the line */ - $aline = preg_split("/\s+/", $line); - - // First Step: Getting the array name - // look for this output: - // Geom name: pouet - if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) { - $diskname = $aline[2]; - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/concat/" . $diskname; - $foundname = 1 ; - continue ; - } - - // Second Step: Getting the array status - // look for this output: - // State: UP - if ( (strcmp($aline[0],"State:") == 0) && $foundname) { - - $desc = $aline[1]; - $disklist[$diskname]['desc'] = $desc; - $founddesc=1; - continue ; - } - - // Third Step: Getting the array Size - // look for this output: - // Name: concat/pouet - // Mediasize: 107373568 (102M) - if (preg_match("/Name: concat\/(.*)$/", $line, $matches)) { - if ($matches[1]=$diskname) { - $goodname=1; - continue ; - } - - } - - if (($aline[0] = "Mediasize:") && $goodname) { - // extract the size between the ( ) - preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match); - $disklist[$diskname]['size'] = $match[1]; - $disklist[$diskname]['type'] = "Software RAID - gconcat"; - - // init the check variable for the next RAID volume - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - continue ; - } - } - - return $disklist; -} - -function get_gstripe_disks_list() { - /* Get information about gstripe volume */ - global $g; - - //[volumename] => Array - // ( - // [type] => Software RAID - gstripe - // [desc] => COMPLETE - // [size] => 6149M - // [name] => raid0 - // [fullname] => /dev/stripe/raid0 - // ) - - /* Display all configured gstripe volume*/ - exec("/sbin/gstripe list",$rawdata); - - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - foreach ($rawdata as $line) { - /* Use space for break the line */ - $aline = preg_split("/\s+/", $line); - - // First Step: Getting the array name - // look for this output: - // Geom name: pouet - if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) { - $diskname = $aline[2]; - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/stripe/" . $diskname; - $foundname = 1 ; - continue ; - } - - // Second Step: Getting the array status - // look for this output: - // State: UP - if ( (strcmp($aline[0],"State:") == 0) && $foundname) { - $desc = $aline[1]; - $disklist[$diskname]['desc'] = $desc; - $founddesc=1; - continue ; - } - - // Third Step: Getting the array Size - // look for this output: - // Name: stripe/pouet - // Mediasize: 107373568 (102M) - if (preg_match("/Name: stripe\/(.*)$/", $line, $matches)) { - if ($matches[1]=$diskname) { - $goodname=1; - continue ; - } - - } - - if (($aline[0] = "Mediasize:") && $goodname) { - // extract the size between the ( ) - preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match); - $disklist[$diskname]['size'] = $match[1]; - $disklist[$diskname]['type'] = "Software RAID - gstripe"; - - // init the check variable for the next RAID volume - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - continue ; - - } - } - - return $disklist; -} - -function get_graid5_disks_list() { - /* Get information about graid5 volume */ - global $g; - - //[volumename] => Array - // ( - // [type] => Software RAID - graid5 - // [desc] => COMPLETE - // [size] => 6149M - // [name] => BIG1 - // [fullname] => /dev/raid5/BIG1 - // ) - - /* Display all configured graid5 volume*/ - exec("/sbin/graid5 list",$rawdata); - - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - foreach ($rawdata as $line) { - /* Use space for break the line */ - $aline = preg_split("/\s+/", $line); - - // First Step: Getting the array name - // look for this output: - // Geom name: pouet - if ( (strcmp($aline[0],"Geom") == 0) && (strcmp($aline[1],"name:") == 0) ) { - $diskname = $aline[2]; - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/raid5/" . $diskname; - $foundname = 1 ; - continue ; - } - - // Second Step: Getting the array status - // look for this output: - // State: COMPLETE - if ( (strcmp($aline[0],"State:") == 0) && $foundname) { - $desc = $aline[1]; - $disklist[$diskname]['desc'] = $desc; - $founddesc=1; - continue ; - } - - // Third Step: Getting the array Size - // look for this output: - // Name: raid5/pouet - // Mediasize: 107373568 (102M) - if (preg_match("/Name: raid5\/(.*)$/", $line, $matches)) { - if ($matches[1]=$diskname) { - $goodname=1; - continue ; - } - } - - if (($aline[0] = "Mediasize:") && $goodname) { - // extract the size between the ( ) - preg_match("/.*\\(([^\)]*)\).*/",$aline[3],$match); - $disklist[$diskname]['size'] = $match[1]; - $disklist[$diskname]['type'] = "Software RAID - graid5"; - - // init the check variable for the next RAID volume - $foundname = 0 ; - $founddesc = 0 ; - $goodname = 0 ; - - continue ; - } - } - - return $disklist; -} - -function get_ata_disks_list() { - /* Return list of ATA disk */ - - //[ad0] => Array - // ( - // [type] => IDE - // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00 - // [size] => 6149MB - // ) - - global $g; - - /* Recupere le dmesg */ - exec("/sbin/dmesg",$rawdmesg); - - $disklist = array(); - - /******* Getting IDE disk informations *******/ - exec("/sbin/atacontrol list",$rawdata); - - foreach ($rawdata as $line) { - /* Separe la ligne par les espace */ - $aline = preg_split("/\s+/", $line); - - /* Si ATA alors NEXT */ - if ($aline[0] == "ATA") { continue ; } - - $diskname = chop($aline[2]); - - /* Exlude CDROM (acdX) and Empty (no) */ - if (!preg_match("/^(acd)/", $diskname ) & $diskname != "no") { - $disklist[$diskname] = array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/" . $diskname; - - $disklist[$diskname]['type'] = "IDE"; - - /* Match the description witch is include between < and > */ - preg_match("/.*\<([^>]*)>.*/",$line,$match); - - $disklist[$diskname]['desc'] = $match[1]; - - /* Looking for the disk size */ - foreach ($rawdmesg as $dmesgline) { - /* Take only the first dmesg line */ - if (!$disklist[$diskname]['size']) { - /* Separe la ligne par les espace */ - $dmesgtab = explode(" ", $dmesgline); - $dmesgtab[0] = rtrim($dmesgtab[0],":"); - /* When there is a wrong DMA cable, the first line is: - * ad0: DMA limited to UDMA33, controller found non-ATA66 cable - */ - if ($dmesgtab[0]!="" && (strcasecmp($dmesgtab[0],$diskname) == 0) && - strcmp($dmesgtab[1],"DMA") !=0) { - $disklist[$diskname]['size'] = $dmesgtab[1]; - } - } // end if - } // end foreach - } // end if - } // end foreach - - return $disklist; -} - -function get_scsi_disks_list() { - /* Recupere la liste des disques SCSI */ - - //[ad0] => Array - // ( - // [type] => IDE - // [desc] => QUANTUM FIREBALL EX6.4A/A0A.0D00 - // [size] => 6149MB - // ) - - global $g; - - /* Recupere le dmesg */ - exec("/sbin/dmesg",$rawdmesg); - - /* on envoie la commande d'affichage de la liste des disques*/ - exec("/sbin/camcontrol devlist",$rawdata); - - foreach ($rawdata as $line) { - /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/ - preg_match("/.*\(([^>]*)\).*/",$line,$match); - - /* Sépare le resultat par la virgule */ - $temp = preg_split("/,/", $match[1]); - - // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement - $diskname = $temp[1]; - - if ($diskname[0] == "p") { $diskname = $temp[0]; } - - /* On exlus les lecteurs cd */ - if (!preg_match("/^(cd)/", $diskname )) { - $disklist[$diskname] = array(); - $disklist[$diskname]['name'] = $diskname; - $disklist[$diskname]['fullname'] = "/dev/" . $diskname; - $disklist[$diskname]['type'] = "SCSI"; - /* Recupčre la description: ce qu'il y a entre < et > */ - - preg_match("/.*\<([^>]*)>.*/",$line,$match); - - $disklist[$diskname]['desc'] = $match[1]; - - /* Looking for the disk size */ - foreach ($rawdmesg as $dmesgline) { - /* Separe la ligne par les espace */ - $dmesgtab = explode(" ", $dmesgline); - $dmesgtab[0] = rtrim($dmesgtab[0],":"); - if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0)) { - $disklist[$diskname]['size'] = $dmesgtab[1]; - } - } // end foreach - } // end if - } // end foreach - - return $disklist; -} - -function get_hraid_disks_list() { - /* Recupere la liste des disques RAID */ - $kerneldisks = explode(" ", trim(preg_replace("/kern.disks: /", "", exec("/sbin/sysctl kern.disks")))); - - /* Recupere la liste des disques ATA et SCSI */ - $diskdetected = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list()); - - /* Recupere le dmesg */ - exec("/sbin/dmesg",$rawdmesg); - - foreach ($kerneldisks as $diskname) { - $allready=1; - - // Check of this entry is IDE or SCSI (allready detected) - foreach ($diskdetected as $diskfoundk => $diskfoundv) { - if (strcasecmp($diskfoundk,$diskname) == 0) { - $allready = 0; - } - } - - if ($allready) { - /* If not an IDE and SCSI disk */ - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/" . $diskname; - - $disklist[$diskname]['type'] = "RAID"; - - /* Looking for the disk size in the dmesg */ - foreach ($rawdmesg as $dmesgline) { - /* Separe la ligne par les espace */ - $dmesgtab = explode(" ", $dmesgline); - $dmesgtab[0] = rtrim($dmesgtab[0],":"); - // si la ligne commence par le nom du disque: attention il y a 2 lignes - if ($dmesgtab[0]!="" &&(strcasecmp($dmesgtab[0],$diskname) == 0)) { - // the first line as this example "aacd0: <RAID 5> on aac0" - if (strcasecmp(substr($dmesgtab[1], 0, 1),"<") == 0) { - /* Match the description witch is include between < and > */ - preg_match("/.*\<([^>]*)>.*/",$dmesgline,$match); - $disklist[$diskname]['desc'] = $match[1]; - } else{ - // si c'est la deuxieme ligne, elle ressemble a "aacd0: 138850MB (284365824 sectors)" - $disklist[$diskname]['size'] = $dmesgtab[1]; - } // end if - } // end if - } // end foreach - } // end if - } // end foreach - - return $disklist; -} - -function get_physical_disks_list() { - /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */ - $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list()); - return $disklist; -} - -function get_all_disks_list() { - /* Return list of ALL disk: physical, hardware RAID and Software RAID disk */ - $disklist = array_merge((array)get_ata_disks_list(),(array)get_scsi_disks_list(),(array)get_hraid_disks_list(), (array)get_sraid_disks_list()); - return $disklist; -} - -function get_disks_size($diskname) { - /* Return size of the disk */ - $disklist=get_physical_disks_list(); - $disksize=0; - - foreach ($disklist as $diskk => $diskv) { - if (strcmp($diskk,$diskname)==0) { - $disksize=$diskv['size']; - } - } - - return $disksize; -} - -function get_cdrom_list() { - /* Return list of IDE AND SCSI CDROM */ - // exemple: Array - // [acd0] => Array - // ( - // [type] => IDE - // [desc] => TDK CDRW241040B/57S2 - // ) - - global $g; - - /* Recupere la liste des disques IDE */ - exec("/sbin/atacontrol list",$rawdata); - - /* Recupere le dmesg */ - exec("/sbin/dmesg",$rawdmesg); - - $disklist = array(); - - /* Variable $i utilisé pour l'index du tableau */ - $i=0; - foreach ($rawdata as $line) { - /* Separe la ligne par les espace */ - $aline = preg_split("/\s+/", $line); - - /* Si ATA alors NEXT */ - if ($aline[0] == "ATA") { continue ; } - - $diskname = chop($aline[2]); - - /* Exlude disk (adX) and Empty (no) */ - if (!preg_match("/^(ad)/", $diskname ) & $diskname != "no") { - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/" . $diskname; - - $disklist[$diskname]['type'] = "IDE"; - - /* Match the description witch is include between < and > */ - preg_match("/.*\<([^>]*)>.*/",$line,$match); - - $disklist[$diskname]['desc'] = $match[1]; - - $i++; - } // end if - } // end foreach - - /* Get the SCSI disk list */ - - /* Cleaning used variable and initialize array */ - unset($rawdata); - unset($dmesgtab); - reset($rawdmesg); - - /* Get the result of the command camcontrol*/ - exec("/sbin/camcontrol devlist",$rawdata); - - foreach ($rawdata as $line) { - /* Get information include between parenthese: (pass0,da0) or (da0,pass0)*/ - preg_match("/.*\(([^>]*)\).*/",$line,$match); - - /* Sépare le resultat par la virgule */ - $temp = preg_split("/,/", $match[1]); - - // Check if diskname is the first (da0,pass0) or the second (pass0,da0) arguement - $diskname = $temp[1]; - if ($diskname[0] == "p") { $diskname = $temp[0]; } - - /* On exlus les lecteurs disque dur da */ - if (!preg_match("/^(da)/", $diskname )) { - $disklist[$diskname]=array(); - $disklist[$diskname]['name']=$diskname; - $disklist[$diskname]['fullname']= "/dev/" . $diskname; - $disklist[$diskname]['type'] = "SCSI"; - - /* Recupčre la description: ce qu'il y a entre < et > */ - preg_match("/.*\<([^>]*)>.*/",$line,$match); - - $disklist[$diskname]['desc'] = $match[1]; - - $i++; - } // end if - } // end foreach - - return $disklist; -} - -/* Get list of disks from given type of filesystem. */ -function get_fstype_disks_list($fstype) { - global $freenas_config; - - $result = array(); - - /* Scan all physical disk */ - if (is_array($freenas_config['disks']['disk'])) { - foreach ($freenas_config['disks']['disk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - /* Scan all gmirror volume */ - if (is_array($freenas_config['gmirror']['vdisk'])) { - foreach ($freenas_config['gmirror']['vdisk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - /* Scan all gconcat volume */ - if (is_array($freenas_config['gconcat']['vdisk'])) { - foreach ($freenas_config['gconcat']['vdisk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - /* Scan all gstripe volume */ - if (is_array($freenas_config['gstripe']['vdisk'])) { - foreach ($freenas_config['gstripe']['vdisk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - /* Scan all gvinum volume */ - if (is_array($freenas_config['gvinum']['vdisk'])) { - foreach ($freenas_config['gvinum']['vdisk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - /* Scan all graid5 volume */ - if (is_array($freenas_config['graid5']['vdisk'])) { - foreach ($freenas_config['graid5']['vdisk'] as $disk) { - if (strcmp($disk['fstype'],$fstype) == 0) { - $result[] = $disk; - } - } // end foreach - } // end if - - return $result; -} - -/* Get list of supported filesystem types */ -function get_fstype_list() { - $fstlist = array( - ""=>"Unformated", - "ufs"=>"UFS with Soft Updates (use 8% space disk)", - "ufs_no_su"=>"UFS", - "ufsgpt"=>"UFS (EFI/GPT) with Soft Updates (use 8% space disk)", - "ufsgpt_no_su"=>"UFS (EFI/GPT)", - "msdos"=>"FAT32", - "ntfs"=>"NTFS", - "softraid"=>"Software RAID"); -/* - "gmirror"=>"Software RAID: gmirror", - "gconcat"=>"Software RAID: gconcat", - "gstripe"=>"Software RAID: gstripe", - "graid5"=>"Software RAID: graid5", - "gvinum"=>"Software RAID: gvinum"); -*/ - return $fstlist; -} - -function get_fstype_shortdesc($fstype) { - $shortdesc = ""; - - switch($fstype) { - case "": $shortdesc = "Unformated"; - break; - case "ufs": - case "ufs_no_su": - case "ufsgpt": - case "ufsgpt_no_su": $shortdesc = "UFS"; - break; - case "msdos": $shortdesc = "FAT32"; - break; - case "ntfs": $shortdesc = "NTFS"; - break; - case "gmirror": $shortdesc = "gmirror"; - break; - case "gconcat": $shortdesc = "gconcat"; - break; - case "gstripe": $shortdesc = "gstripe"; - break; - case "graid5": $shortdesc = "graid5"; - break; - case "gvinum": $shortdesc = "gvinum"; - break; - case "softraid": $shortdesc = "softraid"; - break; - } // end switch - - return $shortdesc; -} - -/* Search in a multidimensional array */ -function array_search_ex($needle, $haystack, $key) { - foreach($haystack as $haystackval => $value) { - $found = false; - - if (is_array($needle) && is_array($key)) { - foreach ($needle as $n => $needlev) { - $found = ($value[$key[$n]] == $needlev); - - if (false == $found) { break; } - } - } else { - $found = ($value[$key] == $needle); - } // end if - - if (true == $found) { return $haystackval; } - } // end foreach - - return false; -} - -/* TODO: This function is probably not needed. */ -function freenas_install($src,$dst) { - // Creating source directory - passthru("/bin/mkdir /mnt/src"); - - // Mount the source function is_cdrom must BE CREATED!!!! - - if (is_cdrom($src)) { - echo "Mount CDROM:\n"; - passthru("/sbin/mount_cd9660 /dev/$src /mnt/src"); - } else { - echo "Mount disk:\n"; - passthru("/sbin/mount -t ufs /dev/$src /mnt/src"); - } // end if - - echo "Erasing primary partitions:\n"; - passthru("/bin/dd if=/dev/zero of=/dev/$dst bs=1k count=20"); - - echo "Creation 1 booting primary parition:\n"; - passthru("/sbin/fdisk -BI -b /boot/boot0 $dst"); - - /* echo "Installing bootloader:\n"; - passthru("/usr/sbin/boot0cfg -B -b /boot/boot0 $dst"); */ - - echo "Erasing FreeBSD partition on the primary:\n"; - passthru("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($dst) . "s1 bs=32k count=16"); - - echo "Creating FreeBSD partition:\n"; - passthru("/sbin/bsdlabel -B -w -b /boot/boot " . escapeshellarg($dst) ."s1 auto"); - - echo "Modify partition information:\n"; - - /* Generation de la table des partitions dans un fichier temp */ - - passthru("/sbin/bsdlabel " . escapeshellarg($dst) ."s1 > label.tmp"); - - /* copie de ce fichier dans un tableau*/ - $tableau = file("label.tmp"); - - // Ouverture du fichier en mode ajout - $handle = fopen("label.tmp", 'a'); - - while(list(,$val) = each($tableau)) { - // Si la ligne contient le mot "unused" - - if (ereg ("unused",$val)) { - // On remplace c: par a: - $val = ereg_replace ("c:","a:", $val); - // On remplace unused par 4.2BSD - $val = ereg_replace ("unused","4.2BSD", $val); - // On ajoute cette ligne ŕ la fin du fichier - fwrite($handle, $val); - } // end if - } // end while - - // Fermeture du fichier - fclose($handle); - - // On injecte la nouvelle table des paritions - passthru("/sbin/bsdlabel -R -B " . escapeshellarg($dst) ."s1 label.tmp"); - - echo "Creating filesystem:\n"; - passthru("/sbin/newfs /dev/" . escapeshellarg($dst) . "s1"); - - echo "Creation temp mouting point:\n"; - passthru("/bin/mkdir /mnt/src"); - - echo "Mount disk:\n"; - passthru("/sbin/mount /dev/" . escapeshellarg($dst) . "s1 /mnt/dst"); - - echo "Installation:\n"; - - passthru("/bin/cp -pr /mnt/src/boot /mnt/dst"); - passthru("/bin/cp /mnt/src/cf.gz /mnt/dst/mfsroot.gz"); - - if ($src == CDROM) { - passthru("/bin/rm -f /mnt/dst/boot/cdloader"); - } - - passthru("mkdir /mnt/dst/conf"); - passthru("/bin/cp /conf/config.xml /mnt/dst/conf/"); - - /* demontage des disques */ - passthru("/sbin/umount /mnt/dst"); - passthru("/sbin/umount /mnt/src"); - passthru("/bin/rm -rf /mnt/src"); - passthru("/bin/rm -rf /mnt/dst"); -} - -/* Force kill a process by name */ -function forcekillbyname($procname) { - return mwexec("/usr/bin/killall -9 " . escapeshellarg($procname)); -} -?>
\ No newline at end of file diff --git a/packages/freenas/pkg/rc.freenas b/packages/freenas/pkg/rc.freenas deleted file mode 100644 index 3b5c6c0c..00000000 --- a/packages/freenas/pkg/rc.freenas +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/local/bin/php -f -<?php -/* $Id$ */ -/* ========================================================================== */ - rc.freenas - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt - 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. - */ -/* ========================================================================== */ - -require_once("globals.inc"); - -/* parse the configuration and include all functions used below */ -require_once("config.inc"); -require_once("functions.inc"); -require_once("freenas_functions.inc"); - -/* Tune the system */ -system_tuning(); - -/* Generate local user base */ -system_users_create(); - -/* start iSCSI service */ -services_iscsi_configure(); - -/* start the S.M.A.R.T daemon */ -services_smart_configure(); - -/* ATA disk Idle configuration */ -disks_set_ataidle(); - -/* RAID configuration */ -disks_raid_start(); - -/* Mount the disks */ -disks_mount_all(); - -/* Generate the pam configuration file */ -system_pam_configure(); - -/* start NIS service */ -services_nis_configure(); - -/* start SAMBA service */ -services_samba_configure(); - -/* start Rsynd service */ -services_rsyncd_configure(); - -/* start FTP service */ -services_ftpd_configure(); - -/* start NFS service */ -services_nfs_configure(); - -/* configure Unison service */ -services_unison_configure(); - -/* start SSH service */ -/* services_sshd_configure(); */ - -/* start AFP service */ -services_afpd_configure(); - -/* start RSYNC client/slave mode service */ -services_rsyncclient_configure(); - -/* start RSYNC local service */ -services_rsync_local_configure(); - -/* Start cron */ -services_cron_configure(); - -/* Start mdnsresponder (Zeroconf/Bonjour) */ -services_zeroconf_configure(); - -?>
\ No newline at end of file diff --git a/packages/freenas/www/diag_ad_infos.php b/packages/freenas/www/diag_ad_infos.php deleted file mode 100644 index e9882a70..00000000 --- a/packages/freenas/www/diag_ad_infos.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_ad_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("Active Directory Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_ad_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), true, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - if (! isset($freenas_config['ad']['enable'])) { - echo "<strong>AD Authentication disable</strong><br />"; - } else { - echo "<pre style=\"font-size: medium;\">"; - echo "<strong>Accessiblity test to MS domain:</strong><br />"; - echo htmlspecialchars("Results for net rpc testjoin:") . "<br />"; - exec("/usr/local/bin/net rpc testjoin",$rawdata); - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($rawdata); - echo "<br />"; - echo htmlspecialchars("Ping winbindd to see if it is alive:") . "<br />"; - exec("/usr/local/bin/wbinfo -p",$rawdata); - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($rawdata); - echo "<br />"; - echo htmlspecialchars("Check shared secret:") . "<br />"; - exec("/usr/local/bin/wbinfo -t",$rawdata); - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($rawdata); - echo "<br>"; - echo "</pre>"; - } - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_ataidle_infos.php b/packages/freenas/www/diag_ataidle_infos.php deleted file mode 100644 index 7ba6c737..00000000 --- a/packages/freenas/www/diag_ataidle_infos.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_ataidle_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("ATAidle Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_ataidle_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), true, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - $disklist=get_ata_disks_list(); - echo "<strong>List of Advanced ATA capabilities on all ATA disk:</strong><br />"; - 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:") . "<br />"; - $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) . "<br />"; - } - unset ($rawdata); - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_disk_infos.php b/packages/freenas/www/diag_disk_infos.php deleted file mode 100644 index 31419040..00000000 --- a/packages/freenas/www/diag_disk_infos.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_ataidle_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("Disk Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_disk_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), true, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - exec("/sbin/atacontrol list",$iderawdata); - echo "<pre style=\"font-size: medium;\">"; - echo "<strong>List of detected ATA disks:</strong><br />"; - foreach ($iderawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - exec("/sbin/camcontrol devlist",$scsirawdata); - echo "<strong>List of detected SCSI disks:</strong><br />"; - foreach ($scsirawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_daemon.php b/packages/freenas/www/diag_fn_logs_daemon.php deleted file mode 100644 index 1eaa1f0f..00000000 --- a/packages/freenas/www/diag_fn_logs_daemon.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_daemon.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("Daemon")); - -require_once("freenas_config.inc"); -require_once("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_fn_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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_daemon.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), true, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> Daemon log entries - </td> - </tr> - <?php dump_clog("/var/log/daemon.log", $nentries); ?> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_ftp.php b/packages/freenas/www/diag_fn_logs_ftp.php deleted file mode 100644 index 21d8cfb2..00000000 --- a/packages/freenas/www/diag_fn_logs_ftp.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_ftp.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("FTP")); - -require_once("freenas_config.inc"); -require_once("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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_ftp.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), true, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> FTP log entries - </td> - </tr> - <?php dump_clog("/var/log/ftp.log", $nentries); ?> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_rsyncd.php b/packages/freenas/www/diag_fn_logs_rsyncd.php deleted file mode 100644 index 44ab3d85..00000000 --- a/packages/freenas/www/diag_fn_logs_rsyncd.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_rsyncd.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("RSYNCD")); - -require_once("freenas_config.inc"); -require_once("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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_rsyncd.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), true, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> RSYNCD log entries - </td> - </tr> - <?php dump_clog("/var/log/rsyncd.log", $nentries); ?> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_samba.php b/packages/freenas/www/diag_fn_logs_samba.php deleted file mode 100644 index 436de12d..00000000 --- a/packages/freenas/www/diag_fn_logs_samba.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_samba.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("Samba")); - -require_once("freenas_config.inc"); -require_once("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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_samba.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), true, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> nmbd service log entries - </td> - </tr> - <?php - if (file_exists("/var/log/samba/log.nmbd")) { - exec("cat /var/log/samba/log.nmbd", $rawlog); - } else { - $rawlog=array("No logs"); - } - ?> - <?php foreach ($rawlog as $log) { ?> - <tr> - <td class="listr" nowrap> - <pre><?php echo htmlspecialchars($log); } ?></pre> - </td> - </tr> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <?php unset ($rawlog); ?> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> smbd service log entries - </td> - </tr> - <?php - if (file_exists("/var/log/samba/log.smbd")) { - exec("cat /var/log/samba/log.smbd", $rawlog); - } else { - $rawlog=array("No logs"); - } - ?> - <?php foreach ($rawlog as $log) { ?> - <tr> - <td class="listr" nowrap> - <pre><?php echo htmlspecialchars($log); } ?></pre> - </td> - </tr> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> winbindd service log entries - </td> - </tr> - <?php - if (file_exists("/var/log/samba/log.winbindd")) { - exec("cat /var/log/samba/log.winbindd", $rawlog); - } else { - $rawlog=array("No logs"); - } - ?> - <?php foreach ($rawlog as $log) { ?> - <tr> - <td class="listr" nowrap> - <pre><?php echo htmlspecialchars($log); } ?></pre> - </td> - </tr> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_settings.php b/packages/freenas/www/diag_fn_logs_settings.php deleted file mode 100644 index a51e8479..00000000 --- a/packages/freenas/www/diag_fn_logs_settings.php +++ /dev/null @@ -1,310 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_settings.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("Settings")); - -require_once("freenas_config.inc"); -require_once("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 -<script language="JavaScript" type="text/javascript"> -<!-- -function enable_change(enable_over) { - endis = !(document.iform.enable.checked || enable_over); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - if (document.iform.enable.checked || enable_over) { - document.iform.remoteserver.disabled = 0; - document.iform.filter.disabled = 0; - document.iform.dhcp.disabled = 0; - document.iform.portalauth.disabled = 0; - document.iform.vpn.disabled = 0; - document.iform.system.disabled = 0; - document.iform.webservlogs.disabled = 0; - document.iform.sshd.disabled = 0; - document.iform.ftp.disabled = 0; - document.iform.rsyncd.disabled = 0; - document.iform.smartd.disabled = 0; - document.iform.daemon.disabled = 0; - - } else { - document.iform.remoteserver.disabled = 1; - document.iform.filter.disabled = 1; - document.iform.dhcp.disabled = 1; - document.iform.portalauth.disabled = 1; - document.iform.vpn.disabled = 1; - document.iform.system.disabled = 1; - document.iform.webservlogs.disabled = 1; - document.iform.sshd.disabled = 1; - document.iform.ftp.disabled = 1; - document.iform.rsyncd.disabled = 1; - document.iform.smartd.disabled = 1; - document.iform.daemon.disabled = 1; - } - - /* color adjustments */ - document.iform.remoteserver.style.backgrounColor = color; - document.iform.filter.style.backgrounColor = color; - document.iform.dhcp.style.backgrounColor = color; - document.iform.portalauth.style.backgrounColor = color; - document.iform.vpn.style.backgrounColor = color; - document.iform.system.style.backgrounColor = color; - document.iform.webservlogs.style.backgrounColor = color; - document.iform.sshd.style.backgrounColor = color; - document.iform.ftp.style.backgrounColor = color; - document.iform.rsyncd.style.backgrounColor = color; - document.iform.smartd.style.backgrounColor = color; - document.iform.daemon.style.backgrounColor = color; -} -// --> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_settings.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), true, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vtable"> </td> - <td width="78%" class="vtable"> <input name="reverse" class="formfld" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?> /> - <strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vtable"> </td> - <td width="78%" class="vtable"><?=gettext("Number of log entries to show");?>: - <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vtable"> </td> - <td class="vtable"> <input name="logdefaultblock" class="formfld" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?> /> - <strong><?=gettext("Log packets blocked by the default rule");?></strong><br /> - <?=gettext("Hint: packets that are blocked by the - implicit default block rule will not be logged anymore - if you uncheck this option. Per-rule logging options are not affected.");?> - </td> - </tr> - <tr> - <td valign="top" class="vtable"> </td> - <td class="vtable"> <input name="rawfilter" class="formfld" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?> /> - <strong><?=gettext("Show raw filter logs");?></strong><br /> - <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information.");?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vtable"> </td> - <td width="78%" class="vtable"> <input name="disablelocallogging" class="formfld" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onclick="enable_change(false)" /> - <strong><?=gettext("Disable writing log files to the local disk");?></strong> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vtable"> </td> - <td width="78%" class="vtable"> <input name="enable" class="formfld" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onclick="enable_change(false)" /> - <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Remote syslog server</td> - <td width="78%" class="vtable"> - <input name="remoteserver" id="remoteserver" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" /> - <br /><?=gettext("IP address of remote syslog server");?> - <br /><br /> - <input name="system" id="system" class="formfld" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked=\"checked\""; ?> /> - <?=gettext("system events");?><br /> - <input name="filter" id="filter" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked=\"checked\""; ?> /> - <?=gettext("firewall events");?><br /> - <input name="dhcp" id="dhcp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked=\"checked\""; ?> /> - <?=gettext("DHCP service events");?><br /> - <input name="portalauth" id="portalauth" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked=\"checked\""; ?> /> - <?=gettext("Portal Auth");?><br /> - <input name="vpn" id="vpn" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked=\"checked\""; ?> /> - <?=gettext("PPTP VPN events");?><br /> - <input name="webservlogs" id="webservlogs" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['webservlogs']) echo "checked=\"checked\""; ?> /> - <?=gettext("webConfigurator Logs");?><br /> - <input name="sshd" id="sshd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['sshd']) echo "checked=\"checked\""; ?> /> - <?=gettext("SSHD events");?><br /> - <input name="ftp" id="ftp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['ftp']) echo "checked=\"checked\""; ?> /> - <?=gettext("FTP events");?><br /> - <input name="rsyncd" id="rsyncd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['rsyncd']) echo "checked=\"checked\""; ?> /> - <?=gettext("RSYNCD events");?><br /> - <input name="smartd" id="smartd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['smartd']) echo "checked=\"checked\""; ?> /> - <?=gettext("SMARTD events");?><br /> - <input name="daemon" id="daemon" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['daemon']) echo "checked=\"checked\""; ?> /> - <?=gettext("Daemon events");?><br /> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> - </td> - </tr> - <tr> - <td width="22%" height="53" valign="top"> </td> - <td width="78%"><strong><span class="red"><?=gettext("Note");?>:</span></strong><br /> - <?=gettext(" - syslog sends UDP datagrams to port 514 on the specified - remote syslog server. Be sure to set syslogd on the - remote server to accept syslog messages from {$g['product_name']}. - ");?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<script language="JavaScript" type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_smartd.php b/packages/freenas/www/diag_fn_logs_smartd.php deleted file mode 100644 index 7e57d543..00000000 --- a/packages/freenas/www/diag_fn_logs_smartd.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_smartd.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("SMARTD")); - -require_once("freenas_config.inc"); -require_once("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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_smartd.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), true, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> SmartD log entries - </td> - </tr> - <?php dump_clog("/var/log/smartd.log", $nentries); ?> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_fn_logs_sshd.php b/packages/freenas/www/diag_fn_logs_sshd.php deleted file mode 100644 index bc61d57f..00000000 --- a/packages/freenas/www/diag_fn_logs_sshd.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_fn_logs_sshd.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("System logs"), - gettext("SSHD")); - -require_once("freenas_config.inc"); -require_once("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_fn_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(); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<form action="diag_fn_logs_sshd.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> -<?php - $tab_array = array(); - $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php"); - $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php"); - $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php"); - $tab_array[] = array(gettext("SSHD"), true, "diag_fn_logs_sshd.php"); - $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php"); - $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php"); - $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php"); - display_top_tabs($tab_array);?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic"> - Last <?=$nentries;?> SSHD log entries - </td> - </tr> - <?php dump_clog("/var/log/sshd.log", $nentries); ?> - <tr> - <td align="left" valign="top" height="12"> </td> - </tr> - <tr> - <td align="left" valign="top"> - <input name="clear" type="submit" class="formbtn" value="Clear log" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_iscsi_infos.php b/packages/freenas/www/diag_iscsi_infos.php deleted file mode 100644 index 05c136e8..00000000 --- a/packages/freenas/www/diag_iscsi_infos.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_iscsi_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("iSCSI Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_iscsi_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), true, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - if (! isset($freenas_config['iscsi']['enable'])) { - echo "<strong>iSCSI initiator disabled</strong><br />"; - } else { - echo "<pre style=\"font-size: medium;\">"; - echo "<strong>Show the list of available target Name on the iSCSI target</strong><br>"; - - exec("/usr/local/sbin/iscontrol -d targetaddress={$freenas_config['iscsi']['targetaddress']}",$rawdata); - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br>"; - } - unset ($rawdata); - echo "</pre>"; - } - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_mounts_infos.php b/packages/freenas/www/diag_mounts_infos.php deleted file mode 100644 index 29eb49f5..00000000 --- a/packages/freenas/www/diag_mounts_infos.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_mounts_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("Mount Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_mounts_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), true, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - echo "<strong>List of mounted point:</strong><br />"; - exec("/sbin/mount",$mountrawdata); - foreach ($mountrawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_part_infos.php b/packages/freenas/www/diag_part_infos.php deleted file mode 100644 index 011a771c..00000000 --- a/packages/freenas/www/diag_part_infos.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_part_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("Partition Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_part_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), true, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - $disklist = get_physical_disks_list(); - echo "<strong>List of partition on all detected disk:</strong><br />"; - foreach ($disklist as $disknamek => $disknamev) - { - exec("/sbin/fdisk $disknamek",$fdiskrawdata); - foreach ($fdiskrawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($fdiskrawdata); - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_raid_infos.php b/packages/freenas/www/diag_raid_infos.php deleted file mode 100644 index ad1621c1..00000000 --- a/packages/freenas/www/diag_raid_infos.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_raid_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("RAID Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_raid_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), true, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - echo "<strong>" . gettext("Software RAID") . " - " . gettext("Geom Mirror") . ":</strong><br /><br />"; - exec("/sbin/gmirror list",$rawdata); - foreach ($rawdata as $line) { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - unset ($rawdata); - echo "<strong>" . gettext("Software RAID") . " - " . gettext("Geom Vinum") . ":</strong><br /><br />"; - exec("/sbin/gvinum list",$rawdata); - foreach ($rawdata as $line) { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - unset ($rawdata); - echo "<strong>" . gettext("Software RAID") . " - " . gettext("Geom Concat") . ":</strong><br /><br />"; - exec("/sbin/gconcat list",$rawdata); - foreach ($rawdata as $line) { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - unset ($rawdata); - echo "<strong>" . gettext("Software RAID") . " - " . gettext("Geom Stripe") . ":</strong><br /><br />"; - exec("/sbin/gstripe list",$rawdata); - foreach ($rawdata as $line) { - echo htmlspecialchars($line) . "<br />"; - } - unset ($line); - unset ($rawdata); - echo "<strong>" . gettext("Software RAID") . " - " . gettext("Geom Raid5") . ":</strong><br /><br />"; - exec("/sbin/graid5 list",$rawdata); - foreach ($rawdata as $line) { - echo htmlspecialchars($line) . "<br />"; - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_smart_infos.php b/packages/freenas/www/diag_smart_infos.php deleted file mode 100644 index d265d1b7..00000000 --- a/packages/freenas/www/diag_smart_infos.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_smart_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("SMART Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_smart_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), true, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - $disklist = get_physical_disks_list(); - echo "<strong>List of SMART capabilities on all detected disk:</strong><br />"; - foreach ($disklist as $disknamek => $disknamev) - { - exec("/usr/local/sbin/smartctl -a /dev/$disknamek",$fdiskrawdata); - foreach ($fdiskrawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - unset ($fdiskrawdata); - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/diag_space_infos.php b/packages/freenas/www/diag_space_infos.php deleted file mode 100644 index e0726b07..00000000 --- a/packages/freenas/www/diag_space_infos.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - diag_space_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Diagnostics"), - gettext("Space Infos")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="diag_space_infos.php" method="post" name="iform" id="iform"> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php"); - $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php"); - $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php"); - $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php"); - $tab_array[4] = array(gettext("Space used"), true, "diag_space_infos.php"); - $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php"); - $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php"); - $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("MS Domain"), false, "diag_ad_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="left" valign="top"> - <?php - echo "<pre style=\"font-size: medium;\">"; - exec("/bin/df -h",$rawdata); - echo "<strong>Free Space:</strong><br />"; - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br />"; - } - echo "</pre>"; - ?> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_manage.php b/packages/freenas/www/disks_manage.php deleted file mode 100644 index b6dece05..00000000 --- a/packages/freenas/www/disks_manage.php +++ /dev/null @@ -1,208 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_manage.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Management")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_manage.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The disk list has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), true, "disks_manage.php"); - $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php"); - $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php"); - $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Disk");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Description");?></td> - <td class="listhdrr"><?=gettext("Standby time");?></td> - <td class="listhdrr"><?=gettext("File system");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_disk_conf as $disk): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($disk['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($disk['size']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($disk['desc']);?> - </td> - <td valign="middle" class="listr"> - <?php - if ($disk['harddiskstandby']) { - $value = $disk['harddiskstandby']; - //htmlspecialchars($value); - echo $value; - } else { - echo "Always on"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?= ($disk['fstype']) ? $disk['fstype']: gettext("unknown or unformatted"); ?> - </td> - <td valign="middle" class="listr"> - <?php - $stat = disks_status($disk); - echo $stat; - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_manage_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit disk");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_manage.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="6"></td> - <td class="list" nowrap> - <a href="disks_manage_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_manage_edit.php b/packages/freenas/www/disks_manage_edit.php deleted file mode 100644 index 80e11ef3..00000000 --- a/packages/freenas/www/disks_manage_edit.php +++ /dev/null @@ -1,275 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_manage_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Management"), - gettext("Edit")); - -require_once("freenas_config.inc"); -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']; - $pconfig['fullname'] = $a_disk[$id]['fullname']; -} - -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['fullname'] = "/dev/$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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="disks_manage_edit.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td> - <td width="78%" class="vtable"> - <select name="name" class="formselect" id="name"> - <?php foreach ($disklist as $diski => $diskv): ?> - <option value="<?=$diski;?>" <?php if ($diski == $pconfig['name']) echo "selected=\"selected\"";?>> - <?php echo htmlspecialchars($diski . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?> - </option> - <?php endforeach; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("UDMA mode");?></td> - <td width="78%" class="vtable"> - <select name="udma" class="formselect" id="udma"> - <?php - $types = explode(",", "Auto,UDMA-33,UDMA-66,UDMA-100,UDMA-133"); - $vals = explode(" ", "auto UDMA2 UDMA4 UDMA5 UDMA6"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['udma']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - <br /> - <?= gettext("You can force UDMA mode if you have \"UDMA_ERROR.... LBA\" message with your hard drive."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Hard disk standby time");?></td> - <td width="78%" class="vtable"> - <select name="harddiskstandby" class="formselect"> - <?php - $sbvals = array(0=>"Always on",5=>"5 minutes",10=>"10 minutes",20=>"20 minutes",30=>"30 minutes",60=>"60 minutes"); - ?> - <?php foreach ($sbvals as $sbval => $sbname): ?> - <option value="<?=$sbval;?>" <?php if($pconfig['harddiskstandby'] == $sbval) echo 'selected="selected"';?>><?=htmlspecialchars($sbname);?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("Puts the hard disk into standby mode when the selected amount of time after the last - access has elapsed. <em>Do not set this for CF cards.</em>"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Advanced Power Management");?></td> - <td width="78%" class="vtable"> - <select name="apm" class="formselect"> - <?php - $apmvals = array(0=>"Disabled",1=>"Minimum power usage with Standby",64=>"Medium power usage with Standby",128=>"Minimum power usage without Standby",192=>"Medium power usage without Standby",254=>"Maximum performance, maximum power usage"); - ?> - <?php foreach ($apmvals as $apmval => $apmname): ?> - <option value="<?=$apmval;?>" <?php if($pconfig['apm'] == $apmval) echo 'selected="selected"';?>><?=htmlspecialchars($apmname);?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("This allows you to lower the power consumption of the drive, at the expense of performance.<em>Do not set this for CF cards.</em>"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("acoustic level");?></td> - <td width="78%" class="vtable"> - <select name="acoustic" class="formselect"> - <?php - $acvals = array(0=>"Disabled",1=>"Minimum performance, Minimum acoustic output",64=>"Medium acoustic output",127=>"Maximum performance, maximum acoustic output"); - ?> - <?php foreach ($acvals as $acval => $acname): ?> - <option value="<?=$acval;?>" <?php if($pconfig['acoustic'] == $acval) echo 'selected';?>><?=htmlspecialchars($acname);?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("This allows you to set how loud the drive is while it\'s operating.<em>Do not set this for CF cards.</em>"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("preformated FS");?></td> - <td width="78%" class="vtable"> - <select name="fstype" class="formselect"> - <?php $fstlist = get_fstype_list(); ?> - <?php foreach ($fstlist as $fstval => $fstname): ?> - <option value="<?=$fstval;?>" <?php if($pconfig['fstype'] == $fstval) echo 'selected';?>><?=htmlspecialchars($fstname);?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("This allows you to set FS type for preformated disk with data.<br /> - <em>Leave \"unformated\" for unformated disk and then use Format menu.</em>"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - <?php if (isset($id) && $a_disk[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_manage_init.php b/packages/freenas/www/disks_manage_init.php deleted file mode 100644 index e8d939d3..00000000 --- a/packages/freenas/www/disks_manage_init.php +++ /dev/null @@ -1,511 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_manage_init.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Initialize")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -define("DISK_DETAILS_PARA", " - <p style='font-size: small;'> - <strong>Disk initialization details</strong> (use the toggle icon to unveil detailed infos): - </p> - "); - -function create_format_output($disk, $type, $notinitmbr) { - $ddetails = DISK_DETAILS_PARA; - - ob_end_flush(); - - $retvalue =<<<EOD -{$ddetails} - -EOD; - - // Erase MBR if not checked - if (!$notinitmbr) { - $button = create_toggle_button("Erasing MBR and all paritions", "mbr_out"); - $cmd = "dd if=/dev/zero of=" . escapeshellarg($disk) . " bs=32k count=640"; - $out = create_cmdout_container("mbr_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - } else { - $diskinit_str = "Keeping the MBR and all partitions"; - $retvalue .=<<<EOD - <div id="mbr_out" style="font-family: Courier, monospace; font-size: small;"> - <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre> - </div> - -EOD; - } // end if - - switch ($type) { - case "ufs": - $button = create_toggle_button("Creating one partition", "ufs_fdisk_out"); - /* Initialize disk */ - $cmd = "/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk); - $out = create_cmdout_container("ufs_fdisk_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Initializing partition", "ufs_dd_out"); - /* Initialise the partition (optional) */ - $cmd = "/bin/dd if=/dev/zero of=" . escapeshellarg($disk) . "s1 bs=32k count=16"; - $out = create_cmdout_container("ufs_dd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating BSD label", "ufs_label_out"); - /* Create s1 label */ - $cmd = "/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"; - $out = create_cmdout_container("ufs_label_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating Filesystem", "ufs_newfs_out"); - /* Create filesystem */ - $cmd = "/sbin/newfs -U " . escapeshellarg($disk) . "s1"; - $out = create_cmdout_container("ufs_newfs_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - break; // end case "ufs": - case "ufs_no_su": - $button = create_toggle_button("Creating one partition", "ufsn_fdisk_out"); - /* Initialize disk */ - $cmd = "/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk); - $out = create_cmdout_container("ufsn_fdisk_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Initializing partition", "ufsn_dd_out"); - /* Initialise the partition (optional) */ - $cmd = "/bin/dd if=/dev/zero of=" . escapeshellarg($disk) . "s1 bs=32k count=16"; - $out = create_cmdout_container("ufsn_dd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating BSD label", "ufsn_label_out"); - /* Create s1 label */ - $cmd = "/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"; - $out = create_cmdout_container("ufsn_label_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating Filesystem", "ufsn_newfs_out"); - /* Create filesystem */ - $cmd = "/sbin/newfs -m 0 " . escapeshellarg($disk) . "s1"; - $out = create_cmdout_container("ufsn_newfs_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - break; // end ufs_no_su - case "ufsgpt": - $button = create_toggle_button("Destroying old GTP information", "ufsg_gptd_out"); - /* Destroy GPT partition table */ - $cmd = "/sbin/gpt destroy " . escapeshellarg($disk); - $out = create_cmdout_container("ufsg_gptd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating GPT partition", "ufsg_gptc_out"); - /* Create GPT partition table */ - $cmd = array("/sbin/gpt create -f " . escapeshellarg($disk), - "/sbin/gpt add -t ufs " . escapeshellarg($disk)); - $out = create_cmdout_container("ufsg_gptc_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating Filesystem with Soft Updates", "ufsg_newfs_out"); - /* Create filesystem */ - $cmd = "/sbin/newfs -U " . escapeshellarg($disk) . "p1"; - $out = create_cmdout_container("ufsg_newfs_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - break; // end case "ufsgpt": - case "ufsgpt_no_su": - $button = create_toggle_button("Destroying old GTP information", "ufsgn_gpt_out"); - /* Destroy GPT partition table */ - $cmd = "/sbin/gpt destroy " . escapeshellarg($disk); - $out = create_cmdout_container("ufsgn_gpt_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating GPT partition", "ufsgn_gptc_out"); - /* Create GPT partition table */ - $cmd = array("/sbin/gpt create -f " . escapeshellarg($disk), - "/sbin/gpt add -t ufs " . escapeshellarg($disk)); - $out = create_cmdout_container("ufsgn_gptc_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating Filesystem without Soft Updates", "ufsgn_newfs_out"); - /* Create filesystem */ - $cmd = "/sbin/newfs -m 0 " . escapeshellarg($disk) . "p1"; - $out = create_cmdout_container("ufsgn_newfs_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - break; // end case "ufsgpt_no_su": - case "softraid": - $button = create_toggle_button("Initializing disk", "softr_fdisk_out"); - /* Initialize disk */ - $cmd = "/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk); - $out = create_cmdout_container("softr_fdisk_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Initializing partition", "softr_dd_out"); - /* Initialise the partition (optional) */ - $cmd = "/bin/dd if=/dev/zero of=" . escapeshellarg($disk) . "s1 bs=32k count=16"; - $out = create_cmdout_container("softr_dd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Delete old gmirror information", "softr_dd_out"); - /* Delete old gmirror information */ - $cmd = "/sbin/gmirror clear " . escapeshellarg($disk); - $out = create_cmdout_container("softr_dd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - break; // end case "softraid": - case "msdos": - $button = create_toggle_button("Initialize disk", "dos_fdisk_out"); - /* Initialize disk */ - $cmd = "/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk); - $out = create_cmdout_container("dos_fdisk_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Initialize partion", "dos_dd_out"); - /* Initialise the partition (optional) */ - $cmd = "/bin/dd if=/dev/zero of=" . escapeshellarg($disk) . "s1 bs=32k count=16"; - $out = create_cmdout_container("dos_dd_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating BSD label", "dos_label_out"); - /* Initialise the partition (optional) */ - $cmd = "/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto"; - $out = create_cmdout_container("dos_label_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - - $button = create_toggle_button("Creating Filesystem", "dos_newfs_out"); - /* Initialise the partition (optional) */ - $a_out = "/sbin/newfs_msdos -F 32 " . escapeshellarg($disk) . "s1"; - $out = create_cmdout_container("dos_newfs_out", $cmd); - $retvalue .= assemble_cmdout($button, $out, true); - - break; // end case "msdos": - } // end switch - - return $retvalue; -} - -if (!is_array($freenas_config['disks']['disk'])) - $freenas_config['disks']['disk'] = array(); - -disks_sort(); - -if (!is_array($freenas_config['gconcat']['vdisk'])) - $freenas_config['gconcat']['vdisk'] = array(); - -gconcat_sort(); - -if (!is_array($freenas_config['gmirror']['vdisk'])) - $freenas_config['gmirror']['vdisk'] = array(); - -gmirror_sort(); - -if (!is_array($freenas_config['graid5']['vdisk'])) - $freenas_config['graid5']['vdisk'] = array(); - -graid5_sort(); - -if (!is_array($freenas_config['gstripe']['vdisk'])) - $freenas_config['gstripe']['vdisk'] = array(); - -gstripe_sort(); - -if (!is_array($freenas_config['gvinum']['vdisk'])) - $freenas_config['gvinum']['vdisk'] = array(); - -gvinum_sort(); - -// Get all fstype supported by FreeNAS -$a_fst = get_fstype_list(); -// Remove NTFS: can't format on NTFS under FreeNAS -unset($a_fst['ntfs']); -// Remove the first blank line 'unknown' -$a_fst = array_slice($a_fst, 1); - -$a_disk = &$freenas_config['disks']['disk']; -$a_gconcat = &$freenas_config['gconcat']['vdisk']; -$a_gmirror = &$freenas_config['gmirror']['vdisk']; -$a_gstripe = &$freenas_config['gstripe']['vdisk']; -$a_graid5 = &$freenas_config['graid5']['vdisk']; -$a_gvinum = &$freenas_config['gvinum']['vdisk']; - $a_alldisk = array_merge($a_disk, - $a_gconcat, - $a_gmirror, - $a_gstripe, - $a_graid5, - $a_gvinum); - -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']; - $notinitmbr= $_POST['notinitmbr']; - - /* Check if disk is mounted. */ - if(isAjax() && disks_check_mount_fullname($disk)) { - $statustxt = sprintf(gettext("The disk is currently mounted! <a href=%s>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount"); - - $divcontents = "<div style='background:#990000'><table>"; - $divcontents .= "<tr><td>"; - $divcontents .= "<img src='/themes/{$g['theme']}/images/icons/icon_error.gif' width='28' height='32'>"; - $divcontents .= "</td><td><font color='white'><br> The following errors have occured:<p><ul>"; - $divcontents .= "<font color='white'><li> " . $statustxt . "</li>"; - $divcontents .= "</ul></td></table></div><br />"; - - header("HTTP/1.0 500 Internal Server Error"); - header("Status: 500 Internal Server Error. {$statustxt}"); - echo $divcontents; - exit; - } else if (disks_check_mount_fullname($disk)) { - $errormsg = sprintf(gettext("The disk is currently mounted! <a href=%s>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount"); - $do_format = false; - } - - if($do_format) { - /* Get the id of the disk array entry. */ - $NotFound = 1; - $id = array_search_ex($disk, $a_disk, "fullname"); - - if ($id) { - /* Set new filesystem type. */ - $a_disk[$id]['fstype'] = $type; - $NotFound = 0; - } - else { - $id = array_search_ex($disk, $a_gmirror, "fullname"); - } - if (($id !== false) && $NotFound) { - /* Set new filesystem type. */ - $a_gmirror[$id]['fstype'] = $type; - $NotFound = 0; - } - else { - $id = array_search_ex($disk, $a_gstripe, "fullname"); - } - if (($id !== false) && $NotFound) { - /* Set new filesystem type. */ - $a_gstripe[$id]['fstype'] = $type; - $NotFound = 0; - } - else { - $id = array_search_ex($disk, $a_gconcat, "fullname"); - } - if (($id !== false) && $NotFound) { - /* Set new filesystem type. */ - $a_gconcat[$id]['fstype'] = $type; - $NotFound = 0; - } - else { - $id = array_search_ex($disk, $a_graid5, "fullname"); - } - if (($id !== false) && $NotFound) { - /* Set new filesystem type. */ - $a_graid5[$id]['fstype'] = $type; - $NotFound = 0; - } - else { - $id = array_search_ex($disk, $a_gvinum, "fullname"); - } - if (($id !== false) && $NotFound) { - /* Set new filesystem type. */ - $a_gvinum[$id]['fstype'] = $type; - $NotFound = 0; - } - - write_config(); - - echo create_format_output($disk, $type, $notinitmbr); - exit; // cause of Ajax - } - } -} - -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 */ -$pfSenseHead->setCloseHead(false); -echo $pfSenseHead->getHTML(); - -?> -<script type="text/javascript"> -<!-- -function disk_change() { - switch(document.iform.disk.value) - { - <?php foreach ($a_alldisk as $diskv): ?> - case "<?=$diskv['fullname'];?>": - <?php $i = 0;?> - <?php foreach ($a_fst as $fstval => $fstname): ?> - document.iform.type.options[<?=$i++;?>].selected = <?php if($diskv['fstype'] == $fstval){echo "true";}else{echo "false";};?>; - <?php endforeach; ?> - break; - <?php endforeach; ?> - } -} - -<?= CMDOUT_TOGGLE_FUNC ?> -// --> -</script> -</head> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if($errormsg) print_error_box($errormsg);?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php"); - $tab_array[1] = array(gettext("Format"), true, "disks_manage_init.php"); - $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php"); - $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form id="iform" name="iform" action="disks_manage_init.php" method="post"> - <?= CMDOUT_AJAX_SCRIPT ?> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td> - <td width="78%" class="vtable"> - <select name="disk" class="formselect" id="disk" onchange="disk_change();"> - <?php foreach ($a_alldisk as $diskv): ?> - <option value="<?=$diskv['fullname'];?>" <?php if ($diskv['name'] == $disk) echo "selected=\selected\"";?>> - <?php echo htmlspecialchars($diskv['name'] . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?> - <?php endforeach; ?> - </option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td> - <td width="78%" class="vtable"> - <select name="type" class="formselect" id="type"> - <?php foreach ($a_fst as $fstval => $fstname): ?> - <option value="<?=$fstval;?>" <?php if($type == $fstval) echo 'selected="selected"';?>><?=htmlspecialchars($fstname);?></option> - <?php endforeach; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Don't Erase MBR");?></td> - <td width="78%" class="vtable"> - <input name="notinitmbr" id="notinitmbr" type="checkbox" value="yes" /><br /> - <?= gettext("don't erase the MBR (useful for some RAID controller cards)"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="doCMDSubmit" name="doCMDSubmit" type="button" class="formbtn" value="<?=gettext("Format disk!");?>" onclick="execCMD();" /> - </td> - </tr> - <tr> - <!-- Format Output Container - Do Not Delete --> - <td id="cmdOutputTD" valign="top" colspan="2" style="visibility: hidden; border: solid 1px silver; vertical-align: middle; width: 100%"></td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong> - </span> - <br /> - <span class="vexpl"> - <?= gettext("This step will erase all your partition, create partition number 1 and format the hard drive with the file system specified."); ?> - </span> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_manage_iscsi.php b/packages/freenas/www/disks_manage_iscsi.php deleted file mode 100644 index 5180fc1a..00000000 --- a/packages/freenas/www/disks_manage_iscsi.php +++ /dev/null @@ -1,209 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_manage_iscsi.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("iSCSI Initiator")); - -require_once("freenas_config.inc"); -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); - - $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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.targetname.disabled = endis; - document.iform.targetaddress.disabled = endis; - /* adjust colors */ - document.iform.targetname.style.backgroundColor = color; - document.iform.targetaddress.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php"); - $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php"); - $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php"); - $tab_array[3] = array(gettext("iSCSI Initiator"), true, "disks_manage_iscsi.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form id="iform" name="iform" action="disks_manage_iscsi.php" method="post"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("iSCSI Initiator");?></span> - <span style="vertical-align: middle; position: relative; left: 81%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Target IP address"); ?></td> - <td width="78%" class="vtable"> - <input name="targetaddress" type="text" class="formfld unknown" id="targetaddress" size="20" value="<?=htmlspecialchars($pconfig['targetaddress']);?>" /> - <br /><?= gettext("Target IP address"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("targetname"); ?></td> - <td width="78%" class="vtable"> - <input name="targetname" type="text" class="formfld unknown" id="targetname" size="20" value="<?=htmlspecialchars($pconfig['targetname']);?>" /> - <br /><?= gettext("targetname"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/disks_manage_tools.php b/packages/freenas/www/disks_manage_tools.php deleted file mode 100644 index d851f65c..00000000 --- a/packages/freenas/www/disks_manage_tools.php +++ /dev/null @@ -1,331 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_manage_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Tools")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -function create_cmd_output(&$action, &$a_disk, &$disk, &$partition, &$umount) { - $cmdout = CMDOUT_PARA; - - ob_end_flush(); - - $retvalue =<<<EOD -{$cmdout} - -EOD; - - switch($action) - { - case "fsck": - /* Get the id of the disk. */ - $id = array_search_ex($disk, $a_disk, "name"); - /* Get the filesystem type of the disk. */ - $type = $a_disk[$id]['fstype']; - /* Check if disk is mounted. */ - $ismounted = disks_check_mount_fullname($disk.$partition); - - /* Umount disk if necessary. */ - if($umount && $ismounted) { - $diskinit_str = "<strong class='red'>" . gettext("Note") . ":</strong> " . gettext("The disk is currently mounted! The mount point will be removed temporary to perform selected command.") . "<br /><br />"; - $retvalue .=<<<EOD - <div id="ismounted_out" style="font-family: Courier, monospace; font-size: small;"> - <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre> - </div> - -EOD; - - disks_umount_fullname($disk.$partition); - } - - switch($type) - { - case "": - case "ufs": - case "ufs_no_su": - case "ufsgpt": - case "ufsgpt_no_su": - $button = create_toggle_button("Checking disk", "ufsgn_fsck_out"); - $cmd = "/sbin/fsck_ufs -y -f " . escapeshellarg($disk . $partition); - $out = create_cmdout_container("ufsgn_fsck_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - break; - case "gmirror": - case "gvinum": - case "graid5": - $diskinit_str = sprintf(gettext("Use <a href='%s'>RAID tools</a> for this disk!"), "disks_raid_{$type}_tools.php"); - $retvalue .=<<<EOD - <div id="graid5_out" style="display: none; font-family: Courier, monospace; font-size: small;"> - <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre> - </div> - -EOD; - break; - case "msdos": - $button = create_toggle_button("Checking disk", "dos_fsck_out"); - $cmd = "/sbin/fsck_msdosfs -y -f " . escapeshellarg($disk . $partition); - $out = create_cmdout_container("dos_fsck_out", $cmd); - $retvalue .= assemble_cmdout($button, $out); - break; - } - - /* Mount disk if necessary. */ - if($umount && $ismounted) { - disks_mount_fullname($disk.$partition); - } - - break; - } - - return $retvalue; -} - -if (!is_array($freenas_config['disks']['disk'])) - $freenas_config['disks']['disk'] = array(); - -disks_sort(); - -if (!is_array($freenas_config['gvinum']['vdisk'])) - $freenas_config['gvinum']['vdisk'] = array(); - -gvinum_sort(); - -if (!is_array($freenas_config['gmirror']['vdisk'])) - $freenas_config['gmirror']['vdisk'] = array(); - -gmirror_sort(); - -if (!is_array($freenas_config['gconcat']['vdisk'])) - $freenas_config['gconcat']['vdisk'] = array(); - -gconcat_sort(); - -if (!is_array($freenas_config['gstripe']['vdisk'])) - $freenas_config['gstripe']['vdisk'] = array(); - -gstripe_sort(); - -if (!is_array($freenas_config['graid5']['vdisk'])) - $freenas_config['graid5']['vdisk'] = array(); - -graid5_sort(); - -$a_disk = array_merge($freenas_config['disks']['disk'], - $freenas_config['gvinum']['vdisk'], - $freenas_config['gmirror']['vdisk'], - $freenas_config['gconcat']['vdisk'], - $freenas_config['gstripe']['vdisk'], - $freenas_config['graid5']['vdisk']); - -if ($_POST) { - unset($input_errors); - unset($do_action); - - /* input validation */ - $reqdfields = explode(" ", "disk action"); - $reqdfieldsn = explode(",", "Disk,Action"); - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - /* 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; - $disk = $_POST['disk']; - $action = $_POST['action']; - $partition = $_POST['partitionno']; - $umount = $_POST['umount']; - - echo create_cmd_output($action, $a_disk, $disk, $partition, $umount); - exit; // cause of Ajax - } -} - -if (!isset($do_action)) -{ - $do_action = false; - $disk = ''; - $action = ''; - $partition = ''; - $umount = false; -} - -/* 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 */ -$pfSenseHead->setCloseHead(false); -echo $pfSenseHead->getHTML(); - -?> -<script type="text/javascript"> -<!-- -function disk_change() { - var next = null; - // Remove all entries from partition combobox. - document.iform.partitionno.length = 0; - // Insert entries for partition combobox. - alert(document.iform.disk.value); - switch(document.iform.disk.value) - { - <?php foreach ($a_disk as $diskv): ?> - <?php if (strcmp($diskv['fstype'],"softraid")==0): ?> - <?php continue; ?> - <?php endif; ?> - case "/dev/<?=$diskv['name'];?>": - <?php $partinfo = disks_get_partition_info($diskv['name']);?> - <?php foreach($partinfo as $partinfon => $partinfov): ?> - if(document.all) // MS IE workaround. - next = document.iform.partitionno.length; - alert(document.iform.partitionno); - document.iform.partitionno.add(new Option("<?=$partinfon;?>","s<?=$partinfon;?>",false,<?php if("s{$partinfon}"==$partition){echo "true";}else{echo "false";};?>), next); - <?php endforeach; ?> - break; - <?php endforeach; ?> - } -} - -<?= CMDOUT_TOGGLE_FUNC ?> -// --> -</script> -</head> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_manage_tools.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php"); - $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php"); - $tab_array[2] = array(gettext("Tools"), true, "disks_manage_tools.php"); - $tab_array[3] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <?= CMDOUT_AJAX_SCRIPT ?> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td> - <td width="78%" class="vtable"> - <select name="disk" class="formselect" id="disk" onchange="disk_change();"> - <?php foreach ($a_disk as $diskn): ?> - <?php if (strcmp($diskn['fstype'],"softraid")==0): ?> - <?php continue; ?> - <?php endif; ?> - <option value="<?=$diskn['fullname'];?>"<?php if ($diskn['fullname'] == $disk) echo "selected=\"selected\"";?>> - <?php echo htmlspecialchars($diskn['name'] . ": " .$diskn['size'] . " (" . $diskn['desc'] . ")");?> - <?php endforeach; ?> - </option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td> - <td width="78%" class="vtable"> - <select name="partitionno" class="formselect" id="partitionno"></select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Command");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="fsck" <?php if ($action == "fsck") echo "selected"; ?>>fsck</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"></td> - <td width="78%" class="vtable"> - <input name="umount" type="checkbox" id="umount" value="yes" <?php if ($umount) echo "checked"; ?> /> - <strong> - <?= gettext("Unmount disk/partition"); ?> - </strong> - <span class="vexpl"> - <br /> - <?= gettext("If the selected disk/partition is mounted it will be unmounted temporary to perform selected command, otherwise the commands work in read-only mode."); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="doCMDSubmit" name="doCMDSubmit" type="button" class="formbtn" value="<?=gettext("Send Command!");?>" onclick="execCMD();" /> - </td> - </tr> - <tr> - <!-- Format Output Container - Do Not Delete --> - <td id="cmdOutputTD" valign="top" colspan="2" style="visibility: hidden; border: solid 1px silver; vertical-align: middle; width: 100%"></td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<script type="text/javascript"> -<!-- - disk_change(); -//--> -</script> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php deleted file mode 100644 index c72b0d82..00000000 --- a/packages/freenas/www/disks_mount.php +++ /dev/null @@ -1,235 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_mount.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Mount Point")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form id="iform" name="iform" action="disks_mount.php" method="post"> -<?php if (file_exists($d_mountdirty_path)): ?> -<?php print_info_box_np(gettext("The mount point list has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), true, "disks_mount.php"); - $tab_array[1] = array(gettext("Tools"), false, "disks_mount_tools.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Disk");?></td> - <td class="listhdrr"><?=gettext("Partition");?></td> - <td class="listhdrr"><?=gettext("File system");?></td> - <td class="listhdrr"><?=gettext("Share name");?></td> - <td class="listhdrr"><?=gettext("Description");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_mount as $mount): ?> - <tr> - <td valign="middle" class="listlr"> - <?=htmlspecialchars($mount['mdisk']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($mount['partition']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($mount['fstype']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($mount['sharename']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($mount['desc']);?> - </td> - <td valign="middle" class="listbg" style="color: #FFFFFF;"> - <?php - if (file_exists($d_mountdirty_path)) { - $stat = gettext("configuring"); - } else { - $stat = disks_check_mount($mount); - if ($stat == false) { - $stat = "ERROR - <a href=\"disks_mount.php?act=ret&id=$i\">retry</a>"; - } else { - $stat = gettext("OK"); - } - } - echo $stat; - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_mount_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_mount.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<?= gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="6"></td> - <td class="list" nowrap> - <a href="disks_mount_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add mount");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="7"> - <span class="red"> - <strong>Note:</strong> - </span> - <br /> - <span class="vexpl"> - <?= gettext("Second configuration step: Declaring the filesystem used by your"); ?> - </span> - <br /> - <span class="vexpl"> - <a href="disks_manage.php">previously configured disk</a> - </span> - </td> - </tr> - </table> - </div> - </td> - </tr> - </table> -</form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_mount_edit.php b/packages/freenas/www/disks_mount_edit.php deleted file mode 100644 index 6b7a2248..00000000 --- a/packages/freenas/www/disks_mount_edit.php +++ /dev/null @@ -1,307 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_mount_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Mount Point"), - gettext("Edit")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -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['gvinum']['vdisk'])) - $freenas_config['gvinum']['vdisk'] = array(); - -gvinum_sort(); - -if (!is_array($freenas_config['gmirror']['vdisk'])) - $freenas_config['gmirror']['vdisk'] = array(); - -gmirror_sort(); - -if (!is_array($freenas_config['gconcat']['vdisk'])) - $freenas_config['gconcat']['vdisk'] = array(); - -gconcat_sort(); - -if (!is_array($freenas_config['gstripe']['vdisk'])) - $freenas_config['gstripe']['vdisk'] = array(); - -gstripe_sort(); - -if (!is_array($freenas_config['graid5']['vdisk'])) - $freenas_config['graid5']['vdisk'] = array(); - -graid5_sort(); - -$a_mount = &$freenas_config['mounts']['mount']; - -$a_disk = array_merge($freenas_config['disks']['disk'],$freenas_config['gvinum']['vdisk'],$freenas_config['gmirror']['vdisk'],$freenas_config['gconcat']['vdisk'],$freenas_config['gstripe']['vdisk'],$freenas_config['graid5']['vdisk']); - -/* Load the cfdevice file*/ -$filename=$g['varetc_path']."/cfdevice"; -if (file_exists($filename)) - $cfdevice = trim(file_get_contents("$filename")); - -if (isset($id) && $a_mount[$id]) { - $pconfig['mdisk'] = $a_mount[$id]['mdisk']; - $pconfig['partition'] = $a_mount[$id]['partition']; - $pconfig['fullname'] = $a_mount[$id]['fullname']; - $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(" ", "partitionno 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['partitionno']; - - 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; - - /* Check for duplicate mount point */ - if ($mount['mdisk'] == $_POST['mdisk']) - { - $error_bucket[] = array("error" => gettext("This disk/partition is allready configured."), - "field" => "mdisk"); - 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['partitionno']; - $mount['fstype'] = $_POST['fstype']; - $mount['desc'] = $_POST['desc']; - /* if not sharename given, create one */ - if (!$_POST['sharename']) - $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partitionno']}"; - else - $mount['sharename'] = $_POST['sharename']; - - // Generate fullname - $mount['fullname'] = "{$mount['mdisk']}{$mount['partition']}"; - - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="disks_mount_edit.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td> - <td width="78%" class="vtable"> - <select name="mdisk" class="formselect" id="mdisk"> - <?php foreach ($a_disk as $disk): ?> - <?php if (strcmp($disk['fstype'],"softraid")==0): ?> - <?php continue; ?> - <?php endif; ?> - <option value="<?=$disk['fullname'];?>" <?php if ($pconfig['mdisk'] == $disk['name']) echo "selected";?>> - <?php echo htmlspecialchars($disk['name'] . ": " .$disk['size'] . " (" . $disk['desc'] . ")"); ?> - </option> - <?php endforeach; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td> - <td width="78%" class="vtable"> - <select name="partitionno" class="formselect" id="partition_number"> - <option value="s1" <?php if ($pconfig['partition'] == "s1") echo "selected"; ?>>1 (or new software RAID method)</option> - <option value="s2" <?php if ($pconfig['partition'] == "s2") echo "selected"; ?>>2</option> - <option value="s3" <?php if ($pconfig['partition'] == "s3") echo "selected"; ?>>3</option> - <option value="s4" <?php if ($pconfig['partition'] == "s4") echo "selected"; ?>>4</option> - <option value="gmirror" <?php if ($pconfig['partition'] == "gmirror") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gmirror</option> - <option value="graid5" <?php if ($pconfig['partition'] == "graid5") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - graid5</option> - <option value="gvinum" <?php if ($pconfig['partition'] == "gvinum") echo "selected"; ?>>previous <?=_SOFTRAID ;?> - gvinum</option> - <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected"; ?>>GPT (or new software RAID method with GPT)</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td> - <td width="78%" class="vtable"> - <select name="fstype" class="formselect" id="fstype"> - <option value="ufs" <?php if ($pconfig['fstype'] == "ufs") echo "selected=\"selected\""; ?>>UFS</option> - <option value="msdosfs" <?php if ($pconfig['fstype'] == "msdosfs") echo "selected\"selected\""; ?>>FAT</option> - <option value="ntfs" <?php if ($pconfig['fstype'] == "ntfs") echo "selected\"selected\""; ?>>NTFS (read-only)</option> - <option value="ext2fs" <?php if ($pconfig['fstype'] == "ext2fs") echo "selected\"selected\""; ?>>EXT2 FS</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Share name");?></td> - <td width="78%" class="vtable"> - <input name="sharename" type="text" class="formfld unknown" id="sharename" size="20" value="<?=htmlspecialchars($pconfig['sharename']);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> - <td width="78%" class="vtable"> - <input name="desc" type="text" class="formfld unknown" id="desc" size="20" value="<?=htmlspecialchars($pconfig['desc']);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - <?php if (isset($id) && $a_mount[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - <tr> - <td width="100%" align="left" valign="top" colspan="2"> - <span class="red"> - <strong><?= gettext("WARNING"); ?>:</strong> - </span> - <ol> - <li> - <span class="vexpl"> - <?= gettext("You can't mount the partition '"); ?> - <?php echo htmlspecialchars($cfdevice);?> - <?= gettext("' where the config file is stored"); ?> - </span> - </li> - <li><span class="vexpl"><?= gettext("FreeBSD NTFS has lots of bugs."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_mount_tools.php b/packages/freenas/www/disks_mount_tools.php deleted file mode 100644 index 4f415b77..00000000 --- a/packages/freenas/www/disks_mount_tools.php +++ /dev/null @@ -1,233 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_mount_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("Mount Point"), - gettext("Tools")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -function create_cmd_output(&$action, &$a_mount, &$fullname) { - $cmdout = CMDOUT_PARA_WOHINT; - - ob_end_flush(); - - $retvalue =<<<EOD -{$cmdout} - -EOD; - - /* Get the id of the mount array entry. */ - $id = array_search_ex($fullname, $a_mount, "fullname"); - /* Get the mount data. */ - $mount = $a_mount[$id]; - - switch($action) - { - case "mount": - $diskinit_str = gettext("Mounting '{$fullname}'...") . "<br />"; - $result = disks_mount_fullname($fullname); - break; - case "umount": - $diskinit_str = gettext("Umounting '{$fullname}'...") . "<br />"; - $result = disks_umount_fullname($fullname); - break; - } - - /* Display result */ - (0 == $result) ? $diskinit_str .= gettext("Successful") : $diskinit_str .= gettext("Failed"); - - $retvalue .=<<<EOD - <div id="ismounted_out" style="font-family: Courier, monospace; font-size: small;"> - <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre> - </div> - -EOD; - - return $retvalue; -} - -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); - unset($do_action); - - /* input validation */ - $reqdfields = explode(" ", "fullname action"); - $reqdfieldsn = explode(",", "Fullname,Action"); - 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; - $fullname = $_POST['fullname']; - $action = $_POST['action']; - - echo create_cmd_output($action, $a_mount, $fullname); - exit; // cause of Ajax - } -} - -if(!isset($do_action)) -{ - $do_action = false; - $fullname = ''; - $action = ''; -} - -// URL GET from the disks_manage_init.php page: -// we get the $disk value, must found the $fullname now -if(isset($_GET['disk'])) { - $disk = $_GET['disk']; - $id = array_search_ex($disk, $a_mount, "mdisk"); - - $fullname = $a_mount[$id]['fullname']; -} -if(isset($_GET['action'])) { - $action = $_GET['action']; -} - -/* 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 */ -$pfSenseHead->setCloseHead(false); -echo $pfSenseHead->getHTML(); - -?> -<script type="text/javascript"> -<!-- -<?= CMDOUT_TOGGLE_FUNC ?> -// --> -</script> -</head> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_mount_tools.php" method="post" name="iform" id="iform"> -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage"), false, "disks_mount.php"); - $tab_array[1] = array(gettext("Tools"), true, "disks_mount_tools.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <?= CMDOUT_AJAX_SCRIPT ?> - <?php if ($input_errors) print_input_errors($input_errors); ?> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Share Name"); ?></td> - <td class="vtable"> - <select name="fullname" class="formselect" id="fullname"> - <?php foreach ($a_mount as $mountv): ?> - <option value="<?=$mountv['fullname'];?>"<?php if ($mountv['fullname'] == $fullname) echo "selected";?>> - <?php echo htmlspecialchars($mountv['sharename'] . " (" . gettext("Disk") . ": " . $mountv['mdisk'] . " " . gettext("Partition") . ": " . $mountv['partition'] . ")");?> - <?php endforeach; ?> - </option> - </select> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Command"); ?></td> - <td class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="mount" <?php if ($action == "mount") echo "selected"; ?>>mount</option> - <option value="umount" <?php if ($action == "umount") echo "selected"; ?>>umount</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="doCMDSubmit" name="doCMDSubmit" type="button" class="formbtn" value="<?=gettext("Send Command!");?>" onclick="execCMD();" /> - </td> - </tr> - <tr> - <!-- Format Output Container - Do Not Delete --> - <td id="cmdOutputTD" valign="top" colspan="2" style="visibility: hidden; border: solid 1px silver; vertical-align: middle; width: 100%"></td> - </tr> - </table> - </div> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gconcat.php b/packages/freenas/www/disks_raid_gconcat.php deleted file mode 100644 index e7fc9f81..00000000 --- a/packages/freenas/www/disks_raid_gconcat.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gconcat.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Concat"), - gettext("RAID")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['gconcat']['vdisk'])) - $freenas_config['gconcat']['vdisk'] = array(); - -gconcat_sort(); - -$raidstatus=get_sraid_disks_list(); - -$a_raid = &$freenas_config['gconcat']['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_gconcat_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_gconcat_delete($raidname); - unset($a_raid[$_GET['id']]); - write_config(); - touch($d_raidconfdirty_path); - pfSenseHeader("disks_raid_gconcat.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_raid_gconcat.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gconcat.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gconcat_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gconcat_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Volume name");?></td> - <td class="listhdrr"><?=gettext("Type");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_raid as $raid): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['type']);?> - </td> - <td valign="middle" class="listr"> - <?php - $raidconfiguring = file_exists($d_raidconfdirty_path) && - in_array($raid['name']."\n",file($d_raidconfdirty_path)); - if ($raidconfiguring) - echo gettext("configuring"); - else { - $tempo=$raid['name']; - echo "{$raidstatus[$tempo]['size']}"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?php - if ($raidconfiguring) - echo gettext("configuring"); - else { - echo "{$raidstatus[$tempo]['desc']}"; - } - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_raid_gconcat_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_raid_gconcat.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" nowrap> - <a href="disks_raid_gconcat_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="5"> - <span class="red"> - <strong><?= gettext("Note:"); ?></strong> - </span> - <br /> - <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span> - <br /> - <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span> - <br /> - <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span> - </span> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gconcat_edit.php b/packages/freenas/www/disks_raid_gconcat_edit.php deleted file mode 100644 index f4bd33cc..00000000 --- a/packages/freenas/www/disks_raid_gconcat_edit.php +++ /dev/null @@ -1,256 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gconcat_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Concat"), - gettext("RAID"), - isset($id) ? gettext("Edit") : gettext("Add")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['gconcat']['vdisk'])) - $freenas_config['gconcat']['vdisk'] = array(); - -gconcat_sort(); -disks_sort(); - -$a_raid = &$freenas_config['gconcat']['vdisk']; -$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gconcat']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']); -$a_disk = get_fstype_disks_list("softraid"); - -if (!sizeof($a_disk)) { - $nodisk_errors[] = gettext("You must add disks first."); -} - -if (isset($id) && $a_raid[$id]) { - $pconfig['name'] = $a_raid[$id]['name']; - $pconfig['type'] = $a_raid[$id]['type']; - $pconfig['diskr'] = $a_raid[$id]['diskr']; - $pconfig['fullname'] = $a_raid[$id]['fullname']; -} - -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 a minimum of 2 disks in a JBOD."), - "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['type'] = "JBOD"; - $raid['diskr'] = $_POST['diskr']; - $raid['desc'] = "Software gconcat JBOD"; - $raid['fullname'] = "/dev/concat/{$raid['name']}"; - - 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_gconcat.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gconcat_edit.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td> - <td class="vtable">JBOD</td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td> - <td width="78%" class="vtable"> - <? - $i=0; - $disable_script=""; - - foreach ($a_disk as $diskv) { - $r_name=""; - - foreach($all_raid as $raid) { - if (in_array($diskv['fullname'],(array)$raid['diskr'])) { - $r_name=$raid['name']; - if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n"; - break; - } - } - echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'". - ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") . - " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n"; - $i++; - - $i++; - } - - if ($disable_script) - echo "<script type='text/javascript'><!--\n$disable_script--></script>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gconcat_infos.php b/packages/freenas/www/disks_raid_gconcat_infos.php deleted file mode 100644 index 09dfd76a..00000000 --- a/packages/freenas/www/disks_raid_gconcat_infos.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gconcat_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Concat"), - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gconcat.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gconcat_tools.php"); - $tab_array[2] = array(gettext("Information"), true, "disks_raid_gconcat_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gconcat_infos.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" class="vtable"> - <?php - echo "<pre>"; - echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />"; - - exec("/sbin/gconcat list",$rawdata); - foreach ($rawdata as $line){ - echo htmlspecialchars($line) . "<br>"; - } - - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gconcat_tools.php b/packages/freenas/www/disks_raid_gconcat_tools.php deleted file mode 100644 index 7783450d..00000000 --- a/packages/freenas/www/disks_raid_gconcat_tools.php +++ /dev/null @@ -1,187 +0,0 @@ -<?php -/* - disks_raid_gmirror_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Concat"), - gettext("Tools")); - -require_once("freenas_config.inc"); -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); - unset($do_action); - - $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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), true, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gmirror_tools.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option> - <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option> - <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option> - <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Send Command!" /> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_action) { - echo("<strong>" . gettext("GCONCAT command output:") . "</strong><br />"); - echo('<pre>'); - ob_end_flush(); - - system("/sbin/gmirror $action " . escapeshellarg($object)); - - echo('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <ol> - <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li> - <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gmirror.php b/packages/freenas/www/disks_raid_gmirror.php deleted file mode 100644 index 78390a64..00000000 --- a/packages/freenas/www/disks_raid_gmirror.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gmirror.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Mirror"), - gettext("RAID")); - -require_once("freenas_config.inc"); -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(); - touch($d_raidconfdirty_path); - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_raid_gmirror.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Volume name");?></td> - <td class="listhdrr"><?=gettext("Type");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_raid as $raid): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['type']);?> - </td> - <td valign="middle" class="listr"> - <?php - $raidconfiguring = file_exists($d_raidconfdirty_path) && - in_array($raid['name']."\n",file($d_raidconfdirty_path)); - if ($raidconfiguring) - echo gettext("configuring"); - else { - $tempo=$raid['name']; - echo "{$raidstatus[$tempo]['size']}"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?php - if ($raidconfiguring) - echo gettext("configuring"); - else { - echo "{$raidstatus[$tempo]['desc']}"; - } - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_raid_gmirror_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_raid_gmirror.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" nowrap> - <a href="disks_raid_gmirror_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="5"> - <span class="red"> - <strong><?= gettext("Note:"); ?></strong> - </span> - <br /> - <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span> - <br /> - <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span> - <br /> - <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span> - </span> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gmirror_edit.php b/packages/freenas/www/disks_raid_gmirror_edit.php deleted file mode 100644 index ac08a442..00000000 --- a/packages/freenas/www/disks_raid_gmirror_edit.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gmirror_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Mirror"), - gettext("RAID"), - isset($id) ? gettext("Edit") : gettext("Add")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['gmirror']['vdisk'])) - $freenas_config['gmirror']['vdisk'] = array(); - -gmirror_sort(); -disks_sort(); - -$a_raid = &$freenas_config['gmirror']['vdisk']; -$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gmirror']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']); -$a_disk = get_fstype_disks_list("softraid"); - -if (!sizeof($a_disk)) { - $nodisk_errors[] = gettext("You must add disks first."); -} - -if (isset($id) && $a_raid[$id]) { - $pconfig['name'] = $a_raid[$id]['name']; - $pconfig['fullname'] = $a_raid[$id]['fullname']; - $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']}"; - $raid['fullname'] = "/dev/mirror/{$raid['name']}"; - - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gmirror_edit.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td> - <td class="vtable"> - RAID 1 (<?= gettext("mirroring"); ?>) - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Balance algorithm"); ?></td> - <td width="78%" class="vtable"> - <select name="balance" class="formselect"> - <?php $balvals = array( - "split"=>"Split request", - "load"=>"Read from lowest load", - "round-robin"=>"Round-robin read"); - ?> - <?php foreach ($balvals as $balval => $balname): ?> - <option value="<?=$balval;?>" <?php if($pconfig['balance'] == $balval) echo 'selected';?>><?=htmlspecialchars($balname);?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("Select your read balance algorithm."); ?></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td> - <td width="78%" class="vtable"> - <? - $i=0; - $disable_script=""; - - foreach ($a_disk as $diskv) { - $r_name=""; - - foreach($all_raid as $raid) { - if (in_array($diskv['fullname'],(array)$raid['diskr'])) { - $r_name=$raid['name']; - if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n"; - break; - } - } - echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'". - ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") . - " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n"; - $i++; - - $i++; - } - - if ($disable_script) - echo "<script type='text/javascript'><!--\n$disable_script--></script>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gmirror_infos.php b/packages/freenas/www/disks_raid_gmirror_infos.php deleted file mode 100644 index 878f571e..00000000 --- a/packages/freenas/www/disks_raid_gmirror_infos.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gmirror_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), true, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gmirror_infos.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" class="vtable"> - <?php - echo "<pre>"; - echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />"; - - exec("/sbin/gmirror list",$rawdata); - foreach ($rawdata as $line){ - echo htmlspecialchars($line) . "<br>"; - } - - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gmirror_init.php b/packages/freenas/www/disks_raid_gmirror_init.php deleted file mode 100644 index 2b2d59af..00000000 --- a/packages/freenas/www/disks_raid_gmirror_init.php +++ /dev/null @@ -1,179 +0,0 @@ -<?php -/* $Id$ */ -/* - disks_raid_gmirror_init.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* ========================================================================== */ -/* == T H I S F I L E I S C U R R E N T L Y N O T U S E D == */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Mirror"), - gettext("Initialize")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Format RAID"), true, "disks_raid_gmirror_init.php"); - $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php"); - $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gmirror_init.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td> - <td width="78%" class="vtable"> - <input name="disk" type="text" class="formfld" id="disk" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_format) { - echo("<strong>" . gettext("Disk format UFS output:") . "</strong><br />"); - echo('<pre>'); - ob_end_flush(); - - /* Create filesystem */ - system("/sbin/newfs -U /dev/mirror/" . escapeshellarg($disk)); - - echo('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <span class="vexpl"> - <?= gettext("This step will format the RAID volume in Unix FileSystem (UFS)."); ?> - </span> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gmirror_tools.php b/packages/freenas/www/disks_raid_gmirror_tools.php deleted file mode 100644 index 0fe99576..00000000 --- a/packages/freenas/www/disks_raid_gmirror_tools.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php -/* - disks_raid_gmirror_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Mirror"), - gettext("Tools")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gmirror_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gmirror_tools.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="rebuild" <?php if ($action == "rebuild") echo "selected=\"selected\""; ?>>rebuild</option> - <option value="list" <?php if ($action == "list") echo "selected=\"selected\""; ?>>list</option> - <option value="status" <?php if ($action == "status") echo "selected=\"selected\""; ?>>status</option> - <option value="remove" <?php if ($action == "remove") echo "selected=\"selected\""; ?>>remove</option> - <option value="activate" <?php if ($action == "activate") echo "selected=\"selected\""; ?>>activate</option> - <option value="deactivate" <?php if ($action == "deactivate") echo "selected=\"selected\""; ?>>deactivate</option> - <option value="forget" <?php if ($action == "forget") echo "selected=\"selected\""; ?>>forget</option> - <option value="clear" <?php if ($action == "clear") echo "selected=\"selected\""; ?>>clear</option> - <option value="stop" <?php if ($action == "stop") echo "selected=\"selected\""; ?>>stop</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Send Command!" /> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_action) { - echo("<strong>" . gettext("GMIRROR command output:") . "</strong><br />"); - echo('<pre>'); - ob_end_flush(); - - system("/sbin/gmirror $action " . escapeshellarg($object)); - - echo('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <ol> - <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li> - <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_graid5.php b/packages/freenas/www/disks_raid_graid5.php deleted file mode 100644 index 6273b077..00000000 --- a/packages/freenas/www/disks_raid_graid5.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_graid5.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM RAID5"), - gettext("RAID")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['graid5']['vdisk'])) - $freenas_config['graid5']['vdisk'] = array(); - -graid5_sort(); - -$raidstatus=get_sraid_disks_list(); - -$a_raid = &$freenas_config['graid5']['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_graid5_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_graid5_delete($raidname); - unset($a_raid[$_GET['id']]); - write_config(); - touch($d_raidconfdirty_path); - pfSenseHeader("disks_raid_graid5.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_raid_graid5.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_graid5.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Volume name");?></td> - <td class="listhdrr"><?=gettext("Type");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_raid as $raid): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['type']);?> - </td> - <td valign="middle" class="listr"> - <?php - $raidconfiguring = file_exists($d_raidconfdirty_path) && - in_array($raid['name']."\n",file($d_raidconfdirty_path)); - if ($raidconfiguring) - echo gettext("configuring"); - else { - $tempo=$raid['name']; - echo "{$raidstatus[$tempo]['size']}"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?php - if ($raidconfiguring) - echo gettext("configuring"); - else { - echo "{$raidstatus[$tempo]['desc']}"; - } - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_raid_graid5_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_raid_graid5.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" nowrap> - <a href="disks_raid_graid5_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="5"> - <span class="red"> - <strong><?= gettext("Note:"); ?></strong> - </span> - <br /> - <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span> - <br /> - <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span> - <br /> - <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span> - </span> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_graid5_edit.php b/packages/freenas/www/disks_raid_graid5_edit.php deleted file mode 100644 index 27069f6c..00000000 --- a/packages/freenas/www/disks_raid_graid5_edit.php +++ /dev/null @@ -1,258 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_graid5_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM RAID5"), - gettext("RAID"), - isset($id) ? gettext("Edit") : gettext("Add")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['graid5']['vdisk'])) - $freenas_config['graid5']['vdisk'] = array(); - -graid5_sort(); -disks_sort(); - -$a_raid = &$freenas_config['graid5']['vdisk']; -$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['graid5']['vdisk']); -$a_disk = get_fstype_disks_list("softraid"); - -if (!sizeof($a_disk)) { - $nodisk_errors[] = gettext("You must add disks first."); -} - -if (isset($id) && $a_raid[$id]) { - $pconfig['name'] = $a_raid[$id]['name']; - $pconfig['type'] = $a_raid[$id]['type']; - $pconfig['diskr'] = $a_raid[$id]['diskr']; - $pconfig['fullname'] = $a_raid[$id]['fullname']; -} - -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']) < 3) - $error_bucket[] = array("error" => gettext("There must be a minimum of 3 disks in a RAID 5 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['type'] = "JBOD"; - $raid['diskr'] = $_POST['diskr']; - $raid['desc'] = "Software graid5 RAID 5"; - $raid['fullname'] = "/dev/raid5/{$raid['name']}"; - - 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_graid5.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_graid5.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_graid5_edit.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td> - <td class="vtable"> - RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>) - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td> - <td width="78%" class="vtable"> - <? - $i=0; - $disable_script=""; - - foreach ($a_disk as $diskv) { - $r_name=""; - - foreach($all_raid as $raid) { - if (in_array($diskv['fullname'],(array)$raid['diskr'])) { - $r_name=$raid['name']; - if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n"; - break; - } - } - echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'". - ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") . - " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n"; - $i++; - - $i++; - } - - if ($disable_script) - echo "<script type='text/javascript'><!--\n$disable_script--></script>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_graid5_infos.php b/packages/freenas/www/disks_raid_graid5_infos.php deleted file mode 100644 index 31506011..00000000 --- a/packages/freenas/www/disks_raid_graid5_infos.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_graid5_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM RAID5"), - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_graid5.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_graid5_tools.php"); - $tab_array[2] = array(gettext("Information"), true, "disks_raid_graid5_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_graid5_infos.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" class="vtable"> - <?php - echo "<pre>"; - echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />"; - - exec("/sbin/graid5 list",$rawdata); - foreach ($rawdata as $line){ - echo htmlspecialchars($line) . "<br>"; - } - - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_graid5_tools.php b/packages/freenas/www/disks_raid_graid5_tools.php deleted file mode 100644 index c8b3cf5b..00000000 --- a/packages/freenas/www/disks_raid_graid5_tools.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -/* - disks_raid_graid5_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM RAID5"), - gettext("Tools")); - -require_once("freenas_config.inc"); -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); - unset($do_action); - - $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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), true, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_graid5.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_graid5_init.php"); */ - $tab_array[1] = array(gettext("Tools"), true, "disks_raid_graid5_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_graid5_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_graid5_tools.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option> - <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option> - <option value="insert" <?php if ($action == "insert") echo "selected"; ?>>insert</option> - <option value="remove" <?php if ($action == "remove") echo "selected"; ?>>remove</option> - <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option> - <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option> - <option value="destroy" <?php if ($action == "destroy") echo "selected"; ?>>destroy</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Send Command!" /> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_action) { - echo("<strong>" . gettext("GCONCAT command output:") . "</strong><br />"); - echo('<pre>'); - ob_end_flush(); - - system("/sbin/graid5 $action " . escapeshellarg($object)); - - echo('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <ol> - <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li> - <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gstripe.php b/packages/freenas/www/disks_raid_gstripe.php deleted file mode 100644 index 4d5f622d..00000000 --- a/packages/freenas/www/disks_raid_gstripe.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gstripe.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Stripe"), - gettext("RAID")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['gstripe']['vdisk'])) - $freenas_config['gstripe']['vdisk'] = array(); - -gstripe_sort(); - -$raidstatus=get_sraid_disks_list(); - -$a_raid = &$freenas_config['gstripe']['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_gstripe_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_gstripe_delete($raidname); - unset($a_raid[$_GET['id']]); - write_config(); - touch($d_raidconfdirty_path); - pfSenseHeader("disks_raid_gstripe.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_raid_gstripe.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gstripe.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Volume name");?></td> - <td class="listhdrr"><?=gettext("Type");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_raid as $raid): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['type']);?> - </td> - <td valign="middle" class="listr"> - <?php - $raidconfiguring = file_exists($d_raidconfdirty_path) && - in_array($raid['name']."\n",file($d_raidconfdirty_path)); - if ($raidconfiguring) - echo gettext("configuring"); - else { - $tempo=$raid['name']; - echo "{$raidstatus[$tempo]['size']}"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?php - if ($raidconfiguring) - echo gettext("configuring"); - else { - echo "{$raidstatus[$tempo]['desc']}"; - } - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_raid_gstripe_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_raid_gstripe.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" nowrap> - <a href="disks_raid_gstripe_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="5"> - <span class="red"> - <strong><?= gettext("Note:"); ?></strong> - </span> - <br /> - <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span> - <br /> - <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span> - <br /> - <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span> - </span> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gstripe_edit.php b/packages/freenas/www/disks_raid_gstripe_edit.php deleted file mode 100644 index ab18d6e7..00000000 --- a/packages/freenas/www/disks_raid_gstripe_edit.php +++ /dev/null @@ -1,258 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gstripe_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Stripe"), - gettext("RAID"), - gettext("Edit")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['gstripe']['vdisk'])) - $freenas_config['gstripe']['vdisk'] = array(); - -gstripe_sort(); -disks_sort(); - -$a_raid = &$freenas_config['gstripe']['vdisk']; -$all_raid = array_merge((array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gstripe']['vdisk']); -$a_disk = get_fstype_disks_list("softraid"); - -if (!sizeof($a_disk)) { - $nodisk_errors[] = gettext("You must add disks first."); -} - -if (isset($id) && $a_raid[$id]) { - $pconfig['name'] = $a_raid[$id]['name']; - $pconfig['type'] = $a_raid[$id]['type']; - $pconfig['diskr'] = $a_raid[$id]['diskr']; - $pconfig['fullname'] = $a_raid[$id]['fullname']; -} - -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 a minimum of 2 disks in a RAID 0 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['type'] = "JBOD"; - $raid['diskr'] = $_POST['diskr']; - $raid['desc'] = "Software gstripe RAID 0"; - $raid['fullname'] = "/dev/stripe/{$raid['name']}"; - - 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_gstripe.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gstripe.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gstripe_edit.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td> - <td class="vtable"> - RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>) - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td> - <td width="78%" class="vtable"> - <? - $i=0; - $disable_script=""; - - foreach ($a_disk as $diskv) { - $r_name=""; - - foreach($all_raid as $raid) { - if (in_array($diskv['fullname'],(array)$raid['diskr'])) { - $r_name=$raid['name']; - if ($r_name!=$pconfig['name']) $disable_script.="document.getElementById($i).disabled=1;\n"; - break; - } - } - echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[fullname]'". - ((is_array($pconfig['diskr']) && in_array($diskv['fullname'],$pconfig['diskr'])) ? " checked=\"checked\"" : "") . - " />$diskv[name] ($diskv[size], $diskv[desc])".(($r_name) ? " - assigned to $r_name" : "")."<br />\n"; - $i++; - - $i++; - } - - if ($disable_script) - echo "<script type='text/javascript'><!--\n$disable_script--></script>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gstripe_infos.php b/packages/freenas/www/disks_raid_gstripe_infos.php deleted file mode 100644 index 5d8a6de0..00000000 --- a/packages/freenas/www/disks_raid_gstripe_infos.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_stripe_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Stripe"), - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gstripe.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gconcat_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gstripe_tools.php"); - $tab_array[2] = array(gettext("Information"), true, "disks_raid_gstripe_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gstripe_infos.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" class="vtable"> - <?php - echo "<pre>"; - echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />"; - - exec("/sbin/gstripe list",$rawdata); - foreach ($rawdata as $line){ - echo htmlspecialchars($line) . "<br>"; - } - - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gstripe_tools.php b/packages/freenas/www/disks_raid_gstripe_tools.php deleted file mode 100644 index 6bc7891a..00000000 --- a/packages/freenas/www/disks_raid_gstripe_tools.php +++ /dev/null @@ -1,187 +0,0 @@ -<?php -/* - disks_raid_stripe_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Stripe"), - gettext("Tools")); - -require_once("freenas_config.inc"); -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); - unset($do_action); - - $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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), true, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), false, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gstripe.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gstripe_init.php"); */ - $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gstripe_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gstripe_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gstripe_tools.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="list" <?php if ($action == "list") echo "selected"; ?>>list</option> - <option value="status" <?php if ($action == "status") echo "selected"; ?>>status</option> - <option value="clear" <?php if ($action == "clear") echo "selected"; ?>>clear</option> - <option value="stop" <?php if ($action == "stop") echo "selected"; ?>>stop</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Send Command!" /> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_action) { - echo("<strong>" . gettext("GSTRIPE command output:") . "</strong><br />"); - echo('<pre>'); - ob_end_flush(); - - system("/sbin/gstripe $action " . escapeshellarg($object)); - - echo('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <ol> - <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li> - <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gvinum.php b/packages/freenas/www/disks_raid_gvinum.php deleted file mode 100644 index 134b2fb5..00000000 --- a/packages/freenas/www/disks_raid_gvinum.php +++ /dev/null @@ -1,235 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gvinum.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Vinum"), - gettext("RAID")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['gvinum']['vdisk'])) - $freenas_config['gvinum']['vdisk'] = array(); - -gvinum_sort(); - -$raidstatus=get_sraid_disks_list(); - -$a_raid = &$freenas_config['gvinum']['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_gvinum_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(); - touch($d_raidconfdirty_path); - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<form action="disks_raid_gvinum.php" method="post" name="iform" id="iform"> -<?php if (file_exists($d_diskdirty_path)): ?> -<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="listhdrr"><?=gettext("Volume name");?></td> - <td class="listhdrr"><?=gettext("Type");?></td> - <td class="listhdrr"><?=gettext("Size");?></td> - <td class="listhdrr"><?=gettext("Status");?></td> - <td class="list"> </td> - </tr> - <?php $i = 0; foreach ($a_raid as $raid): ?> - <tr> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['name']);?> - </td> - <td valign="middle" class="listr"> - <?=htmlspecialchars($raid['type']);?> - </td> - <td valign="middle" class="listr"> - <?php - $raidconfiguring = file_exists($d_raidconfdirty_path) && - in_array($raid['name']."\n",file($d_raidconfdirty_path)); - if ($raidconfiguring) - echo gettext("configuring"); - else { - $tempo=$raid['name']; - echo "{$raidstatus[$tempo]['size']}"; - } - ?> - </td> - <td valign="middle" class="listr"> - <?php - if ($raidconfiguring) - echo "_CONFIGURING"; - else { - echo "{$raidstatus[$tempo]['desc']}"; - } - ?> - </td> - <td valign="middle" class="list"> - <a href="disks_raid_gvinum_edit.php?id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" /> - </a> - <a href="disks_raid_gvinum.php?act=del&id=<?=$i;?>"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" nowrap> - <a href="disks_raid_gvinum_edit.php"> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" /> - </a> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="5"> - <span class="red"> - <strong><?= gettext("Note:"); ?></strong> - </span> - <br /> - <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span> - <br /> - <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span> - <br /> - <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gvinum_edit.php b/packages/freenas/www/disks_raid_gvinum_edit.php deleted file mode 100644 index e0245419..00000000 --- a/packages/freenas/www/disks_raid_gvinum_edit.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gvinum_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Vinum"), - gettext("RAID"), - isset($id) ? gettext("Edit") : gettext("Add")); - -require_once("freenas_config.inc"); -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(); -disks_sort(); - -$a_raid = &$freenas_config['gvinum']['vdisk']; -$a_disk = get_fstype_disks_list("softraid"); -$all_raid = array_merge((array)$freenas_config['graid5']['vdisk'],(array)$freenas_config['gmirror']['vdisk'],(array)$freenas_config['gvinum']['vdisk'],(array)$freenas_config['gstripe']['vdisk'],(array)$freenas_config['gconcat']['vdisk']); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!sizeof($a_disk)) { - $nodisk_errors[] = gettext("You must add disks first."); -} - -if (isset($id) && $a_raid[$id]) { - $pconfig['name'] = $a_raid[$id]['name']; - $pconfig['fullname'] = $a_raid[$id]['fullname']; - $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 */ - - 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 gvinum RAID {$_POST['type']}"; - $raid['fullname'] = "/dev/gvinum/{$raid['name']}"; - - if (isset($id) && $a_raid[$id]) - $a_raid[$id] = $raid; - else - $a_raid[] = $raid; - - $fd = @fopen("$d_raidconfdirty_path", "a"); - if (!$fd) { - echo gettext("ERR Could not save RAID configuration.\n"); - 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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gvinum_edit.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Raid name");?></td> - <td width="78%" class="vtable"> - <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" /> - </td> - </tr> - <tr> - <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td> - <td class="vtable"> - <select name="type" class="formselect" id="type"> - <option value="0" <?php if ($pconfig['type'] == 0) echo "selected=\"selected\""; ?>>RAID 0 (<?= gettext("striping"); ?>)</option> - <option value="1" <?php if ($pconfig['type'] == 1) echo "selected=\"selected\""; ?>>RAID 1 (<?= gettext("mirroring"); ?>)</option> - <option value="5" <?php if ($pconfig['type'] == 5) echo "selected=\"selected\""; ?>>RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>)</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td> - <td width="78%" class="vtable"> - <? - $i=0; - $disable_script=""; - - foreach ($a_disk as $diskv) { - $r_name=""; - - if (strcmp($diskv['fstype'],"raid")==0) { - foreach($all_raid as $raid) { - if (in_array($diskv['name'],$raid['diskr'])) { - $r_name=$raid['name']; - - if ($r_name!=$pconfig['name']) - $disable_script.="document.getElementById($i).disabled=1;\n"; - break; - } - } - echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[name]'". - ((is_array($pconfig['diskr']) && in_array($diskv['name'], $pconfig['diskr'])) ? " checked=\"checked\"" : ""). - " />$diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "<br>\n"; - } - $i++; - } - if ($disable_script) echo "<script type='text/javascript'><!--\n$disable_script--></script>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gvinum_infos.php b/packages/freenas/www/disks_raid_gvinum_infos.php deleted file mode 100644 index 71a424fa..00000000 --- a/packages/freenas/www/disks_raid_gvinum_infos.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gvinum_infos.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Vinum"), - gettext("Information")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php"); - $tab_array[2] = array(gettext("Information"), true, "disks_raid_gvinum_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gvinum_infos.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" class="vtable"> - <?php - echo "<pre>"; - echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />"; - - exec("/sbin/gvinum list",$rawdata); - foreach ($rawdata as $line) - { - echo htmlspecialchars($line) . "<br>"; - } - unset ($line); - echo "</pre>"; - ?> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gvinum_init.php b/packages/freenas/www/disks_raid_gvinum_init.php deleted file mode 100644 index 787c416e..00000000 --- a/packages/freenas/www/disks_raid_gvinum_init.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php -/* $Id$ */ -/* - disks_raid_gmirror_init.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* ========================================================================== */ -/* == T H I S F I L E I S C U R R E N T L Y N O T U S E D == */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Vinum"), - gettext("Initialize")); - -require_once("freenas_config.inc"); -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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php"); - $tab_array[1] = array(gettext("Format RAID"), true, "disks_raid_gvinum_init.php"); - $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php"); - $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gvinum_init.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td> - <td width="78%" class="vtable"> - <input name="disk" type="text" class="formfld" id="disk" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_format) { - echo("<strong>_DISKSRAIDINITPHP_INFO</strong><br />"); - echo('<pre>'); - 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('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <span class="vexpl"> - <?= gettext("This step will format the RAID volume in Unix FileSystem (UFS)."); ?> - </span> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/disks_raid_gvinum_tools.php b/packages/freenas/www/disks_raid_gvinum_tools.php deleted file mode 100644 index 343fc221..00000000 --- a/packages/freenas/www/disks_raid_gvinum_tools.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - disks_raid_gvinum_tools.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("System"), - gettext("Disks"), - gettext("GEOM Vinum"), - gettext("Tools")); - -require_once("freenas_config.inc"); -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); - unset($do_action); - - $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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php"); - $tab_array[1] = array(gettext("Geom Concat"), false, "disks_raid_gconcat.php"); - $tab_array[2] = array(gettext("Geom Stripe"), false, "disks_raid_gstripe.php"); - $tab_array[3] = array(gettext("Geom RAID5"), false, "disks_raid_graid5.php"); - $tab_array[4] = array(gettext("Geom Vinum"), true, "disks_raid_gvinum.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php"); - /* $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php"); */ - $tab_array[1] = array(gettext("Tools"), true, "disks_raid_gvinum_tools.php"); - $tab_array[2] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form action="disks_raid_gvinum_tools.php" method="post" name="iform" id="iform"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td> - <td width="78%" class="vtable"> - <select name="action" class="formselect" id="action"> - <option value="start" <?php if ($action == "start") echo "selected=\"selected\""; ?>>start</option> - <option value="rebuild" <?php if ($action == "rebuild") echo "selected=\"selected\""; ?>>rebuild parity</option> - <option value="list" <?php if ($action == "list") echo "selected=\"selected\""; ?>>list</option> - <option value="remove" <?php if ($action == "remove") echo "selected=\"selected\""; ?>>remove</option> - <option value="forceup" <?php if ($action == "forceup") echo "selected=\"selected\""; ?>>Force State to UP</option> - <option value="saveconfig" <?php if ($action == "saveconfig") echo "selected=\"selected\""; ?>>saveconfig</option> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Send Command!" /> - <?php if (isset($id) && $a_raid[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - <tr> - <td valign="top" colspan="2"> - <? - if ($do_action) { - echo("<strong>" . gettext("GVINUM command output:") . "</strong><br />"); - echo('<pre>'); - 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('</pre>'); - } - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" colspan="2"> - <span class="red"> - <strong>WARNING:</strong><br /> - </span> - <ol> - <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li> - <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li> - </ol> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/packages/freenas/www/services_afp.php b/packages/freenas/www/services_afp.php deleted file mode 100644 index 2487c6f7..00000000 --- a/packages/freenas/www/services_afp.php +++ /dev/null @@ -1,199 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_afp.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("AFP")); - -require_once("freenas_config.inc"); -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_zeroconf_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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.guest.disabled = endis; - document.iform.local.disabled = endis; - document.iform.afpname.disabled = endis; - /* color adjustments */ - document.iform.guest.style.backgroundColor = color; - document.iform.local.style.backgroundColor = color; - document.iform.afpname.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="services_afp.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("AFP Server");?></span> - <span style="vertical-align: middle; position: relative; left: 84%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Server Name");?></td> - <td width="78%" class="vtable"> - <input name="afpname" type="text" class="formfld unknown" id="afpname" size="20" value="<?=htmlspecialchars($pconfig['afpname']);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Authentication");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="guest" id="guest" type="checkbox" value="yes" <?php if ($pconfig['guest']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable guest access."); ?><br /> - <input name="local" id="local" type="checkbox" value="yes" <?php if ($pconfig['local']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable local user authentication."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_ftp.php b/packages/freenas/www/services_ftp.php deleted file mode 100644 index 050361e5..00000000 --- a/packages/freenas/www/services_ftp.php +++ /dev/null @@ -1,392 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_ftp.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("FTP")); - -require_once("freenas_config.inc"); -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['authbackend'] = $freenas_config['ftp']['authentication_backend']; -$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']['authentication_backend'] = $_POST['authbackend']; - $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_wzdftpd_configure(); - services_zeroconf_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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.port.disabled = endis; - document.iform.authbackend.disabled = endis; - document.iform.timeout.disabled = endis; - document.iform.numberclients.disabled = endis; - document.iform.maxconperip.disabled = endis; - document.iform.anonymous.disabled = endis; - document.iform.localuser.disabled = endis; - document.iform.banner.disabled = endis; - document.iform.fxp.disabled = endis; - document.iform.natmode.disabled = endis; - document.iform.passiveip.disabled = endis; - document.iform.pasv_max_port.disabled = endis; - document.iform.pasv_min_port.disabled = endis; - /* color adjustments */ - document.iform.port.style.backgroundColor = color; - document.iform.authbackend.backgroundColor = color; - document.iform.timeout.style.backgroundColor = color; - document.iform.numberclients.style.backgroundColor = color; - document.iform.maxconperip.style.backgroundColor = color; - document.iform.anonymous.style.backgroundColor = color; - document.iform.localuser.style.backgroundColor = color; - document.iform.banner.style.backgroundColor = color; - document.iform.fxp.style.backgroundColor = color; - document.iform.natmode.style.backgroundColor = color; - document.iform.passiveip.style.backgroundColor = color; - document.iform.pasv_max_port.style.backgroundColor = color; - document.iform.pasv_min_port.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="services_ftp.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("FTP Server");?></span> - <span style="vertical-align: middle; position: relative; left: 84%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("TCP port");?></td> - <td width="78%" class="vtable"> - <input name="port" type="text" class="formfld unknown" id="port" size="20" value="<?=htmlspecialchars($pconfig['port']);?>" /> - </td> - </tr> - <?php - if (file_exists("/usr/local/sbin/wzdftpd")) { - $a_backends = array(); - - $dh = opendir("/usr/local/share/wzdftpd/backends"); - while (false !== ($filename = readdir($dh))) { - if (preg_match("/\.so$/", $filename)) { - $lastslash = strrpos($filename, "/"); - $dot = strrpos($filename, "."); - - $backend_name = str_replace("libwzd", - "", - substr($filename, - $lastslash, - $dot - $lastslash)); - $a_backends[] = $backend_name; - } - } - } - ?> - <?php if (is_array($a_backends)) : ?> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication Backend");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="authbackend" id="authbackend" class="formselect"> - <?php foreach ($a_backends as $backend) : ?> - <option value="<?= $backend ?>"><?= $backend ?></option> - <?php endforeach; ?> - </select><br /> - <?= gettext("Choose a particular backend, that will be used to authenticate FTP users."); ?> - </td> - </tr> - <?php endif; ?> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Number of clients");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="numberclients" type="text" class="formfld unknown" id="numberclients" size="20" value="<?=htmlspecialchars($pconfig['numberclients']);?>" /> - <br /> - <?= gettext("Maximum number of simultaneous clients."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Max conn per ip");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="maxconperip" type="text" class="formfld unknown" id="maxconperip" size="20" value="<?=htmlspecialchars($pconfig['maxconperip']);?>" /> - <br /> - <?= gettext("Maximum connection per IP address."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Timeout");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="timeout" type="text" class="formfld unknown" id="timeout" size="20" value="<?=htmlspecialchars($pconfig['timeout']);?>" /> - <br /> - <?= gettext("Maximum idle time in seconds."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Anonymous login");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="anonymous" type="checkbox" id="anonymous" value="yes" <?php if ($pconfig['anonymous']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable Anonymous login"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Local User");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="localuser" type="checkbox" id="localuser" value="yes" <?php if ($pconfig['localuser']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable local User login"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Banner");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <textarea name="banner" cols="65" rows="7" id="banner" class="formpre"><?=htmlspecialchars($pconfig['banner']);?></textarea> - <br /> - <?= gettext("Greeting banner displayed by FTP when a connection first comes in."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("FXP");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="fxp" type="checkbox" id="fxp" value="yes" <?php if ($pconfig['fxp']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable FXP protocol."); ?> - <br /> - <?= gettext("FXP allows transfers between two remote servers without any file data going to the client asking for the transfer (insecure!)."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("NAT mode");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="natmode" type="checkbox" id="natmode" value="yes" <?php if ($pconfig['natmode']) echo "checked=\"checked\""; ?> /> - <?= gettext("Force NAT mode"); ?> - <br /> - <?= gettext("Enable it if your FTP server is behind a NAT box that doesn't support applicative FTP proxying"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Passive IP address");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="passiveip" type="text" class="formfld unknown" id="passiveip" size="30" value="<?=htmlspecialchars($pconfig['passiveip']);?>" /> - <?= gettext("Use this option to override the IP address that FTP daemon will advertise in response to the PASV command."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("pasv_min_port");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="pasv_min_port" type="text" class="formfld unknown" id="pasv_min_port" size="20" value="<?=htmlspecialchars($pconfig['pasv_min_port']);?>" /> - <?= gettext("The minimum port to allocate for PASV style data connections."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("pasv_max_port");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="pasv_max_port" type="text" class="formfld unknown" id="pasv_max_port" size="20" value="<?=htmlspecialchars($pconfig['pasv_max_port']);?>" /> - <?= gettext("The maximum port to allocate for PASV style data connections."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submitt" name="Submitt" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php deleted file mode 100644 index 7b4b9a18..00000000 --- a/packages/freenas/www/services_nfs.php +++ /dev/null @@ -1,243 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_nfs.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("NFS")); - -require_once("freenas_config.inc"); -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['bindto'] = $freenas_config['nfs']['bindto']; -$pconfig['serveudp'] = isset($freenas_config['nfs']['serveudp']); -$pconfig['servetcp'] = isset($freenas_config['nfs']['servetcp']); - -if (! empty($_POST)) -{ - /* hash */ - unset($error_bucket); - /* simple error list */ - unset($input_errors); - $pconfig = $_POST; - - /* input validation */ - $reqdfields = explode(" ", "bindto"); - $reqdfieldsn = explode(",", "IP address to bind to"); - - 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) - { - $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false; - $freenas_config['nfs']['bindto'] = $_POST['bindto']; - if (isset($_POST['servetcp'])) { - $freenas_config['nfs']['servetcp'] = $_POST['servetcp']; - } else { - unset($freenas_config['nfs']['servetcp']); - } - if (isset($_POST['serveudp'])) { - $freenas_config['nfs']['serveudp'] = $_POST['serveudp']; - } else { - unset($freenas_config['nfs']['serveudp']); - } - - write_config(); - - $retval = 0; - if (!file_exists($d_sysrebootreqd_path)) - { - /* nuke the cache file */ - config_lock(); - services_nfs_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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.servetcp.disabled = endis; - document.iform.serveudp.disabled = endis; - document.iform.bindto.disabled = endis; - /* color adjustments */ - document.iform.servetcp.style.backgroundColor = color; - document.iform.serveudp.style.backgroundColor = color; - document.iform.bindto.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<form id="iform" name="iform" action="services_nfs.php" method="post"> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Settings"), true, "services_nfs.php"); - $tab_array[1] = array(gettext("Exports"), false, "services_nfs_export.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("NFS Server");?></span> - <span style="vertical-align: middle; position: relative; left: 84%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Bind to IP address");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="bindto" id="bindto" class="formselect"> - <option value="(ANY)"<?php if ($pconfig['bindto'] == "(ANY)") { echo " selected=\"selected\""; } ?>> - (ANY) - </option> - <option value="<?= $config['interfaces']['wan'][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['wan'][ipaddr]) { echo " selected=\"selected\""; } ?>> - <?= $config['interfaces']['wan'][ipaddr] ?> - </option> - <option value="<?= $config['interfaces']['lan'][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['lan'][ipaddr]) { echo " selected=\"selected\""; } ?>> - <?= $config['interfaces']['lan'][ipaddr] ?> - </option> - <?php - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): - ?> - <option value="<?= $config['interfaces']['opt' . $i][ipaddr] ?>"<?php if ($pconfig['bindto'] == $config['interfaces']['opt' . $i][ipaddr]) { echo " selected=\"selected\""; } ?>> - <?= $config['interfaces']['opt' . $i][ipaddr] ?> - </option> - <?php endfor; ?> - </select> - <br /> - <?= gettext("Use an address from the list to make nfsd and rpcbind bind to a specific address."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Client Types");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <p> - <input type="checkbox" name="servetcp" id="servetcp" value="on"<?php if ($pconfig['servetcp']) { echo " checked=\"checked\""; } ?>/> - <label for="servetcp"><?= gettext("Serve TCP NFS clients"); ?></label> - </p> - <p> - <input type="checkbox" name="serveudp" id="serveudp" value="on"<?php if ($pconfig['serveudp']) { echo " checked=\"checked\""; } ?>/> - <label for="serveudp"><?= gettext("Serve UDP NFS clients"); ?></label> - </p> - <p> - <span class="red"><strong><?= gettext("Note"); ?>: </strong></span> - <span class="vexpl"> - <?= gettext("Usually it's save to enable support for both, UDP and TCP client types."); ?> - </span> - </p> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_nfs_export.php b/packages/freenas/www/services_nfs_export.php deleted file mode 100644 index c1712762..00000000 --- a/packages/freenas/www/services_nfs_export.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_nfs_export.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("NFS"), - gettext("Exports")); - -require_once("freenas_config.inc"); -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); - $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 (!$input_errors) - { - if($_POST['apply']) { - $retval = 0; - if(!file_exists($d_sysrebootreqd_path)) { - config_lock(); - services_nfs_configure(); - services_zeroconf_configure(); - config_unlock(); - } - - $savemsg = get_std_save_message($retval); - - if(0 == $retval) { - if(file_exists($d_nfsexportconfdirty_path)) - unlink($d_nfsexportconfdirty_path); - } - } - } -} - -if($_GET['act'] == "ret") { - pfSenseHeader("services_nfs_export.php"); - exit; -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ - -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<form id="iform" name="iform" action="services_nfs_export.php" method="post"> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if (file_exists($d_nfsexportconfdirty_path)): ?> -<?php print_info_box_np(gettext("The exports have been modified.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<div id="inputerrors"></div> - -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Settings"), false, "services_nfs.php"); - $tab_array[1] = array(gettext("Exports"), true, "services_nfs_export.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr"><?= gettext("Export"); ?></td> - <td width="25%" class="listhdrr"><?= gettext("Description"); ?></td> - <td width="20%" class="listhdrr"><?= gettext("Export To"); ?></td> - <td width="10%" class="list"></td> - </tr> - <?php $i = 0; foreach($a_mount as $mountv): ?> - <tr> - <td class="listr">/mnt/<?=htmlspecialchars($mountv['sharename']);?></td> - <td class="listr"><?=htmlspecialchars($mountv['desc']);?></td> - <td class="listbg" style="color: #FFFFFF;"><?= isset($mountv['nfs']['networks']) ? str_replace(",", "<br />", htmlspecialchars($mountv['nfs']['networks'])) : gettext("None"); ?></td> - <td valign="middle" nowrap class="list"> - <?php if(isset($freenas_config['nfs']['enable'])) - echo("<a href='services_nfs_export_edit.php?id={$i}'><img src='./themes/" . $g['theme'] . "/images/icons/icon_e.gif' alt='" . gettext("Edit Export") . "' title='" . gettext("Edit Export") . "' width='17' height='17' border='0' /></a>"); - ?> - </td> - </tr> - <?php $i++; endforeach; ?> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/services_nfs_export_edit.php b/packages/freenas/www/services_nfs_export_edit.php deleted file mode 100644 index f9fd53ea..00000000 --- a/packages/freenas/www/services_nfs_export_edit.php +++ /dev/null @@ -1,783 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_samba_share_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("NFS"), - gettext("Exports"), - gettext("Edit")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['mounts']['mount'])) - $freenas_config['mounts']['mount'] = array(); - -mount_sort(); - -$pconfig['mapall'] = $freenas_config['mounts']['mount'][$id]['nfs']['mapall']; - -if (! empty($_POST)) -{ - /* hash */ - unset($error_bucket); - /* simple error list */ - unset($input_errors); - $pconfig = $_POST; - - /* input validation */ - $reqdfields = explode(" ", "authnetworks"); - $reqdfieldsn = explode(",", "Destination network"); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - if (isset($_POST['authnetworks']) && is_array($_POST['authnetworks'])) { - foreach ($_POST['authnetworks'] as $netel) { - list($_POST['network'], $_POST['network_subnet']) = explode('/', $netel); - - if (($_POST['network'] && !is_ipaddr($_POST['network']))) { - $error_bucket[] = array("error" => gettext("A valid network must be specified."), - "field" => "network"); - } - - if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) { - $error_bucket[] = array("error" => gettext("A valid network bit count must be specified."), - "field" => "network_subnet"); - } - - $osn[] = 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['mounts']['mount'][$id]['nfs']['networks'] = implode(",", $osn); - $freenas_config['mounts']['mount'][$id]['nfs']['mapall'] = $_POST['mapall']; - - touch($d_nfsexportconfdirty_path); - write_config(); - pfSenseHeader("services_nfs_export.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ - -$addressTransString = gettext("Address"); -$plusimgDescTransString = gettext("add to network list"); -$minusimgDescTransString = gettext("remove from network list"); -$currentnetTransString = gettext("Current networks"); -$networksTypehintTransString = gettext("Network that is authorised to access NFS shares"); - -$networkCount = count($freenas_config['nfs']['nfsnetwork']); -$generatedWANSubnet = gen_subnet($config['interfaces']['wan']['ipaddr'], - $config['interfaces']['wan']['subnet']); -$generatedLANSubnet = gen_subnet($config['interfaces']['lan']['ipaddr'], - $config['interfaces']['lan']['subnet']); - -$jscriptstr = <<<EOD -<script type="text/javascript"> -<!-- -function network_exists(myValue) { - for (i = 0; i < $('authnetworks').options.length; i++) { - if ($('authnetworks').options[i].value == myValue) { - return true; - } - } - - return false; -} -function selectnetel() { - for (i = 0; i < $('authnetworks').options.length; i++) { - $('authnetworks').options[i].selected = true; - } -} -function get_selected_listitems() { - var selected = new Array(); - - if (!$('authnetworks')) { return; } - - for (i = 0; i < $('authnetworks').options.length; i++) { - if ($('authnetworks').childNodes[i].selected == true) { - selected.push($('authnetworks').options[i]); - } - } - - return selected; -} - -function add_selnetwork(net, mask) { - var newOption = document.createElement("option"); - var newOptionText = document.createTextNode(net + '/' + mask); - var selectSize = $('authnetworks').size; - - if (!net || !mask) { return; } - - if (network_exists(net + '/' + mask)) { - alert('Element already exist in the network list'); - return; - } - - newOption.setAttribute('value', net + '/' + mask); - newOption.appendChild(newOptionText); - - /* add the option to the select element */ - $('authnetworks').appendChild(newOption); - $('authnetworks').setAttribute('size', '3'); - - /* clear values from HTML fields */ - if ($('network')) { $('network').value = ''; } - if ($('network_subnet')) { $('network_subnet').selectedIndex = 0; } -} - -function remove_selnetwork() { - var selectedItems = get_selected_listitems(); - - if (selectedItems.length <= 0) { - alert('No element selected!'); - return; - } - - for (i = 0; i < selectedItems.length; i++) { - $('authnetworks').removeChild(selectedItems[i]); - } -} - -function create_authnetworks_tr(selectElement) { - var newTR = document.createElement("tr"); - newTR.setAttribute('id', 'authNetworksTR'); - - var newImageTR = document.createElement("tr"); - newImageTR.setAttribute('id', 'authNetworksImageTR'); - - var descTD = document.createElement("td"); - descTD.setAttribute('align', 'left'); - descTD.setAttribute('valign', 'top'); - descTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;'); - - var selectTD = document.createElement("td"); - selectTD.setAttribute('align', 'left'); - selectTD.setAttribute('valign', 'middle'); - selectTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;'); - - var typehintTD = document.createElement("td"); - typehintTD.setAttribute('align', 'left'); - typehintTD.setAttribute('valign', 'middle'); - typehintTD.setAttribute('colspan', '2'); - typehintTD.setAttribute('style', 'padding-top: 10px; border-top: solid 1px grey;'); - - var blankTD = document.createElement("td"); - blankTD.setAttribute('align', 'left'); - blankTD.setAttribute('valign', 'top'); - - var imageTD = document.createElement("td"); - imageTD.setAttribute('align', 'left'); - imageTD.setAttribute('valign', 'middle'); - imageTD.setAttribute('style', 'vertical-align: middle;'); - imageTD.setAttribute('colspan', '3'); - - var newSpan = document.createElement("span"); - newSpan.setAttribute('style', 'padding-left: 5px; vertical-align: middle;'); - - var newTypehintSpan = document.createElement("span"); - newTypehintSpan.setAttribute('style', 'padding-left: 5px; vertical-align: middle;'); - - var newDescription = document.createTextNode('{$currentnetTransString}:'); - var newImgDescription = document.createTextNode('{$minusimgDescTransString}'); - var typehint = document.createTextNode('{$networksTypehintTransString}'); - - var newSelect = document.createElement("select"); - newSelect.setAttribute('name', 'authnetworks[]'); - newSelect.setAttribute('class', 'formselect'); - newSelect.setAttribute('id', 'authnetworks'); - newSelect.setAttribute('multiple', 'multiple'); - newSelect.setAttribute('size', '{$networkCount}'); - - /* divs are used to achieve proper alignement */ - newImageDiv = document.createElement("div"); - newImageDiv.setAttribute('style', 'float: left;'); - - newImageDescDiv = document.createElement("div"); - newImageDescDiv.setAttribute('style', 'padding-top: 1px;'); - - /* try to add each network to the select element */ - -EOD; - -if (isset($freenas_config['mounts']['mount'][$id]['nfs']['networks'])) { - foreach (explode(",", $freenas_config['mounts']['mount'][$id]['nfs']['networks']) as $networkel) { - list($netaddress, $netmask) = explode('/', $networkel); - $networkSanitized = htmlspecialchars($netaddress); - - $jscriptstr .= <<<EOD - var newOption = document.createElement("option"); - var newOptionText = document.createTextNode('{$networkSanitized}/{$netmask}'); - - newOption.setAttribute('value', '{$networkSanitized}/{$netmask}'); - newOption.appendChild(newOptionText); - - /* add the option to the select element */ - newSelect.appendChild(newOption); - -EOD; - } // end if -} // end foreach - -$jscriptstr .= <<<EOD - var newImage = document.createElement("img"); - newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_minus.png'); - newImage.setAttribute('alt', 'remove network'); - newImage.setAttribute('border', '0'); - newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;'); - newImage.setAttribute('onclick', 'remove_selnetwork();'); - - /* assemble everything */ - newTypehintSpan.appendChild(typehint); - - descTD.appendChild(newDescription); - selectElement != null ? selectTD.appendChild(selectElement) : selectTD.appendChild(newSelect); - typehintTD.appendChild(newTypehintSpan); - - newImageDiv.appendChild(newImage); - newImageDescDiv.appendChild(newImgDescription); - - imageTD.appendChild(newImageDiv); - imageTD.appendChild(newImageDescDiv); - - newTR.appendChild(descTD); - newTR.appendChild(selectTD); - newTR.appendChild(typehintTD); - - newImageTR.appendChild(blankTD); - newImageTR.appendChild(imageTD); - - $('networkopttab').appendChild(newTR); - $('networkopttab').appendChild(newImageTR); -} - -function create_network_tr() { - var newTR = document.createElement("tr"); - newTR.setAttribute('id', 'typeDetailsTR'); - - var descTD = document.createElement("td"); - descTD.setAttribute('align', 'left'); - descTD.setAttribute('valign', 'top'); - - var inputTD = document.createElement("td"); - inputTD.setAttribute('align', 'left'); - inputTD.setAttribute('valign', 'top'); - - var selectTD = document.createElement("td"); - selectTD.setAttribute('align', 'left'); - selectTD.setAttribute('valign', 'middle'); - - var imageTD = document.createElement("td"); - imageTD.setAttribute('align', 'left'); - imageTD.setAttribute('valign', 'middle'); - - var newDescription = document.createTextNode('{$addressTransString}:'); - var newImgDescription = document.createTextNode('{$plusimgDescTransString}'); - - var newInput = document.createElement("input"); - newInput.setAttribute('name', 'network'); - newInput.setAttribute('type', 'text'); - newInput.setAttribute('class', 'formfld host'); - newInput.setAttribute('id', 'network'); - newInput.setAttribute('size', '20'); - newInput.setAttribute('value', ''); - - var newSelect = document.createElement("select"); - newSelect.setAttribute('name', 'network_subnet'); - newSelect.setAttribute('class', 'formselect'); - newSelect.setAttribute('id', 'network_subnet'); - - var newImage = document.createElement("img"); - newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png'); - newImage.setAttribute('alt', 'add network'); - newImage.setAttribute('border', '0'); - newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;'); - newImage.setAttribute('onclick', 'add_selnetwork($("network").value, $("network_subnet").value);'); - - /* divs are used to achieve proper alignement */ - newImageDiv = document.createElement("div"); - newImageDiv.setAttribute('style', 'float: left;'); - - newImageDescDiv = document.createElement("div"); - newImageDescDiv.setAttribute('style', 'padding-top: 1px;'); - - /* add options to select */ - for (i = 31; i > 0; i--) { - var newOption = document.createElement("option"); - var newOptionText = document.createTextNode(i.toString()); - - newOption.setAttribute('value', i); - newOption.appendChild(newOptionText); - - /* add the option to the select element */ - newSelect.appendChild(newOption); - } - - /* assemble everything */ - descTD.appendChild(newDescription); - inputTD.appendChild(newInput); - selectTD.appendChild(newSelect); - - newImageDiv.appendChild(newImage); - newImageDescDiv.appendChild(newImgDescription); - - imageTD.appendChild(newImageDiv); - imageTD.appendChild(newImageDescDiv); - - newTR.appendChild(descTD); - newTR.appendChild(inputTD); - newTR.appendChild(selectTD); - newTR.appendChild(imageTD); - - $('networkopttab').appendChild(newTR); -} - -function create_wan_tr() { - var wanSubnet = '{$config['interfaces']['wan']['subnet']}'; - - var newTR = document.createElement("tr"); - newTR.setAttribute('id', 'typeDetailsTR'); - - var descTD = document.createElement("td"); - descTD.setAttribute('align', 'left'); - descTD.setAttribute('valign', 'top'); - - var nettextTD = document.createElement("td"); - nettextTD.setAttribute('align', 'left'); - nettextTD.setAttribute('valign', 'top'); - - var imageTD = document.createElement("td"); - imageTD.setAttribute('align', 'left'); - imageTD.setAttribute('valign', 'middle'); - imageTD.setAttribute('colspan', '2'); - - var newDescription = document.createTextNode('{$addressTransString}:'); - var newWanDescription = document.createTextNode('{$generatedWANSubnet}/' + wanSubnet); - - var newNetTextSpan = document.createElement("span"); - newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;'); - - var newImage = document.createElement("img"); - newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png'); - newImage.setAttribute('alt', 'add network'); - newImage.setAttribute('border', '0'); - newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;'); - newImage.setAttribute('onclick', 'add_selnetwork("{$generatedWANSubnet}", ' + wanSubnet + ');'); - - /* divs are used to achieve proper alignement */ - newImageDiv = document.createElement("div"); - newImageDiv.setAttribute('style', 'float: left;'); - - newImageDescDiv = document.createElement("div"); - newImageDescDiv.setAttribute('style', 'padding-top: 1px;'); - - var newImgDescription = document.createTextNode('{$plusimgDescTransString}'); - - /* assemble everything */ - newNetTextSpan.appendChild(newWanDescription); - - descTD.appendChild(newDescription); - nettextTD.appendChild(newNetTextSpan); - - newImageDiv.appendChild(newImage); - newImageDescDiv.appendChild(newImgDescription); - - imageTD.appendChild(newImageDiv); - imageTD.appendChild(newImageDescDiv); - - newTR.appendChild(descTD); - newTR.appendChild(nettextTD); - newTR.appendChild(imageTD); - - $('networkopttab').appendChild(newTR); -} - -function create_lan_tr() { - var lanSubnet = '{$config['interfaces']['lan']['subnet']}'; - - var newTR = document.createElement("tr"); - newTR.setAttribute('id', 'typeDetailsTR'); - - var descTD = document.createElement("td"); - descTD.setAttribute('align', 'left'); - descTD.setAttribute('valign', 'top'); - - var nettextTD = document.createElement("td"); - nettextTD.setAttribute('align', 'left'); - nettextTD.setAttribute('valign', 'top'); - - var imageTD = document.createElement("td"); - imageTD.setAttribute('align', 'left'); - imageTD.setAttribute('valign', 'middle'); - imageTD.setAttribute('colspan', '2'); - - var newDescription = document.createTextNode('{$addressTransString}:'); - var newLanDescription = document.createTextNode('{$generatedLANSubnet}/' + lanSubnet); - - var newNetTextSpan = document.createElement("span"); - newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;'); - - var newImage = document.createElement("img"); - newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png'); - newImage.setAttribute('alt', 'add network'); - newImage.setAttribute('border', '0'); - newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;'); - newImage.setAttribute('onclick', 'add_selnetwork("{$generatedLANSubnet}", ' + lanSubnet + ');'); - - /* divs are used to achieve proper alignement */ - newImageDiv = document.createElement("div"); - newImageDiv.setAttribute('style', 'float: left;'); - - newImageDescDiv = document.createElement("div"); - newImageDescDiv.setAttribute('style', 'padding-top: 1px;'); - - var newImgDescription = document.createTextNode('{$plusimgDescTransString}'); - - /* assemble everything */ - newNetTextSpan.appendChild(newLanDescription); - - descTD.appendChild(newDescription); - nettextTD.appendChild(newNetTextSpan); - - newImageDiv.appendChild(newImage); - newImageDescDiv.appendChild(newImgDescription); - - imageTD.appendChild(newImageDiv); - imageTD.appendChild(newImageDescDiv); - - newTR.appendChild(descTD); - newTR.appendChild(nettextTD); - newTR.appendChild(imageTD); - - $('networkopttab').appendChild(newTR); -} - -function get_optnetwork() { - var slashIndex= $('opt_iface_desc').firstChild.nodeValue.indexOf('/'); - var myNetwork = $('opt_iface_desc').firstChild.nodeValue.substring(0, slashIndex); - - return myNetwork; -} - -function get_optsubnet() { - var slashIndex= $('opt_iface_desc').firstChild.nodeValue.indexOf('/'); - var mySubnet = $('opt_iface_desc').firstChild.nodeValue.substring(slashIndex + 1, $('opt_iface_desc').firstChild.nodeValue.length); - - return mySubnet; -} - -function create_opt_tr() { - var newTR = document.createElement("tr"); - newTR.setAttribute('id', 'typeDetailsTR'); - - var descTD = document.createElement("td"); - descTD.setAttribute('align', 'left'); - descTD.setAttribute('valign', 'top'); - - var nettextTD = document.createElement("td"); - nettextTD.setAttribute('align', 'left'); - nettextTD.setAttribute('valign', 'top'); - - var imageTD = document.createElement("td"); - imageTD.setAttribute('align', 'left'); - imageTD.setAttribute('valign', 'middle'); - imageTD.setAttribute('colspan', '2'); - - var newDescription = document.createTextNode('{$addressTransString}:'); - var newImgDescription = document.createTextNode('{$plusimgDescTransString}'); - - var newImage = document.createElement("img"); - newImage.setAttribute('src', '/themes/{$g['theme']}/images/misc/bullet_toggle_plus.png'); - newImage.setAttribute('alt', 'add network'); - newImage.setAttribute('border', '0'); - newImage.setAttribute('style', 'margin-right: 5px; border: solid 1px silver; cursor: pointer;'); - newImage.setAttribute('onclick', 'add_selnetwork(get_optnetwork(), get_optsubnet());'); - - /* divs are used to achieve proper alignement */ - newImageDiv = document.createElement("div"); - newImageDiv.setAttribute('style', 'float: left;'); - - newImageDescDiv = document.createElement("div"); - newImageDescDiv.setAttribute('style', 'padding-top: 1px;'); - - /* add options to select */ - -EOD; - -for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { - $optSubnet = $config['interfaces']['opt' . $i]['subnet']; - $generatedOPTSubnet = gen_subnet($config['interfaces']['opt' . $i]['ipaddr'], - $config['interfaces']['opt' . $i]['subnet']); - - if (empty($optSubnet) || empty($generatedOPTSubnet)) { continue; } - - $jscriptstr .= <<<EOD - var selOptIndex = $('authnettype').selectedIndex; - var optNumber = $('authnettype').options[selOptIndex].value.substr(3, $('authnettype').options[selOptIndex].value.length); - var newOptDescription = null; - var newNetTextSpan = null; - - if (optNumber == {$i}) { - newOptDescription = document.createTextNode('{$generatedOPTSubnet}/{$optSubnet}'); - - newNetTextSpan = document.createElement("span"); - newNetTextSpan.setAttribute('id', 'opt_iface_desc'); - newNetTextSpan.setAttribute('style', 'font-weight: bold; font-style: italic; vertical-align: middle;'); - } - -EOD; -} - -$jscriptstr .= <<<EOD - /* assemble everything */ - if (newNetTextSpan) - newNetTextSpan.appendChild(newOptDescription); - - descTD.appendChild(newDescription); - if (newNetTextSpan) - nettextTD.appendChild(newNetTextSpan); - - newImageDiv.appendChild(newImage); - newImageDescDiv.appendChild(newImgDescription); - - imageTD.appendChild(newImageDiv); - imageTD.appendChild(newImageDescDiv); - - newTR.appendChild(descTD); - newTR.appendChild(nettextTD); - newTR.appendChild(imageTD); - - $('networkopttab').appendChild(newTR); -} - -function authnet_change() { - var tmpElement = $('authnetworks'); - - if ($('typeDetailsTR')) { $('networkopttab').removeChild($('typeDetailsTR')); } - if ($('authNetworksTR')) { $('networkopttab').removeChild($('authNetworksTR')); } - if ($('authNetworksImageTR')) { $('networkopttab').removeChild($('authNetworksImageTR')); } - - switch ($('authnettype').selectedIndex) { - case 0: - /* Network */ - create_network_tr(); - break; - case 1: - /* WAN subnet */ - create_wan_tr(); - break; - case 2: - /* LAN subnet */ - create_lan_tr(); - break; - -EOD; - -for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { - $case_count = 2 + $i; - - $jscriptstr .= <<<EOD - case {$case_count}: - /* OPT subnet */ - create_opt_tr(); - break; - -EOD; - -} // end for - -$jscriptstr .= <<<EOD - } // end switch - - create_authnetworks_tr(tmpElement); -} // end function authnet_change -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="disks_mount_edit.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" align="left" valign="middle" class="listtopic" colspan="2"><?=gettext("Export Options");?></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Export Name"); ?></td> - <td width="78%" class="vtable"> - <input type="text" class="formfld file" size="30" value="/mnt/<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['sharename']);?>" readonly="readonly" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Description"); ?></td> - <td width="78%" class="vtable"> - <input type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['desc']);?>" readonly="readonly" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("map all user to root");?></td> - <td width="78%" class="vtable"> - <select name="mapall" class="formselect" id="mapall"> - <?php - $types = explode(",", "Yes,No"); - $vals = explode(" ", "yes no"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['mapall']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - <br /> - <?= gettext("All users will have the root privilege."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Authorised network");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <table border="0" cellspacing="0" cellpadding="4" id="networkopttab"> - <tr> - <td align="left" valign="middle"><?=gettext("Type");?>:</td> - <td align="left" valign="middle" colspan="4"> - <select name="authnettype" id="authnettype" class="formselect" onchange="authnet_change();"> - <option value="network"> - <?=gettext("Network")?> - </option> - <option value="wan"> - <?=gettext("WAN subnet");?> - </option> - <option value="lan"> - <?=gettext("LAN subnet");?> - </option> - <?php - for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): - ?> - <option value="opt<?=$i;?>"> - <?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> - <?=gettext("subnet");?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onmousedown="selectnetel();" onkeydown="selectnetel();" /> - <?php if(isset($id)): ?> - <input id="id" name="id" type="hidden" value="<?=$id;?>" /> - <?php endif; ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <span class="red"> - <strong><?= gettext("NOTE"); ?>:</strong> - </span> - <br /> - <ul> - <li> - <span class="vexpl"> - <?= gettext("The name of each exported directory is: /mnt/sharename"); ?> - </span> - </li> - <li> - <span class="vexpl"> - <?= gettext("Try adding networks to the 'current networks' list to authorize each particular network."); ?> - </span> - </li> - <li> - <span class="vexpl"> - <?= gettext("Use ctrl-click (or command-click on the Mac) to select and de-select elements from the 'current networks' list."); ?> - </span> - </li> - </ul> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -authnet_change(); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_rsyncd.php b/packages/freenas/www/services_rsyncd.php deleted file mode 100644 index a31aa229..00000000 --- a/packages/freenas/www/services_rsyncd.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_rsyncd.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("RSYNCD"), - gettext("Server")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -/* TODO: use pfSense users/groups. */ -if (!is_array($freenas_config['system']['user'])) - $freenas_config['system']['user'] = array(); - -users_sort(); - -$a_user = &$freenas_config['system']['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_zeroconf_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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.readonly.disabled = endis; - document.iform.port.disabled = endis; - document.iform.motd.disabled = endis; - document.iform.maxcon.disabled = endis; - document.iform.rsyncd_user.disabled = endis; - /* adjust colors */ - document.iform.readonly.style.backgroundColor = color; - document.iform.port.style.backgroundColor = color; - document.iform.motd.style.backgroundColor = color; - document.iform.maxcon.style.backgroundColor = color; - document.iform.rsyncd_user.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> - <?php - $tab_array = array(); - $tab_array[0] = array(gettext("Server"), true, "services_rsyncd.php"); - $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php"); - $tab_array[2] = array(gettext("Local"), false, "services_rsyncd_local.php"); - display_top_tabs($tab_array); - ?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form id="iform" name="iform" action="services_rsyncd.php" method="post"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Daemon");?></span> - <span style="vertical-align: middle; position: relative; left: 81%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Read only"); ?></td> - <td width="78%" class="vtable"> - <select name="readonly" class="formselect" id="readonly"> - <?php - $types = explode(",", "Yes,No"); - $vals = explode(" ", "yes no"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['readonly']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Map to user"); ?></td> - <td width="78%" class="vtable"> - <select name="rsyncd_user" class="formselect" id="rsyncd_user"> - <option value="ftp"<?php if ($pconfig['rsyncd_user'] == "ftp") echo "selected";?>> - <?php echo htmlspecialchars("guest"); ?> - <?php foreach ($a_user as $user): ?> - <option value="<?=$user['name'];?>"<?php if ($user['name'] == $pconfig['rsyncd_user']) echo "selected";?>> - <?php echo htmlspecialchars($user['name']); ?> - </option> - <?php endforeach; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("TCP port"); ?></td> - <td width="78%" class="vtable"> - <input name="port" type="text" class="formfld unknown" id="port" size="20" value="<?=htmlspecialchars($pconfig['port']);?>" /> - <br /><?= gettext("Alternate TCP port."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Maximum connections"); ?></td> - <td width="78%" class="vtable"> - <input name="maxcon" type="text" class="formfld unknown" id="maxcon" size="20" value="<?=htmlspecialchars($pconfig['maxcon']);?>" /> - <br /><?= gettext("Maximum number of simultaneous connections. Default is 0 (unlimited)"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("MOTD"); ?></td> - <td width="78%" class="vtable"> - <textarea name="motd" cols="65" rows="7" id="motd" class="formpre"><?=htmlspecialchars($pconfig['motd']);?></textarea> - <br /> - <?= gettext("message of the day");?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_rsyncd_client.php b/packages/freenas/www/services_rsyncd_client.php deleted file mode 100644 index efb0e870..00000000 --- a/packages/freenas/www/services_rsyncd_client.php +++ /dev/null @@ -1,585 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_rsyncd_client.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("RSYNCD"), - gettext("Client")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['rsyncclient'])) -{ - $freenas_config['rsyncclient'] = 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"); -$a_mount = 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 (!is_array($freenas_config['mounts']['mount'])) { - $nodisk_errors[] = gettext("You must configure mount point first."); -} else { - 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 ($_POST['enable'] && !is_ipaddr($_POST['rsyncserverip'])) { - $error_bucket[] = array("error" => gettext("A valid IP address must be specified."), - "field" => "rsyncserverip"); - } - - 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); - } - } - - 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"; - } -} - -/* 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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - -EOD; - -$i = 0; - -if (is_array($a_mount)) { - foreach ($a_mount as $mountv) { - $jscriptstr .= " document.iform.share_" . $i . ".disabled = endis;\n"; - $i++; - } -} - -/* Note: In contrast to FreeNAS we are only using - * three minutes and one hours field(s) - */ -$jscriptstr .= <<<EOD - - document.iform.rsyncserverip.disabled = endis; - document.iform.minutes1.disabled = endis; - document.iform.minutes2.disabled = endis; - document.iform.minutes3.disabled = endis; - document.iform.hours1.disabled = endis; - /* document.iform.hours2.disabled = endis; */ - document.iform.days1.disabled = endis; - document.iform.days2.disabled = endis; - /* document.iform.days3.disabled = endis; */ - document.iform.months.disabled = endis; - document.iform.weekdays.disabled = endis; - document.iform.all_mins1.disabled = endis; - document.iform.all_mins2.disabled = endis; - document.iform.all_hours1.disabled = endis; - document.iform.all_hours2.disabled = endis; - document.iform.all_days1.disabled = endis; - document.iform.all_days2.disabled = endis; - document.iform.all_months1.disabled = endis; - document.iform.all_months2.disabled = endis; - document.iform.all_weekdays1.disabled = endis; - document.iform.all_weekdays2.disabled = endis; - document.iform.opt_delete.disabled = endis; - /* color adjustments */ - document.iform.rsyncserverip.style.backgroundColor = color; - document.iform.minutes1.style.backgroundColor = color; - document.iform.minutes2.style.backgroundColor = color; - document.iform.minutes3.style.backgroundColor = color; - document.iform.hours1.style.backgroundColor = color; - /* document.iform.hours2.style.backgroundColor = color; */ - document.iform.days1.style.backgroundColor = color; - document.iform.days2.style.backgroundColor = color; - /* document.iform.days3.style.backgroundColor = color; */ - document.iform.months.style.backgroundColor = color; - document.iform.weekdays.style.backgroundColor = color; - document.iform.all_mins1.style.backgroundColor = color; - document.iform.all_mins2.style.backgroundColor = color; - document.iform.all_hours1.style.backgroundColor = color; - document.iform.all_hours2.style.backgroundColor = color; - document.iform.all_days1.style.backgroundColor = color; - document.iform.all_days2.style.backgroundColor = color; - document.iform.all_months1.style.backgroundColor = color; - document.iform.all_months2.style.backgroundColor = color; - document.iform.all_weekdays1.style.backgroundColor = color; - document.iform.all_weekdays2.style.backgroundColor = color; - document.iform.opt_delete.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php"); - $tab_array[1] = array(gettext("Client"), true, "services_rsyncd_client.php"); - $tab_array[2] = array(gettext("Local"), false, "services_rsyncd_local.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form id="iform" name="iform" action="services_rsyncd_client.php" method="post"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Client Synchronization");?></span> - <span style="vertical-align: middle; position: relative; left: 70%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Remote RSYNC Server"); ?></td> - <td width="84%" class="vtable"> - <input name="rsyncserverip" id="rsyncserverip" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['rsyncserverip']);?>" /> - <br /> - <?= gettext("IP address of remote RSYNC server"); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("RSYNC Options"); ?></td> - <td width="84%" class="vtable"> - <input name="opt_delete" id="opt_delete" type="checkbox" value="yes" <?php if ($pconfig['opt_delete']) echo "checked=\"checked\""; ?> /> - <?= gettext("Delete files that don't exist on sender."); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Shares to be synchronized"); ?></td> - <td width="84%" class="vtable"> - <?php - if (is_array($freenas_config['mounts']['mount'])) { - $i=0; - foreach ($a_mount as $mountv) { - echo "<input name=\"sharetosync[]\" id=\"share_" . $i . "\" type=\"checkbox\" value=\"" . $mountv['sharename'] . "\""; - if ($mountv['sharename'] == $pconfig['sharetosync']) - echo " checked=\"checked\""; - echo" />"; - echo $mountv['sharename'] . " (" . $mountv['desc'] . ")<br />\n"; - $i++; - } - } - else - echo "You must configure mount point before!"; - ?> - <br /> - <?= gettext("This same local share must be present on the Remote Server."); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Synchronization Time"); ?></td> - <td width="84%" class="vtable"> - <table width="100%" border="1" cellpadding="4" cellspacing="0"> - <tr> - <td align="left" valign="top" class="listtopic"><?= gettext("minutes"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("hours"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("days"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("months"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("week days"); ?></td> - </tr> - <tr> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_min_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_mins" id="all_mins1" value="1"<?php echo $all_mins_all;?> /> - <label for="all_mins1">All</label><br /> - <input type="radio" name="all_mins" id="all_mins2" value="0"<?php echo $all_mins_selected;?> /> - <label for="all_mins2">Selected ...</label> - </div> - <div id="all_min_select" style="vertical-align: top;"> - <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;"> - <?php - $i = 0; - while ($i <= 23){ - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;"> - <?php - $i = 24; - while ($i <= 47) { - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple="multible" class="formselect" size="12" name="minutes[]" id="minutes3" style="vertical-align: top;"> - <?php - $i = 48; - while ($i <= 59) { - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_hours_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_hours" id="all_hours1" value="1"<?php echo $all_hours_all;?> /> - <label for="all_hours1">All</label><br /> - <input type="radio" name="all_hours" id="all_hours2" value="0"<?php echo $all_hours_selected;?> /> - <label for="all_hours2">Selected ...</label> - </div> - <div id="all_hours_select" style="vertical-align: top;"> - <select multiple size="24" name="hours[]" id="hours1" style="vertical-align: top;"> - <?php - $i = 0; - while ($i <= 23) { - if (isset($pconfig['hour'])) { - if (in_array($i, $pconfig['hour'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_days_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_days" id="all_days1" value="1" <?php echo $all_days_all;?> /> - <label for="all_days1">All</label><br /> - <input type="radio" name="all_days" id="all_days2" value="0"<?php echo $all_days_selected;?> /> - <label for="all_days2">Selected ...</label> - </div> - <div id="all_days_select" style="vertical-align: top;"> - <select multiple size="24" name="days[]" id="days1" style="vertical-align: top;"> - <?php - $i = 1; - while ($i <= 24) { - if (isset($pconfig['day'])) { - if (in_array($i, $pconfig['day'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple size="7" name="days[]" id="days2" style="vertical-align: top;"> - <?php - $i = 25; - while ($i <= 31) { - if (isset($pconfig['day'])) { - if (in_array($i, $pconfig['day'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell"> - <div id="all_months_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_months" id="all_months1" value="1"<?php echo $all_months_all;?> /> - <label for="all_months1">All</label><br /> - <input type="radio" name="all_months" id="all_months2" value="0"<?php echo $all_months_selected;?> /> - <label for="all_months2">Selected ...</label> - </div> - <div id="all_months_select" style="vertical-align: top;"> - <select multiple size="12" name="months[]" id="months" style="vertical-align: top;"> - <?php - $i=1; - foreach ($a_months as $monthv) { - if (isset($pconfig['month'])) { - if (in_array($i, $pconfig['month'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $monthv . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell"> - <div id="all_weekdays_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_weekdays" id="all_weekdays1" value="1"<?php echo $all_weekdays_all;?> /> - <label for="all_weekdays1">All</label><br /> - <input type="radio" name="all_weekdays" id="all_weekdays2" value="0"<?php echo $all_weekdays_selected;?> /> - <label for="all_weekdays2">Selected ...</label> - </div> - <div id="all_weekdays_select" style="vertical-align: top;"> - <select multiple size="7" name="weekdays[]" id="weekdays" style="vertical-align: top;"> - <?php - $i=0; - foreach ($a_weekdays as $weekdayv) { - if (isset($pconfig['weekday'])){ - if (in_array($i, $pconfig['weekday'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $weekdayv . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - </tr> - <tr> - <td align="left" valign="top" class="vncell" colspan="5"> - <?= gettext("Note: Ctrl-click (or command-click on the Mac) to select and de-select minutes, hours, days and months."); ?> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td width="16%" valign="top"> </td> - <td width="84%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_rsyncd_local.php b/packages/freenas/www/services_rsyncd_local.php deleted file mode 100644 index df29961a..00000000 --- a/packages/freenas/www/services_rsyncd_local.php +++ /dev/null @@ -1,579 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_rsyncd_local.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("RSYNCD"), - gettext("Local")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['rsync_local'])) -{ - $freenas_config['rsync_local'] = 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 (!is_array($freenas_config['mounts']['mount'])) { - $nodisk_errors[] = gettext("You must configure mount point first."); -} else { - 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(" ", "source destination")); - $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Source,Destination")); - } - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - if ($_POST['enable'] && (strcmp($_POST['source'],$_POST['destination'])==0)) { - $error_bucket[] = array("error" => gettext("You can't have the same mount point for source and destination!"), - "field" => "source"); - } - - 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['rsync_local']['opt_delete'] = $_POST['opt_delete'] ? true : false;; - $freenas_config['rsync_local']['minute'] = $_POST['minutes']; - $freenas_config['rsync_local']['hour'] = $_POST['hours']; - $freenas_config['rsync_local']['day'] = $_POST['days']; - $freenas_config['rsync_local']['month'] = $_POST['months']; - $freenas_config['rsync_local']['weekday'] = $_POST['weekdays']; - $freenas_config['rsync_local']['source'] = $_POST['source']; - $freenas_config['rsync_local']['destination'] = $_POST['destination']; - $freenas_config['rsync_local']['enable'] = $_POST['enable'] ? true : false; - $freenas_config['rsync_local']['sharetosync'] = $_POST['sharetosync']; - $freenas_config['rsync_local']['all_mins'] = $_POST['all_mins']; - $freenas_config['rsync_local']['all_hours'] = $_POST['all_hours']; - $freenas_config['rsync_local']['all_days'] = $_POST['all_days']; - $freenas_config['rsync_local']['all_months'] = $_POST['all_months']; - $freenas_config['rsync_local']['all_weekdays'] = $_POST['all_weekdays']; - - write_config(); - - $retval = 0; - - if (!file_exists($d_sysrebootreqd_path)){ - /* nuke the cache file */ - config_lock(); - services_rsync_local_configure(); - services_cron_configure(); - config_unlock(); - } - - $savemsg = get_std_save_message($retval); - } - } - - mount_sort(); - $a_mount = &$freenas_config['mounts']['mount']; - - $pconfig['opt_delete'] = isset($freenas_config['rsync_local']['opt_delete']); - $pconfig['enable'] = isset($freenas_config['rsync_local']['enable']); - $pconfig['source'] = $freenas_config['rsync_local']['source']; - $pconfig['destination'] = $freenas_config['rsync_local']['destination']; - $pconfig['minute'] = $freenas_config['rsync_local']['minute']; - $pconfig['hour'] = $freenas_config['rsync_local']['hour']; - $pconfig['day'] = $freenas_config['rsync_local']['day']; - $pconfig['month'] = $freenas_config['rsync_local']['month']; - $pconfig['weekday'] = $freenas_config['rsync_local']['weekday']; - $pconfig['sharetosync'] = $freenas_config['rsync_local']['sharetosync']; - $pconfig['all_mins'] = $freenas_config['rsync_local']['all_mins']; - $pconfig['all_hours'] = $freenas_config['rsync_local']['all_hours']; - $pconfig['all_days'] = $freenas_config['rsync_local']['all_days']; - $pconfig['all_months'] = $freenas_config['rsync_local']['all_months']; - $pconfig['all_weekdays'] = $freenas_config['rsync_local']['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"; - } -} - -/* 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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - -EOD; - -/* Note: In contrast to FreeNAS we are only using - * three minutes and one hours field(s) - */ -$jscriptstr .= <<<EOD - - document.iform.source.disabled = endis; - document.iform.destination.disabled = endis; - document.iform.minutes1.disabled = endis; - document.iform.minutes2.disabled = endis; - document.iform.minutes3.disabled = endis; - document.iform.hours1.disabled = endis; - /* document.iform.hours2.disabled = endis; */ - document.iform.days1.disabled = endis; - document.iform.days2.disabled = endis; - /* document.iform.days3.disabled = endis; */ - document.iform.months.disabled = endis; - document.iform.weekdays.disabled = endis; - document.iform.all_mins1.disabled = endis; - document.iform.all_mins2.disabled = endis; - document.iform.all_hours1.disabled = endis; - document.iform.all_hours2.disabled = endis; - document.iform.all_days1.disabled = endis; - document.iform.all_days2.disabled = endis; - document.iform.all_months1.disabled = endis; - document.iform.all_months2.disabled = endis; - document.iform.all_weekdays1.disabled = endis; - document.iform.all_weekdays2.disabled = endis; - document.iform.opt_delete.disabled = endis; - /* color adjustments */ - document.iform.source.style.backgroundColor = color; - document.iform.destination.style.backgroundColor = color; - document.iform.minutes1.style.backgroundColor = color; - document.iform.minutes2.style.backgroundColor = color; - document.iform.minutes3.style.backgroundColor = color; - document.iform.hours1.style.backgroundColor = color; - /* document.iform.hours2.style.backgroundColor = color; */ - document.iform.days1.style.backgroundColor = color; - document.iform.days2.style.backgroundColor = color; - /* document.iform.days3.style.backgroundColor = color; */ - document.iform.months.style.backgroundColor = color; - document.iform.weekdays.style.backgroundColor = color; - document.iform.all_mins1.style.backgroundColor = color; - document.iform.all_mins2.style.backgroundColor = color; - document.iform.all_hours1.style.backgroundColor = color; - document.iform.all_hours2.style.backgroundColor = color; - document.iform.all_days1.style.backgroundColor = color; - document.iform.all_days2.style.backgroundColor = color; - document.iform.all_months1.style.backgroundColor = color; - document.iform.all_months2.style.backgroundColor = color; - document.iform.all_weekdays1.style.backgroundColor = color; - document.iform.all_weekdays2.style.backgroundColor = color; - document.iform.opt_delete.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php"); - $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php"); - $tab_array[2] = array(gettext("Local"), true, "services_rsyncd_local.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <form id="iform" name="iform" action="services_rsyncd_local.php" method="post"> - <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Client Synchronization");?></span> - <span style="vertical-align: middle; position: relative; left: 70%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Source"); ?></td> - <td width="84%" class="vtable"> - <select name="source" class="formselect" id="source"> - <?php - if (is_array($freenas_config['mounts']['mount'])) { - foreach ($a_mount as $mountv) { - echo "<option value=\"{$mountv['sharename']}\""; - if (strcmp($mountv['sharename'],$pconfig['source']) == 0) - echo " selected"; - echo">"; - echo htmlspecialchars($mountv['sharename']); - echo "</option>"; - } - } - else - echo gettext("You must configure mount point first."); - ?> - </select> - <br /> - <?= gettext("Source Mount Point."); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Destination"); ?></td> - <td width="84%" class="vtable"> - <select name="destination" class="formselect" id="destination"> - <?php - if (is_array($freenas_config['mounts']['mount'])) { - foreach ($a_mount as $mountv) { - echo "<option value=\"{$mountv['sharename']}\""; - if (strcmp($mountv['sharename'],$pconfig['destination']) == 0) - echo " selected"; - echo">"; - echo htmlspecialchars($mountv['sharename']); - echo "</option>"; - } - } - else - echo gettext("You must configure mount point first."); - ?> - </select> - <br /> - <?= gettext("Destination Mount Point."); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("RSYNC Options"); ?></td> - <td width="84%" class="vtable"> - <input name="opt_delete" id="opt_delete" type="checkbox" value="yes" <?php if ($pconfig['opt_delete']) echo "checked=\"checked\""; ?> /> - <?= gettext("Delete files that don't exist on sender."); ?> - </td> - </tr> - <tr> - <td width="16%" valign="top" class="vncellreq"><?= gettext("Synchronization Time"); ?></td> - <td width="84%" class="vtable"> - <table width="100%" border="1" cellpadding="4" cellspacing="0"> - <tr> - <td align="left" valign="top" class="listtopic"><?= gettext("minutes"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("hours"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("days"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("months"); ?></td> - <td align="left" valign="top" class="listtopic"><?= gettext("week days"); ?></td> - </tr> - <tr> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_min_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_mins" id="all_mins1" value="1"<?php echo $all_mins_all;?> /> - <label for="all_mins1">All</label><br /> - <input type="radio" name="all_mins" id="all_mins2" value="0"<?php echo $all_mins_selected;?> /> - <label for="all_mins2">Selected ...</label> - </div> - <div id="all_min_select" style="vertical-align: top;"> - <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;"> - <?php - $i = 0; - while ($i <= 23){ - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;"> - <?php - $i = 24; - while ($i <= 47) { - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple="multible" class="formselect" size="12" name="minutes[]" id="minutes3" style="vertical-align: top;"> - <?php - $i = 48; - while ($i <= 59) { - if (isset($pconfig['minute'])) { - if (in_array($i, $pconfig['minute'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_hours_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_hours" id="all_hours1" value="1"<?php echo $all_hours_all;?> /> - <label for="all_hours1">All</label><br /> - <input type="radio" name="all_hours" id="all_hours2" value="0"<?php echo $all_hours_selected;?> /> - <label for="all_hours2">Selected ...</label> - </div> - <div id="all_hours_select" style="vertical-align: top;"> - <select multiple size="24" name="hours[]" id="hours1" style="vertical-align: top;"> - <?php - $i = 0; - while ($i <= 23) { - if (isset($pconfig['hour'])) { - if (in_array($i, $pconfig['hour'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell" nowrap="nowrap"> - <div id="all_days_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_days" id="all_days1" value="1" <?php echo $all_days_all;?> /> - <label for="all_days1">All</label><br /> - <input type="radio" name="all_days" id="all_days2" value="0"<?php echo $all_days_selected;?> /> - <label for="all_days2">Selected ...</label> - </div> - <div id="all_days_select" style="vertical-align: top;"> - <select multiple size="24" name="days[]" id="days1" style="vertical-align: top;"> - <?php - $i = 1; - while ($i <= 24) { - if (isset($pconfig['day'])) { - if (in_array($i, $pconfig['day'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - <select multiple size="7" name="days[]" id="days2" style="vertical-align: top;"> - <?php - $i = 25; - while ($i <= 31) { - if (isset($pconfig['day'])) { - if (in_array($i, $pconfig['day'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell"> - <div id="all_months_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_months" id="all_months1" value="1"<?php echo $all_months_all;?> /> - <label for="all_months1">All</label><br /> - <input type="radio" name="all_months" id="all_months2" value="0"<?php echo $all_months_selected;?> /> - <label for="all_months2">Selected ...</label> - </div> - <div id="all_months_select" style="vertical-align: top;"> - <select multiple size="12" name="months[]" id="months" style="vertical-align: top;"> - <?php - $i=1; - foreach ($a_months as $monthv) { - if (isset($pconfig['month'])) { - if (in_array($i, $pconfig['month'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $monthv . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - <td align="left" valign="top" class="vncell"> - <div id="all_weekdays_rdbtns" style="padding-bottom: 10px;" > - <input type="radio" name="all_weekdays" id="all_weekdays1" value="1"<?php echo $all_weekdays_all;?> /> - <label for="all_weekdays1">All</label><br /> - <input type="radio" name="all_weekdays" id="all_weekdays2" value="0"<?php echo $all_weekdays_selected;?> /> - <label for="all_weekdays2">Selected ...</label> - </div> - <div id="all_weekdays_select" style="vertical-align: top;"> - <select multiple size="7" name="weekdays[]" id="weekdays" style="vertical-align: top;"> - <?php - $i=0; - foreach ($a_weekdays as $weekdayv) { - if (isset($pconfig['weekday'])){ - if (in_array($i, $pconfig['weekday'])) { - $is_selected = " selected"; - } else { - $is_selected = ""; - } - } - - echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $weekdayv . "\n"; - $i++; - } - ?> - </select> - </div> - </td> - </tr> - <tr> - <td align="left" valign="top" class="vncell" colspan="5"> - <?= gettext("Note: Ctrl-click (or command-click on the Mac) to select and de-select minutes, hours, days and months."); ?> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td width="16%" valign="top"> </td> - <td width="84%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </form> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_samba.php b/packages/freenas/www/services_samba.php deleted file mode 100644 index afd90a08..00000000 --- a/packages/freenas/www/services_samba.php +++ /dev/null @@ -1,431 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_samba.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("CIFS")); - -require_once("freenas_config.inc"); -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_zeroconf_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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.netbiosname.disabled = endis; - document.iform.workgroup.disabled = endis; - document.iform.localmaster.disabled = endis; - document.iform.winssrv.disabled = endis; - document.iform.timesrv.disabled = endis; - document.iform.serverdesc.disabled = endis; - document.iform.doscharset.disabled = endis; - document.iform.unixcharset.disabled = endis; - document.iform.loglevel.disabled = endis; - document.iform.sndbuf.disabled = endis; - document.iform.rcvbuf.disabled = endis; - document.iform.recyclebin.disabled = endis; - document.iform.security.disabled = endis; - /* color adjustments */ - document.iform.netbiosname.style.backgroundColor = color; - document.iform.workgroup.style.backgroundColor = color; - document.iform.localmaster.style.backgroundColor = color; - document.iform.winssrv.style.backgroundColor = color; - document.iform.timesrv.style.backgroundColor = color; - document.iform.serverdesc.style.backgroundColor = color; - document.iform.doscharset.style.backgroundColor = color; - document.iform.unixcharset.style.backgroundColor = color; - document.iform.loglevel.style.backgroundColor = color; - document.iform.sndbuf.style.backgroundColor = color; - document.iform.rcvbuf.style.backgroundColor = color; - document.iform.recyclebin.style.backgroundColor = color; - document.iform.security.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<form id="iform" name="iform" action="services_samba.php" method="post"> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<div id="inputerrors"></div> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Settings"), true, "services_samba.php"); - $tab_array[1] = array(gettext("Shares"), false, "services_samba_share.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("CIFS share");?></span> - <span style="vertical-align: middle; position: relative; left: 84%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication");?></td> - <td width="78%" class="vtable"> - <select name="security" class="formselect" id="security"> - <?php - $types = explode(",", "Anonymous,Local User,Domain"); - $vals = explode(" ", "share user domain"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['security']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("NetBios name");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="netbiosname" type="text" class="formfld unknown" id="netbiosname" size="20" value="<?=htmlspecialchars($pconfig['netbiosname']);?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Workgroup");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="workgroup" type="text" class="formfld unknown" id="workgroup" size="20" value="<?=htmlspecialchars($pconfig['workgroup']);?>" /> - <br /> - <?= gettext("Workgroup to be member of.");?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="serverdesc" type="text" class="formfld unknown" id="serverdesc" size="30" value="<?=htmlspecialchars($pconfig['serverdesc']);?>" /> - <br /> - <?= gettext("Server description. This can usually be left blank.");?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Dos charset");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="doscharset" class="formselect" id="doscharset"> - <?php - $types = explode(",", "CP850,CP852,CP437,ASCII"); - $vals = explode(" ", "CP850 CP852 CP437 ASCII"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['doscharset']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Unix charset");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="unixcharset" class="formselect" id="unixcharset"> - <?php - $types = explode(",", "UTF-8,iso-8859-1,iso-8859-15,gb2312,ASCII"); - $vals = explode(" ", "UTF-8 iso-8859-1 iso-8859-15 gb2312 ASCII"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['unixcharset']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Log level");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="loglevel" class="formselect" id="loglevel"> - <?php - $types = explode(",", "Minimum,Normal,Full,Debug"); - $vals = explode(" ", "1 2 3 10"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['loglevel']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Local Master Browser");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="localmaster" class="formselect" id="localmaster"> - <?php - $types = explode(",", "Yes,No"); - $vals = explode(" ", "yes no"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['localmaster']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - <br /> - <?= gettext("Allows FreeNAS to try and become a local master browser."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Time Server");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <select name="timesrv" class="formselect" id="timesrv"> - <?php - $types = explode(",", "Yes,No"); - $vals = explode(" ", "yes no"); - $j = 0; - - for ($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['timesrv']) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($types[$j]);?> - </option> - <?php endfor; ?> - </select> - <br /> - <?= gettext("FreeNAS advertises itself as a time server to Windows clients."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("WINS server");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="winssrv" type="text" class="formfld host" id="winssrv" size="30" value="<?=htmlspecialchars($pconfig['winssrv']);?>" /> - <br /> - <?= gettext("WINS Server IP address."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Recycle Bin");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="recyclebin" type="checkbox" id="recyclebin" value="yes" <?php if ($pconfig['recyclebin']) echo "checked=\"checked\""; ?> /> - <?= gettext("Enable Recycle bin"); ?><br /> - <?= gettext("This will create a recycle bin on the CIFS shares"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Send Buffer Size");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="sndbuf" type="text" class="formfld unknown" id="sndbuf" size="30" value="<?=htmlspecialchars($pconfig['sndbuf']);?>" /> - <br /> - <?= gettext("Size of send buffer (16384 by default)."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Receive Buffer Size");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="rcvbuf" type="text" class="formfld unknown" id="rcvbuf" size="30" value="<?=htmlspecialchars($pconfig['rcvbuf']);?>" /> - <br /> - <?= gettext("Size of receive buffer (16384 by default)."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/services_samba_share.php b/packages/freenas/www/services_samba_share.php deleted file mode 100644 index 1545df97..00000000 --- a/packages/freenas/www/services_samba_share.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_samba_share.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("CIFS"), - gettext("Shares")); - -require_once("freenas_config.inc"); -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); - $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 (!$input_errors) - { - if($_POST['apply']) { - $retval = 0; - if(!file_exists($d_sysrebootreqd_path)) { - config_lock(); - services_samba_configure(); - services_zeroconf_configure(); - config_unlock(); - } - - $savemsg = get_std_save_message($retval); - - if(0 == $retval) { - if(file_exists($d_smbshareconfdirty_path)) - unlink($d_smbshareconfdirty_path); - } - } - } -} - -if($_GET['act'] == "ret") { - pfSenseHeader("services_samba_share.php"); - exit; -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ - -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<form id="iform" name="iform" action="services_samba_share.php" method="post"> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if (file_exists($d_smbshareconfdirty_path)): ?> -<?php print_info_box_np(gettext("The shares has been modified.") . "<br />" . - gettext("You must apply the changes in order for them to take effect."));?> -<?php endif; ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<div id="inputerrors"></div> - -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[0] = array(gettext("Settings"), false, "services_samba.php"); - $tab_array[1] = array(gettext("Shares"), true, "services_samba_share.php"); - display_top_tabs($tab_array); -?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr"><?= gettext("Share Name"); ?></td> - <td width="25%" class="listhdrr"><?= gettext("Description"); ?></td> - <td width="20%" class="listhdrr"><?= gettext("Browseable"); ?></td> - <td width="10%" class="list"></td> - </tr> - <?php $i = 0; foreach($a_mount as $mountv): ?> - <tr> - <td class="listr"><?=htmlspecialchars($mountv['sharename']);?></td> - <td class="listr"><?=htmlspecialchars($mountv['desc']);?></td> - <td class="listbg"><?=htmlspecialchars((is_array($freenas_config['samba']['hidemount']) && in_array($mountv['sharename'],$freenas_config['samba']['hidemount']))? gettext("No") : gettext("Yes"));?></td> - <td valign="middle" nowrap class="list"> - <?php if(isset($freenas_config['samba']['enable'])) - echo("<a href='services_samba_share_edit.php?id={$i}'><img src='./themes/" . $g['theme'] . "/images/icons/icon_e.gif' title='" . gettext("Edit Share") . "' width='17' height='17' border='0'></a>"); - ?> - </td> - </tr> - <?php $i++; endforeach; ?> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/services_samba_share_edit.php b/packages/freenas/www/services_samba_share_edit.php deleted file mode 100644 index d417fa4c..00000000 --- a/packages/freenas/www/services_samba_share_edit.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_samba_share_edit.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("Services"), - gettext("CIFS"), - gettext("Shares"), - gettext("Edit")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -$id = $_GET['id']; -if (isset($_POST['id'])) - $id = $_POST['id']; - -if (!is_array($freenas_config['mounts']['mount'])) - $freenas_config['mounts']['mount'] = array(); - -mount_sort(); - -if(!is_array($freenas_config['samba']['hidemount'])) - $freenas_config['samba']['hidemount'] = array(); - -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) - { - /* TODO: This logic needs to be tested! */ - if($_POST['browseable'] == gettext("No")) { - $freenas_config['samba']['hidemount'] = array_merge($freenas_config['samba']['hidemount'],array($freenas_config['mounts']['mount'][$id]['sharename'])); - } else { - if(is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'],$freenas_config['samba']['hidemount'])) { - $freenas_config['samba']['hidemount'] = array_diff($freenas_config['samba']['hidemount'],array($freenas_config['mounts']['mount'][$id]['sharename'])); - } - } - - touch($d_smbshareconfdirty_path); - write_config(); - pfSenseHeader("services_samba_share.php"); - exit; - } -} - -include("head.inc"); -/* put your custom HTML head content here */ -/* using some of the $pfSenseHead function calls */ -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="services_samba_share_edit.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Share Name"); ?></td> - <td width="78%" class="vtable"> - <input type="text" class="formfld file" size="30" value="<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['sharename']);?>" disabled="disabled" /> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?= gettext("Description"); ?></td> - <td width="78%" class="vtable"> - <input type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($freenas_config['mounts']['mount'][$id]['desc']);?>" disabled="disabled"> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Browseable"); ?></td> - <td width="78%" class="vtable"> - <select name="browseable" class="formselect" id="browseable"> - <?php - $text = array(gettext("Yes"),gettext("No")); - $vals = explode(" ","1 0"); $j = 0; - for($j = 0; $j < count($vals); $j++): - ?> - <option value="<?=$vals[$j];?>" <?php if(is_array($freenas_config['samba']['hidemount']) && in_array($freenas_config['mounts']['mount'][$id]['sharename'],$freenas_config['samba']['hidemount'])) echo "selected=\"selected\"";?>> - <?=htmlspecialchars($text[$j]);?> - </option> - <?php endfor;?> - </select> - <br><?= gettext("This controls whether this share is seen in the list of available shares in a net view and in the browse list."); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?= gettext("Save"); ?>"> - <?php if(isset($id)): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -</body> -</html> diff --git a/packages/freenas/www/services_unison.php b/packages/freenas/www/services_unison.php deleted file mode 100644 index eec58865..00000000 --- a/packages/freenas/www/services_unison.php +++ /dev/null @@ -1,249 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - services_unison.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -/* - ************************* - - Unison Installation Notes - - To work, unison requires an environment variable UNISON to point at - a writable directory. Unison keeps information there between syncs to - speed up the process. - - When a user runs the unison client, it will try to invoke ssh to - connect to the this server. Giving the local ssh a UNISON environment - variable without compromising ssh turned out to be non-trivial. - The solution is to modify the default path found in /etc/login.conf. - The path is seeded with "UNISON=/mnt" and this updated by the - /etc/inc/services.inc file. - - Todo: - * Arguably, a full client install could be done too to - allow FreeNAS to FreeNAS syncing. - - ************************* -*/ - -$pgtitle = array(gettext("Services"), - gettext("Unison")); - -require_once("freenas_config.inc"); -require_once("guiconfig.inc"); -require_once("freenas_guiconfig.inc"); -require_once("freenas_functions.inc"); - -if (!is_array($freenas_config['unison'])) { - $freenas_config['unison'] = array(); -} - -$pconfig['enable'] = isset($freenas_config['unison']['enable']); -$pconfig['share'] = $freenas_config['unison']['share']; -$pconfig['workdir'] = isset($freenas_config['unison']['workdir']); -$pconfig['makedir'] = isset($freenas_config['unison']['makedir']); - -if (! empty($_POST)) -{ - /* hash */ - unset($error_bucket); - /* simple error list */ - unset($input_errors); - $pconfig = $_POST; - - /* input validation */ - $reqdfields = split(" ", "share workdir"); - $reqdfieldsn = split(",", "Share,Working Directory"); - - do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket); - - $fullpath = "/mnt/{$_POST['share']}/{$_POST['workdir']}"; - - if (!$_POST['makedir'] && ($fullpath) && (!file_exists($fullpath))) { - $error_bucket[] = array("error" => gettext("The combination of share and working directory does not exist."), - "field" => "workdir"); - } - - 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['unison']['share'] = $_POST['share']; - $freenas_config['unison']['workdir'] = $_POST['workdir']; - $freenas_config['unison']['enable'] = $_POST['enable'] ? true : false; - $freenas_config['unison']['makedir'] = $_POST['makedir'] ? true : false; - - write_config(); - - $retval = 0; - if (!file_exists($d_sysrebootreqd_path)) - { - /* nuke the cache file */ - config_lock(); - services_unison_configure(); - /* services_zeroconf_configure(); */ - config_unlock(); - } - - $savemsg = get_std_save_message($retval); - } -} - -/* retrieve mounts to build list of share names */ -if (!is_array($freenas_config['mounts']['mount'])) - $freenas_config['mounts']['mount'] = array(); - -mount_sort(); - -$a_mount = &$freenas_config['mounts']['mount']; - -/* 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 -<script type="text/javascript"> -<!-- -function enable_change(enable_change) { - var endis; - - endis = !(document.iform.enable.checked || enable_change); - endis ? color = '#D4D0C8' : color = '#FFFFFF'; - - document.iform.share.disabled = endis; - document.iform.workdir.disabled = endis; - document.iform.makedir.disabled = endis; - /* color adjustments */ - document.iform.share.style.backgroundColor = color; - document.iform.workdir.style.backgroundColor = color; - document.iform.makedir.style.backgroundColor = color; -} -//--> -</script> - -EOD; - -$pfSenseHead->addScript($jscriptstr); -echo $pfSenseHead->getHTML(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="services_unison.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="100%" valign="middle" class="listtopic" colspan="2"> - <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Unison File Synchronisation");?></span> - <span style="vertical-align: middle; position: relative; left: 72%;"> - <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" /> <?= gettext("Enable"); ?> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Share");?></td> - <td width="78%" class="vtable"> - <select name="share" class="formselect" id="share"> - <?php foreach ($a_mount as $mount): $tmp=$mount['sharename']; ?> - <option value="<?=$tmp;?>" - <?php if ($tmp == $pconfig['share']) echo "selected=\"selected\"";?>><?=$tmp?></option> - <?php endforeach; ?> - </select> - <br /> - <?= gettext("You may need enough space to duplicate all files being synced."); ?>. - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Working Directory");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="workdir" type="text" class="formfld file" id="workdir" size="20" value="<?=htmlspecialchars($pconfig['workdir']);?>" /> - <?= gettext("Where the working files will be stored"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Create");?></td> - <td width="78%" class="vtable" align="left" valign="middle"> - <input name="makedir" type="checkbox" id="makedir" value="yes" <?php if ($pconfig['makedir']) echo "checked=\"checked\""; ?> /> - <?= gettext("Create work directory if it doesn't exist"); ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <span class="red"> - <strong><?= gettext("Note"); ?>:</strong> - </span> - <br /> - <?= gettext("<a href='/system_advanced.php'>SSHD</a> must be enabled for Unison to work, and the <a href='/system_usermanager.php'>user</a> must have Full Shell enabled."); ?> - </td> - </tr> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -enable_change(false); -//--> -</script> -</body> -</html> diff --git a/packages/freenas/www/status_disks.php b/packages/freenas/www/status_disks.php deleted file mode 100644 index 704bc467..00000000 --- a/packages/freenas/www/status_disks.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -/* $Id$ */ -/* ========================================================================== */ -/* - status_disks.php - part of pfSense (http://www.pfSense.com) - Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> - All rights reserved. - - Based on FreeNAS (http://www.freenas.org) - Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>. - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - -$pgtitle = array(gettext("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(); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>"> -<?php include("fbegin.inc"); ?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> - <div id="inputerrors"></div> - <form id="iform" name="iform" action="status_disks.php" method="post"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="5%" class="listhdrr">Disk</td> - <td width="5%" class="listhdrr">Size</td> - <td width="60%" class="listhdrr">Description</td> - <td width="10%" class="listhdr">Status</td> - </tr> - <?php foreach ($a_disk_conf as $disk): ?> - <tr> - <td class="listr"> - <?=htmlspecialchars($disk['name']);?> - </td> - <td class="listr"> - <?=htmlspecialchars($disk['size']);?> - </td> - <td class="listr"> - <?=htmlspecialchars($disk['desc']);?> - </td> - <td class="listr"> - <?php - $stat=disks_status($disk); - echo $stat;?> - </td> - </tr> - <?php endforeach; ?> - <?php if (isset($raidstatus)): ?> - <?php foreach ($raidstatus as $diskk => $diskv): ?> - <tr> - <td class="listr"> - <?=htmlspecialchars($diskk);?> - </td> - <td class="listr"> - <?=htmlspecialchars($diskv['size']);?> - </td> - <td class="listr"> - - <?=htmlspecialchars("Software RAID volume");?> - </td> - <td class="listr"> - <?=htmlspecialchars($diskv['desc']);?> - </td> - </tr> - <?php endforeach; ?> - <?php endif; ?> - </table> - </form> -<?php include("fend.inc"); ?> -<?= checkForInputErrors(); ?> -<script type="text/javascript"> -<!-- -// enable_change(false); -//--> -</script> -</body> -</html> |