diff options
Diffstat (limited to 'samba_wizard/Samba.pm')
-rwxr-xr-x | samba_wizard/Samba.pm | 166 |
1 files changed, 11 insertions, 155 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index 12594f7f..6f6b50d1 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -46,12 +46,9 @@ my $o = { wiz_netbios => '', wiz_all_printers => '', wiz_level => '', - wiz_printers => '', wiz_do_printer_sharing => '', wiz_printers_comment => '', - wiz_printers_browseable => '', wiz_printers_guestok => '', wiz_printers_createmode => '', wiz_workgroup => '', wiz_banner => '', wiz_log_file => '', wiz_log_level => '', wiz_max_log_size => '', - list_printers => '', wiz_local_master => '', wiz_os_level => '', wiz_security => '', @@ -209,6 +206,13 @@ $o->{pages} = { ldap_conf => { name => N('LDAP configuration for Domain Controlling') . "\n\n" . N('The account (dn) that samba uses to access the LDAP server. This account needs to have write access to the LDAP tree. You will need to give samba the password for this dn.'), pre => sub { +# ldap machine suffix = ou=Computers +# ldap user suffix = ou=Users +# ldap group suffix = ou=Groups +# admin users = + +# global +# testparm if ($samba->{global}{'ldap suffix'}) { $o->{var}{wiz_ldap_suffix} = $samba->{global}{'ldap suffix'}; } else { @@ -217,7 +221,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} = "cn=Manager"; + $o->{var}{wiz_ldap_admin_dn} = "cn=Manager,dc=mydomain,dc=com"; } if ($samba->{global}{'passdb backend'}) { $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'} @@ -299,47 +303,6 @@ $o->{pages} = { ], next => 'summary', }, - ask_printers => { - name => N('Select which printers you want to be accessible from known users'), - pre => sub { - $o->{var}{list_printers} ||= [ list_printers() ]; - $o->{var}{wiz_box_list} ||= []; - }, - data => [ - { text => N('Enable all printers'), type => 'bool', val => \$o->{var}{wiz_all_printers} }, - { val => \$o->{var}{wiz_box_list}, boolean_list => \$o->{var}{list_printers}, disabled => sub { $o->{var}{wiz_all_printers} and return 1; 0 } }, - ], - next => 'ask_printers_options', - }, - ask_printers_options => { - name => N('Now you can configure your printers service. Change value only if you know what your are doing.'), - pre => sub { - if ($samba->{printers}{comment}) { - $o->{var}{wiz_printers_comment} ||= $samba->{printers}{comment} - } else { - $o->{var}{wiz_printers_comment} = "All Printers"; - } - $o->{var}{wiz_printers_browseable} ||= $samba->{printers}{browseable}; - $o->{var}{wiz_printers_guestok} ||= $samba->{printers}{'guest ok'}; - if ($samba->{printers}{'create mode'}) { - $o->{var}{wiz_printers_createmode} ||= $samba->{printers}{'create mode'} - } else { - $o->{var}{wiz_printers_createmode} = "0700"; - } - }, - post => sub { - if ($o->{var}{wiz_do_homes} == 1) { - return 'ask_homes'; - } - }, - data => [ - { label => N('Comment:'), val => \$o->{var}{wiz_printers_comment} }, - { label => N('Create mode:'), val => \$o->{var}{wiz_printers_createmode} }, - { label => N('Browseable:'), val => \$o->{var}{wiz_printers_browseable}, fixed_list => \@yesorno }, - { label => N('Guest ok:'), val => \$o->{var}{wiz_printers_guestok}, fixed_list => \@yesorno }, - ], - next => 'summary', - }, summary => { name => N('Configuring Samba') . "\n\n" . N('The wizard collected the following parameters to configure Samba.') . "\n\n" . N('To accept these values, and configure your server, click the Next button or use the Back button to correct them.') . "\n\n" . N('If you have previously create some shares, they will appear in this configuration. Re-run wizard and choose: Manage share to remove/add/modify them.'), pre => sub { @@ -385,86 +348,10 @@ sub check() { 0; } -#section has the name of the printer -sub add_printer { - my ($printer) = @_; - $samba->{$printer}{printer} = $printer; - $samba->{$printer}{printable} = 'yes'; -} - -sub remove_printer { - my ($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 { () } -} - - -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}; - $samba->{printers}{'guest ok'} = $o->{var}{wiz_printers_guestok}; - $samba->{printers}{'create mode'} = $o->{var}{wiz_printers_createmode}; - # dont want user to change those value... - $samba->{printers}{path} = "/var/spool/samba"; - $samba->{printers}{writable} = "no"; - $samba->{printers}{printable} = "yes"; - $samba->{printers}{'print command'} = "lpr-cups -P %p -o raw %s -r"; - $samba->{printers}{'use client driver'} = "yes"; - for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { - my $printer = $o->{var}{list_printers}[$i]; - if ($o->{var}{wiz_box_list}[$i]) { - add_printer($printer); - } else { - remove_printer($printer); - } - } -} - -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() { +# dos charset = 850 +# unix charset = ISO8859-1 + # detect Samba type 3 is standalone if ($o->{var}{wiz_type} == "3") { exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'}; @@ -496,20 +383,6 @@ sub global_special_options() { } } -sub get_printers() { - if ($o->{var}{wiz_do_printer_sharing}) { - my $string; - $o->{var}{wiz_all_printers} and return "all printers"; - for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { - $string .= "$o->{var}{list_printers}[$i]\n" if $o->{var}{wiz_box_list}[$i] - } - $string; - } - else { - 'disabled'; - } -} - sub store_samba_type { # write config file to store Samba type my ($type) = @_; @@ -550,23 +423,6 @@ sub do_it { $o->{var}{wiz_log_level} and $samba->{global}{'log level'} = $o->{var}{wiz_log_level}; $o->{var}{wiz_max_log_size} and $samba->{global}{'max log size'} = $o->{var}{wiz_max_log_size}; - # share printers - if ($o->{var}{wiz_do_printer_sharing}) { - printer_sharing(); - printer_section(); - printdollar_section(); - } else { - 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(); # remove wait message undef $w; |