X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fsamba.cgi;h=bd0c22a319ca1a886103c6813b39b6d3d633a445;hp=ed72369b69bdf394a8bacfe3d18b2b3d7fb07cd1;hb=b6a542c4df07f0aea694a8c624da9fcddf0b33a9;hpb=cb5e9c6c64d5281eba5c790f14c2e5f3066becbf diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi index ed72369b69..bd0c22a319 100644 --- a/html/cgi-bin/samba.cgi +++ b/html/cgi-bin/samba.cgi @@ -1,10 +1,23 @@ #!/usr/bin/perl -# -# IPFire CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The IPFire Team +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2005-2010 IPTifre Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use strict; # enable only the following on debugging purpose @@ -47,6 +60,10 @@ my %shares = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +my @ovpnnetwork = split(/\//,$ovpnsettings{'DOVPN_SUBNET'}); +my @ovpnip = split(/\./,$ovpnnetwork[0]); +$ovpnip[3]=$ovpnip[3]+1; + ############################################################################################################################ ############################################# Samba Dienste fr Statusberprfung ########################################## @@ -60,7 +77,7 @@ my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd'); $sambasettings{'WORKGRP'} = 'homeip.net'; $sambasettings{'NETBIOSNAME'} = 'IPFire'; -$sambasettings{'SRVSTRING'} = 'Samba running on IPFire 2.0'; +$sambasettings{'SRVSTRING'} = 'Samba running on IPFire 2.7'; $sambasettings{'INTERFACES'} = ''; $sambasettings{'SECURITY'} = 'share'; $sambasettings{'OSLEVEL'} = '33'; @@ -71,12 +88,20 @@ $sambasettings{'VPN'} = 'off'; $sambasettings{'WINSSRV'} = ''; $sambasettings{'WINSSUPPORT'} = 'on'; $sambasettings{'REMOTEANNOUNCE'} = ''; +$sambasettings{'REMOTESYNC'} = ''; $sambasettings{'PASSWORDSYNC'} = 'off'; $sambasettings{'OTHERINTERFACES'} = '127.0.0.1'; $sambasettings{'GUESTACCOUNT'} = 'samba'; $sambasettings{'MAPTOGUEST'} = 'Never'; $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2'; +$sambasettings{'SYSLOGLEVEL'} = '1'; +$sambasettings{'SYSLOGONLY'} = 'on'; +$sambasettings{'DOSCHARSET'} = 'CP850'; +$sambasettings{'UNIXCHARSET'} = 'UTF8'; +$sambasettings{'DISPLAYCHARSET'} = 'CP850'; $sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE'; +$sambasettings{'WIDELINKS'} = 'on'; +$sambasettings{'UNIXEXTENSION'} = 'off'; ### Values that have to be initialized $sambasettings{'ACTION'} = ''; ### Samba CUPS Variablen @@ -100,6 +125,9 @@ my $PDCOPTIONS = `cat ${General::swroot}/samba/pdc`; sub refreshpage{&Header::openbox( 'Waiting', 1, "" );print "

