From cf36d038d28969f615e45e9dbbf61ffd9cac49c0 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Fri, 27 May 2005 06:57:45 +0000 Subject: add global options suppoert, pdc, bdc, member, add help, info --- samba_wizard/Samba.pm | 93 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 20 deletions(-) (limited to 'samba_wizard') diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index 0f8b9616..561f96ac 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -69,12 +69,19 @@ my $o = { wiz_home_browseable => '', wiz_home_createmode => '', wiz_home_comment => '', + wiz_local_master => '', + wiz_os_level => '', + wiz_security => '', + wiz_domain_logons => '', + wiz_domain_master => '', + wiz_password_server => '', + wiz_passdb_backend => '', + wiz_domain => '', test => '', - }, -# init => sub { -# test_host_domain($SHORTHOSTNAME, $DOMAINNAME); -# }, + init => sub { + test_host_domain($SHORTHOSTNAME, $DOMAINNAME); + }, needed_rpm => [ 'samba-server' ], defaultimage => "/usr/share/wizards/samba_wizard/images/samba.png" }; @@ -82,7 +89,7 @@ my $o = { #pdc #bdc #standalone #membre #share_files #share_printers # we ask glueconf to give us the structure representing /etc/samba/smb.conf -my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf', }); +my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf', show_commented_info => 1 }); #debug use Data::Dumper; @@ -126,27 +133,52 @@ $o->{pages} = { ], }, pdc => { - name => N('PDC server: primary domain controller'), + name => N('PDC server: primary domain controller') . "\n\n" . N('Server configured as a PDC is responsible for Windows authentication throughout the domain.') . "\n" . N('Single server installations may use smbpasswd or tdbsam password backends, but large installations should use the LDAP backend to provide centralized management of both Posix users and Windows users.') . "\n" . N('Domain master = yes, causes the server to register the NetBIOS name 1B. This name will be recognized by other servers.'), + pre => sub { + $o->{var}{wiz_domain_master} = "yes"; + $o->{var}{wiz_security} = "user"; + $o->{var}{wiz_domain_logons} = "yes"; + $o->{var}{wiz_passdb_backend} ||= $samba->{global}{'passdb backend'}; + $o->{var}{wiz_wins_support} ||= $samba->{global}{'wins support'}; + }, data => [ - { label => N('val:'), val => \$o->{var}{test} }, + { label => N('Domain logons:'), fixed_val => \$o->{var}{wiz_domain_logons} }, + { label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} }, + { label => N('Security:'), fixed_val => \$o->{var}{wiz_security} }, + { label => N('Wins support:'), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno }, + { label => N('Passdb backend'), val => \$o->{var}{wiz_passdb_backend}, help => "ldapsam:ldap://" }, ], # complete => {}, next => 'ask_workgroup', }, bdc => { - name => N('BDC server: backup domain controller'), + name => N('BDC server: backup domain controller') . "\n\n" . N('This enables BDCs to carry much of the network logon processing. A BDC on a local segment handles logon requests and authenticates users when the PDC is busy on the local network. When a segment becomes heavily loaded, the reponsibility is offloaded to another segment\'s BDC or to the PDC. Therefore, you can optimize resources and add robustness to network services by deploying BDCs throughout the network.'), + pre => sub { + $o->{var}{wiz_domain_master} = "no"; + $o->{var}{wiz_security} = "user"; + }, data => [ - { label => N('val:'), val => \$o->{var}{test} }, -# { label => N(':'), val => \$o->{var}{} }, + { label => N('Security:'), fixed_val => \$o->{var}{wiz_security} }, + { label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} }, ], # complete => {}, next => 'ask_workgroup', }, member => { - name => N('Member of a domain'), + name => N('Member of a domain') . "\n\n" . ('Share data, users home or printers.') . "\n" . N('Please enter the domain you want to join.'), + pre => sub { + $o->{var}{wiz_security} = "domain"; + $o->{var}{wiz_domain_master} = "no"; + $o->{var}{wiz_password_server} ||= $samba->{global}{'password server'}; + $o->{var}{wiz_domain} ||= $samba->{global}{domain}; + $o->{var}{wiz_passdb_backend} ||= $samba->{global}{'passdb backend'};; + }, data => [ - { label => N('val:'), val => \$o->{var}{test} }, -# { label => N(':'), val => \$o->{var}{} }, + { label => N('Password server'), val => \$o->{var}{wiz_password_server} }, + { label => N('Domain:'), val => \$o->{var}{wiz_domain} }, + { label => N('Passdb backend'), val => \$o->{var}{wiz_passdb_backend}, help => "ldapsam:ldap://" }, + { label => N('Security:'), fixed_val => \$o->{var}{wiz_security} }, + { label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} }, ], # complete => {}, next => 'ask_workgroup', @@ -433,13 +465,14 @@ sub list_printers { sub list_share { my @listshare; - my $share; - if ($samba->{$_}{printable} =~ /yes/) { - print "$share is a printer\n"; - () - } else { - print "$share is a share\n"; - push @listshare, $share; + foreach my $clef (keys %$samba) { + if ($samba->{$clef}{printable} =~ /yes/i) { + print "$clef est une imprimante\n"; + } else { + push @listshare, $clef; + } + print "------------- \n"; + foreach (@listshare) { print "$_\n"; } } } @@ -466,6 +499,16 @@ sub printer_sharing { } } +sub global_special_options { + $o->{var}{wiz_domain_master} and $samba->{global}{'domain master'} = $o->{var}{wiz_domain_master}; + $o->{var}{wiz_security} and $samba->{global}{security} = $o->{var}{wiz_security}; + $o->{var}{wiz_domain_logons} and $samba->{global}{'domain logons'} = $o->{var}{wiz_domain_logons}; + $o->{var}{wiz_passdb_backend} and $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; + $o->{var}{wiz_wins_support} and $samba->{global}{'wins support'} = $o->{var}{wiz_wins_support}; + $o->{var}{wiz_password_server} and $samba->{global}{'password server'} = $o->{var}{wiz_password_server}; + $o->{var}{wiz_domain} and $samba->{global}{domain} = $o->{var}{wiz_domain}; +} + sub get_printers { if ($o->{var}{wiz_do_printer_sharing}) { my $string; @@ -495,6 +538,9 @@ sub do_it { $samba->{global}{netbios} = $o->{var}{wiz_netbios}; } + # add special global options + global_special_options; + # log level in global section $samba->{global}{'log file'} = $o->{var}{wiz_log_file}; if ($o->{var}{wiz_log_level}) { @@ -538,6 +584,13 @@ sub do_it { standalone->explanations("Samba deny $o->{var}{wiz_hosts_deny}"); standalone->explanations("Samba allow $o->{var}{wiz_hosts_allow}"); + print "---------debug D\n"; + my $v = $samba->get_comments('{printers}'); + print $v->{normal}; + # print $v->{right_inline}; + print "\n-------debug E\n"; +# list_share; + # share printers if ($o->{var}{wiz_do_printer_sharing}) { standalone->explanations("Enabling printer sharing"); -- cgit v1.2.1