Samba vorbereitet fuer CUPS
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 22 Apr 2007 08:43:35 +0000 (08:43 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 22 Apr 2007 08:43:35 +0000 (08:43 +0000)
Rewrite der internen Verarbeitung mit Hashes und Sub Funktionen
Erweiterung der ausgehenden Firewall um predefined services

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@502 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/outgoingfw/defaultservices [new file with mode: 0644]
config/samba/default.global
config/samba/default.pdc
config/samba/default.printer
doc/language_issues.de
doc/language_issues.en
html/cgi-bin/outgoingfw.cgi
html/cgi-bin/samba.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
src/misc-progs/sambactrl.c

diff --git a/config/outgoingfw/defaultservices b/config/outgoingfw/defaultservices
new file mode 100644 (file)
index 0000000..9e40eeb
--- /dev/null
@@ -0,0 +1,34 @@
+bootpc,68,tcp&udp,Bootstrap Protocol Client
+bootps,67,tcp&udp,Bootstrap Protocol Server
+domain,53,tcp&udp,Domain Name Server
+echo,7,tcp&udp,Echo
+ftp,21,tcp&udp,File Transfer Control
+ftp-data,20,tcp&udp,File Control Data
+http,80,tcp,Hypertext Transfer Protocol
+https,443,tcp,secure HTTP
+imap,143,tcp,Interactive Mail Access Protocol
+imap3,220,tcp,Interactive Mail Access Protocol v3
+imaps,993,tcp,secure IMAP
+ipfire-https,444,tcp,IPFire HTTPS
+ipfire-ssh,222,tcp&udp,IPFire SSH
+irc,194,tcp&udp,Internet Relay Chat
+ircd,6667,tcp&udp,Internet Relay Chat
+microsoft-ds,445,tcp&udp,Netbios Filesharing
+nameserver,42,tcp&udp,Host Name Server
+netbios-dgm,138,tcp&udp,NETBIOS Datagram Service
+netbios-ns,137,tcp&udp,NETBIOS Name Server
+netbios-ssn,139,tcp&udp,NETBIOS Session Service
+nfs,2049,tcp&udp,Network File System
+ntp,123,udp,Network Time Protocol
+pop3,110,tcp,POP3 Email
+pop3s,995,tcp,secure POP3 Email
+sftp,115,tcp&udp,secure File Transfer Protocol
+smtp,25,tcp,Simple Mail Transfer Protocol
+smtps,465,tcp,secure Simple Mail Transfer Protocol
+snmp,161,tcp&udp,Simple Network Management
+snmptrap,162,udp,SNMP Trap
+ssh,22,tcp&udp,SSH
+telnet,23,tcp&udp,Telnet
+tftp,69,tcp&udp,Trivial File Transfer
+time,37,tcp&udp,Time
+wins,1512,tcp&udp,Windows Internet Name Service
\ No newline at end of file
index 5fed22e..0efa7cb 100644 (file)
@@ -1,36 +1,37 @@
-# global.settings by IPFire Project
-
-[global]
-netbios name = ipfire
-server string = Samba
-workgroup = homeip.net
-
-keep alive = 30
-os level = 33
-fstype = NTFS
-
-kernel oplocks = false
-map to guest = false
-smb ports = 445 139
-unix charset = CP850
-
-security = user
-encrypt passwords = yes
-guest account = samba
-unix password sync = false
-null passwords = yes
-
-bind interfaces only = true
-interfaces =  eth0
-socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE
-
-username level = 1
-wins support = true
-
-log file       = /var/log/samba/samba-log.%m
-lock directory = /var/lock/samba
-pid directory = /var/run/
-       
-preferred master = false
-domain master = false
-local master = false
\ No newline at end of file
+# global.settings by IPFire Project\r
+\r
+[global]\r
+netbios name = ipfire\r
+server string = Samba\r
+workgroup = homeip.net\r
+\r
+keep alive = 30\r
+os level = 33\r
+fstype = NTFS\r
+\r
+kernel oplocks = false\r
+map to guest = false\r
+smb ports = 445 139\r
+unix charset = CP850\r
+\r
+security = user\r
+encrypt passwords = yes\r
+guest account = samba\r
+unix password sync = false\r
+null passwords = yes\r
+\r
+bind interfaces only = true\r
+interfaces =  eth0\r
+socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE\r
+\r
+username level = 1\r
+wins support = true\r
+\r
+log file       = /var/log/samba/samba-log.%m\r
+lock directory = /var/lock/samba\r
+pid directory = /var/run/\r
+log level = 3 passdb:5 auth:5 winbind:2\r
+\r
+preferred master = false\r
+domain master = false\r
+local master = false\r
index 905930f..e0955af 100644 (file)
@@ -17,4 +17,3 @@ browseable = no
 writeable = yes\r
 comment = Benutzerprofile\r
 valid users = %S\r
-\r
index 0a76b2e..e297700 100644 (file)
@@ -1,23 +1,21 @@
-# start printer
 [printers]
-       comment     = Drucker
-       security    = server
-       path        = /var/log/spool/lpd/lp
-       lprm command = /usr/local/bin/lprm -P%p %j 
-       lpq command = /usr/local/bin/lpq %p
-       browseable  = yes
-       printable   = yes
-       public      = yes
-       writable    = no
-       create mode = 0700
+comment     = Drucker
+security    = server
+path        = /var/log/spool/lpd/lp
+lprm command = /usr/local/bin/lprm -P%p %j
+lpq command = /usr/local/bin/lpq %p
+browseable  = yes
+printable   = yes
+public      = yes
+writable    = no
+create mode = 0700
 
 [Drucker]
-       security      = server
-       path          = /var/log/spool/lpd/lp
-       printer name  = lp
-       writable      = no
-       public        = yes
-       printable     = yes
-       print command = lpr -r -h -P %p %s
-       use client driver = Yes
-# end printer
+security      = server
+path          = /var/log/spool/lpd/lp
+printer name  = lp
+writable      = no
+public        = yes
+printable     = yes
+print command = lpr -r -h -P %p %s
+use client driver = Yes
index 1e8cd91..a032638 100644 (file)
@@ -85,7 +85,6 @@ WARNING: translation string unused: ddns help dnsmadeeasy
 WARNING: translation string unused: ddns help freedns
 WARNING: translation string unused: ddns help plus
 WARNING: translation string unused: debugme
-WARNING: translation string unused: description
 WARNING: translation string unused: dhcp base ip fixed lease
 WARNING: translation string unused: dhcp create fixed leases
 WARNING: translation string unused: dhcp fixed lease err1
@@ -305,7 +304,6 @@ WARNING: translation string unused: written sectors
 WARNING: translation string unused: xtaccess bad transfert
 WARNING: translation string unused: year
 WARNING: untranslated string: IPFires hostname
-WARNING: untranslated string: add cronjob
 WARNING: untranslated string: allmsg
 WARNING: untranslated string: alt proxy
 WARNING: untranslated string: dial profile
index f8b34ec..4ef1375 100644 (file)
@@ -99,7 +99,6 @@ WARNING: translation string unused: daily firewallhits
 WARNING: translation string unused: dat without key
 WARNING: translation string unused: dbfile
 WARNING: translation string unused: debugme
-WARNING: translation string unused: description
 WARNING: translation string unused: dhcp server disabled on blue interface
 WARNING: translation string unused: dhcp server enabled on blue interface
 WARNING: translation string unused: dialup settings
@@ -309,7 +308,6 @@ WARNING: translation string unused: written sectors
 WARNING: translation string unused: year
 WARNING: translation string unused: yearly firewallhits
 WARNING: untranslated string: IPFires hostname
-WARNING: untranslated string: add cronjob
 WARNING: untranslated string: alt proxy
 WARNING: untranslated string: down
 WARNING: untranslated string: firewall logs ip
index ab7c2fa..a8660b7 100644 (file)
@@ -30,6 +30,7 @@ my @p2pline = ();
 
 my $configfile = "/var/ipfire/outgoing/rules";
 my $p2pfile = "/var/ipfire/outgoing/p2protocols";
+my $servicefile = "/var/ipfire/outgoing/defaultservices"
 
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 
@@ -201,7 +202,7 @@ if ($outfwsettings{'POLICY'} ne 'MODE0'){
        &Header::openbox('100%', 'center', 'Rules');
                print <<END
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
-               <input type='submit' name='ACTION' value='Add rule'>
+               <input type='submit' name='ACTION' value='Add rule' />
        </form>
 END
 ;
@@ -210,7 +211,7 @@ END
        close FILE;
        if (@configs) {
                print <<END
-               <hr>
+               <hr />
                <table border='0' width='100%' cellspacing='0'>
                <tr bgcolor='white'>
                    <td width='14%'><b>Protokoll</b>
@@ -365,16 +366,16 @@ print <<END
        <table width='100%'>
                <tr><td width='10%' align='right'><b>Modus 0:</b><td width='90%' align='left' colspan='2'>In diesem Modus ist es allen Rechnern im Netzwerk uneingeschraenkt moeglich Verbindungen ins Internet aufzubauen.
                <tr><td width='10%' align='right'><b>Modus 1:</b><td width='90%' align='left' colspan='2'>In diesem Modus werden nur Verbindungen nach den oben definierten Regeln zugelassen.
-               <tr><td width='10%' align='right'><b>Modus 2:</b><td width='90%' align='left' colspan='2'>In diesem Modus werden saemtliche Verbindungen erlaubt, bis auf die oben definierten Block-Regeln.<br>Hier ist eine Besonderheit der P2P-Filter.
-               <tr><td colspan='3'><hr>
+               <tr><td width='10%' align='right'><b>Modus 2:</b><td width='90%' align='left' colspan='2'>In diesem Modus werden saemtliche Verbindungen erlaubt, bis auf die oben definierten Block-Regeln.<br />Hier ist eine Besonderheit der P2P-Filter.
+               <tr><td colspan='3'><hr />
                <tr><td width='10%' align='right'>      <select name='POLICY'><option value='MODE0' $selected{'POLICY'}{'MODE0'}>Modus 0</option><option value='MODE1' $selected{'POLICY'}{'MODE1'}>Modus 1</option><option value='MODE2' $selected{'POLICY'}{'MODE2'}>Modus 2</option></select>
-                   <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'}>
+                   <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
                    <td width='45%' align='right'>
 END
 ;
        if ($outfwsettings{'POLICY'} ne 'MODE0') {
                print <<END
-                   Alle Regeln loeschen: <input type='submit' name='ACTION' value=$Lang::tr{'reset'}>
+                   Alle Regeln loeschen: <input type='submit' name='ACTION' value=$Lang::tr{'reset'} />
 END
 ;
        }
@@ -418,14 +419,14 @@ END
                    <td width='30%' align='left'><select name='SNET'>
                        <option value='all' $selected{'SNET'}{'ALL'}>alle</option>
                        <option value='ip' $selected{'SNET'}{'ip'}>Quell-IP/MAC benutzen</option>
-                       <option value='green' $selected{'SNET'}{'green'}>Gruen</option>
+                       <option value='green' $selected{'SNET'}{'green'}>$Lang::tr{'green'}</option>
 END
 ;
        if (&Header::blue_used()){
-               print "\t\t\t<option value='blue' $selected{'SNET'}{'blue'}>Blau</option>\n";
+               print "\t\t\t<option value='blue' $selected{'SNET'}{'blue'}>$Lang::tr{'wireless'}</option>\n";
        }
        if (&Header::orange_used()){
-               print "\t\t\t<option value='orange' $selected{'SNET'}{'orange'}>Orange</option>\n";
+               print "\t\t\t<option value='orange' $selected{'SNET'}{'orange'}>$Lang::tr{'dmz'}</option>\n";
        }
        print <<END
                        </select>
@@ -445,5 +446,48 @@ END
 END
 ;
        &Header::closebox();
+
+if ($outfwsettings{'POLICY'} eq 'MODE1')
+{
+&Header::openbox('100%', 'center', 'Quick Add');
+
+       open( FILE, "< /var/ipfire/outgoing/defaultservices" ) or die "Unable to read default services";
+       my @defservices = <FILE>;
+       close FILE;
+
+print "<table width='100%'><tr bgcolor='#F0F0F0'><td><b>$Lang::tr{'service'}</b></td><td><b>$Lang::tr{'description'}</b></td><td><b>$Lang::tr{'port'}</b></td><td><b>$Lang::tr{'protocol'}</b></td><td><b>$Lang::tr{'source net'}</b></td><td></td></tr>";
+foreach my $serviceline(@defservices)
+       {
+       my @service = split(/,/,$serviceline);
+       print <<END
+       <tr><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <td>$service[0]<input type='hidden' name='NAME' value='@service[0]' /></td>
+                                                                                               <td>$service[3]</td>
+                                                                                               <td><a href='http://isc.sans.org/port_details.php?port=$service[1]' target='top'>$service[1]</a><input type='hidden' name='DPORT' value='@service[1]' /></td>
+                                                                                               <td>$service[2]<input type='hidden' name='PROT' value='@service[2]' /></td>
+                                                                                               <td><select name='SNET'><option value='all' $selected{'SNET'}{'ALL'}>$Lang::tr{'all'}</option><option value='green' $selected{'SNET'}{'green'}>$Lang::tr{'green'}</option>
+END
+;
+       if (&Header::blue_used()){
+               print "<option value='blue' $selected{'SNET'}{'blue'}>$Lang::tr{'wireless'}</option>";
+       }
+       if (&Header::orange_used()){
+               print "<option value='orange' $selected{'SNET'}{'orange'}>$Lang::tr{'dmz'}</option>";
+       }
+       print <<END
+                                       </select></td><td>
+                                       <input type='hidden' name='ACTION' value=$Lang::tr{'add'} />
+                                       <input type='image' alt='$Lang::tr{'add'}' src='/images/add.gif' />
+                                       <input type='hidden' name='ENABLED' value='on' />
+                                       <input type='hidden' name='STATE' value='ALLOW' />
+                                       </form></td></tr>
+END
+;
+       }
+print "</table>";
+
+       &Header::closebox();
+}
+
 }
 
index b49c0bc..b916ef0 100644 (file)
@@ -22,48 +22,35 @@ my %netsettings = ();
 my %ovpnsettings = ();
 my $message = "";
 my $errormessage = "";
+
 my @Logs = qx(ls /var/log/samba/);
 my $Log =$Lang::tr{'no log selected'};
-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";
+
+my $Status = qx(/usr/local/bin/sambactrl smbstatus);
+$Status=~s/\n/<br \/>/g;
+
 my $userentry = "";
 my @user = ();
 my @userline = ();
-my @proto = ();
+my $userfile = "${General::swroot}/samba/private/smbpasswd";
 my %selected= () ;
-my $userfile = "/var/ipfire/samba/private/smbpasswd";
+
+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";
+my $defaultprinter= "[Printer]\ncomment = Printer public\npath = /var/spool/cups\nprinting = sysvn\nprintcap = lpstat\npublic = yes\nwritable = no\nprintable = yes";
+my %printer = ();
+my %shares = ();
+
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &General::readhash("${General::swroot}/ovpn/settings", \%ovpnsettings);
 
 ############################################################################################################################
 ############################################# Samba Dienste fr Statusberprfung ##########################################
 
-my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd','Winbind Daemon' => 'winbindd');
+my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd');
+#my %servicenames = ('SMB Daemon' => 'smbd','NetBIOS Nameserver' => 'nmbd','Winbind Daemon' => 'winbindd');
 
 &Header::showhttpheaders();
 
-############################################################################################################################
-#################################### Initialisierung von Samba Sharess fr die Verarbeitung ################################
-
-my @Zeilen= ();
-my @Shares= ();
-my $shareentry = "";
-my $shareconfigentry = "";
-my @shareconfigline = ();
-my $shareoption = '';
-my @shares = ();
-my @shareline = ();
-my $sharefile = "/var/ipfire/samba/shares";
-my $EOF = qx(cat $sharefile | wc -l);
-my $Status = qx(/usr/local/bin/sambactrl smbstatus);
-$Status=~s/\n/<br \/>/g;
-
-@shares = `grep -n '^\\[' $sharefile`;
-foreach $shareentry (@shares)
- {
- @shareline = split( /\:/, $shareentry );
- push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
- }
-
 ############################################################################################################################
 #################################### Initialisierung von Samba Variablen fr global Settings ###############################
 
@@ -72,7 +59,7 @@ $sambasettings{'NETBIOSNAME'} = 'IPFire';
 $sambasettings{'SRVSTRING'} = 'Samba running on IPFire 2.0';
 $sambasettings{'INTERFACES'} = '';
 $sambasettings{'SECURITY'} = 'share';
-$sambasettings{'OSLEVEL'} = '65';
+$sambasettings{'OSLEVEL'} = '33';
 $sambasettings{'GREEN'} = 'on';
 $sambasettings{'BLUE'} = 'off';
 $sambasettings{'ORANGE'} = 'off';
@@ -88,6 +75,10 @@ $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
 $sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
 ### Values that have to be initialized
 $sambasettings{'ACTION'} = '';
+### Samba CUPS Variablen
+$sambasettings{'LOADPRINTERS'} = 'Yes';
+$sambasettings{'PRINTING'} = 'cups';
+$sambasettings{'PRINTCAPNAME'} = 'cups';
 my $LOGLINES = '50';
 
 ################################################## Samba PDC Variablen #####################################################
@@ -139,6 +130,11 @@ if ($sambasettings{'ACTION'} eq 'globalresetyes')
        $sambasettings{'GUESTACCOUNT'} = 'samba';
        $sambasettings{'MAPTOGUEST'} = 'Never';
        $sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
+### Samba CUPS Variablen
+       $sambasettings{'LOADPRINTERS'} = 'Yes';
+       $sambasettings{'PRINTING'} = 'cups';
+       $sambasettings{'PRINTCAPNAME'} = 'cups';
+       $sambasettings{'PRINTERNAME'} = 'Printer';
 ### Values that have to be initialized
        $sambasettings{'ACTION'} = '';
        $sambasettings{'LOCALMASTER'} = 'off';
@@ -149,27 +145,6 @@ if ($sambasettings{'ACTION'} eq 'globalresetyes')
        system("/usr/local/bin/sambactrl smbreload");
        }
 
-# smbsafeconf is directly called by the if clause
-
-if ($sambasettings{'ACTION'} eq 'sharesresetyes')
-{
-system('/usr/local/bin/sambactrl smbsharesreset');
- @Zeilen = ();
- @Shares = ();
- $shareentry = "";
- @shares = ();
- @shareline = ();
- $EOF = qx(cat $sharefile | wc -l);
- @shares = `grep -n '^\\[' $sharefile`;
- foreach $shareentry (@shares)
- {
- @shareline = split( /\:/, $shareentry );
- push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
- }
- system("/usr/local/bin/sambactrl smbreload");
-}
-
 ############################################################################################################################
 ################################################ Sicherheitsabfrage für den Reset ##########################################
 
@@ -214,163 +189,6 @@ END
 
 if ($sambasettings{'ACTION'} eq 'userdelete'){system("/usr/local/bin/sambactrl smbuserdelete $sambasettings{'NAME'}");}
 
-############################################################################################################################
-############################################## Samba Share neu anlegen #####################################################
-
-if ($sambasettings{'ACTION'} eq 'smbshareadd')
-{
-  my $emptyline= ""; 
-       open (FILE, ">>${General::swroot}/samba/shares") or die "Can't save the shares settings: $!";
-       flock (FILE, 2);
-       
-print FILE <<END
-$sambasettings{'SHAREOPTION'}
-$emptyline
-END
-;
-close FILE;
-system("/usr/local/bin/sambactrl smbsafeconf");
-
- @Zeilen = ();
- @Shares = ();
- $shareentry = "";
- @shares = ();
- @shareline = ();
- $EOF = qx(cat $sharefile | wc -l);
- @shares = `grep -n '^\\[' $sharefile`;
- foreach $shareentry (@shares)
- {
- @shareline = split( /\:/, $shareentry );
- push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
- }
-system("/usr/local/bin/sambactrl smbreload");
-}
-
-############################################################################################################################
-################################################## Samba Share l�chen #####################################################
-
-if ($sambasettings{'ACTION'} eq 'smbsharedel')
-{
-my $sharebody = '';
-my $sharehead = '';
-my $sharetext = '';
-my $sharename = "$sambasettings{'NAME'}";
-chomp $sharename;
-$sharename=~s/\s//g;
-
-for(my $i = 0; $i <= $#Shares; $i++)
- {
- chomp $Shares[$i];
- $Shares[$i]=~s/\s//g;
- if ( "$Shares[$i]" eq "$sharename" )
-  {
-  my $Zeilenbegin = $Zeilen[$i]-2;
-  my $Zeilenende =  $EOF-$Zeilen[$i+1]+1;
-  my $Zeilenende2 =  $Zeilenende-1;
-
-  if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
-   {
-   $sharehead = qx(head -$Zeilenbegin $sharefile);
-   $sharetext = $sharehead;
-   }
-  elsif ($Zeilen[$i] eq 1 )
-   {
-   $sharehead = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
-   $sharetext = $sharehead;
-   }
-  else
-   {
-   $sharehead = qx(head -$Zeilenbegin $sharefile);$sharebody = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
-   $sharetext = "$sharehead\n$sharebody";
-   }
-  }
- }
-open (FILE, ">${General::swroot}/samba/shares") or die "Can't delete the share settings: $!";
-flock (FILE, 2);
-print FILE <<END
-$sharetext
-END
-;
-close FILE;
-system("/usr/local/bin/sambactrl smbsafeconf");
-
- @Zeilen = ();
- @Shares = ();
- $shareentry = "";
- @shares = ();
- @shareline = ();
- $EOF = qx(cat $sharefile | wc -l);
- @shares = `grep -n '^\\[' $sharefile`;
- foreach $shareentry (@shares)
- {
- @shareline = split( /\:/, $shareentry );
- push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
- }
-system("/usr/local/bin/sambactrl smbreload");
-}
-############################################################################################################################
-################################################## Sambashare �dern #######################################################
-
-if ($sambasettings{'ACTION'} eq 'smbsharechange')
-{
-my $sharebody = '';
-my $sharehead = '';
-my $sharename = "$sambasettings{'NAME'}";
-my $sharetext = '';
-$sharename=~s/\s//g;
-
-for(my $i = 0; $i <= $#Shares; $i++)
- {
- chomp $Shares[$i];
- $Shares[$i]=~s/\s//g;
- if ( "$Shares[$i]" eq "$sharename" )
-  {
-  my $Zeilenbegin = $Zeilen[$i]-2;
-  my $Zeilenende =  $EOF-$Zeilen[$i+1]+1;
-  my $Zeilenende2 =  $Zeilenende-1;
-
-  if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
-   {
-   $sharehead = qx(head -$Zeilenbegin $sharefile);
-   $sharetext = $sharehead;
-   }
-  elsif ($Zeilen[$i] eq 1 )
-   {
-   $sharehead = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
-   $sharetext = $sharehead;
-   }
-  else
-   {
-   $sharehead = qx(head -$Zeilenbegin $sharefile);$sharebody = qx(tail -$Zeilenende $sharefile | head -$Zeilenende2);
-   $sharetext = "$sharehead\n$sharebody";
-   }
-  }
- }
-open (FILE, ">${General::swroot}/samba/shares") or die "Can't delete the share settings: $!";
-flock (FILE, 2);
-print FILE <<END
-$sharetext
-$sambasettings{'SHAREOPTION'}
-END
-;
-close FILE;
-system("/usr/local/bin/sambactrl smbsafeconf");
-
- @Zeilen = ();
- @Shares = ();
- @shares = `grep -n '^\\[' $sharefile`;
- foreach $shareentry (@shares)
- {
- @shareline = split( /\:/, $shareentry );
- push(@Zeilen,$shareline[0]);push(@Shares,$shareline[1]);
- }
-system("/usr/local/bin/sambactrl smbreload");
-}
-
 ############################################################################################################################
 ##################################### Umsetzen der Werte von Checkboxen und Dropdowns ######################################
 
@@ -386,8 +204,8 @@ if ($sambasettings{'OTHERINTERFACES'} ne ''){ $sambasettings{'INTERFACES'} .= "
 ############################################################################################################################
 ##################################### Schreiben settings und bersetzen fr smb.conf #######################################
 
-  &General::writehash("${General::swroot}/samba/settings", \%sambasettings);
-  
+&General::writehash("${General::swroot}/samba/settings", \%sambasettings);
+
 if ($sambasettings{'PASSWORDSYNC'} eq 'on'){ $sambasettings{'PASSWORDSYNC'} = "true";} else { $sambasettings{'PASSWORDSYNC'} = "false";}
 if ($sambasettings{'WINSSUPPORT'} eq 'on'){ $sambasettings{'WINSSUPPORT'} = "true";$sambasettings{'WINSSRV'} = "";} else { $sambasettings{'WINSSUPPORT'} = "false";}
 if ($sambasettings{'LOCALMASTER'} eq 'on'){ $sambasettings{'LOCALMASTER'} = "true";} else { $sambasettings{'LOCALMASTER'} = "false";}
@@ -445,32 +263,59 @@ END
 ;
 close FILE;
 
- if ($sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' )
- {     
- open (FILE, ">${General::swroot}/samba/pdc") or die "Can't save the pdc settings: $!";
- flock (FILE, 2);
- print FILE <<END
+       if (-e "${General::swroot}/cups/enable"){
+       open (FILE, ">>${General::swroot}/samba/global") or die "Can't save the global cups settings: $!";
+       flock (FILE, 2);
+       print FILE <<END
+load printers = $sambasettings{'LOADPRINTERS'}
+printing = $sambasettings{'PRINTING'}
+printcap name = $sambasettings{'PRINTCAPNAME'}
+
+END
+;
+close FILE;
+       }
+
+       if ($sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' )
+       {
+       open (FILE, ">${General::swroot}/samba/pdc") or die "Can't save the pdc settings: $!";
+       flock (FILE, 2);
+       chomp $sambasettings{'PDCOPTIONS'};
+       $sambasettings{'PDCOPTIONS'} =~ s/\r\n/\n/gi;
+       $sambasettings{'PDCOPTIONS'} =~ s/^\n//gi;
+       $sambasettings{'PDCOPTIONS'} =~ s/^\r//gi;
+       $sambasettings{'PDCOPTIONS'} =~ s/^.\n//gi;
+       $sambasettings{'PDCOPTIONS'} =~ s/^.\r//gi;
+       print FILE <<END
 $sambasettings{'PDCOPTIONS'}
 END
 ;
- close FILE;
- system('/usr/local/bin/sambactrl smbsafeconfpdc');
- }
- else
- {
- system('/usr/local/bin/sambactrl smbsafeconf');
- }
+       close FILE;
+       }
+
+if ( -e "/var/ipfire/cups/enable")
+       {
+       if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");}
+       else {system("/usr/local/bin/sambactrl smbsafeconfcups");}
+       }
+else
+       {
+       if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");}
+       else{system("/usr/local/bin/sambactrl smbsafeconf");}
+       }
+
 system("/usr/local/bin/sambactrl smbreload");
 }
   &General::readhash("${General::swroot}/samba/settings", \%sambasettings);
   
 
-if ($errormessage) {
-        &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
-        print "<class name='base'>$errormessage\n";
-        print "&nbsp;</class>\n";
-        &Header::closebox();
-                  }
+if ($errormessage)
+       {
+       &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
+       print "<class name='base'>$errormessage\n";
+       print "&nbsp;</class>\n";
+       &Header::closebox();
+       }
 
 ############################################################################################################################
 ########################################## Aktivieren von Checkboxen und Dropdowns #########################################
@@ -511,9 +356,9 @@ $selected{'SECURITY'}{$sambasettings{'SECURITY'}} = "selected='selected'";
 
 &Header::openbox('100%', 'center', $Lang::tr{'samba'});
 print <<END
-        <hr />
-        <br />
-        <table width='95%' cellspacing='0'>
+<hr />
+<br />
+<table width='95%' cellspacing='0'>
 END
 ;
 if ( $message ne "" )
@@ -635,6 +480,18 @@ if ($sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'o
        <tr><td align='left'><br /></td><td></td></tr>
        <tr><td colspan='2' align='center'><textarea name="PDCOPTIONS" cols="50" rows="15" Wrap="off">$PDCOPTIONS</textarea></td></tr>
 END
+;
+       }
+       
+       if ( -e "/var/ipfire/cups/enable")
+       {
+       print <<END
+       <tr><td align='left'><br /></td><td></td></tr>
+       <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'printing options'}</b></td></tr>
+       <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>
+       <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>
+       <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>
+END
 ;
        }
 
@@ -704,7 +561,7 @@ END
 
        print "<td align='left'><u>$Lang::tr{'status'}</u></td><td colspan='3' width='5%' align='center'><u>$Lang::tr{'options'}</u></td></tr>";
        system('/usr/local/bin/sambactrl readsmbpasswd');
-       open(FILE, "</var/ipfire/samba/private/smbpasswd") or die "Can't read user file: $!";
+       open(FILE, "<${General::swroot}/samba/private/smbpasswd") or die "Can't read user file: $!";
        @user = <FILE>;
        close(FILE);
        system('/usr/local/bin/sambactrl locksmbpasswd');
@@ -924,6 +781,9 @@ END
 
 &Header::openbox('100%', 'center', $Lang::tr{'shares'});
 
+my %shares =  config("${General::swroot}/samba/shares");
+
+
 print <<END
 <hr />
 <br />
@@ -933,8 +793,11 @@ print <<END
 END
 ;
 
-foreach $shareentry (sort @Shares)
+my @Shares = keys(%shares);
+
+foreach my $shareentry (sort @Shares)
        {
+       chomp $shareentry;
        print <<END
        <tr><td align='left'>$shareentry</td>
        <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
@@ -997,8 +860,7 @@ if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optio
        <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'add share'}</b></td></tr>
        <tr><td colspan='2' align='center'></td></tr>
        <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}
- <a href="sambahlp.cgi" target="popup" onClick="window.open ('', 'popup', 'width=580,height=360,scrollbars=no, 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>
+ <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>
        <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>
        </table>
        <br />
@@ -1012,33 +874,14 @@ END
 
 if ($sambasettings{'ACTION'} eq 'sharechange' || $sambasettings{'ACTION'} eq 'optioncaption2' )
        {
-       my $sharename = "$sambasettings{'NAME'}";
-       chomp $sharename;
-       $sharename=~s/\s//g;
-       
-       for(my $i = 0; $i <= $#Shares; $i++)
-               {
-               chomp $Shares[$i];
-               $Shares[$i]=~s/\s//g;
-               if ( "$Shares[$i]" eq "$sharename" )
-                       {
-                       my $Zeilenbegin = $Zeilen[$i+1]-2;
-                       my $Zeilenende =  $Zeilen[$i+1]-$Zeilen[$i];
-                       if ( $Zeilen[$i] eq $Zeilen[$#Shares] )
-                               {$Zeilenende =  $EOF-$Zeilen[$#Shares]+1;$Zeilenbegin = $EOF-$Zeilen[$#Shares]; $shareoption = qx(tail -$Zeilenende $sharefile | head -$Zeilenbegin);}
-                       else
-                               {$shareoption = qx(head -$Zeilenbegin $sharefile | tail -$Zeilenende);}
-                       }
-               }
+       my $shareoption = $shares{$sambasettings{'NAME'}};
        print <<END
        <hr />
        <br />
        <table width='95%' cellspacing='0'>
        <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'edit share'}</b></td></tr>
        <tr><td colspan='2' align='center'></td></tr>
-       <tr><td colspan='2' align='center'>$Lang::tr{'show share options'}<form method='post' action='$ENV{'SCRIPT_NAME'}'>
-                                                                                                                                                                                                                                                                                       <input type='hidden' name='ACTION' value='optioncaption2' />
-                                                                                                                                                                                                                                                                                       <input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
+       <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>
        <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>
        </table>
        <br />
@@ -1051,7 +894,157 @@ END
 ;
        }
 
+if ($sambasettings{'ACTION'} eq 'sharesresetyes')
+       {
+       system('/usr/local/bin/sambactrl smbsharesreset');
+       my $shares = config("${General::swroot}/samba/shares");
+       system("/usr/local/bin/sambactrl smbreload");
+       }
+if ($sambasettings{'ACTION'} eq 'smbshareadd')
+       {
+       $shares{'xvx'}= "$sambasettings{'SHAREOPTION'}";
+       save("shares");
+       my $shares = config("${General::swroot}/samba/shares");
+       }
+if ($sambasettings{'ACTION'} eq 'smbsharedel')
+       {
+       delete $shares{$sambasettings{'NAME'}};
+       save("shares");
+       my %shares = config("${General::swroot}/samba/shares");
+       }
+if ($sambasettings{'ACTION'} eq 'smbsharechange')
+       {
+       $shares{$sambasettings{'NAME'}} = $sambasettings{'SHAREOPTION'};
+       save("shares");
+       my %shares = config("${General::swroot}/samba/shares");
+       }
+
+&Header::closebox();
+
+############################################################################################################################
+################################################ Verwalten von Druckern ####################################################
+
+my %printer =  config("${General::swroot}/samba/printer");
+
+if ( -e "/var/ipfire/cups/enable")
+{
+&Header::openbox('100%', 'center', $Lang::tr{'printer'});
+
+my @Printers = keys(%printer);
+print <<END
+<hr />
+<br />
+<table width='95%' cellspacing='0'>
+<tr><td bgcolor='${Header::table1colour}' colspan='3' align='left'><b>$Lang::tr{'manage printers'}</b>
+<tr><td align='left'><u>$Lang::tr{'printername'}</u></td><td colspan='2' width="5%" align='center'><u>$Lang::tr{'options'}</u></td></tr>
+END
+;
+foreach my $printerentry (sort @Printers)
+       {
+       chomp $printerentry;
+       print <<END
+       <tr><td align='left'>$printerentry</td>
+       <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                       <input type='hidden' name='NAME' value='$printerentry' />
+                       <input type='hidden' name='ACTION' value='printerchange' />
+                       <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
+       </form></td>
+       <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                       <input type='hidden' name='NAME' value='$printerentry' />
+                       <input type='hidden' name='ACTION' value='smbprinterdel' />
+                       <input type='image' alt='$Lang::tr{'delete'}' src='/images/user-trash.png' />
+       </form></td></tr>
+END
+;
+       }
+print <<END
+</table>
+<br />
+<table width='10%' cellspacing='0'>
+<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <input type='hidden' name='ACTION' value='printeradd' />
+                                                                                               <input type='image' alt='$Lang::tr{'add printer'}' src='/images/list-add.png' />
+                                                                                               </form></td>
+               <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <input type='hidden' name='ACTION' value='printereset' />
+                                                                                               <input type='image' alt='$Lang::tr{'reset'}' src='/images/reload.gif' />
+                                                                                               </form></td>
+               <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                                                                                               <input type='hidden' name='ACTION' value='printercaption' />
+                                                                                               <input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' />
+                                                                                               </form></td>
+</tr>
+</table>
+END
+;
+
+if ($sambasettings{'ACTION'} eq 'printeradd' || $sambasettings{'ACTION'} eq 'printercaption' )
+       {
+       print <<END
+       <hr />
+       <br />
+       <table width='95%' cellspacing='0'>
+       <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'add printer'}</b></td></tr>
+       <tr><td colspan='2' align='center'></td></tr>
+       <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>
+       <form method='post' action='$ENV{'SCRIPT_NAME'}'><tr><td colspan='2' align='center'><textarea name="PRINTEROPTION" cols="50" rows="15" Wrap="off">$defaultprinter</textarea></td></tr>
+       </table>
+       <br />
+       <table width='10%' cellspacing='0'>
+       <tr><td align='center'><input type='hidden' name='ACTION' value='smbprinteradd' />
+                                                                                                       <input type='image' alt='$Lang::tr{'add share'}' src='/images/media-floppy.png' /></td></tr>
+       </table>
+       </form>
+END
+;
+       }
+       
+if ($sambasettings{'ACTION'} eq 'printerchange' || $sambasettings{'ACTION'} eq 'printercaption2' )
+       {
+       my $printeroption = $printer{$sambasettings{'NAME'}};
+       print <<END
+       <hr />
+       <br />
+       <table width='95%' cellspacing='0'>
+       <tr bgcolor='${Header::table1colour}'><td colspan='2' align='left'><b>$Lang::tr{'edit printer'}</b></td></tr>
+       <tr><td colspan='2' align='center'></td></tr>
+       <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>
+       <tr><td colspan='2' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><textarea name="PRINTEROPTION" cols="50" rows="15" Wrap="off">$printeroption</textarea></td></tr>
+       </table>
+       <br />
+       <table width='10%' cellspacing='0'>
+       <tr><td align='center'><input type='hidden' name='NAME' value='$sambasettings{'NAME'}' />
+                                                                                                       <input type='image' alt='$Lang::tr{'change share'}' src='/images/media-floppy.png' />
+                                                                                                       <input type='hidden' name='ACTION' value='smbprinterchange' /></form></td></tr>
+       </table>
+END
+;
+       }
+
+if ($sambasettings{'ACTION'} eq 'smbprinteradd')
+       {
+       $printer{'xvx'}= "$sambasettings{'PRINTEROPTION'}";
+       save("printer");
+       my %printer = config("${General::swroot}/samba/printer");
+       }
+
+if ($sambasettings{'ACTION'} eq 'smbprinterdel')
+       {
+       delete $printer{$sambasettings{'NAME'}};
+       save("printer");
+       my %printer = config("${General::swroot}/samba/printer");
+       }
+
+if ($sambasettings{'ACTION'} eq 'smbprinterchange')
+       {
+       $printer{$sambasettings{'NAME'}} = $sambasettings{'PRINTEROPTION'};
+       save("printer");
+       my %printer = config("${General::swroot}/samba/printer");
+       }
+
 &Header::closebox();
+}
 
 ############################################################################################################################
 ############################################### Anzeige des Sambastatus ####################################################
@@ -1070,12 +1063,12 @@ END
 &Header::closebox();
 
 ############################################################################################################################
-############################################### Anzeige des Sambastatus ####################################################
+############################################### Anzeige der Sambalogs ######################################################
 
 
 if ($sambasettings{'ACTION'} eq 'showlog')
 {
-$Log = qx(tail -n $LOGLINES /var/log/samba/$sambasettings{'LOG'});
+$Log = qx(tail -n $sambasettings{'LOGLINES'} /var/log/samba/$sambasettings{'LOG'});
 $Log=~s/\n/<br \/>/g;
 }
 
@@ -1104,7 +1097,6 @@ print <<END
 </form>
 END
 ;
-
 &Header::closebox();
 &Header::closebigbox();
 &Header::closepage();
@@ -1112,6 +1104,69 @@ END
 ############################################################################################################################
 ############################################ Subfunktion fr Sambadienste ###################################################
 
+sub config
+{
+my $file = shift;
+my @allarray = `grep -n '^\\[' $file`;
+my @linesarray = ();
+my @namearray = ();
+my %hash = ();
+my $options = ();
+my $EOF = qx(cat $file | wc -l);
+foreach my $allarrayentry (@allarray)
+ {
+ my @allarrayline = split( /\:/, $allarrayentry );
+ push(@linesarray,$allarrayline[0]);$allarrayline[1]=~s/\[//g;$allarrayline[1]=~s/\]//g;push(@namearray,$allarrayline[1]);
+ }
+       for(my $i = 0; $i <= $#namearray; $i++)
+               {
+               chomp $namearray[$i];
+               $namearray[$i]=~s/\[//g;$namearray[$i]=~s/\]//g;
+               if ( $i eq $#namearray )
+                       {
+                       my $lineend = $EOF-$linesarray[$i]+1;
+                       $options=qx(tail -$lineend $file);
+                       }
+               else
+                       {
+                       my $linestart = $EOF-$linesarray[$i]+1;
+                       my $lineend =  $linesarray[$i+1]-$linesarray[$i];
+                       $options=qx(tail -$linestart $file | head -$lineend);
+                       }
+               $hash{$namearray[$i]} = "$options";
+#              print"<pre>$namearray[$i]\n$options\n</pre>"; # enable only for debuging
+               }
+return(%hash);
+}
+
+sub save
+{
+my $smb = shift;
+open (FILE, ">${General::swroot}/samba/$smb") or die "Can't $smb settings $!";
+flock (FILE, 2);
+
+if ( $smb eq 'printer')
+       {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";}}
+
+if ( $smb eq 'shares')
+       {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";}        }
+
+close FILE;
+
+if ( -e "/var/ipfire/cups/enable")
+       {
+       if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");}
+       else {system("/usr/local/bin/sambactrl smbsafeconfcups");}
+       }
+else
+       {
+       if ( $sambasettings{'SECURITY'} eq 'User' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");}
+       else{system("/usr/local/bin/sambactrl smbsafeconf");}
+       }
+
+system("/usr/local/bin/sambactrl smbreload");
+}
+
 sub isrunning
        {
        my $cmd = $_[0];
@@ -1144,4 +1199,4 @@ sub isrunning
                        }
                }
        return $status;
-       }
\ No newline at end of file
+       }
index d8c52b4..0eaf708 100644 (file)
@@ -51,6 +51,7 @@
 'add new lease' => 'Neue Zuordnung definieren',
 'add new ovpn' => 'OpenVPN Einstellungen',
 'add pc' => 'PC anlegen',
+'add printer' => 'Drucker hinzufügen',
 'add service' => 'Dienst hinzufügen',
 'add share' => 'Freigabe anlegen',
 'add user' => 'Benutzer anlegen',
 'edit device' => 'Gerät bearbeiten',
 'edit hosts' => 'Hosts bearbeiten',
 'edit network' => 'Netzwerk bearbeiten',
+'edit printer' => 'Drucker bearbeiten',
 'edit service' => 'Dienst bearbeiten',
 'edit share' => 'Freigabe bearbeiten',
 'editor' => 'Editor',
 'legend' => 'Legende',
 'line' => 'Leitung',
 'linkq' => 'Verbindungsqualität',
+'load printer' => 'Load Printer',
 'loaded modules' => 'Geladene Module:',
 'local hard disk' => 'Festplatte',
 'local master' => 'Local Master',
 'mailprogramm' => 'Mail Programm',
 'main page' => 'Startseite',
 'manage ovpn' => '5. Tunnel Management',
+'manage printers' => 'Drucker verwalten',
 'manage shares' => 'Freigaben verwalten',
 'manual' => 'Manuell',
 'manual control and status' => 'Manuelle Einstellung und Status:',
 'primary dns' => 'Primärer DNS:',
 'primary ntp server' => 'Primärer NTP-Server',
 'primary wins server address' => 'Primäre WINS-Server Adresse',
+'printcap name' => 'Printercap Name',
+'printer' => 'Drucker',
+'printername' => 'Druckername',
+'printing' => 'Printing',
+'printing options' => 'Druckeroptionen',
 'priority' => 'Priorität',
 'profile' => 'Profil',
 'profile deleted' => 'Profil gelöscht: ',
index 3df237e..454ed75 100644 (file)
@@ -51,6 +51,7 @@
 'add new lease' => 'Add a new fixed lease',
 'add new ovpn' => 'OpenVPN Settings:',
 'add pc' => 'add workstation',
+'add printer' => 'add printer',
 'add service' => 'Add service',
 'add share' => 'add share',
 'add user' => 'add User',
 'edit device' => 'Edit device',
 'edit hosts' => 'Edit Hosts',
 'edit network' => 'Edit network',
+'edit printer' => 'edit printer',
 'edit service' => 'Edit service',
 'edit share' => 'edit share',
 'editor' => 'Editor',
 'legend' => 'Legend',
 'line' => 'Line',
 'linkq' => 'Link Quality',
+'load printer' => 'Load Printer',
 'loaded modules' => 'Loaded modules:',
 'local hard disk' => 'Hard disk',
 'local master' => 'Local Master',
 'mailprogramm' => 'Mailprogramm',
 'main page' => 'Main page',
 'manage ovpn' => '5. Tunnel Management:',
+'manage printers' => 'manage printers',
 'manage shares' => 'Manage Shares',
 'manual' => 'Manual',
 'manual control and status' => 'Manual control and status:',
 'primary dns' => 'Primary DNS:',
 'primary ntp server' => 'Primary NTP Server',
 'primary wins server address' => 'Primary WINS Server address',
+'printcap name' => 'Printercap Name',
+'printer' => 'Printer',
+'printername' => 'Printername',
+'printing' => 'Printing',
+'printing options' => 'printing options',
 'priority' => 'Priority',
 'profile' => 'Profile',
 'profile deleted' => 'Profile deleted: ',
index a6e1f7c..2a573b6 100644 (file)
@@ -25,155 +25,155 @@ return 1;
 
 if (strcmp(argv[1], "smbuserdisable")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -d %s", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -d %s >/dev/null", argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbuserenable")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -e %s", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -e %s >/dev/null", argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbuserdelete")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -x %s", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -x %s >/dev/null", argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/userdel %s", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/userdel %s >/dev/null", argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbsafeconf")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbsafeconfcups")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbsafeconfpdc")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbsafeconfpdccups")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbglobalreset")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/default.global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
-safe_system("/bin/cat /var/ipfire/samba/default.settings > /var/ipfire/samba/settings");
-safe_system("/bin/cat /var/ipfire/samba/default.global > /var/ipfire/samba/global");
-safe_system("/bin/cat /var/ipfire/samba/default.pdc > /var/ipfire/samba/pdc");
+safe_system("/bin/cat /var/ipfire/samba/default.global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf >/dev/null");
+safe_system("/bin/cat /var/ipfire/samba/default.settings > /var/ipfire/samba/settings >/dev/null");
+safe_system("/bin/cat /var/ipfire/samba/default.global > /var/ipfire/samba/global >/dev/null");
+safe_system("/bin/cat /var/ipfire/samba/default.pdc > /var/ipfire/samba/pdc >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbsharesreset")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/default.shares > /var/ipfire/samba/smb.conf");
-safe_system("/bin/cat /var/ipfire/samba/default.shares > /var/ipfire/samba/shares");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/default.shares > /var/ipfire/samba/smb.conf >/dev/null");
+safe_system("/bin/cat /var/ipfire/samba/default.shares > /var/ipfire/samba/shares >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbprinterreset")==0)
 {
-safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/default.printer > /var/ipfire/samba/smb.conf");
-safe_system("/bin/cat /var/ipfire/samba/default.printer > /var/ipfire/samba/printer");
+safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/default.printer > /var/ipfire/samba/smb.conf >/dev/null");
+safe_system("/bin/cat /var/ipfire/samba/default.printer > /var/ipfire/samba/printer >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbstop")==0)
 {
-safe_system("/etc/rc.d/init.d/samba stop");
+safe_system("/etc/rc.d/init.d/samba stop >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbstart")==0)
 {
-safe_system("/etc/rc.d/init.d/samba start");
+safe_system("/etc/rc.d/init.d/samba start >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbrestart")==0)
 {
-safe_system("/etc/rc.d/init.d/samba restart");
+safe_system("/etc/rc.d/init.d/samba restart >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbreload")==0)
 {
-safe_system("/etc/rc.d/init.d/samba reload");
+safe_system("/etc/rc.d/init.d/samba reload >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "smbstatus")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbstatus");
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbstatus 2>/dev/null");
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbuseradd")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambauser");
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambauser >/dev/null");
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba User' -m -g %s -p %s -s %s %s", argv[4], argv[3], argv[5], argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba User' -m -g %s -p %s -s %s %s >/dev/null", argv[4], argv[3], argv[5], argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s >/dev/null", argv[3], argv[3], argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbpcadd")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambawks");
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambawks >/dev/null");
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba Workstation' -g %s -s %s %s", argv[3], argv[4], argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba Workstation' -g %s -s %s %s >/dev/null", argv[3], argv[4], argv[2]);
 safe_system(command);
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -a -m %s", argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -a -m %s >/dev/null", argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "smbchangepw")==0)
 {
-snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s", argv[3], argv[3], argv[2]);
+snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s >/dev/null", argv[3], argv[3], argv[2]);
 safe_system(command);
 return 0;
 }
 
 if (strcmp(argv[1], "readsmbpasswd")==0)
 {
-safe_system("/bin/chown root:nobody /var/ipfire/samba/private");
-safe_system("/bin/chown root:nobody /var/ipfire/samba/private/smbpasswd");
-safe_system("/bin/chmod 640 /var/ipfire/samba/private/smbpasswd");
-safe_system("/bin/chmod 650 /var/ipfire/samba/private");
+safe_system("/bin/chown root:nobody /var/ipfire/samba/private >/dev/null");
+safe_system("/bin/chown root:nobody /var/ipfire/samba/private/smbpasswd >/dev/null");
+safe_system("/bin/chmod 640 /var/ipfire/samba/private/smbpasswd >/dev/null");
+safe_system("/bin/chmod 650 /var/ipfire/samba/private >/dev/null");
 return 0;
 }
 
 if (strcmp(argv[1], "locksmbpasswd")==0)
 {
-safe_system("/bin/chown root:root /var/ipfire/samba/private");
-safe_system("/bin/chown root:root /var/ipfire/samba/private/smbpasswd");
-safe_system("/bin/chmod 600 /var/ipfire/samba/private/smbpasswd");
-safe_system("/bin/chmod 600 /var/ipfire/samba/private");
+safe_system("/bin/chown root:root /var/ipfire/samba/private >/dev/null");
+safe_system("/bin/chown root:root /var/ipfire/samba/private/smbpasswd >/dev/null");
+safe_system("/bin/chmod 600 /var/ipfire/samba/private/smbpasswd >/dev/null");
+safe_system("/bin/chmod 600 /var/ipfire/samba/private >/dev/null");
 return 0;
 }
 if (strcmp(argv[1], "enable")==0)
 {
 safe_system("touch /var/ipfire/samba/enable");
-safe_system("/etc/rc.d/init.d/samba start");
+safe_system("/etc/rc.d/init.d/samba start ");
 safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc2.d/S50samba");
 safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc2.d/K50samba");
 safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/S50samba");
@@ -192,4 +192,4 @@ safe_system("unlink /etc/rc.d/rc3.d/K50samba");
 return 0;
 }
 return 0;
-}
\ No newline at end of file
+}