diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-05-31 13:42:03 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-05-31 13:42:03 +0000 |
commit | a8b68e313616d6c74000043afb17946851c9ecf6 (patch) | |
tree | d49fcc5412653e06d36f8bbd124be88321f6d2a2 /samba_wizard | |
parent | b727858810c0601636c2f559ca6cae8700f2b5af (diff) | |
download | drakwizard-a8b68e313616d6c74000043afb17946851c9ecf6.tar drakwizard-a8b68e313616d6c74000043afb17946851c9ecf6.tar.gz drakwizard-a8b68e313616d6c74000043afb17946851c9ecf6.tar.bz2 drakwizard-a8b68e313616d6c74000043afb17946851c9ecf6.tar.xz drakwizard-a8b68e313616d6c74000043afb17946851c9ecf6.zip |
various fix in printer sectio, and some typo (thx anne)
Diffstat (limited to 'samba_wizard')
-rwxr-xr-x | samba_wizard/Samba.pm | 79 |
1 files changed, 58 insertions, 21 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index 8269a105..f02949fd 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -37,6 +37,7 @@ my $DOMAINNAME = chomp_(`dnsdomainname`); my $SHORTHOSTNAME = chomp_(`hostname -s`); my $wiz_samba_etc = "/etc/sysconfig/wizard_samba"; my @listshare; +my @listprinters; my $o = { name => 'Samba wizard', @@ -401,7 +402,7 @@ $o->{pages} = { if ($samba->{global}{'ldap admin dn'}) { $o->{var}{wiz_ldap_admin_dn} ||= $samba->{global}{'ldap admin dn'} } else { - $o->{var}{wiz_ldap_admin_dn} = "root"; + $o->{var}{wiz_ldap_admin_dn} = "cn=Manager"; } if ($samba->{global}{'passdb backend'}) { $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'} @@ -503,8 +504,8 @@ $o->{pages} = { $o->{var}{wiz_do_homes} ||= exists $samba->{homes}; }, data => [ - { text => N('Enable file sharing area'), type => 'bool', val => \$o->{var}{wiz_do_file_sharing} }, - { text => N('Enable Server Printer Sharing'), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} }, + { text => N('Enable public file sharing area'), type => 'bool', val => \$o->{var}{wiz_do_file_sharing} }, + { text => N('Enable server printer sharing'), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} }, { text => N('Make home directories available for their owners'), type => 'bool', val => \$o->{var}{wiz_do_homes} }, ], post => sub { @@ -697,9 +698,9 @@ $o->{pages} = { }, data => [ { label => N('Workgroup:'), fixed_val => \$o->{var}{wiz_workgroup} }, - { label => N('Server Banner:'), fixed_val => \$o->{var}{wiz_banner} }, - { label => N('File Sharing:'), fixed_val => \$o->{var}{file_sharing} }, - { label => N('Print Server:'), fixed_val => \$o->{var}{printer_sharing} }, + { label => N('Server banner:'), fixed_val => \$o->{var}{wiz_banner} }, + { label => N('Public file sharing:'), fixed_val => \$o->{var}{file_sharing} }, + { label => N('Print server:'), fixed_val => \$o->{var}{printer_sharing} }, { label => N('Home:'), fixed_val => \$o->{var}{shared_homes} }, ], post => \&do_it, @@ -784,15 +785,26 @@ sub remove_printer { delete $samba->{$printer}; } +sub list_printers_smbconf() { + undef @listprinters; + foreach my $clef (keys %$samba) { + if ($samba->{$clef}{printable} =~ /yes/i) { + print "$clef is a printer\n"; + push @listprinters, $clef; + } + } + return @listprinters; +} + sub list_printers() { - my @list if 0; - return @list if @list; - @list = sort grep /^(?!\#).+/, map { - my ($printer) = split(':', $_); - } cat_("/etc/printcap"); - if (@list) { - @list - } else { () } + my @list if 0; + return @list if @list; + @list = sort grep /^(?!\#).+/, map { + my ($printer) = split(':', $_); + } cat_("/etc/printcap"); + if (@list) { + @list + } else { () } } sub list_all_shares() { @@ -811,6 +823,7 @@ sub list_all_shares() { sub printer_sharing() { # create default sedction for printers with default value + $samba->{global}{'printer adm'} = "\@adm"; $samba->{printers}; $samba->{printers}{comment} = $o->{var}{wiz_printers_comment}; $samba->{printers}{browseable} = $o->{var}{wiz_printers_browseable}; @@ -832,8 +845,28 @@ sub printer_sharing() { } } +sub priner_section() { + $samba->{'pdf-gen'}; + $samba->{path} = "/var/tmp"; + $samba->{'guest ok'} = "no"; + $samba->{printable} = "yes"; + $samba->{comment} = "PDF Generator (only valid users)"; + $samba->{printing} = "bsd"; + $samba->{'print command'} = "/usr/share/samba/scripts/print-pdf \"%s\" \"%H\" \"//%L/%u\" \"%m\" \"%I\" \"%J\" &"; + $samba->{'lpq command'} = "/bin/true"; +} + +sub printdollar_section() { + $samba->{'print$'}; + $samba->{path} = "/var/lib/samba/printers"; + $samba->{browseable} = "yes"; + $samba->{'write list'} = "\@adm root"; + $samba->{'guest ok'} = "yes"; + $samba->{inherit permissions} = "yes"; +} + sub global_special_options() { - # detect Samab type 3 is standalone + # detect Samba type 3 is standalone if ($o->{var}{wiz_type} == "3") { exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'}; $samba->{global}{'security'} = "share"; @@ -855,11 +888,12 @@ sub global_special_options() { $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; $samba->{global}{'ldap admin_dn'} = $o->{var}{wiz_ldap_admin_dn}; $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix}; - } + } else { # delete ldap options if exist - exists $samba->{global}{'passdb backend'} and delete $samba->{global}{'passdb backend'}; - exists $samba->{global}{'ldap admin_dn'} and delete $samba->{global}{'ldap admin_dn'}; - exists $samba->{global}{'ldap suffix'} and delete $samba->{global}{'ldap suffix'}; + exists $samba->{global}{'passdb backend'} and delete $samba->{global}{'passdb backend'}; + exists $samba->{global}{'ldap admin_dn'} and delete $samba->{global}{'ldap admin_dn'}; + exists $samba->{global}{'ldap suffix'} and delete $samba->{global}{'ldap suffix'}; + } } } @@ -1034,16 +1068,19 @@ sub do_it { # share printers if ($o->{var}{wiz_do_printer_sharing}) { - standalone->explanations("Enabling printer sharing"); printer_sharing(); + printer_section(); + printdollar_section(); } else { - standalone->explanations("Disabling printer sharing"); if ($o->{var}{wiz_box_list}) { for(my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { $o->{var}{list_printers}[$i] and remove_printer($o->{var}{list_printers}[$i]); } } + delete $samba->{global}{'printer adm'}; delete $samba->{printers}; + delete $samba->{'print$'}; + delete $samba->{'pdf-gen'}; } write_conf_restart_smb(); |