Add "Wide links" and "Unix extension" settings to samba.cgi.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / samba.cgi
1 #!/usr/bin/perl
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 use strict;
23 # enable only the following on debugging purpose
24 #use warnings;
25 #use CGI::Carp 'fatalsToBrowser';
26
27 require '/var/ipfire/general-functions.pl';
28 require "${General::swroot}/lang.pl";
29 require "${General::swroot}/header.pl";
30
31 my %sambasettings = ();
32 my %cgisettings = ();
33 my %checked = ();
34 my %netsettings = ();
35 my %ovpnsettings = ();
36 my %color = ();
37 my %mainsettings = ();
38 my $message = "";
39 my $errormessage = "";
40
41 my @Logs = qx(ls /var/log/samba/);
42 my $Log =$Lang::tr{'no log selected'};
43
44 my $Status = qx(/usr/local/bin/sambactrl smbstatus);
45 $Status=~s/\n/<br \/>/g;
46
47 my $userentry = "";
48 my @user = ();
49 my @userline = ();
50 my $userfile = "${General::swroot}/samba/private/smbpasswd";
51 my %selected= () ;
52
53 my $defaultoption= "[Share]\npath = /var/ipfire/samba/share1\ncomment = Share - Public Access\nbrowseable = yes\nwriteable = yes\ncreate mask = 0777\ndirectory mask = 0777\npublic = yes\nforce user = samba";
54 my $defaultprinter= "[Printer]\ncomment = Printer public\npath = /var/spool/cups\nprinting = sysvn\nprintcap = lpstat\npublic = yes\nwritable = no\nprintable = yes";
55 my %printer = ();
56 my %shares = ();
57
58 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
59 &General::readhash("${General::swroot}/ovpn/settings", \%ovpnsettings);
60 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
61 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
62
63 my @ovpnnetwork = split(/\//,$ovpnsettings{'DOVPN_SUBNET'});
64 my @ovpnip = split(/\./,$ovpnnetwork[0]);
65 $ovpnip[3]=$ovpnip[3]+1;
66
67 ############################################################################################################################
68 ############################################# Samba Dienste fr Statusberprfung ##########################################
69
70 my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd');
71 #my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd','Winbind Daemon' => 'winbindd');
72
73 &Header::showhttpheaders();
74
75 ############################################################################################################################
76 #################################### Initialisierung von Samba Variablen fr global Settings ###############################
77
78 $sambasettings{'WORKGRP'} = 'homeip.net';
79 $sambasettings{'NETBIOSNAME'} = 'IPFire';
80 $sambasettings{'SRVSTRING'} = 'Samba running on IPFire 2.5';
81 $sambasettings{'INTERFACES'} = '';
82 $sambasettings{'SECURITY'} = 'share';
83 $sambasettings{'OSLEVEL'} = '33';
84 $sambasettings{'GREEN'} = 'on';
85 $sambasettings{'BLUE'} = 'off';
86 $sambasettings{'ORANGE'} = 'off';
87 $sambasettings{'VPN'} = 'off';
88 $sambasettings{'WINSSRV'} = '';
89 $sambasettings{'WINSSUPPORT'} = 'on';
90 $sambasettings{'REMOTEANNOUNCE'} = '';
91 $sambasettings{'REMOTESYNC'} = '';
92 $sambasettings{'PASSWORDSYNC'} = 'off';
93 $sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
94 $sambasettings{'GUESTACCOUNT'} = 'samba';
95 $sambasettings{'MAPTOGUEST'} = 'Never';
96 $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
97 $sambasettings{'SYSLOGLEVEL'} = '1';
98 $sambasettings{'SYSLOGONLY'} = 'on';
99 $sambasettings{'DOSCHARSET'} = 'CP850';
100 $sambasettings{'UNIXCHARSET'} = 'UTF8';
101 $sambasettings{'DISPLAYCHARSET'} = 'CP850';
102 $sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
103 $sambasettings{'WIDELINKS'} = 'on';
104 $sambasettings{'UNIXEXTENSION'} = 'off';
105 ### Values that have to be initialized
106 $sambasettings{'ACTION'} = '';
107 ### Samba CUPS Variablen
108 $sambasettings{'LOADPRINTERS'} = 'Yes';
109 $sambasettings{'PRINTING'} = 'cups';
110 $sambasettings{'PRINTCAPNAME'} = 'cups';
111 my $LOGLINES = '50';
112
113 ################################################## Samba PDC Variablen #####################################################
114
115 $sambasettings{'LOCALMASTER'} = 'off';
116 $sambasettings{'DOMAINMASTER'} = 'off';
117 $sambasettings{'PREFERREDMASTER'} = 'off';
118 my $PDCOPTIONS = `cat ${General::swroot}/samba/pdc`;
119
120
121 ############################################################################################################################
122
123 &General::readhash("${General::swroot}/samba/settings", \%sambasettings);
124 &Header::getcgihash(\%sambasettings);
125
126 sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
127
128 if (($sambasettings{'WIDELINKS'} eq 'on') & ($sambasettings{'UNIXEXTENSION'} eq 'on'))
129 {$errormessage="Don't enable 'Wide links' and 'Unix extension' at the same time"; }
130
131 &Header::openpage('Samba', 1, '');
132 &Header::openbigbox('100%', 'left', '', $errormessage);
133
134 ############################################################################################################################
135 ############################################# Samba Rootskript aufrufe fr SU-Actions #######################################
136
137 if ($sambasettings{'ACTION'} eq 'smbuserdisable'){system("/usr/local/bin/sambactrl smbuserdisable $sambasettings{'NAME'}");refreshpage();}
138 if ($sambasettings{'ACTION'} eq 'smbuserenable'){system("/usr/local/bin/sambactrl smbuserenable $sambasettings{'NAME'}");refreshpage();}
139 if ($sambasettings{'ACTION'} eq 'smbuseradd'){system("/usr/local/bin/sambactrl smbuseradd $sambasettings{'USERNAME'} $sambasettings{'PASSWORD'} $sambasettings{'GROUP'} $sambasettings{'SHELL'}");refreshpage();}
140 if ($sambasettings{'ACTION'} eq 'smbpcadd'){system("/usr/local/bin/sambactrl smbpcadd $sambasettings{'PCNAME'} $sambasettings{'GROUP'} $sambasettings{'SHELL'}");refreshpage();}
141 if ($sambasettings{'ACTION'} eq 'smbchangepw'){system("/usr/local/bin/sambactrl smbchangepw $sambasettings{'USERNAME'} $sambasettings{'PASSWORD'}");refreshpage();}
142 if ($sambasettings{'ACTION'} eq 'smbrestart'){system("/usr/local/bin/sambactrl smbrestart");refreshpage();}
143 if ($sambasettings{'ACTION'} eq 'smbstart'){system("/usr/local/bin/sambactrl smbstart");refreshpage();}
144 if ($sambasettings{'ACTION'} eq 'smbstop'){system("/usr/local/bin/sambactrl smbstop");refreshpage();}
145 if ($sambasettings{'ACTION'} eq 'smbreload'){system("/usr/local/bin/sambactrl smbreload");refreshpage();}
146 if ($sambasettings{'ACTION'} eq 'globalresetyes')
147 {
148 system("/usr/local/bin/sambactrl smbglobalreset");
149 $sambasettings{'WORKGRP'} = 'homeip.net';
150 $sambasettings{'NETBIOSNAME'} = 'IPFire';
151 $sambasettings{'SRVSTRING'} = 'Samba running on IPFire 2.0';
152 $sambasettings{'INTERFACES'} = '';
153 $sambasettings{'SECURITY'} = 'share';
154 $sambasettings{'OSLEVEL'} = '65';
155 $sambasettings{'GREEN'} = 'on';
156 $sambasettings{'BLUE'} = 'off';
157 $sambasettings{'ORANGE'} = 'off';
158 $sambasettings{'VPN'} = 'off';
159 $sambasettings{'WINSSRV'} = '';
160 $sambasettings{'WINSSUPPORT'} = 'on';
161 $sambasettings{'REMOTEANNOUNCE'} = '';
162 $sambasettings{'REMOTESYNC'} = '';
163 $sambasettings{'PASSWORDSYNC'} = 'off';
164 $sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
165 $sambasettings{'GUESTACCOUNT'} = 'samba';
166 $sambasettings{'MAPTOGUEST'} = 'Never';
167 $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
168 $sambasettings{'SYSLOGLEVEL'} = '1';
169 $sambasettings{'SYSLOGONLY'} = 'on';
170 $sambasettings{'DOSCHARSET'} = 'CP850';
171 $sambasettings{'UNIXCHARSET'} = 'UTF8';
172 $sambasettings{'DISPLAYCHARSET'} = 'CP850';
173 ### Samba CUPS Variablen
174 $sambasettings{'LOADPRINTERS'} = 'Yes';
175 $sambasettings{'PRINTING'} = 'cups';
176 $sambasettings{'PRINTCAPNAME'} = 'cups';
177 $sambasettings{'PRINTERNAME'} = 'Printer';
178 ### Values that have to be initialized
179 $sambasettings{'WIDELINKS'} = 'on';
180 $sambasettings{'UNIXEXTENSION'} = 'off';
181 $sambasettings{'ACTION'} = '';
182 $sambasettings{'LOCALMASTER'} = 'off';
183 $sambasettings{'DOMAINMASTER'} = 'off';
184 $sambasettings{'PREFERREDMASTER'} = 'off';
185 $sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
186 $PDCOPTIONS = `cat ${General::swroot}/samba/pdc`;
187 system("/usr/local/bin/sambactrl smbreload");
188 refreshpage();
189 }
190
191 ############################################################################################################################
192 ################################################ Sicherheitsabfrage für den Reset ##########################################
193
194 if ($sambasettings{'ACTION'} eq 'globalreset')
195 {
196 print <<END
197 <br />
198 <table width='95%' cellspacing='0'>
199 <tr><td bgcolor='$color{'color20'}' colspan='3' align='center'><b>$Lang::tr{'resetglobals'}</b>
200 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
201 $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' title='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
202 <input type='hidden' name='ACTION' value='globalresetyes' /></form></td>
203 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
204 <input type='image' alt='$Lang::tr{'no'}' title='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'}
205 <input type='hidden' name='ACTION' value='cancel' /></form></td>
206 </tr>
207 </table>
208 END
209 ;
210 }
211
212 if ($sambasettings{'ACTION'} eq 'sharesreset')
213 {
214 print <<END
215 <br />
216 <table width='95%' cellspacing='0'>
217 <tr><td bgcolor='$color{'color20'}' colspan='3' align='center'><b>$Lang::tr{'resetshares'}</b>
218 <tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
219 $Lang::tr{'yes'} <input type='image' alt='$Lang::tr{'yes'}' title='$Lang::tr{'yes'}' src='/images/edit-redo.png' />
220 <input type='hidden' name='ACTION' value='sharesresetyes' /></form></td>
221 <td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
222 <input type='image' alt='$Lang::tr{'no'}' title='$Lang::tr{'no'}' src='/images/dialog-error.png' /> $Lang::tr{'no'}
223 <input type='hidden' name='ACTION' value='cancel' /></form></td>
224 </tr>
225 </table>
226 END
227 ;
228 }
229
230 ############################################################################################################################
231 ########################################### Samba Benutzer oder PC l�chen #################################################
232
233 if ($sambasettings{'ACTION'} eq 'userdelete'){system("/usr/local/bin/sambactrl smbuserdelete $sambasettings{'NAME'}");refreshpage();}
234
235 ############################################################################################################################
236 ##################################### Umsetzen der Werte von Checkboxen und Dropdowns ######################################
237
238 if ($sambasettings{'ACTION'} eq $Lang::tr{'save'})
239 {
240 $sambasettings{'INTERFACES'} = '';
241 if ($sambasettings{'GREEN'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'GREEN_DEV'}";}
242 if ($sambasettings{'BLUE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'BLUE_DEV'}";}
243 if ($sambasettings{'ORANGE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'ORANGE_DEV'}";}
244 if ($sambasettings{'VPN'} eq 'on'){$sambasettings{'INTERFACES'} .= " ";}
245 if ($sambasettings{'OTHERINTERFACES'} ne ''){ $sambasettings{'INTERFACES'} .= " $sambasettings{'OTHERINTERFACES'}";}
246
247 ############################################################################################################################
248 ##################################### Schreiben settings und bersetzen fr smb.conf #######################################
249
250 delete $sambasettings{'__CGI__'};delete $sambasettings{'x'};delete $sambasettings{'y'};
251 &General::writehash("${General::swroot}/samba/settings", \%sambasettings);
252
253 if ($sambasettings{'PASSWORDSYNC'} eq 'on'){ $sambasettings{'PASSWORDSYNC'} = "true";} else { $sambasettings{'PASSWORDSYNC'} = "false";}
254 if ($sambasettings{'WINSSUPPORT'} eq 'on'){ $sambasettings{'WINSSUPPORT'} = "true";$sambasettings{'WINSSRV'} = "";} else { $sambasettings{'WINSSUPPORT'} = "false";}
255 if ($sambasettings{'LOCALMASTER'} eq 'on'){ $sambasettings{'LOCALMASTER'} = "true";} else { $sambasettings{'LOCALMASTER'} = "false";}
256 if ($sambasettings{'DOMAINMASTER'} eq 'on'){ $sambasettings{'DOMAINMASTER'} = "true";} else { $sambasettings{'DOMAINMASTER'} = "false";}
257 if ($sambasettings{'PREFERREDMASTER'} eq 'on'){ $sambasettings{'PREFERREDMASTER'} = "true";} else { $sambasettings{'PREFERREDMASTER'} = "false";}
258 if ($sambasettings{'SYSLOGONLY'} eq 'on'){ $sambasettings{'SYSLOGONLY'} = "yes";} else { $sambasettings{'SYSLOGONLY'} = "no";}
259 if ($sambasettings{'WIDELINKS'} eq 'on'){ $sambasettings{'WIDELINKS'} = "yes";} else { $sambasettings{'WIDELINKS'} = "no";}
260 if ($sambasettings{'UNIXEXTENSION'} eq 'on'){ $sambasettings{'UNIXEXTENSION'} = "yes";} else { $sambasettings{'UNIXEXTENSION'} = "no";}
261
262 ############################################################################################################################
263 ############################################# Schreiben der Samba globals ##################################################
264
265 open (FILE, ">${General::swroot}/samba/global") or die "Can't save the global settings: $!";
266 flock (FILE, 2);
267
268 print FILE <<END
269 # global.settings by IPFire Project
270
271 [global]
272 netbios name = $sambasettings{'NETBIOSNAME'}
273 server string = $sambasettings{'SRVSTRING'}
274 workgroup = $sambasettings{'WORKGRP'}
275
276 wide links = $sambasettings{'WIDELINKS'}
277 unix extensions = $sambasettings{'UNIXEXTENSION'}
278
279 keep alive = 30
280 os level = $sambasettings{'OSLEVEL'}
281 fstype = NTFS
282
283 kernel oplocks = false
284 map to guest = $sambasettings{'MAPTOGUEST'}
285 smb ports = 445 139
286 dos charset = $sambasettings{'DOSCHARSET'}
287 unix charset = $sambasettings{'UNIXCHARSET'}
288 display charset = $sambasettings{'DISPLAYCHARSET'}
289
290 security = $sambasettings{'SECURITY'}
291 encrypt passwords = yes
292 guest account = $sambasettings{'GUESTACCOUNT'}
293 unix password sync = $sambasettings{'PASSWORDSYNC'}
294 null passwords = yes
295
296 bind interfaces only = true
297 interfaces = $sambasettings{'INTERFACES'}
298 socket options = $sambasettings{'SOCKETOPTIONS'}
299 remote announce = $sambasettings{'REMOTEANNOUNCE'}
300 remote browse sync = $sambasettings{'REMOTESYNC'}
301
302 username level = 1
303 wins support = $sambasettings{'WINSSUPPORT'}
304 wins server = $sambasettings{'WINSSRV'}
305
306 log file = /var/log/samba/samba-log.%m
307 lock directory = /var/lock/samba
308 pid directory = /var/run/
309 log level = $sambasettings{'LOGLEVEL'}
310 syslog = $sambasettings{'SYSLOGLEVEL'}
311 syslog only = $sambasettings{'SYSLOGONLY'}
312
313 preferred master = $sambasettings{'PREFERREDMASTER'}
314 domain master = $sambasettings{'DOMAINMASTER'}
315 local master = $sambasettings{'LOCALMASTER'}
316
317 END
318 ;
319 close FILE;
320
321 if (-e "${General::swroot}/cups/enable"){
322 open (FILE, ">>${General::swroot}/samba/global") or die "Can't save the global cups settings: $!";
323 flock (FILE, 2);
324 print FILE <<END
325 load printers = $sambasettings{'LOADPRINTERS'}
326 printing = $sambasettings{'PRINTING'}
327 printcap name = $sambasettings{'PRINTCAPNAME'}
328
329 END
330 ;
331 close FILE;
332 }
333
334 if ($sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' )
335 {
336 open (FILE, ">${General::swroot}/samba/pdc") or die "Can't save the pdc settings: $!";
337 flock (FILE, 2);
338 chomp $sambasettings{'PDCOPTIONS'};
339 $sambasettings{'PDCOPTIONS'} =~ s/\r\n/\n/gi;
340 $sambasettings{'PDCOPTIONS'} =~ s/^\n//gi;
341 $sambasettings{'PDCOPTIONS'} =~ s/^\r//gi;
342 $sambasettings{'PDCOPTIONS'} =~ s/^.\n//gi;
343 $sambasettings{'PDCOPTIONS'} =~ s/^.\r//gi;
344 print FILE <<END
345 $sambasettings{'PDCOPTIONS'}
346 END
347 ;
348 close FILE;
349 }
350
351 if ( -e "/var/ipfire/cups/enable")
352 {
353 if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");refreshpage();}
354 else {system("/usr/local/bin/sambactrl smbsafeconfcups");}
355 }
356 else
357 {
358 if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");refreshpage();}
359 else{system("/usr/local/bin/sambactrl smbsafeconf");}
360 }
361
362 system("/usr/local/bin/sambactrl smbreload");refreshpage();
363 }
364 &General::readhash("${General::swroot}/samba/settings", \%sambasettings);
365
366
367 if ($errormessage)
368 {
369 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
370 print "<class name='base'>$errormessage\n";
371 print "&nbsp;</class>\n";
372 &Header::closebox();
373 }
374
375 ############################################################################################################################
376 ########################################## Aktivieren von Checkboxen und Dropdowns #########################################
377
378 $checked{'SYSLOGONLY'}{'off'} = '';
379 $checked{'SYSLOGONLY'}{'on'} = '';
380 $checked{'SYSLOGONLY'}{$sambasettings{'SYSLOGONLY'}} = "checked='checked'";
381 $checked{'WINSSUPPORT'}{'off'} = '';
382 $checked{'WINSSUPPORT'}{'on'} = '';
383 $checked{'WINSSUPPORT'}{$sambasettings{'WINSSUPPORT'}} = "checked='checked'";
384 $checked{'PASSWORDSYNC'}{'off'} = '';
385 $checked{'PASSWORDSYNC'}{'on'} = '';
386 $checked{'PASSWORDSYNC'}{$sambasettings{'PASSWORDSYNC'}} = "checked='checked'";
387 $checked{'LOCALMASTER'}{'off'} = '';
388 $checked{'LOCALMASTER'}{'on'} = '';
389 $checked{'LOCALMASTER'}{$sambasettings{'LOCALMASTER'}} = "checked='checked'";
390 $checked{'DOMAINMASTER'}{'off'} = '';
391 $checked{'DOMAINMASTER'}{'on'} = '';
392 $checked{'DOMAINMASTER'}{$sambasettings{'DOMAINMASTER'}} = "checked='checked'";
393 $checked{'PREFERREDMASTER'}{'off'} = '';
394 $checked{'PREFERREDMASTER'}{'on'} = '';
395 $checked{'PREFERREDMASTER'}{$sambasettings{'PREFERREDMASTER'}} = "checked='checked'";
396 $checked{'WIDELINKS'}{'off'} = '';
397 $checked{'WIDELINKS'}{'on'} = '';
398 $checked{'WIDELINKS'}{$sambasettings{'WIDELINKS'}} = "checked='checked'";
399 $checked{'UNIXEXTENSION'}{'off'} = '';
400 $checked{'UNIXEXTENSION'}{'on'} = '';
401 $checked{'UNIXEXTENSION'}{$sambasettings{'UNIXEXTENSION'}} = "checked='checked'";
402 $checked{'GREEN'}{'off'} = '';
403 $checked{'GREEN'}{'on'} = '';
404 $checked{'GREEN'}{$sambasettings{'GREEN'}} = "checked='checked'";
405 $checked{'BLUE'}{'off'} = '';
406 $checked{'BLUE'}{'on'} = '';
407 $checked{'BLUE'}{$sambasettings{'BLUE'}} = "checked='checked'";
408 $checked{'ORANGE'}{'off'} = '';
409 $checked{'ORANGE'}{'on'} = '';
410 $checked{'ORANGE'}{$sambasettings{'ORANGE'}} = "checked='checked'";
411 $checked{'VPN'}{'off'} = '';
412 $checked{'VPN'}{'on'} = '';
413 $checked{'VPN'}{$sambasettings{'VPN'}} = "checked='checked'";
414
415 $selected{'MAPTOGUEST'}{$sambasettings{'MAPTOGUEST'}} = "selected='selected'";
416 $selected{'SECURITY'}{$sambasettings{'SECURITY'}} = "selected='selected'";
417
418 ############################################################################################################################
419 ################################### Aufbau der HTML Seite fr globale Sambaeinstellungen ###################################
420
421 &Header::openbox('100%', 'center', $Lang::tr{'samba'});
422 print <<END
423 <br />
424 <table width='95%' cellspacing='0'>
425 END
426 ;
427 if ( $message ne "" )
428 {
429 print "<tr><td colspan='3' align='left'><font color='red'>$message</font>";
430 }
431
432 print <<END
433 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'all services'}</b></td></tr>
434 </table><table width='95%' cellspacing='0'>
435 END
436 ;
437
438 my $key = '';
439 foreach $key (sort keys %servicenames)
440 {
441 print "<tr><td align='left' width='40%'>$key</td>";
442 my $shortname = $servicenames{$key};
443 my $status = &isrunning($shortname);
444 print "$status</tr>";
445 }
446
447 print <<END
448 </table>
449 <br />
450 <table width='95%' cellspacing='0'>
451 <tr><td align='left' width='40%' />
452 <td align='center' ><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='smbstart' /><input type='image' alt='$Lang::tr{'smbstart'}' title='$Lang::tr{'smbstart'}' src='/images/go-up.png' /></form></td>
453 <td align='center' ><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='smbstop' /><input type='image' alt='$Lang::tr{'smbstop'}' title='$Lang::tr{'smbstop'}' src='/images/go-down.png' /></form></td>
454 <td align='center' ><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='smbrestart' /><input type='image' alt='$Lang::tr{'smbrestart'}' title='$Lang::tr{'smbrestart'}' src='/images/view-refresh.png' /></form></td></tr>
455 </table>
456 <br />
457 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
458 <table width='95%' cellspacing='0'>
459 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'basic options'}</b></td></tr>
460 <tr><td align='left' width='40%'>$Lang::tr{'workgroup'}</td><td align='left'><input type='text' name='WORKGRP' value='$sambasettings{'WORKGRP'}' size="30" /></td></tr>
461 <tr><td align='left' width='40%'>$Lang::tr{'netbios name'}</td><td align='left'><input type='text' name='NETBIOSNAME' value='$sambasettings{'NETBIOSNAME'}' size="30" /></td></tr>
462 <tr><td align='left' width='40%'>$Lang::tr{'dos charset'}</td><td align='left'><input type='text' name='DOSCHARSET' value='$sambasettings{'DOSCHARSET'}' size="30" /></td></tr>
463 <tr><td align='left' width='40%'>$Lang::tr{'unix charset'}</td><td align='left'><input type='text' name='UNIXCHARSET' value='$sambasettings{'UNIXCHARSET'}' size="30" /></td></tr>
464 <tr><td align='left' width='40%'>$Lang::tr{'display charset'}</td><td align='left'><input type='text' name='DISPLAYCHARSET' value='$sambasettings{'DISPLAYCHARSET'}' size="30" /></td></tr>
465 <tr><td align='left' width='40%'>$Lang::tr{'server string'}</td><td align='left'><input type='text' name='SRVSTRING' value='$sambasettings{'SRVSTRING'}' size="30" /></td></tr>
466 <tr><td align='left' width='40%'>$Lang::tr{'log level'}</td><td align='left'><input type='text' name='LOGLEVEL' value='$sambasettings{'LOGLEVEL'}' size="30" /></td></tr>
467 <tr><td align='left' width='40%'>Sys$Lang::tr{'log level'}</td><td align='left'><input type='text' name='SYSLOGLEVEL' value='$sambasettings{'SYSLOGLEVEL'}' size="30" /></td></tr>
468 <tr><td align='left' width='40%'>Syslog only</td><td align='left'>on <input type='radio' name='SYSLOGONLY' value='on' $checked{'SYSLOGONLY'}{'on'} />/
469 <input type='radio' name='SYSLOGONLY' value='off' $checked{'SYSLOGONLY'}{'off'} /> off</td></tr>
470 <tr><td align='left' width='40%'>$Lang::tr{'interfaces'}</td><td align='left'>on <input type='radio' name='VPN' value='on' $checked{'VPN'}{'on'} />/
471 <input type='radio' name='VPN' value='off' $checked{'VPN'}{'off'} /> off |
472 <font size='2' color='$Header::colourovpn'><b> OpenVpn - $ovpnip[0].$ovpnip[1].$ovpnip[2].$ovpnip[3]/$ovpnnetwork[1]</b></font></td></tr>
473 <tr><td align='left' width='40%'></td><td align='left'>on <input type='radio' name='GREEN' value='on' $checked{'GREEN'}{'on'} />/
474 <input type='radio' name='GREEN' value='off' $checked{'GREEN'}{'off'} /> off |
475 <font size='2' color='$Header::colourgreen'><b> $Lang::tr{'green'} - $netsettings{'GREEN_DEV'}</b></font></td></tr>
476 END
477 ;
478
479 if (&Header::blue_used())
480 {
481 print <<END
482 <tr><td align='left' width='40%'></td><td align='left'>on <input type='radio' name='BLUE' value='on' $checked{'BLUE'}{'on'} />/
483 <input type='radio' name='BLUE' value='off' $checked{'BLUE'}{'off'} /> off |
484 <font size='2' color='$Header::colourblue'><b> $Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'}</b></font></td></tr>
485 END
486 ;
487 }
488
489 if (&Header::orange_used())
490 {
491 print <<END
492 <tr><td align='left' width='40%'></td><td align='left'>on <input type='radio' name='ORANGE' value='on' $checked{'ORANGE'}{'on'} />/
493 <input type='radio' name='ORANGE' value='off' $checked{'ORANGE'}{'off'} /> off |
494 <font size='2' color='$Header::colourorange'><b> $Lang::tr{'dmz'} - $netsettings{'ORANGE_DEV'}</b></font></td></tr>
495 END
496 ;
497 }
498
499 print <<END
500 <tr><td align='center' width='40%'>$Lang::tr{'more'}</td><td align='left'><input type='text' name='OTHERINTERFACES' value='$sambasettings{'OTHERINTERFACES'}' size="30" /></td></tr>
501 <tr><td align='left'><br /></td><td></td></tr>
502 <tr><td align='left' width='40%'>Wide links</td><td align='left'>on <input type='radio' name='WIDELINKS' value='on' $checked{'WIDELINKS'}{'on'} />/
503 <input type='radio' name='WIDELINKS' value='off' $checked{'WIDELINKS'}{'off'} /> off</td></tr>
504 <tr><td align='left' width='40%'>Unix extension</td><td align='left'>on <input type='radio' name='UNIXEXTENSION' value='on' $checked{'UNIXEXTENSION'}{'on'} />/
505 <input type='radio' name='UNIXEXTENSION' value='off' $checked{'UNIXEXTENSION'}{'off'} /> off</td></tr>
506 <tr><td align='left'><br /></td><td></td></tr>
507 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'security options'}</b></td></tr>
508 <tr><td align='left' width='40%'>$Lang::tr{'security'}</td><td align='left'><select name='SECURITY' style="width: 165px">
509 <option value='share' $selected{'SECURITY'}{'share'}>Share</option>
510 <option value='user' $selected{'SECURITY'}{'user'}>User</option>
511 <option value='domain' $selected{'SECURITY'}{'domain'}>Domain</option>
512 <option value='ADS' $selected{'SECURITY'}{'ADS'}>ADS</option>
513 <option value='server' $selected{'SECURITY'}{'server'}>Server</option>
514 </select></td></tr>
515 <tr><td align='left' width='40%'>$Lang::tr{'map to guest'}</td><td align='left'><select name='MAPTOGUEST' style="width: 165px">
516 <option value='Never' $selected{'MAPTOGUEST'}{'Never'}>Never</option>
517 <option value='Bad User' $selected{'MAPTOGUEST'}{'Bad User'}>Bad User</option>
518 <option value='Bad Password' $selected{'MAPTOGUEST'}{'Bad Password'}>Bad Password</option>
519 </select></td></tr>
520 END
521 ;
522 #<tr><td align='left' width='40%'>$Lang::tr{'unix password sync'}</td><td align='left'>on <input type='radio' name='PASSWORDSYNC' value='on' $checked{'PASSWORDSYNC'}{'on'} />/
523 # <input type='radio' name='PASSWORDSYNC' value='off' $checked{'PASSWORDSYNC'}{'off'} /> off</td></tr>
524 print <<END
525 <tr><td align='left'><br /></td><td /></tr>
526 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'network options'}</b></td></tr>
527 <tr><td align='left' width='40%'>$Lang::tr{'os level'}</td><td align='left'><input type='text' name='OSLEVEL' value='$sambasettings{'OSLEVEL'}' size="30" /></td></tr>
528 <tr><td align='left' width='40%'>$Lang::tr{'socket options'}</td><td align='left'><input type='text' name='SOCKETOPTIONS' value='$sambasettings{'SOCKETOPTIONS'}' size="30" /></td></tr>
529 <tr><td align='left' width='40%'>$Lang::tr{'remote announce'}</td><td align='left'><input type='text' name='REMOTEANNOUNCE' value='$sambasettings{'REMOTEANNOUNCE'}' size="30" /></td></tr>
530 <tr><td align='left' width='40%'>$Lang::tr{'remote browse sync'}</td><td align='left'><input type='text' name='REMOTESYNC' value='$sambasettings{'REMOTESYNC'}' size="30" /></td></tr>
531 END
532 ;
533 if ($sambasettings{'WINSSUPPORT'} eq 'off') {print"<tr><td align='left' width='40%'>$Lang::tr{'wins server'}</td><td align='left'><input type='text' name='WINSSRV' value='$sambasettings{'WINSSRV'}' size='30' /></td></tr>";}
534 print <<END
535 <tr><td align='left' width='40%'>$Lang::tr{'wins support'}</td><td align='left'>on <input type='radio' name='WINSSUPPORT' value='on' $checked{'WINSSUPPORT'}{'on'} />/
536 <input type='radio' name='WINSSUPPORT' value='off' $checked{'WINSSUPPORT'}{'off'} /> off</td></tr>
537 END
538 ;
539
540 if ($sambasettings{'SECURITY'} eq 'user')
541 {
542 print <<END
543 <tr><td align='left' width='40%'>$Lang::tr{'local master'}</td><td align='left'>on <input type='radio' name='LOCALMASTER' value='on' $checked{'LOCALMASTER'}{'on'} />/
544 <input type='radio' name='LOCALMASTER' value='off' $checked{'LOCALMASTER'}{'off'} /> off</td></tr>
545 <tr><td align='left' width='40%'>$Lang::tr{'domain master'}</td><td align='left'>on <input type='radio' name='DOMAINMASTER' value='on' $checked{'DOMAINMASTER'}{'on'} />/
546 <input type='radio' name='DOMAINMASTER' value='off' $checked{'DOMAINMASTER'}{'off'} /> off</td></tr>
547 <tr><td align='left' width='40%'>$Lang::tr{'prefered master'}</td><td align='left'>on <input type='radio' name='PREFERREDMASTER' value='on' $checked{'PREFERREDMASTER'}{'on'} />/
548 <input type='radio' name='PREFERREDMASTER' value='off' $checked{'PREFERREDMASTER'}{'off'} /> off</td></tr>
549 END
550 ;
551 }
552
553 if ($sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'on')
554 {
555 print <<END
556 <tr><td align='left'><br /></td><td></td></tr>
557 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'pdc options'}</b></td></tr>
558 <tr><td align='left'><br /></td><td></td></tr>
559 <tr><td colspan='2' align='center'><textarea name="PDCOPTIONS" cols="50" rows="15" Wrap="off">$PDCOPTIONS</textarea></td></tr>
560 END
561 ;
562 }
563
564 if ( -e "/var/ipfire/cups/enable")
565 {
566 print <<END
567 <tr><td align='left'><br /></td><td></td></tr>
568 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'printing options'}</b></td></tr>
569 <tr><td align='left' width='40%'>$Lang::tr{'load printer'}</td><td align='left'><input type='text' name='LOADPRINTERS' value='$sambasettings{'LOADPRINTERS'}' size="30" /></td></tr>
570 <tr><td align='left' width='40%'>$Lang::tr{'printing'}</td><td align='left'><input type='text' name='PRINTING' value='$sambasettings{'PRINTING'}' size="30" /></td></tr>
571 <tr><td align='left' width='40%'>$Lang::tr{'printcap name'}</td><td align='left'><input type='text' name='PRINTCAPNAME' value='$sambasettings{'PRINTCAPNAME'}' size="30" /></td></tr>
572 END
573 ;
574 }
575
576 print <<END
577 </table>
578 <br />
579 <table width='10%' cellspacing='0'>
580 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
581 <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
582 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td>
583 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
584 <input type='hidden' name='ACTION' value='globalreset' />
585 <input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
586 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
587 <input type='hidden' name='ACTION' value='globalcaption' />
588 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
589 </table>
590 END
591 ;
592
593 if ($sambasettings{'ACTION'} eq 'globalcaption')
594 {
595 print <<END
596 <br />
597 <table width='95%' cellspacing='0'>
598 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
599 <tr><td align='right' width='33%'><img src='/images/media-floppy.png' /></td><td align='left'>$Lang::tr{'save settings'}</td></tr>
600 <tr><td align='right' width='33%'><img src='/images/reload.gif' /></td><td align='left'>$Lang::tr{'restore settings'}</td></tr>
601 </table>
602 END
603 ;
604 }
605
606 &Header::closebox();
607
608 ############################################################################################################################
609 ########################################## Benutzerverwaltung fr Usersecurity #############################################
610
611 if ($sambasettings{'SECURITY'} eq 'user')
612 {
613 if ($sambasettings{'DOMAINMASTER'} eq 'off')
614 {
615 &Header::openbox('100%', 'center', $Lang::tr{'accounting user nonpdc'});
616 }
617 else
618 {
619 &Header::openbox('100%', 'center', $Lang::tr{'accounting user pdc'});
620 }
621 print <<END
622 <a name="$Lang::tr{'accounting'}"</a>
623 <br />
624 <table width='95%' cellspacing='0'>
625 <tr><td colspan='6' align='left'></td></tr>
626 <tr><td bgcolor='$color{'color20'}' colspan='7' align='left'><b>$Lang::tr{'accounting'}</b></td></tr>
627 <tr><td align='left'><u>$Lang::tr{'username'}</u></td><td align='left'><u>$Lang::tr{'password'}</u></td>
628 END
629 ;
630
631 if ($sambasettings{'DOMAINMASTER'} eq 'off')
632 {
633 print "<td></td>";
634 }
635 else
636 {
637 print "<td align='left'><u>$Lang::tr{'type'}</u></td>";
638 }
639
640 print "<td align='left'><u>$Lang::tr{'status'}</u></td><td colspan='3' width='5%' align='center'><u>$Lang::tr{'options'}</u></td></tr>";
641 system('/usr/local/bin/sambactrl readsmbpasswd');
642 open(FILE, "<${General::swroot}/samba/private/smbpasswd") or die "Can't read user file: $!";
643 @user = <FILE>;
644 close(FILE);
645 system('/usr/local/bin/sambactrl locksmbpasswd');
646
647 my $lines = 0;
648
649 foreach $userentry (sort @user)
650 {
651 @userline = split( /\:/, $userentry );
652 if ($lines % 2) {print "<tr bgcolor='$color{'color20'}'>";} else {print "<tr bgcolor='$color{'color22'}'>";}
653 print "<td align='left'>$userline[0]</td><td align='left'>";
654 if ($userline[4] =~ /N/)
655 {
656 print "$Lang::tr{'not set'}</td><td align='left'>";
657 }
658 else
659 {
660 print "$Lang::tr{'set'}</td><td align='left'>";
661 }
662
663 if ($sambasettings{'DOMAINMASTER'} eq 'off')
664 {
665 print "</td><td align='left'>";
666 }
667 else
668 {
669 if ($userline[0] =~ /\$/)
670 {
671 print "$Lang::tr{'pc'}</td><td align='left'>";
672 }
673 else
674 {
675 print "$Lang::tr{'user'}</td><td align='left'>";
676 }
677 }
678
679 if ($userline[4] =~ /D/)
680 {
681 print <<END
682 $Lang::tr{'inactive'}</td>
683 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
684 <input type='hidden' name='NAME' value='$userline[0]' />
685 <input type='hidden' name='ACTION' value='smbuserenable' />
686 <input type='image' alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' />
687 </form></td>
688 END
689 ;
690 }
691 else
692 {
693 print <<END
694 $Lang::tr{'active'}</td>
695 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
696 <input type='hidden' name='NAME' value='$userline[0]' />
697 <input type='hidden' name='ACTION' value='smbuserdisable' />
698 <input type='image' alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' />
699 </form></td>
700 END
701 ;
702 }
703
704 if ($userline[0] =~ /\$/)
705 {
706 print "<td></td>";
707 }
708 else
709 {
710 print <<END
711 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
712 <input type='hidden' name='NAME' value='$userline[0]' />
713 <input type='hidden' name='ACTION' value='userchangepw' />
714 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
715 </form></td>
716 END
717 ;
718 }
719
720 if ($sambasettings{'DOMAINMASTER'} eq 'on' && $userline[0] =~ /\$/)
721 {
722 print <<END
723 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
724 <input type='hidden' name='NAME' value='$userline[0]' />
725 <input type='hidden' name='ACTION' value='userdelete' />
726 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/network-error.png' />
727 </form></td></tr>
728 END
729 ;
730 }
731 else
732 {
733 print <<END
734 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
735 <input type='hidden' name='NAME' value='$userline[0]' />
736 <input type='hidden' name='ACTION' value='userdelete' />
737 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-option-remove.png' />
738 </form></td></tr>
739 END
740 ;
741 }
742 $lines++;
743 }
744 print <<END
745 </table>
746 <br />
747 <table width='10%' cellspacing='0'>
748 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
749 <input type='hidden' name='ACTION' value='useradd' />
750 <input type='image' alt='$Lang::tr{'add user'}' title='$Lang::tr{'add user'}' src='/images/user-option-add.png' /></form></td>
751 END
752 ;
753
754 if ($sambasettings{'DOMAINMASTER'} eq 'on')
755 {
756 print <<END
757 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
758 <input type='hidden' name='ACTION' value='pcadd' />
759 <input type='image' alt='$Lang::tr{'pc add'}' title='$Lang::tr{'pc add'}' src='/images/network.png' /></form>
760 END
761 ;
762 }
763 print <<END
764 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
765 <input type='hidden' name='ACTION' value='usercaption' />
766 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form>
767 </td></tr>
768 </table>
769 END
770 ;
771
772 if ($sambasettings{'ACTION'} eq 'usercaption')
773 {
774 print <<END
775 <br />
776 <table width='95%' cellspacing='0'>
777 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
778 <tr><td align='right' width='33%'><img src='/images/user-option-add.png' /></td><td align='left'>$Lang::tr{'add user'}</td></tr>
779 <tr><td align='right' width='33%'><img src='/images/network.png' /></td><td align='left'>$Lang::tr{'pc add'}</td></tr>
780 <tr><td align='right' width='33%'><img src='/images/user-option-remove.png' /></td><td align='left'>$Lang::tr{'delete user'}</td></tr>
781 <tr><td align='right' width='33%'><img src='/images/network-error.png' /></td><td align='left'>$Lang::tr{'delete pc'}</td></tr>
782 <tr><td align='right' width='33%'><img src='/images/off.gif' /></td><td align='left'>$Lang::tr{'activate user'}</td></tr>
783 <tr><td align='right' width='33%'><img src='/images/on.gif' /></td><td align='left'>$Lang::tr{'deactivate user'}</td></tr>
784 <tr><td align='right' width='33%'><img src='/images/edit.gif' /></td><td align='left'>$Lang::tr{'change passwords'}</td></tr>
785 <tr><td align='right' width='33%'><img src='/images/media-floppy.png' /></td><td align='left'>$Lang::tr{'save config'}</td></tr>
786 </table>
787 END
788 ;
789 }
790
791 if ($sambasettings{'ACTION'} eq 'userchangepw')
792 {
793 my $username = "$sambasettings{'NAME'}";
794 my $password = 'samba';
795 print <<END
796 <br />
797 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
798 <table width='95%' cellspacing='0'>
799 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'change passwords'}</b></td></tr>
800 <tr><td align='left'>$Lang::tr{'username'}</td><td><input type='text' name='USERNAME' value='$username' size='30' readonly /></td></tr>
801 <tr><td align='left'>$Lang::tr{'password'}</td><td><input type='password' name='PASSWORD' value='$password' size='30' /></td></tr>
802 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbchangepw' />
803 <input type='image' alt=$Lang::tr{'save'} title=$Lang::tr{'save'} src='/images/media-floppy.png' /></td></tr>
804 </table>
805 </form>
806 END
807 ;
808 }
809
810 if ($sambasettings{'ACTION'} eq 'useradd')
811 {
812 my $username = "user";
813 my $password = "samba";
814 chomp $username;
815 $username=~s/\s//g;
816 chomp $password;
817 $password=~s/\s//g;
818 print <<END
819 <br />
820 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
821 <table width='95%' cellspacing='0'>
822 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'add user'}</b></td></tr>
823 <tr><td align='left'>$Lang::tr{'username'}</td><td><input type='text' name='USERNAME' value='$username' size='30' /></td></tr>
824 <tr><td align='left'>$Lang::tr{'password'}</td><td><input type='password' name='PASSWORD' value='$password' size='30' /></td></tr>
825 <tr><td align='left'>$Lang::tr{'unix group'}</td><td><input type='text' name='GROUP' value='sambauser' size='30' /></td></tr>
826 <tr><td align='left'>$Lang::tr{'unix shell'}</td><td><input type='text' name='SHELL' value='/bin/false' size='30' /></td></tr>
827 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbuseradd' />
828 <input type='image' alt=$Lang::tr{'save'} title=$Lang::tr{'save'} src='/images/media-floppy.png' /></td></tr>
829 </table>
830 </form>
831 END
832 ;
833 }
834
835 if ($sambasettings{'ACTION'} eq 'pcadd')
836 {
837 my $pcname = "client\$";
838 chomp $pcname;
839 $pcname=~s/\s//g;
840 print <<END
841 <br />
842 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'accounting'}'>
843 <table width='95%' cellspacing='0'>
844 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'pc add'}</b></td></tr>
845 <tr><td align='left'>$Lang::tr{'client'}</td><td><input type='text' name='PCNAME' value='$pcname' size='30' /></td></tr>
846 <tr><td align='left'>$Lang::tr{'unix group'}</td><td><input type='text' name='GROUP' value='sambawks' size='30' /></td></tr>
847 <tr><td align='left'>$Lang::tr{'unix shell'}</td><td><input type='text' name='SHELL' value='/bin/false' size='30' /></td></tr>
848 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbpcadd' />
849 <input type='image' title=$Lang::tr{'save'} alt=$Lang::tr{'save'} src='/images/media-floppy.png' /></td></tr>
850 </table>
851 </form>
852 END
853 ;
854 }
855
856 &Header::closebox();
857 }
858
859 ############################################################################################################################
860 ############################################### Verwalten von Freigaben ####################################################
861
862 &Header::openbox('100%', 'center', $Lang::tr{'shares'});
863
864 my %shares = config("${General::swroot}/samba/shares");
865
866
867 print <<END
868 <a name="$Lang::tr{'manage shares'}"</a>
869 <br />
870 <table width='95%' cellspacing='0'>
871 <tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'manage shares'}</b>
872 <tr><td align='left'><u>$Lang::tr{'sharename'}</u></td><td colspan='2' width="5%" align='center'><u>$Lang::tr{'options'}</u></td></tr>
873 END
874 ;
875
876 my @Shares = keys(%shares);
877 my $lines = 0;
878
879 foreach my $shareentry (sort @Shares)
880 {
881 chomp $shareentry;
882 if ($lines % 2) {print "<tr bgcolor='$color{'color20'}'>";} else {print "<tr bgcolor='$color{'color22'}'>";}
883 print <<END
884 <td align='left'>$shareentry</td>
885 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'>
886 <input type='hidden' name='NAME' value='$shareentry' />
887 <input type='hidden' name='ACTION' value='sharechange' />
888 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
889 </form></td>
890 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'>
891 <input type='hidden' name='NAME' value='$shareentry' />
892 <input type='hidden' name='ACTION' value='smbsharedel' />
893 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
894 </form></td></tr>
895 END
896 ;
897 $lines++;
898 }
899
900 print <<END
901 </table>
902 <br />
903 <table width='10%' cellspacing='0'>
904 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'>
905 <input type='hidden' name='ACTION' value='shareadd' />
906 <input type='image' alt='$Lang::tr{'add share'}' title='$Lang::tr{'add share'}' src='/images/list-add.png' />
907 </form></td>
908 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'>
909 <input type='hidden' name='ACTION' value='sharesreset' />
910 <input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' />
911 </form></td>
912 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'>
913 <input type='hidden' name='ACTION' value='sharecaption' />
914 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' />
915 </form></td>
916 </tr>
917 </table>
918 END
919 ;
920
921 if ($sambasettings{'ACTION'} eq 'sharecaption')
922 {
923 print <<END
924 <br />
925 <table width='95%' cellspacing='0'>
926 <tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
927 <tr><td align='right' width='33%'><img src='/images/list-add.png' /></td><td align='left'>$Lang::tr{'add share'}</td></tr>
928 <tr><td align='right' width='33%'><img src='/images/edit.gif' /></td><td align='left'>$Lang::tr{'edit share'}</td></tr>
929 <tr><td align='right' width='33%'><img src='/images/media-floppy.png' /></td><td align='left'>$Lang::tr{'save config'}</td></tr>
930 <tr><td align='right' width='33%'><img src='/images/reload.gif' /></td><td align='left'>$Lang::tr{'reset shares'}</td></tr>
931 <tr><td align='right' width='33%'><img src='/images/user-trash.png' /></td><td align='left'>$Lang::tr{'delete share'}</td></tr>
932 </table>
933 END
934 ;
935 }
936
937 if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optioncaption' )
938 {
939 print <<END
940 <br />
941 <table width='95%' cellspacing='0'>
942 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'add share'}</b></td></tr>
943 <tr><td colspan='2' align='center'></td></tr>
944 <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}
945 <a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=600,scrollbars=yes, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"><img border="0" src="/images/help-browser.png"></a></td></tr>
946 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'><tr><td colspan='2' align='center'><textarea name="SHAREOPTION" cols="50" rows="15" Wrap="off">$defaultoption</textarea></td></tr>
947 </table>
948 <br />
949 <table width='10%' cellspacing='0'>
950 <tr><td align='center'><input type='hidden' name='ACTION' value='smbshareadd' />
951 <input type='image' alt='$Lang::tr{'add share'}' title='$Lang::tr{'add share'}' src='/images/media-floppy.png' /></td></tr></form>
952 </table>
953 END
954 ;
955 }
956
957 if ($sambasettings{'ACTION'} eq 'sharechange' || $sambasettings{'ACTION'} eq 'optioncaption2' )
958 {
959 my $shareoption = $shares{$sambasettings{'NAME'}};
960 print <<END
961 <br />
962 <table width='95%' cellspacing='0'>
963 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'edit share'}</b></td></tr>
964 <tr><td colspan='2' align='center'></td></tr>
965 <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}<a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=600,scrollbars=yes, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"><img border="0" src="/images/help-browser.png"></a></td></tr>
966 <tr><td colspan='2' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage shares'}'><textarea name="SHAREOPTION" cols="50" rows="15" Wrap="off">$shareoption</textarea></td></tr>
967 </table>
968 <br />
969 <table width='10%' cellspacing='0'>
970 <tr><td align='center'><input type='hidden' name='NAME' value='$sambasettings{'NAME'}' />
971 <input type='image' alt='$Lang::tr{'change share'}' title='$Lang::tr{'change share'}' src='/images/media-floppy.png' />
972 <input type='hidden' name='ACTION' value='smbsharechange' /></form></td></tr>
973 </table>
974 END
975 ;
976 }
977
978 if ($sambasettings{'ACTION'} eq 'sharesresetyes')
979 {
980 system('/usr/local/bin/sambactrl smbsharesreset');
981 my $shares = config("${General::swroot}/samba/shares");
982 system("/usr/local/bin/sambactrl smbreload");
983 }
984 if ($sambasettings{'ACTION'} eq 'smbshareadd')
985 {
986 $shares{'xvx'}= "$sambasettings{'SHAREOPTION'}";
987 save("shares");
988 my $shares = config("${General::swroot}/samba/shares");
989 }
990 if ($sambasettings{'ACTION'} eq 'smbsharedel')
991 {
992 delete $shares{$sambasettings{'NAME'}};
993 save("shares");
994 my %shares = config("${General::swroot}/samba/shares");
995 }
996 if ($sambasettings{'ACTION'} eq 'smbsharechange')
997 {
998 $shares{$sambasettings{'NAME'}} = $sambasettings{'SHAREOPTION'};
999 save("shares");
1000 my %shares = config("${General::swroot}/samba/shares");
1001 }
1002
1003 &Header::closebox();
1004
1005 ############################################################################################################################
1006 ################################################ Verwalten von Druckern ####################################################
1007
1008 my %printer = config("${General::swroot}/samba/printer");
1009
1010 if ( -e "/var/ipfire/cups/enable")
1011 {
1012 &Header::openbox('100%', 'center', $Lang::tr{'printer'});
1013
1014 my @Printers = keys(%printer);
1015 print <<END
1016 <a name="$Lang::tr{'manage printers'}"</a>
1017 <br />
1018 <table width='95%' cellspacing='0'>
1019 <tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'manage printers'}</b>
1020 <tr><td align='left'><u>$Lang::tr{'printername'}</u></td><td colspan='2' width="5%" align='center'><u>$Lang::tr{'options'}</u></td></tr>
1021 END
1022 ;
1023 foreach my $printerentry (sort @Printers)
1024 {
1025 chomp $printerentry;
1026 print <<END
1027 <tr><td align='left'>$printerentry</td>
1028 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'>
1029 <input type='hidden' name='NAME' value='$printerentry' />
1030 <input type='hidden' name='ACTION' value='printerchange' />
1031 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1032 </form></td>
1033 <td><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'>
1034 <input type='hidden' name='NAME' value='$printerentry' />
1035 <input type='hidden' name='ACTION' value='smbprinterdel' />
1036 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
1037 </form></td></tr>
1038 END
1039 ;
1040 }
1041 print <<END
1042 </table>
1043 <br />
1044 <table width='10%' cellspacing='0'>
1045 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'>
1046 <input type='hidden' name='ACTION' value='printeradd' />
1047 <input type='image' alt='$Lang::tr{'add printer'}' title='$Lang::tr{'add printer'}' src='/images/list-add.png' />
1048 </form></td>
1049 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'>
1050 <input type='hidden' name='ACTION' value='printereset' />
1051 <input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' />
1052 </form></td>
1053 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'>
1054 <input type='hidden' name='ACTION' value='printercaption' />
1055 <input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' />
1056 </form></td>
1057 </tr>
1058 </table>
1059 END
1060 ;
1061
1062 if ($sambasettings{'ACTION'} eq 'printeradd' || $sambasettings{'ACTION'} eq 'printercaption' )
1063 {
1064 print <<END
1065 <br />
1066 <table width='95%' cellspacing='0'>
1067 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'add printer'}</b></td></tr>
1068 <tr><td colspan='2' align='center'></td></tr>
1069 <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}
1070 <a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=600,scrollbars=yes, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"><img border="0" src="/images/help-browser.png"></a></td></tr>
1071 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'><tr><td colspan='2' align='center'><textarea name="PRINTEROPTION" cols="50" rows="15" Wrap="off">$defaultprinter</textarea></td></tr>
1072 </table>
1073 <br />
1074 <table width='10%' cellspacing='0'>
1075 <tr><td align='center'><input type='hidden' name='ACTION' value='smbprinteradd' />
1076 <input type='image' alt='$Lang::tr{'add share'}' title='$Lang::tr{'add share'}' src='/images/media-floppy.png' /></td></tr>
1077 </table>
1078 </form>
1079 END
1080 ;
1081 }
1082
1083 if ($sambasettings{'ACTION'} eq 'printerchange' || $sambasettings{'ACTION'} eq 'printercaption2' )
1084 {
1085 my $printeroption = $printer{$sambasettings{'NAME'}};
1086 print <<END
1087 <br />
1088 <table width='95%' cellspacing='0'>
1089 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'edit printer'}</b></td></tr>
1090 <tr><td colspan='2' align='center'></td></tr>
1091 <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}<a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=600,scrollbars=yes, toolbar=no,status=no, resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')"><img border="0" src="/images/help-browser.png"></a></td></tr>
1092 <tr><td colspan='2' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'manage printers'}'><textarea name="PRINTEROPTION" cols="50" rows="15" Wrap="off">$printeroption</textarea></td></tr>
1093 </table>
1094 <br />
1095 <table width='10%' cellspacing='0'>
1096 <tr><td align='center'><input type='hidden' name='NAME' value='$sambasettings{'NAME'}' />
1097 <input type='image' alt='$Lang::tr{'change share'}' title='$Lang::tr{'change share'}' src='/images/media-floppy.png' />
1098 <input type='hidden' name='ACTION' value='smbprinterchange' /></form></td></tr>
1099 </table>
1100 END
1101 ;
1102 }
1103
1104 if ($sambasettings{'ACTION'} eq 'smbprinteradd')
1105 {
1106 $printer{'xvx'}= "$sambasettings{'PRINTEROPTION'}";
1107 save("printer");
1108 my %printer = config("${General::swroot}/samba/printer");
1109 }
1110
1111 if ($sambasettings{'ACTION'} eq 'smbprinterdel')
1112 {
1113 delete $printer{$sambasettings{'NAME'}};
1114 save("printer");
1115 my %printer = config("${General::swroot}/samba/printer");
1116 }
1117
1118 if ($sambasettings{'ACTION'} eq 'smbprinterchange')
1119 {
1120 $printer{$sambasettings{'NAME'}} = $sambasettings{'PRINTEROPTION'};
1121 save("printer");
1122 my %printer = config("${General::swroot}/samba/printer");
1123 }
1124
1125 &Header::closebox();
1126 }
1127
1128 ############################################################################################################################
1129 ############################################### Anzeige des Sambastatus ####################################################
1130
1131 &Header::openbox('100%', 'center', 'Status');
1132
1133 print <<END
1134 <br />
1135 <table width='95%' cellspacing='0'>
1136 <tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'samba status'}</b></td></tr>
1137 <tr><td align='left'>$Status</td></tr>
1138 </table>
1139 END
1140 ;
1141 &Header::closebox();
1142
1143 ############################################################################################################################
1144 ############################################### Anzeige der Sambalogs ######################################################
1145
1146
1147 if ($sambasettings{'ACTION'} eq 'showlog')
1148 {
1149 $Log = qx(tail -n $sambasettings{'LOGLINES'} /var/log/samba/$sambasettings{'LOG'});
1150 $Log=~s/\n/<br \/>/g;
1151 }
1152
1153 &Header::openbox('100%', 'center', $Lang::tr{'log'});
1154
1155 print <<END
1156 <a name="$Lang::tr{'log view'}"</a>
1157 <br />
1158 <form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'log view'}'>
1159 <table width='95%' cellspacing='0'>
1160 <tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'log view'}</b></td></tr>
1161 <tr><td colspan='3' align='left'><br /></td></tr>
1162 <tr><td align='left'><select name='LOG' style="width: 200px">
1163 END
1164 ;
1165 foreach my $log (@Logs) {chomp $log;print"<option value='$log'>$log</option>";}
1166 print <<END
1167
1168 </select></td><td align='left'>$Lang::tr{'show last x lines'}<input type='text' name='LOGLINES' value='$LOGLINES' size="3" /></td>
1169 <td align='left'><input type='hidden' name='ACTION' value='showlog' /><input type='image' alt='view Log' title='view Log' src='/images/format-justify-fill.png' /></td></tr>
1170 <tr><td colspan='3' align='left'><br /></td></tr>
1171 <tr><td colspan='3' align='left'><font size=2>$Log</font></td></tr>
1172 <tr><td colspan='3' align='left'><br /></td></tr>
1173 <tr><td colspan='3' align='center'>$sambasettings{'LOG'}</td></tr>
1174 </table>
1175 </form>
1176 END
1177 ;
1178 &Header::closebox();
1179 &Header::closebigbox();
1180 &Header::closepage();
1181
1182 ############################################################################################################################
1183 ############################################ Subfunktion fr Sambadienste ###################################################
1184
1185 sub config
1186 {
1187 my $file = shift;
1188 my @allarray = `grep -n '^\\[' $file`;
1189 my @linesarray = ();
1190 my @namearray = ();
1191 my %hash = ();
1192 my $options = ();
1193 my $EOF = qx(cat $file | wc -l);
1194 foreach my $allarrayentry (@allarray)
1195 {
1196 my @allarrayline = split( /\:/, $allarrayentry );
1197 push(@linesarray,$allarrayline[0]);$allarrayline[1]=~s/\[//g;$allarrayline[1]=~s/\]//g;push(@namearray,$allarrayline[1]);
1198 }
1199 for(my $i = 0; $i <= $#namearray; $i++)
1200 {
1201 chomp $namearray[$i];
1202 $namearray[$i]=~s/\[//g;$namearray[$i]=~s/\]//g;
1203 if ( $i eq $#namearray )
1204 {
1205 my $lineend = $EOF-$linesarray[$i]+1;
1206 $options=qx(tail -$lineend $file);
1207 }
1208 else
1209 {
1210 my $linestart = $EOF-$linesarray[$i]+1;
1211 my $lineend = $linesarray[$i+1]-$linesarray[$i];
1212 $options=qx(tail -$linestart $file | head -$lineend);
1213 }
1214 $hash{$namearray[$i]} = "$options";
1215 #print"<pre>$namearray[$i]\n$options\n</pre>"; # enable only for debuging
1216 }
1217 return(%hash);
1218 }
1219
1220 sub save
1221 {
1222 my $smb = shift;
1223 open (FILE, ">${General::swroot}/samba/$smb") or die "Can't $smb settings $!";
1224 flock (FILE, 2);
1225
1226 if ( $smb eq 'printer')
1227 {while (my ($name, $option) = each %printer){chomp $option;$option =~ s/\r\n/\n/gi;$option =~ s/^\n//gi;$option =~ s/^\r//gi;$option =~ s/^.\n//gi;$option =~ s/^.\r//gi;print FILE "$option\n";}}
1228
1229 if ( $smb eq 'shares')
1230 {while (my ($name, $option) = each %shares){chomp $option;$option =~ s/\r\n/\n/gi;$option =~ s/^\n//gi;$option =~ s/^\r//gi;$option =~ s/^.\n//gi;$option =~ s/^.\r//gi;print FILE "$option\n";} }
1231
1232 close FILE;
1233
1234 if ( -e "/var/ipfire/cups/enable")
1235 {
1236 if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");}
1237 else {system("/usr/local/bin/sambactrl smbsafeconfcups");}
1238 }
1239 else
1240 {
1241 if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");}
1242 else{system("/usr/local/bin/sambactrl smbsafeconf");}
1243 }
1244
1245 system("/usr/local/bin/sambactrl smbreload");
1246 refreshpage();
1247 }
1248
1249 sub isrunning
1250 {
1251 my $cmd = $_[0];
1252 my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
1253 my $pid = '';
1254 my $testcmd = '';
1255 my $exename;
1256
1257 $cmd =~ /(^[a-z]+)/;
1258 $exename = $1;
1259
1260 if (open(FILE, "/var/run/${cmd}.pid"))
1261 {
1262 $pid = <FILE>; chomp $pid;
1263 close FILE;
1264 if (open(FILE, "/proc/${pid}/status"))
1265 {
1266 while (<FILE>)
1267 {
1268 if (/^Name:\W+(.*)/)
1269 {
1270 $testcmd = $1;
1271 }
1272 }
1273 close FILE;
1274 if ($testcmd =~ /$exename/)
1275 {
1276 $status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
1277 }
1278 }
1279 }
1280 return $status;
1281 }