Korrekturen im Code, es wird langsam ....
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / samba.cgi
CommitLineData
5e773594
MT
1#!/usr/bin/perl
2#
3# IPFire CGIs
4#
5# This code is distributed under the terms of the GPL
6#
7# (c) The IPFire Team
5e773594
MT
8
9use strict;
10# enable only the following on debugging purpose
11use warnings;
12use CGI::Carp 'fatalsToBrowser';
13
14require '/var/ipfire/general-functions.pl';
15require "${General::swroot}/lang.pl";
16require "${General::swroot}/header.pl";
17
18my %sambasettings = ();
44254afd 19my %cgisettings = ();
5e773594
MT
20my %checked = ();
21my %netsettings = ();
97de2cae 22my %ovpnsettings = ();
5e773594
MT
23my $message = "";
24my $errormessage = "";
32f77a0b 25my $defaultoption= "[Share]\npath = /var/samba/share1\ncomment = Share - Public Access\nbrowseable = yes\nwriteable = yes\ncreate mask = 0777\ndirectory mask = 0777\nguest ok = yes\npublic = yes\nforce user = samba";
1ee8bf5d
MT
26my $userentry = "";
27my @user = ();
28my @userline = ();
5e773594
MT
29my @proto = ();
30my %selected= () ;
1ee8bf5d 31my $userfile = "/var/ipfire/samba/private/smbpasswd";
5e773594 32&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
97de2cae 33&General::readhash("${General::swroot}/ovpn/settings", \%ovpnsettings);
5e773594 34
14cc7eac 35############################################################################################################################
32f77a0b 36############################################# Samba Dienste fr Statusberprfung ##########################################
14cc7eac 37
32f77a0b 38my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd','Winbind Daemon' => 'winbindd');
5e773594
MT
39
40&Header::showhttpheaders();
41
14cc7eac 42############################################################################################################################
32f77a0b 43#################################### Initialisierung von Samba Sharess fr die Verarbeitung ################################
14cc7eac
MT
44
45my @Zeilen= ();
46my @Shares= ();
47my $shareentry = "";
44254afd
MT
48my $shareconfigentry = "";
49my @shareconfigline = ();
50my $shareoption = '';
14cc7eac
MT
51my @shares = ();
52my @shareline = ();
53my $sharefile = "/var/ipfire/samba/shares";
54my $EOF = qx(cat $sharefile | wc -l);
32f77a0b 55my $Status = qx(/usr/local/bin/sambactrl smbstatus);
14cc7eac
MT
56
57@shares = `grep -n '^\\[' $sharefile`;
58foreach $shareentry (@shares)
59 {
60 @shareline = split( /\:/, $shareentry );
61 push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
62 }
63
64############################################################################################################################
32f77a0b 65#################################### Initialisierung von Samba Variablen fr global Settings ###############################
14cc7eac 66
5e773594
MT
67$sambasettings{'WORKGRP'} = 'homeip.net';
68$sambasettings{'NETBIOSNAME'} = 'IPFIRE';
1ee8bf5d
MT
69$sambasettings{'SRVSTRING'} = 'Samba Server running on IPFire 2.0';
70$sambasettings{'INTERFACES'} = '';
5e773594 71$sambasettings{'SECURITY'} = 'share';
1ee8bf5d 72$sambasettings{'OSLEVEL'} = '65';
97de2cae
MT
73$sambasettings{'GREEN'} = 'on';
74$sambasettings{'BLUE'} = 'off';
75$sambasettings{'ORANGE'} = 'off';
76$sambasettings{'VPN'} = 'off';
1ee8bf5d
MT
77$sambasettings{'WINSSRV'} = "$netsettings{'GREEN_NETADDRESS'}";
78$sambasettings{'WINSSUPPORT'} = 'off';
32f77a0b 79$sambasettings{'PASSWORDSYNC'} = 'off';
1ee8bf5d
MT
80$sambasettings{'OTHERINTERFACES'} = '';
81$sambasettings{'GUESTACCOUNT'} = 'samba';
82$sambasettings{'MAPTOGUEST'} = 'Never';
5e773594 83### Values that have to be initialized
44254afd 84$cgisettings{'ACTION'} = '';
5e773594 85
32f77a0b
CS
86################################################## Samba PDC Variablen #####################################################
87
88$sambasettings{'LOCALMASTER'} = 'off';
89$sambasettings{'DOMAINMASTER'} = 'off';
90$sambasettings{'PREFERREDMASTER'} = 'off';
91my $PDCOPTIONS = `cat ${General::swroot}/samba/pdc`;
92
93
94############################################################################################################################
95
5e773594
MT
96&General::readhash("${General::swroot}/samba/settings", \%sambasettings);
97&Header::getcgihash(\%sambasettings);
98
99&Header::openpage('Samba', 1, '');
100&Header::openbigbox('100%', 'left', '', $errormessage);
101
102############################################################################################################################
32f77a0b 103############################################# Samba Rootskript aufrufe fr SU-Actions ######################################
14cc7eac 104
44254afd
MT
105if ($sambasettings{'ACTION'} eq 'smbuserdisable'){system("/usr/local/bin/sambactrl smbuserdisable $sambasettings{'NAME'}");}
106if ($sambasettings{'ACTION'} eq 'smbuserenable'){system("/usr/local/bin/sambactrl smbuserenable $sambasettings{'NAME'}");}
32f77a0b
CS
107if ($sambasettings{'ACTION'} eq 'smbuseradd'){system("/usr/local/bin/sambactrl smbuseradd $sambasettings{'USERNAME'} $sambasettings{'PASSWORD'} $sambasettings{'GROUP'} $sambasettings{'SHELL'}");}
108if ($sambasettings{'ACTION'} eq 'smbpcadd'){system("/usr/local/bin/sambactrl smbpcadd $sambasettings{'PCNAME'} $sambasettings{'GROUP'} $sambasettings{'SHELL'}");}
44254afd
MT
109if ($sambasettings{'ACTION'} eq 'smbchangepw'){system("/usr/local/bin/sambactrl smbchangepw $sambasettings{'USERNAME'} $sambasettings{'PASSWORD'}");}
110if ($sambasettings{'ACTION'} eq 'smbrestart'){system("/usr/local/bin/sambactrl smbrestart");}
111if ($sambasettings{'ACTION'} eq 'smbstart'){system("/usr/local/bin/sambactrl smbstart");}
112if ($sambasettings{'ACTION'} eq 'smbstop'){system("/usr/local/bin/sambactrl smbstop");}
113if ($sambasettings{'ACTION'} eq 'smbstop'){system("/usr/local/bin/sambactrl smbstop");}
114if ($sambasettings{'ACTION'} eq 'globalreset'){system("/usr/local/bin/sambactrl smbglobalreset");}
115
116# smbsafeconf is directly called by the if clause
117
118if ($sambasettings{'ACTION'} eq 'sharesreset')
119{
120system('/usr/local/bin/sambactrl smbsharesreset');
121 @Zeilen = ();
122 @Shares = ();
123 $shareentry = "";
124 @shares = ();
125 @shareline = ();
126 $EOF = qx(cat $sharefile | wc -l);
127
128 @shares = `grep -n '^\\[' $sharefile`;
129 foreach $shareentry (@shares)
130 {
131 @shareline = split( /\:/, $shareentry );
132 push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
133 }
134}
1ee8bf5d 135
32f77a0b
CS
136############################################################################################################################
137########################################### Samba Benutzer oder PC l�chen #################################################
138
139if ($sambasettings{'ACTION'} eq 'userdelete' && $sambasettings{'NAME'} =~ /\$/)
140{
141system("/usr/local/bin/sambactrl smbpcdelete $sambasettings{'NAME'}");
142}
143elsif ($sambasettings{'ACTION'} eq 'userdelete')
144{
145system("/usr/local/bin/sambactrl smbuserdelete $sambasettings{'NAME'}");
146}
147
1ee8bf5d
MT
148############################################################################################################################
149############################################## Samba Share neu anlegen #####################################################
150
151if ($sambasettings{'ACTION'} eq 'smbshareadd')
5e773594 152{
1ee8bf5d 153 my $emptyline= "";
1ee8bf5d
MT
154 open (FILE, ">>${General::swroot}/samba/shares") or die "Can't save the shares settings: $!";
155 flock (FILE, 2);
156
157print FILE <<END
158$sambasettings{'SHAREOPTION'}
159$emptyline
160END
161;
162close FILE;
44254afd 163system("/usr/local/bin/sambactrl smbsafeconf");
14cc7eac
MT
164
165 @Zeilen = ();
166 @Shares = ();
44254afd
MT
167 $shareentry = "";
168 @shares = ();
169 @shareline = ();
170 $EOF = qx(cat $sharefile | wc -l);
171
14cc7eac
MT
172 @shares = `grep -n '^\\[' $sharefile`;
173 foreach $shareentry (@shares)
174 {
175 @shareline = split( /\:/, $shareentry );
176 push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
177 }
5e773594
MT
178}
179
1ee8bf5d 180############################################################################################################################
32f77a0b 181################################################## Samba Share l�chen #####################################################
14cc7eac
MT
182
183if ($sambasettings{'ACTION'} eq 'smbsharedel')
184{
185my $sharebody = '';
186my $sharehead = '';
187my $sharetext = '';
188my $sharename = "$sambasettings{'NAME'}";
189chomp $sharename;
190$sharename=~s/\s//g;
191
192for(my $i = 0; $i <= $#Shares; $i++)
193 {
194 chomp $Shares[$i];
195 $Shares[$i]=~s/\s//g;
196 if ( "$Shares[$i]" eq "$sharename" )
197 {
198 my $Zeilenbegin = $Zeilen[$i]-2;
199 my $Zeilenende = $EOF-$Zeilen[$i+1]+1;
200 my $Zeilenende2 = $Zeilenende-1;
201
202 if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
203 {
204 $sharehead = qx(head -$Zeilenbegin $sharefile);
205 $sharetext = $sharehead;
206 }
207 elsif ($Zeilen[$i] eq 1 )
208 {
209 $sharehead = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
210 $sharetext = $sharehead;
211 }
212 else
213 {
214 $sharehead = qx(head -$Zeilenbegin $sharefile);$sharebody = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
215 $sharetext = "$sharehead\n$sharebody";
216 }
217 }
218 }
219
220open (FILE, ">${General::swroot}/samba/shares") or die "Can't delete the share settings: $!";
221flock (FILE, 2);
222print FILE <<END
223$sharetext
224END
225;
226close FILE;
44254afd 227system("/usr/local/bin/sambactrl smbsafeconf");
14cc7eac 228
44254afd
MT
229 @Zeilen = ();
230 @Shares = ();
231 $shareentry = "";
232 @shares = ();
233 @shareline = ();
234 $EOF = qx(cat $sharefile | wc -l);
235
236 @shares = `grep -n '^\\[' $sharefile`;
237 foreach $shareentry (@shares)
14cc7eac
MT
238 {
239 @shareline = split( /\:/, $shareentry );
240 push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
241 }
242}
1ee8bf5d 243############################################################################################################################
32f77a0b 244################################################## Sambashare �dern #######################################################
14cc7eac
MT
245
246if ($sambasettings{'ACTION'} eq 'smbsharechange')
247{
248my $sharebody = '';
249my $sharehead = '';
250my $sharename = "$sambasettings{'NAME'}";
251my $sharetext = '';
14cc7eac
MT
252$sharename=~s/\s//g;
253
254for(my $i = 0; $i <= $#Shares; $i++)
255 {
256 chomp $Shares[$i];
257 $Shares[$i]=~s/\s//g;
258 if ( "$Shares[$i]" eq "$sharename" )
259 {
260 my $Zeilenbegin = $Zeilen[$i]-2;
261 my $Zeilenende = $EOF-$Zeilen[$i+1]+1;
262 my $Zeilenende2 = $Zeilenende-1;
263
264 if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
265 {
266 $sharehead = qx(head -$Zeilenbegin $sharefile);
267 $sharetext = $sharehead;
268 }
269 elsif ($Zeilen[$i] eq 1 )
270 {
271 $sharehead = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
272 $sharetext = $sharehead;
273 }
274 else
275 {
276 $sharehead = qx(head -$Zeilenbegin $sharefile);$sharebody = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
277 $sharetext = "$sharehead\n$sharebody";
278 }
279 }
280 }
281
282open (FILE, ">${General::swroot}/samba/shares") or die "Can't delete the share settings: $!";
283flock (FILE, 2);
284print FILE <<END
285$sharetext
286$sambasettings{'SHAREOPTION'}
287END
288;
289close FILE;
44254afd 290system("/usr/local/bin/sambactrl smbsafeconf");
14cc7eac
MT
291
292 @Zeilen = ();
293 @Shares = ();
294 @shares = `grep -n '^\\[' $sharefile`;
295 foreach $shareentry (@shares)
296 {
297 @shareline = split( /\:/, $shareentry );
298 push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
299 }
300}
301
302############################################################################################################################
303##################################### Umsetzen der Werte von Checkboxen und Dropdowns ######################################
1ee8bf5d
MT
304
305if ($sambasettings{'ACTION'} eq $Lang::tr{'save'})
306{
307$sambasettings{'INTERFACES'} = '';
44254afd
MT
308if ($sambasettings{'GREEN'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'GREEN_DEV'}";}
309if ($sambasettings{'BLUE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'BLUE_DEV'}";}
310if ($sambasettings{'ORANGE'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $netsettings{'ORANGE_DEV'}";}
311if ($sambasettings{'VPN'} eq 'on'){ $sambasettings{'INTERFACES'} .= " $ovpnsettings{'DDEVICE'}";}
312if ($sambasettings{'OTHERINTERFACES'} ne ''){ $sambasettings{'INTERFACES'} .= " $sambasettings{'OTHERINTERFACES'}";}
1ee8bf5d
MT
313
314############################################################################################################################
32f77a0b 315##################################### Schreiben settings und bersetzen fr smb.conf #######################################
1ee8bf5d
MT
316
317 &General::writehash("${General::swroot}/samba/settings", \%sambasettings);
32f77a0b
CS
318
319if ($sambasettings{'PASSWORDSYNC'} eq 'on'){ $sambasettings{'PASSWORDSYNC'} = "true";} else { $sambasettings{'PASSWORDSYNC'} = "false";}
320if ($sambasettings{'WINSSUPPORT'} eq 'on'){ $sambasettings{'WINSSUPPORT'} = "true";} else { $sambasettings{'WINSSUPPORT'} = "false";}
321if ($sambasettings{'LOCALMASTER'} eq 'on'){ $sambasettings{'LOCALMASTER'} = "true";} else { $sambasettings{'LOCALMASTER'} = "false";}
322if ($sambasettings{'DOMAINMASTER'} eq 'on'){ $sambasettings{'DOMAINMASTER'} = "true";} else { $sambasettings{'DOMAINMASTER'} = "false";}
323if ($sambasettings{'PREFERREDMASTER'} eq 'on'){ $sambasettings{'PREFERREDMASTER'} = "true";} else { $sambasettings{'PREFERREDMASTER'} = "false";}
324if ($sambasettings{'MAPTOGUEST'} eq 'on'){ $sambasettings{'MAPTOGUEST'} = "true";} else { $sambasettings{'MAPTOGUEST'} = "false";}
325
326############################################################################################################################
327############################################# Schreiben der Samba globals ##################################################
1ee8bf5d
MT
328
329 open (FILE, ">${General::swroot}/samba/global") or die "Can't save the global settings: $!";
330 flock (FILE, 2);
331
332print FILE <<END
32f77a0b
CS
333# global.settings by IPFire Project
334
335[global]
336netbios name = $sambasettings{'NETBIOSNAME'}
337server string = $sambasettings{'SRVSTRING'}
338workgroup = $sambasettings{'WORKGRP'}
339
340keep alive = 30
341os level = $sambasettings{'OSLEVEL'}
342fstype = NTFS
343
344kernel oplocks = false
345map to guest = $sambasettings{'MAPTOGUEST'}
346smb ports = 445 139
347unix charset = CP850
348
349security = $sambasettings{'SECURITY'}
350encrypt passwords = yes
351guest account = $sambasettings{'GUESTACCOUNT'}
352unix password sync = $sambasettings{'PASSWORDSYNC'}
353null passwords = yes
354
355bind interfaces only = true
356interfaces = $sambasettings{'INTERFACES'}
357socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE
358
359username level = 1
360wins support = $sambasettings{'WINSSUPPORT'}
361
362log file = /var/log/samba/samba-log.%m
363lock directory = /var/lock/samba
364pid directory = /var/run/
1ee8bf5d 365
32f77a0b
CS
366preferred master = $sambasettings{'PREFERREDMASTER'}
367domain master = $sambasettings{'DOMAINMASTER'}
368local master = $sambasettings{'LOCALMASTER'}
1ee8bf5d 369
32f77a0b
CS
370END
371;
372close FILE;
1ee8bf5d 373
32f77a0b
CS
374 if ($sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' )
375 {
376 open (FILE, ">${General::swroot}/samba/pdc") or die "Can't save the pdc settings: $!";
377 flock (FILE, 2);
378 print FILE <<END
379$sambasettings{'PDCOPTIONS'}
1ee8bf5d
MT
380END
381;
32f77a0b
CS
382 close FILE;
383 system('/usr/local/bin/sambactrl smbsafeconfpdc');
384 }
385 else
386 {
387 system('/usr/local/bin/sambactrl smbsafeconf');
388 }
1ee8bf5d
MT
389}
390 &General::readhash("${General::swroot}/samba/settings", \%sambasettings);
5e773594
MT
391
392if ($errormessage) {
97de2cae
MT
393 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
394 print "<class name='base'>$errormessage\n";
395 print "&nbsp;</class>\n";
396 &Header::closebox();
1ee8bf5d
MT
397 }
398
14cc7eac
MT
399############################################################################################################################
400########################################## Aktivieren von Checkboxen und Dropdowns #########################################
401
44254afd
MT
402$checked{'WINSSUPPORT'}{'off'} = '';
403$checked{'WINSSUPPORT'}{'on'} = '';
404$checked{'WINSSUPPORT'}{$sambasettings{'WINSSUPPORT'}} = "checked='checked'";
32f77a0b
CS
405$checked{'PASSWORDSYNC'}{'off'} = '';
406$checked{'PASSWORDSYNC'}{'on'} = '';
407$checked{'PASSWORDSYNC'}{$sambasettings{'PASSWORDSYNC'}} = "checked='checked'";
408$checked{'LOCALMASTER'}{'off'} = '';
409$checked{'LOCALMASTER'}{'on'} = '';
410$checked{'LOCALMASTER'}{$sambasettings{'LOCALMASTER'}} = "checked='checked'";
411$checked{'DOMAINMASTER'}{'off'} = '';
412$checked{'DOMAINMASTER'}{'on'} = '';
413$checked{'DOMAINMASTER'}{$sambasettings{'DOMAINMASTER'}} = "checked='checked'";
414$checked{'PREFERREDMASTER'}{'off'} = '';
415$checked{'PREFERREDMASTER'}{'on'} = '';
416$checked{'PREFERREDMASTER'}{$sambasettings{'PREFERREDMASTER'}} = "checked='checked'";
44254afd
MT
417$checked{'GREEN'}{'off'} = '';
418$checked{'GREEN'}{'on'} = '';
419$checked{'GREEN'}{$sambasettings{'GREEN'}} = "checked='checked'";
420$checked{'BLUE'}{'off'} = '';
421$checked{'BLUE'}{'on'} = '';
422$checked{'BLUE'}{$sambasettings{'BLUE'}} = "checked='checked'";
423$checked{'ORANGE'}{'off'} = '';
424$checked{'ORANGE'}{'on'} = '';
425$checked{'ORANGE'}{$sambasettings{'ORANGE'}} = "checked='checked'";
426$checked{'VPN'}{'off'} = '';
427$checked{'VPN'}{'on'} = '';
428$checked{'VPN'}{$sambasettings{'VPN'}} = "checked='checked'";
5e773594 429
97de2cae 430$selected{'MAPTOGUEST'}{$sambasettings{'MAPTOGUEST'}} = "selected='selected'";
97de2cae 431$selected{'SECURITY'}{$sambasettings{'SECURITY'}} = "selected='selected'";
5e773594
MT
432
433############################################################################################################################
32f77a0b 434################################### Aufbau der HTML Seite fr globale Sambaeinstellungen ###################################
5e773594
MT
435
436&Header::openbox('100%', 'center', 'Samba');
437print <<END
32f77a0b
CS
438 <hr />
439 <table width='95%' cellspacing='0'>
440END
441;
442if ( $message ne "" )
443 {
444 print "<tr><td colspan='2' align='left'><font color='red'>$message</font>";
445 }
446
447print <<END
448<tr><td colspan='2'><br /></td></tr>
449<tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Alle Dienste</b></td></tr>
450</table><table width='95%' cellspacing='0'>
451END
452;
453
454my $key = '';
455foreach $key (sort keys %servicenames)
456 {
457 print "<tr><td align='left'>$key";
458 my $shortname = $servicenames{$key};
459 my $status = &isrunning($shortname);
460 print "$status";
461 print <<END
462 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
463 <input type='hidden' name='ACTION' value='restart $shortname' />
464 <input type='image' src='/images/reload.gif' />
465 </form></td>
466END
467;
468 }
469
470print <<END
471<tr><td colspan='2'><br /></td></tr>
472<tr><td colspan='2' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
473 <input type='submit' name='ACTION' value='Start' />
474 <input type='submit' name='ACTION' value='Stop' />
475 <input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
476</form></td></tr>
477</table>
478
479
480<form method='post' action='$ENV{'SCRIPT_NAME'}'>
481<table width='95%' cellspacing='0'>
482<tr><td colspan='2'><br /></td></tr>
483<tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Basisoptionen</b></td></tr>
484<tr><td align='left'>Workgroup:</td><td><input type='text' name='WORKGRP' value='$sambasettings{'WORKGRP'}' size="30" /></td></tr>
485<tr><td align='left'>NetBIOS-Name:</td><td><input type='text' name='NETBIOSNAME' value='$sambasettings{'NETBIOSNAME'}' size="30" /></td></tr>
486<tr><td align='left'>Server-String:</td><td><input type='text' name='SRVSTRING' value='$sambasettings{'SRVSTRING'}' size="30" /></td></tr>
487<tr><td align='left'>Interfaces:</td><td>on <input type='radio' name='VPN' value='on' $checked{'VPN'}{'on'} />/
488 <input type='radio' name='VPN' value='off' $checked{'VPN'}{'off'} /> off |
489 <font size='2' color='$Header::colourovpn'><b> OpenVpn - $ovpnsettings{'DDEVICE'}</b></font></td></tr>
490<tr><td align='left'></td><td>on <input type='radio' name='GREEN' value='on' $checked{'GREEN'}{'on'} />/
491 <input type='radio' name='GREEN' value='off' $checked{'GREEN'}{'off'} /> off |
492 <font size='2' color='$Header::colourgreen'><b> $Lang::tr{'green'} - $netsettings{'GREEN_DEV'}</b></font></td></tr>
493END
494;
495
496if (&Header::blue_used())
497 {
498 print <<END
499 <tr><td align='left'></td><td>on <input type='radio' name='BLUE' value='on' $checked{'BLUE'}{'on'} />/
500 <input type='radio' name='BLUE' value='off' $checked{'BLUE'}{'off'} /> off |
501 <font size='2' color='$Header::colourblue'><b> $Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'}</b></font></td></tr>
502END
503;
504 }
505
506if (&Header::orange_used())
507 {
508 print <<END
509 <tr><td align='left'></td><td>on <input type='radio' name='ORANGE' value='on' $checked{'ORANGE'}{'on'} />/
510 <input type='radio' name='ORANGE' value='off' $checked{'ORANGE'}{'off'} /> off |
511 <font size='2' color='$Header::colourorange'><b> $Lang::tr{'dmz'} - $netsettings{'ORANGE_DEV'}</b></font></td></tr>
512END
513;
514 }
515
516print <<END
517<tr><td align='center'>weitere</td><td><input type='text' name='OTHERINTERFACES' value='$sambasettings{'OTHERINTERFACES'}' size="30" /></td></tr>
518<tr><td align='left'><br /></td><td></td></tr>
519<tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Sicherheitsoptionen</b></td></tr>
520<tr><td align='left'>Security:</td><td><select name='SECURITY'>
521 <option value='share' $selected{'SECURITY'}{'share'}>Share</option>
522 <option value='user' $selected{'SECURITY'}{'user'}>User</option>
523 <option value='domain' $selected{'SECURITY'}{'domain'}>Domain</option>
524 <option value='ADS' $selected{'SECURITY'}{'ADS'}>ADS</option>
525 <option value='server' $selected{'SECURITY'}{'server'}>Server</option>
526 </select></td></tr>
527<tr><td align='left'>Map to guest:</td><td><select name='MAPTOGUEST'>
528 <option value='Never' $selected{'MAPTOGUEST'}{'Never'}>Never</option>
529 <option value='Bad User' $selected{'MAPTOGUEST'}{'Bad User'}>Bad User</option>
530 <option value='Bad Password' $selected{'MAPTOGUEST'}{'Bad Password'}>Bad Password</option>
531 </select></td></tr>
532<tr><td align='left'>Unix Passwort Sync:</td><td>on <input type='radio' name='PASSWORDSYNC' value='on' $checked{'PASSWORDSYNC'}{'on'} />/
533 <input type='radio' name='PASSWORDSYNC' value='off' $checked{'PASSWORDSYNC'}{'off'} /> off</td></tr>
534<tr><td align='left'><br /></td><td></td></tr>
535<tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Netzwerkoptionen</b></td></tr>
536<tr><td align='left'>OS Level:</td><td><input type='text' name='OSLEVEL' value='$sambasettings{'OSLEVEL'}' size="30" /></td></tr>
537<tr><td align='left'>WINS-Server:</td><td><input type='text' name='WINSSRV' value='$sambasettings{'WINSSRV'}' size="30" /></td></tr>
538END
539;
540
541if ($sambasettings{'SECURITY'} eq 'user')
542 {
543 print <<END
544 <tr><td align='left'>WINS-Support:</td><td>on <input type='radio' name='WINSSUPPORT' value='on' $checked{'WINSSUPPORT'}{'on'} />/
545 <input type='radio' name='WINSSUPPORT' value='off' $checked{'WINSSUPPORT'}{'off'} /> off</td></tr>
546<tr><td align='left'>Local Master:</td><td>on <input type='radio' name='LOCALMASTER' value='on' $checked{'LOCALMASTER'}{'on'} />/
547 <input type='radio' name='LOCALMASTER' value='off' $checked{'LOCALMASTER'}{'off'} /> off</td></tr>
548<tr><td align='left'>Domain Master:</td><td>on <input type='radio' name='DOMAINMASTER' value='on' $checked{'DOMAINMASTER'}{'on'} />/
549 <input type='radio' name='DOMAINMASTER' value='off' $checked{'DOMAINMASTER'}{'off'} /> off</td></tr>
550<tr><td align='left'>Preferred Master:</td><td>on <input type='radio' name='PREFERREDMASTER' value='on' $checked{'PREFERREDMASTER'}{'on'} />/
551 <input type='radio' name='PREFERREDMASTER' value='off' $checked{'PREFERREDMASTER'}{'off'} /> off</td></tr>
552END
553;
554 }
555
556if ($sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'on')
557 {
558 print <<END
559 <tr><td align='left'><br /></td><td></td></tr>
560 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>PDC Optionen</b></td></tr>
561 <tr><td align='left'><br /></td><td></td></tr>
562 <tr><td colspan='2' align='center'><textarea name="PDCOPTIONS" cols="50" rows="15" Wrap="off">$PDCOPTIONS</textarea></td></tr>
563END
564;
565 }
566
567print <<END
568</table>
569<table width='10%' cellspacing='0'>
570<tr><td colspan='2'><br /></td></tr>
571<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
572 <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
573 <input type='image' alt=$Lang::tr{'save'} src='/images/floppy.gif' /></form></td>
574<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
575 <input type='hidden' name='ACTION' value='globalreset' />
576 <input type='image' alt='Reset' src='/images/reload.gif' /></form></td>
577<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
578 <input type='hidden' name='ACTION' value='globalcaption' />
94819213 579 <input type='image' alt='Legende' src='/images/info.gif' /></form></td></tr>
32f77a0b 580</table>
44254afd
MT
581END
582;
32f77a0b 583
44254afd 584if ($sambasettings{'ACTION'} eq 'globalcaption')
32f77a0b
CS
585 {
586 print <<END
587 <table width='95%' cellspacing='0'>
588 <tr><td colspan='2'><br /></td></tr>
589 <tr><td><b>Legende:</b></td></tr>
94819213
CS
590 <tr><td><img src='/images/floppy.gif' />Einstellungen speichern</td></tr>
591 <tr><td><img src='/images/reload.gif' />Auf default zurueck setzen</td></tr>
32f77a0b 592 </table>
5e773594
MT
593END
594;
32f77a0b
CS
595 }
596
5e773594
MT
597&Header::closebox();
598
14cc7eac 599############################################################################################################################
32f77a0b 600########################################## Benutzerverwaltung fr Usersecurity #############################################
14cc7eac 601
1ee8bf5d 602if ($sambasettings{'SECURITY'} eq 'user')
32f77a0b
CS
603 {
604 if ($sambasettings{'DOMAINMASTER'} eq 'off')
605 {
606 &Header::openbox('100%', 'center', 'accounting - user Security none PDC mode');
607 }
608 else
609 {
610 &Header::openbox('100%', 'center', 'accounting - user Security PDC mode');
611 }
612 print <<END
613 <hr />
614 <table width='95%' cellspacing='0'>
615 <tr><td colspan='6'><br /></td></tr>
616 <tr><td colspan='6' align='left'></td></tr>
617 <tr><td bgcolor='${Header::table1colour}' colspan='7' align='left'><b>Benutzerverwaltung</b></td></tr>
618 <tr><td><u>Name</u></td><td><u>Passwort</u></td>
619END
620;
5e773594 621
32f77a0b
CS
622 if ($sambasettings{'DOMAINMASTER'} eq 'off')
623 {
624 print "<td></td>";
625 }
626 else
627 {
628 print "<td><u>Typ</u></td>";
629 }
630
94819213 631 print "<td><u>Status</u></td><td colspan='3' width='5'><u>Optionen</u></td></tr>";
32f77a0b
CS
632 system('/usr/local/bin/sambactrl readsmbpasswd');
633 open(FILE, "</var/ipfire/samba/private/smbpasswd") or die "Can't read user file: $!";
634 @user = <FILE>;
635 close(FILE);
636 system('/usr/local/bin/sambactrl locksmbpasswd');
637 foreach $userentry (sort @user)
638 {
639 @userline = split( /\:/, $userentry );
640 print "<tr><td align='left'>$userline[0]</td><td>";
641 if ($userline[4] =~ /N/)
642 {
643 print "nicht gesetzt</td><td>";
644 }
645 else
646 {
647 print "gesetzt</td><td>";
648 }
649
650 if ($sambasettings{'DOMAINMASTER'} eq 'off')
651 {
652 print "</td><td>";
653 }
654 else
655 {
656 if ($userline[0] =~ /\$/)
657 {
658 print "PC</td><td>";
659 }
660 else
661 {
662 print "User</td><td>";
663 }
664 }
665
666 if ($userline[4] =~ /D/)
667 {
668 print <<END
669 inaktiv</td>
670 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
671 <input type='hidden' name='NAME' value='$userline[0]' />
672 <input type='hidden' name='ACTION' value='smbuserenable' />
673 <input type='image' alt='Aktivieren' src='/images/on.gif' />
674 </form></td>
675END
676;
677 }
678 else
679 {
680 print <<END
681 aktiv</td>
682 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
683 <input type='hidden' name='NAME' value='$userline[0]' />
684 <input type='hidden' name='ACTION' value='smbuserdisable' />
685 <input type='image' alt='Deaktivieren' src='/images/off.gif' />
686 </form></td>
687END
688;
689 }
690
691 if ($userline[0] =~ /\$/)
692 {
693 print "<td></td>";
694 }
695 else
696 {
697 print <<END
698 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
699 <input type='hidden' name='NAME' value='$userline[0]' />
700 <input type='hidden' name='ACTION' value='userchangepw' />
701 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
702 </form></td>
703END
704;
705 }
706
707 print <<END
708 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
709 <input type='hidden' name='NAME' value='$userline[0]' />
710 <input type='hidden' name='ACTION' value='userdelete' />
711 <input type='image' alt='Loeschen' src='/images/delete.gif' />
712 </form></td></tr>
713END
714;
715 }
716 print <<END
717 </table>
718 <table width='10%' cellspacing='0'>
719 <tr><td colspan='3'><br /></td></tr>
720 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
721 <input type='hidden' name='ACTION' value='useradd' />
722 <input type='image' alt='Benutzer anlegen' src='/images/add.gif' /></form></td>
5e773594
MT
723END
724;
1ee8bf5d 725
32f77a0b
CS
726 if ($sambasettings{'DOMAINMASTER'} eq 'on')
727 {
728 print <<END
729 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
730 <input type='hidden' name='ACTION' value='pcadd' />
731 <input type='image' alt='Legende' src='/images/comp.blue.gif' /></form>
732END
733;
734 }
735 print <<END
736 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
737 <input type='hidden' name='ACTION' value='usercaption' />
738 <input type='image' alt='Legende' src='/images/info.gif' /></form>
94819213 739 </td></tr>
32f77a0b
CS
740 </table>
741END
742;
44254afd 743
32f77a0b
CS
744 if ($sambasettings{'ACTION'} eq 'usercaption')
745 {
746 print <<END
747 <table width='95%' cellspacing='0'>
748 <tr><td><br /></td></tr>
749 <tr><td><b>Legende:</b></td></tr>
94819213
CS
750 <tr><td><img src='/images/add.gif' />Benutzer neu anlegen</td></tr>
751 <tr><td><img src='/images/comp.blue.gif' />Client Account neu anlegen</td></tr>
752 <tr><td><img src='/images/on.gif' />Benutzer aktivieren</td></tr>
753 <tr><td><img src='/images/off.gif' />Benutzer deaktivieren</td></tr>
754 <tr><td><img src='/images/floppy.gif' />Einstellungen speichern</td></tr>
755 <tr><td><img src='/images/edit.gif' />Passwort wechseln</td></tr>
756 <tr><td><img src='/images/delete.gif' />Benutzer loeschen</td></tr>
32f77a0b 757 </table>
1ee8bf5d
MT
758END
759;
32f77a0b
CS
760 }
761
762 if ($sambasettings{'ACTION'} eq 'userchangepw')
763 {
764 my $username = "$sambasettings{'NAME'}";
765 my $password = 'samba';
766 print <<END
767 <hr />
768 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
769 <table width='95%' cellspacing='0'>
770 <tr><td colspan='2'><br /></td></tr>
771 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Passwort wechseln</b></td></tr>
772 <tr><td align='left'>Benutzername</td><td><input type='text' name='USERNAME' value='$username' size="30" /></td></tr>
773 <tr><td align='left'>Passwort</td><td><input type='password' name='PASSWORD' value='$password' size="30" /></td></tr>
774 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbchangepw' />
94819213 775 <input type='image' alt=$Lang::tr{'save'} src='/images/floppy.gif' /></td></tr>
32f77a0b 776 </table>
94819213 777 </form>
1ee8bf5d
MT
778END
779;
32f77a0b
CS
780 }
781
782 if ($sambasettings{'ACTION'} eq 'useradd')
783 {
784 my $username = "user";
785 my $password = "samba";
786 chomp $username;
787 $username=~s/\s//g;
788 chomp $password;
789 $password=~s/\s//g;
790 print <<END
791 <hr />
792 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
793 <table width='95%' cellspacing='0'>
794 <tr><td colspan='2'><br /></td></tr>
795 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Benutzer neu anlegen</b></td></tr>
796 <tr><td align='left'>Benutzername</td><td><input type='text' name='USERNAME' value='$username' size="30" /></td></tr>
797 <tr><td align='left'>Passwort</td><td><input type='password' name='PASSWORD' value='$password' size="30" /></td></tr>
798 <tr><td align='left'>Unix Gruppe</td><td><input type='text' name='GROUP' value='sambauser' size="30" /></td></tr>
799 <tr><td align='left'>Unix Shell</td><td><input type='text' name='SHELL' value='/bin/false' size="30" /></td></tr>
800 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbuseradd' />
94819213 801 <input type='image' alt=$Lang::tr{'save'} src='/images/floppy.gif' /></td></tr>
32f77a0b 802 </table>
94819213 803 </form>
32f77a0b
CS
804END
805;
806 }
807
808 if ($sambasettings{'ACTION'} eq 'pcadd')
809 {
810 my $pcname = "client\$";
811 chomp $pcname;
812 $pcname=~s/\s//g;
813 print <<END
814 <hr />
815 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
816 <table width='95%' cellspacing='0'>
817 <tr><td colspan='2'><br /></td></tr>
818 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Client Account neu anlegen</b></td></tr>
819 <tr><td align='left'>Clientname</td><td><input type='text' name='PCNAME' value='$pcname' size="30" /></td></tr>
820 <tr><td align='left'>Unix Gruppe</td><td><input type='text' name='GROUP' value='sambawks' size="30" /></td></tr>
821 <tr><td align='left'>Unix Shell</td><td><input type='text' name='SHELL' value='/bin/false' size="30" /></td></tr>
822 <tr><td colspan='2' align='center'><input type='hidden' name='ACTION' value='smbpcadd' />
94819213 823 <input type='image' alt=$Lang::tr{'save'} src='/images/floppy.gif' /></td></tr>
32f77a0b 824 </table>
94819213 825 </form>
32f77a0b
CS
826END
827;
828 }
97de2cae
MT
829
830&Header::closebox();
1ee8bf5d 831}
14cc7eac
MT
832
833############################################################################################################################
834############################################### Verwalten von Freigaben ####################################################
1ee8bf5d
MT
835
836&Header::openbox('100%', 'center', 'Shares');
97de2cae 837
1ee8bf5d 838print <<END
32f77a0b
CS
839<hr />
840<table width='95%' cellspacing='0'>
841<tr><td colspan='3'><br /></td></tr>
842<tr><td bgcolor='${Header::table1colour}' colspan='3' align='left'><b>Shareverwaltung</b>
843<tr><td><u>Names des Shares</u></td><td colspan='2' width="5"><u>Optionen</u></td></tr>
1ee8bf5d
MT
844END
845;
14cc7eac 846
32f77a0b
CS
847foreach $shareentry (sort @Shares)
848 {
849 print <<END
850 <tr><td align='left'>$shareentry</td>
851 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
852 <input type='hidden' name='NAME' value='$shareentry' />
853 <input type='hidden' name='ACTION' value='sharechange' />
854 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
855 </form></td>
856 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
857 <input type='hidden' name='NAME' value='$shareentry' />
858 <input type='hidden' name='ACTION' value='smbsharedel' />
859 <input type='image' alt='Loeschen' src='/images/delete.gif' />
94819213 860 </form></td></tr>
32f77a0b
CS
861END
862;
863 }
864
865print <<END
866</table>
867<table width='10%' cellspacing='0'>
868<tr><td colspan='3'><br /></td></tr>
869<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
94819213
CS
870 <input type='hidden' name='ACTION' value='shareadd' />
871 <input type='image' alt='neuen Share anlegen' src='/images/add.gif' />
32f77a0b
CS
872 </form></td>
873 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
94819213
CS
874 <input type='hidden' name='ACTION' value='sharesreset' />
875 <input type='image' alt='Reset' src='/images/reload.gif' />
32f77a0b
CS
876 </form></td>
877 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
94819213
CS
878 <input type='hidden' name='ACTION' value='sharecaption' />
879 <input type='image' alt='Legende' src='/images/info.gif' />
880 </form></td></tr>
32f77a0b 881</table>
1ee8bf5d
MT
882END
883;
32f77a0b 884
1ee8bf5d 885if ($sambasettings{'ACTION'} eq 'sharecaption')
32f77a0b
CS
886 {
887 print <<END
888 <table width='95%' cellspacing='0'>
889 <tr><td><br /></td></tr>
890 <tr><td><b>Legende:</b></td></tr>
94819213
CS
891 <tr><td><img src='/images/add.gif' />Share neu anlegen</td></tr>
892 <tr><td><img src='/images/edit.gif' />Share bearbeiten</td></tr>
893 <tr><td><img src='/images/floppy.gif' />Einstellungen speichern</td></tr>
894 <tr><td><img src='/images/reload.gif' />Shares zurueck setzen</td></tr>
895 <tr><td><img src='/images/delete.gif' />Share loeschen</td></tr>
32f77a0b 896 </table>
1ee8bf5d
MT
897END
898;
32f77a0b 899 }
97de2cae 900
1ee8bf5d 901if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optioncaption' )
32f77a0b
CS
902 {
903 print <<END
904 <hr />
905 <table width='95%' cellspacing='0'>
906 <tr><td colspan='2'><br /></td></tr>
907 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>neuen Share anlegen</b></td></tr>
908 <tr><td colspan='2' align='center'></td></tr>
909 <tr><td colspan='2' align='center'>Anzeige der Optionen fuer Shares<form method='post' action='$ENV{'SCRIPT_NAME'}'>
94819213
CS
910 <input type='hidden' name='ACTION' value='optioncaption' />
911 <input type='image' alt='Legende' src='/images/info.gif' />
32f77a0b 912 </form></td></tr>
94819213 913 <form method='post' action='$ENV{'SCRIPT_NAME'}'><tr><td colspan='2' align='center'><textarea name="SHAREOPTION" cols="50" rows="15" Wrap="off">$defaultoption</textarea></td></tr>
32f77a0b
CS
914 </table>
915 <table width='10%' cellspacing='0'>
916 <tr><td><br /></td></tr>
94819213
CS
917 <tr><td align='center'><input type='hidden' name='ACTION' value='smbshareadd' />
918 <input type='image' alt='Share hinzufuegen' src='/images/floppy.gif' /></td></tr></form>
32f77a0b 919 </table>
5e773594
MT
920END
921;
32f77a0b 922 }
5e773594 923
1ee8bf5d 924if ($sambasettings{'ACTION'} eq 'sharechange' || $sambasettings{'ACTION'} eq 'optioncaption2' )
32f77a0b
CS
925 {
926 my $sharename = "$sambasettings{'NAME'}";
927 chomp $sharename;
928 $sharename=~s/\s//g;
929
930 for(my $i = 0; $i <= $#Shares; $i++)
931 {
932 chomp $Shares[$i];
933 $Shares[$i]=~s/\s//g;
934 if ( "$Shares[$i]" eq "$sharename" )
935 {
936 my $Zeilenbegin = $Zeilen[$i+1]-2;
937 my $Zeilenende = $Zeilen[$i+1]-$Zeilen[$i];
938 if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
939 {$Zeilenende = $EOF-$Zeilen[$#Shares]+1;$Zeilenbegin = $EOF-$Zeilen[$#Shares]; $shareoption = qx(tail -$Zeilenende $sharefile | head -$Zeilenbegin);}
940 else
941 {$shareoption = qx(head -$Zeilenbegin $sharefile | tail -$Zeilenende);}
942 }
943 }
944 print <<END
945 <hr />
946 <table width='95%' cellspacing='0'>
947 <tr><td colspan='2'><br /></td></tr>
948 <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>Share bearbeiten</b></td></tr>
949 <tr><td colspan='2' align='center'></td></tr>
950 <tr><td colspan='2' align='center'>Anzeige der Optionen fuer Shares<form method='post' action='$ENV{'SCRIPT_NAME'}'>
94819213
CS
951 <input type='hidden' name='ACTION' value='optioncaption2' />
952 <input type='image' alt='Legende' src='/images/info.gif' /></td></tr></form>
32f77a0b
CS
953 <tr><td colspan='2' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><textarea name="SHAREOPTION" cols="50" rows="15" Wrap="off">$shareoption</textarea></td></tr>
954 </table>
955 <table width='10%' cellspacing='0'>
956 <tr><td><br /></td></tr>
94819213
CS
957 <tr><td align='center'><input type='hidden' name='NAME' value='$sambasettings{'NAME'}' />
958 <input type='submit' name='ACTION' value='smbsharechange' /></td></tr></form>
32f77a0b 959 </table>
1ee8bf5d
MT
960END
961;
32f77a0b 962 }
5e773594 963
1ee8bf5d 964if ($sambasettings{'ACTION'} eq 'optioncaption' || $sambasettings{'ACTION'} eq 'optioncaption2')
32f77a0b
CS
965 {
966 print <<END
967 <table width='95%' cellspacing='0'>
968 <tr><td><br /></td></tr>
969 <tr><td><b>Legende:</b></td></tr>
970 <tr><td><u>Option</u></td><td><u>Bedeutung</u> / <u>Beispiel</u></td></tr>
971 <tr><td>comment</td><td>Kommentar</td></tr>
972 <tr><td></td><td>comment = Mein neues Share</td></tr>
973 <tr><td><br /></td><td></td></tr>
974 <tr><td>path</td><td>Pfad zum Verzeichnis</td></tr>
975 <tr><td></td><td>path = /share/neu</td></tr>
976 <tr><td><br /></td><td></td></tr>
977 <tr><td>writeable</td><td>Verzeichnis schreibbar</td></tr>
978 <tr><td></td><td>writeable = yes</td></tr>
979 <tr><td><br /></td><td></td></tr>
980 <tr><td>browseable</td><td>sichtbar in Verzeichnisliste</td></tr>
981 <tr><td></td><td>browsable = yes</td></tr>
982 <tr><td><br /></td><td></td></tr>
983 <tr><td>user</td><td>Besitzer der Freigabe</td></tr>
984 <tr><td></td><td>user = samba</td></tr>
985 <tr><td><br /></td><td></td></tr>
986 <tr><td>valid users</td><td>Liste der Zugriffsberechtigten</td></tr>
987 <tr><td></td><td>valid users = samba, user1</td></tr>
988 <tr><td><br /></td><td></td></tr>
989 <tr><td>write list</td><td>Liste der Schreibberechtigten</td></tr>
990 <tr><td></td><td>write list = samba</td></tr>
991 <tr><td><br /></td><td></td></tr>
992 <tr><td>hosts allow</td><td>nur die angegebenen Hosts drfen das Share benutzen</td></tr>
993 <tr><td></td><td>hosts allow = localhost 192.168.1.1 192.168.2.0/24</td></tr>
994 <tr><td><br /></td><td></td></tr>
995 <tr><td>hosts deny</td><td>jede Maschine ausser diesen darf das Share benutzen</td></tr>
996 <tr><td></td><td>hosts deny = 192.168.1.2 192.168.3.0/24</td></tr>
997 <tr><td><br /></td><td></td></tr>
998 <tr><td>read list</td><td>Liste der nur Leseberechtigten</td></tr>
999 <tr><td></td><td>read list = user1</td></tr>
1000 <tr><td><br /></td><td></td></tr>
1001 <tr><td>admin users</td><td>Liste der Benutzer mit SuperUser Rechten</td></tr>
1002 <tr><td></td><td>admin users = user1</td></tr>
1003 <tr><td><br /></td><td></td></tr>
1004 <tr><td>invalid users</td><td>Liste der Benutzer denen der Zugriff verweigert wird</td></tr>
1005 <tr><td></td><td>invalid users = user2</td></tr>
1006 <tr><td><br /></td><td></td></tr>
1007 <tr><td>force user</td><td>Standartbenutzer fuer alle Dateien</td></tr>
1008 <tr><td></td><td>force user = samba</td></tr>
1009 <tr><td><br /></td><td></td></tr>
1010 <tr><td>directory mask</td><td>UNIX Verzeichnisberchtigung beim Erzeugen</td></tr>
1011 <tr><td></td><td>directory mask = 0777</td></tr>
1012 <tr><td><br /></td><td></td></tr>
1013 <tr><td>create mask</td><td>UNIX Dateiberchtigung beim Erzeugen</td></tr>
1014 <tr><td></td><td>create mask = 0777</td></tr>
1015 <tr><td><br /></td><td></td></tr>
1016 <tr><td>guest ok</td><td>Annonymer Zugriff</td></tr>
1017 <tr><td></td><td>guest ok = yes</td></tr>
1018 </table>
1ee8bf5d
MT
1019END
1020;
1021}
1022
32f77a0b
CS
1023&Header::closebox();
1024
1025############################################################################################################################
1026############################################### Anzeige des Sambastatus ####################################################
1027
1028&Header::openbox('100%', 'center', 'Status');
1029
1030print <<END
1031<hr />
1032<table width='95%' cellspacing='0'>
1033<tr><td colspan='4'><br /></td></tr>
1034<tr><td bgcolor='${Header::table1colour}' colspan='3' align='left'><b>Samba Status</b></td></tr>
1035<tr><td>$Status</td></tr>
1036</table>
1037END
1038;
1039
1ee8bf5d 1040&Header::closebox();
5e773594
MT
1041&Header::closebigbox();
1042&Header::closepage();
1043
1044############################################################################################################################
32f77a0b 1045############################################ Subfunktion fr Sambadienste ##################################################
5e773594
MT
1046
1047sub isrunning
32f77a0b
CS
1048 {
1049 my $cmd = $_[0];
1050 my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
1051 my $pid = '';
1052 my $testcmd = '';
1053 my $exename;
1054
1055 $cmd =~ /(^[a-z]+)/;
1056 $exename = $1;
1057
1058 if (open(FILE, "/var/run/${cmd}.pid"))
1059 {
1060 $pid = <FILE>; chomp $pid;
1061 close FILE;
1062 if (open(FILE, "/proc/${pid}/status"))
1063 {
1064 while (<FILE>)
1065 {
1066 if (/^Name:\W+(.*)/)
1067 {
1068 $testcmd = $1;
1069 }
1070 }
1071 close FILE;
1072 if ($testcmd =~ /$exename/)
1073 {
1074 $status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
1075 }
1076 }
1077 }
1078 return $status;
1079 }