$Lang::tr{'pagerefresh'}
";&Header::closebox();} +if (($sambasettings{'WIDELINKS'} eq 'on') & ($sambasettings{'UNIXEXTENSION'} eq 'on')) + {$errormessage = "$errormessage
Don't enable 'Wide links' and 'Unix extension' at the same time"; } + &Header::openpage('Samba', 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); @@ -131,17 +159,25 @@ if ($sambasettings{'ACTION'} eq 'globalresetyes') $sambasettings{'WINSSRV'} = ''; $sambasettings{'WINSSUPPORT'} = 'on'; $sambasettings{'REMOTEANNOUNCE'} = ''; + $sambasettings{'REMOTESYNC'} = ''; $sambasettings{'PASSWORDSYNC'} = 'off'; $sambasettings{'OTHERINTERFACES'} = '127.0.0.1'; $sambasettings{'GUESTACCOUNT'} = 'samba'; $sambasettings{'MAPTOGUEST'} = 'Never'; $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2'; + $sambasettings{'SYSLOGLEVEL'} = '1'; + $sambasettings{'SYSLOGONLY'} = 'on'; + $sambasettings{'DOSCHARSET'} = 'CP850'; + $sambasettings{'UNIXCHARSET'} = 'UTF8'; + $sambasettings{'DISPLAYCHARSET'} = 'CP850'; ### Samba CUPS Variablen $sambasettings{'LOADPRINTERS'} = 'Yes'; $sambasettings{'PRINTING'} = 'cups'; $sambasettings{'PRINTCAPNAME'} = 'cups'; $sambasettings{'PRINTERNAME'} = 'Printer'; ### Values that have to be initialized + $sambasettings{'WIDELINKS'} = 'on'; + $sambasettings{'UNIXEXTENSION'} = 'off'; $sambasettings{'ACTION'} = ''; $sambasettings{'LOCALMASTER'} = 'off'; $sambasettings{'DOMAINMASTER'} = 'off'; @@ -205,7 +241,7 @@ $sambasettings{'INTERFACES'} = ''; if ($sambasettings{'GREEN'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'GREEN_DEV'}";} if ($sambasettings{'BLUE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'BLUE_DEV'}";} if ($sambasettings{'ORANGE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'ORANGE_DEV'}";} -if ($sambasettings{'VPN'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $ovpnsettings{'DOVPN_SUBNET'}";} +if ($sambasettings{'VPN'} eq 'on'){$sambasettings{'INTERFACES'} .= " ";} if ($sambasettings{'OTHERINTERFACES'} ne ''){ $sambasettings{'INTERFACES'} .= " $sambasettings{'OTHERINTERFACES'}";} ############################################################################################################################ @@ -219,6 +255,9 @@ if ($sambasettings{'WINSSUPPORT'} eq 'on'){ $sambasettings{'WINSSUPPORT'} = "tru if ($sambasettings{'LOCALMASTER'} eq 'on'){ $sambasettings{'LOCALMASTER'} = "true";} else { $sambasettings{'LOCALMASTER'} = "false";} if ($sambasettings{'DOMAINMASTER'} eq 'on'){ $sambasettings{'DOMAINMASTER'} = "true";} else { $sambasettings{'DOMAINMASTER'} = "false";} if ($sambasettings{'PREFERREDMASTER'} eq 'on'){ $sambasettings{'PREFERREDMASTER'} = "true";} else { $sambasettings{'PREFERREDMASTER'} = "false";} +if ($sambasettings{'SYSLOGONLY'} eq 'on'){ $sambasettings{'SYSLOGONLY'} = "yes";} else { $sambasettings{'SYSLOGONLY'} = "no";} +if ($sambasettings{'WIDELINKS'} eq 'on'){ $sambasettings{'WIDELINKS'} = "yes";} else { $sambasettings{'WIDELINKS'} = "no";} +if ($sambasettings{'UNIXEXTENSION'} eq 'on'){ $sambasettings{'UNIXEXTENSION'} = "yes";} else { $sambasettings{'UNIXEXTENSION'} = "no";} ############################################################################################################################ ############################################# Schreiben der Samba globals ################################################## @@ -233,6 +272,10 @@ print FILE <${General::swroot}/samba/pdc") or die "Can't save the pdc settings: $!"; flock (FILE, 2); @@ -303,12 +351,12 @@ END if ( -e "/var/ipfire/cups/enable") { - if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");refreshpage();} + if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");refreshpage();} else {system("/usr/local/bin/sambactrl smbsafeconfcups");} } else { - if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");refreshpage();} + if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");refreshpage();} else{system("/usr/local/bin/sambactrl smbsafeconf");} } @@ -328,6 +376,9 @@ if ($errormessage) ############################################################################################################################ ########################################## Aktivieren von Checkboxen und Dropdowns ######################################### +$checked{'SYSLOGONLY'}{'off'} = ''; +$checked{'SYSLOGONLY'}{'on'} = ''; +$checked{'SYSLOGONLY'}{$sambasettings{'SYSLOGONLY'}} = "checked='checked'"; $checked{'WINSSUPPORT'}{'off'} = ''; $checked{'WINSSUPPORT'}{'on'} = ''; $checked{'WINSSUPPORT'}{$sambasettings{'WINSSUPPORT'}} = "checked='checked'"; @@ -343,6 +394,12 @@ $checked{'DOMAINMASTER'}{$sambasettings{'DOMAINMASTER'}} = "checked='checked'"; $checked{'PREFERREDMASTER'}{'off'} = ''; $checked{'PREFERREDMASTER'}{'on'} = ''; $checked{'PREFERREDMASTER'}{$sambasettings{'PREFERREDMASTER'}} = "checked='checked'"; +$checked{'WIDELINKS'}{'off'} = ''; +$checked{'WIDELINKS'}{'on'} = ''; +$checked{'WIDELINKS'}{$sambasettings{'WIDELINKS'}} = "checked='checked'"; +$checked{'UNIXEXTENSION'}{'off'} = ''; +$checked{'UNIXEXTENSION'}{'on'} = ''; +$checked{'UNIXEXTENSION'}{$sambasettings{'UNIXEXTENSION'}} = "checked='checked'"; $checked{'GREEN'}{'off'} = ''; $checked{'GREEN'}{'on'} = ''; $checked{'GREEN'}{$sambasettings{'GREEN'}} = "checked='checked'"; @@ -403,11 +460,17 @@ print <$Lang::tr{'basic options'} $Lang::tr{'workgroup'} $Lang::tr{'netbios name'} +$Lang::tr{'dos charset'} +$Lang::tr{'unix charset'} +$Lang::tr{'display charset'} $Lang::tr{'server string'} $Lang::tr{'log level'} +Sys$Lang::tr{'log level'} +Syslog onlyon / + off $Lang::tr{'interfaces'}on / off | - OpenVpn - $ovpnsettings{'DOVPN_SUBNET'} + OpenVpn - $ovpnip[0].$ovpnip[1].$ovpnip[2].$ovpnip[3]/$ovpnnetwork[1] on / off | $Lang::tr{'green'} - $netsettings{'GREEN_DEV'} @@ -437,6 +500,11 @@ END print <$Lang::tr{'more'}
+Wide linkson / + off +Unix extensionon / + off +
$Lang::tr{'security options'} $Lang::tr{'security'} -$Lang::tr{'unix password sync'}on / - off +END +; +#$Lang::tr{'unix password sync'}on / +# off +print <
$Lang::tr{'network options'} $Lang::tr{'os level'} $Lang::tr{'socket options'} $Lang::tr{'remote announce'} +$Lang::tr{'remote browse sync'} END ; if ($sambasettings{'WINSSUPPORT'} eq 'off') {print"$Lang::tr{'wins server'}";} @@ -548,6 +620,7 @@ if ($sambasettings{'SECURITY'} eq 'user') &Header::openbox('100%', 'center', $Lang::tr{'accounting user pdc'}); } print <
@@ -608,10 +681,10 @@ END { print < - END ; @@ -620,10 +693,10 @@ END { print < - END ; @@ -636,7 +709,7 @@ END else { print <
+
+
- +
+
- + @@ -648,7 +721,7 @@ END if ($sambasettings{'DOMAINMASTER'} eq 'on' && $userline[0] =~ /\$/) { print < + @@ -659,7 +732,7 @@ END else { print < + @@ -673,7 +746,7 @@ END

- END @@ -682,14 +755,14 @@ END if ($sambasettings{'DOMAINMASTER'} eq 'on') { print <
+
@@ -707,8 +780,8 @@ END - - + +
+
END ; } print <
+
$Lang::tr{'pc add'}
$Lang::tr{'delete user'}
$Lang::tr{'delete pc'}
$Lang::tr{'activate user'}
$Lang::tr{'deactivate user'}
$Lang::tr{'activate user'}
$Lang::tr{'deactivate user'}
$Lang::tr{'change passwords'}
$Lang::tr{'save config'}
@@ -722,7 +795,7 @@ END my $password = 'samba'; print < -
+ @@ -745,7 +818,7 @@ END $password=~s/\s//g; print < - +
$Lang::tr{'change passwords'}
$Lang::tr{'username'}
@@ -767,7 +840,7 @@ END $pcname=~s/\s//g; print < - +
$Lang::tr{'add user'}
$Lang::tr{'username'}
@@ -793,6 +866,7 @@ my %shares = config("${General::swroot}/samba/shares"); print <
$Lang::tr{'pc add'}
$Lang::tr{'client'}
";} else {print "";} print <$shareentry - -
$Lang::tr{'manage shares'} @@ -809,12 +883,12 @@ foreach my $shareentry (sort @Shares) if ($lines % 2) {print "
+
+
@@ -828,15 +902,15 @@ print <
- - - @@ -870,7 +944,7 @@ if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optio - +
+
+
+
$Lang::tr{'show share options'}

@@ -890,7 +964,7 @@ if ($sambasettings{'ACTION'} eq 'sharechange' || $sambasettings{'ACTION'} eq 'op - +
$Lang::tr{'edit share'}
$Lang::tr{'show share options'}

@@ -940,6 +1014,7 @@ if ( -e "/var/ipfire/cups/enable") my @Printers = keys(%printer); print <
- -
$Lang::tr{'manage printers'} @@ -951,12 +1026,12 @@ foreach my $printerentry (sort @Printers) chomp $printerentry; print <$printerentry +
+
@@ -968,15 +1043,15 @@ print <
- - - @@ -994,7 +1069,7 @@ if ($sambasettings{'ACTION'} eq 'printeradd' || $sambasettings{'ACTION'} eq 'pri - +
+
+
+
$Lang::tr{'show share options'}

@@ -1015,7 +1090,7 @@ if ($sambasettings{'ACTION'} eq 'printerchange' || $sambasettings{'ACTION'} eq ' - +
$Lang::tr{'edit printer'}
$Lang::tr{'show share options'}

@@ -1079,8 +1154,9 @@ $Log=~s/\n/
/g; &Header::openbox('100%', 'center', $Lang::tr{'log'}); print <
- +
@@ -1158,12 +1234,12 @@ close FILE; if ( -e "/var/ipfire/cups/enable") { - if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");} + if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");} else {system("/usr/local/bin/sambactrl smbsafeconfcups");} } else { - if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");} + if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");} else{system("/usr/local/bin/sambactrl smbsafeconf");} }
$Lang::tr{'log view'}