From 03ab8056d8bdb4b53b77929cc7c40cd0d5af7ec9 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Tue, 20 Jun 2006 12:56:58 +0000 Subject: add netbios configuration, various perl_checker fix --- samba_wizard/Samba.pm | 73 +++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'samba_wizard') diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index a0421bea..dd1b0605 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -73,7 +73,7 @@ my $o = { $::Wizard_pix_up = "/usr/share/wizards/samba_wizard/images/sambasrv.png"; # we ask glueconf to give us the structure representing /etc/samba/smb.conf if (!-f "/etc/samba/smb.conf") { mkdir_p("/etc/samba/"); cp_af("/usr/share/wizards/samba_wizard/scripts/smb.conf.default", "/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' }); #my $samba = new Libconf::Glueconf::Samba::Smb_conf(filename => '/etc/samba/smb.conf', comments_struct => [['^\s*#'], ['^\s*;']]); $samba->{libconf}{disable_inline_comments} = 1; @@ -145,19 +145,19 @@ $o->{pages} = { { label => N("Security:"), fixed_val => \$o->{var}{wiz_security} }, { label => N("Wins support:"), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno }, { label => N("admin users:"), val => \$o->{var}{wiz_admin_users}, help => N("root \@adm") }, - { label => N("Os level:"), fixed_val => \$o->{var}{wiz_oslevel}, help =>N("The global os level option dictates the operating system level at which Samba will masquerade during a browser election. If you wish to have Samba win an election and become the master browser, you can set the level above that of the operating system on your network with the highest current value. ie: os level = 34") }, + { label => N("Os level:"), fixed_val => \$o->{var}{wiz_oslevel}, help => N("The global os level option dictates the operating system level at which Samba will masquerade during a browser election. If you wish to have Samba win an election and become the master browser, you can set the level above that of the operating system on your network with the highest current value. ie: os level = 34") }, # { label => N("Use LDAP Passdb backend"), val => \$o->{var}{wiz_passdb_backend_yn}, fixed_list => \@yesorno }, ], complete => sub { if (!$o->{var}{wiz_domain_master}) { $::in->ask_warn(N("Error"), N("The domain is wrong.")); - return 1 - } else { return 0 }; + return 1; + } else { return 0 } }, next => 'ask_workgroup', }, bdc => { - 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."), + 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."), pre => sub { $o->{var}{wiz_domain_master} = "no"; $o->{var}{wiz_security} = "user"; @@ -169,20 +169,20 @@ $o->{pages} = { $o->{var}{wiz_domain_logons} = "yes"; $o->{var}{wiz_wins_server} = ""; if ($samba->{global}{'name resolve order'}) { - $o->{var}{wiz_name_resolve_order} = $samba->{global}{'name resolve order'} + $o->{var}{wiz_name_resolve_order} = $samba->{global}{'name resolve order'}; } else { $o->{var}{wiz_name_resolve_order} = "lmhosts host wins bcast" } $o->{var}{wiz_dns_proxy} = "no"; }, data => [ { label => N("Wins support:"), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno }, - { label => N("Wins server:"), val => \$o->{var}{wiz_wins_server}, help => N("This specifies the IP address (or DNS name: IP address for preference) of the WINS server that nmbd(8) should register with. If you have a WINS server on your network then you should set this to the WINS server\'s IP.") }, + { label => N("Wins server:"), val => \$o->{var}{wiz_wins_server}, help => N("This specifies the IP address (or DNS name: IP address for preference) of the WINS server that nmbd(8) should register with. If you have a WINS server on your network then you should set this to the WINS server's IP.") }, { label => N("Wins name resolve order:"), val => \$o->{var}{wiz_name_resolve_order} }, ], complete => sub { - if ($o->{var}{wiz_wins_support} =~ /no/ and !$o->{var}{wiz_wins_server} ) { + if ($o->{var}{wiz_wins_support} =~ /no/ and !$o->{var}{wiz_wins_server}) { $::in->ask_warn(N("Error"), N("Your server doesn't support Wins. Please provide a Wins server, or leave blank Wins Support entry.")); - return 1 - } else { return 0 }; + return 1; + } else { return 0 } }, next => 'ask_bdc2', }, @@ -201,15 +201,15 @@ $o->{pages} = { next => 'ldap_conf', }, member => { - name => N("Member of a domain") . "\n\n" . ("Share data, users home or printers.") . "\n" . N("Please enter the domain you want to join."), + name => N("Member of a domain") . "\n\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'}; if ($samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend_yn} = "yes" + $o->{var}{wiz_passdb_backend_yn} = "yes"; } else { - $o->{var}{wiz_passdb_backend_yn} = "no" + $o->{var}{wiz_passdb_backend_yn} = "no"; } }, post => sub { @@ -225,8 +225,8 @@ $o->{pages} = { complete => sub { if (!$o->{var}{wiz_password_server}) { $::in->ask_warn(N("Error"), N("Please provide the password server.")); - return 1 - } else { return 0 }; + return 1; + } else { return 0 } }, next => 'ask_workgroup', }, @@ -238,20 +238,20 @@ $o->{pages} = { $o->{var}{wiz_ldap_suffix} = $samba->{global}{'ldap suffix'}; } else { $o->{var}{wiz_ldap_suffix} = "dc=mydomain, dc=com" } if ($samba->{global}{'ldap admin dn'}) { - $o->{var}{wiz_ldap_admin_dn} ||= $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,dc=mydomain,dc=com" } if ($samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'} + $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'}; } else { $o->{var}{wiz_passdb_backend} = "ldapsam:ldap://localhost" } - if($samba->{global}{'ldap machine suffix'}) { - $o->{var}{wiz_ldap_machine_suffix} = $samba->{global}{'ldap machine suffix'} } - else { $o->{var}{wiz_ldap_machine_suffix} = "ou=Computers" } - if($samba->{global}{'ldap group suffix'}) { - $o->{var}{wiz_ldap_group_suffix} = $samba->{global}{'ldap group suffix'} } - else { $o->{var}{wiz_ldap_group_suffix} = "ou=Groups" } - if($samba->{global}{'ldap user suffix'}) { - $o->{var}{wiz_ldap_user_suffix} = $samba->{global}{'ldap user suffix'} } - else { $o->{var}{wiz_ldap_user_suffix} = "ou=Users" } + if ($samba->{global}{'ldap machine suffix'}) { + $o->{var}{wiz_ldap_machine_suffix} = $samba->{global}{'ldap machine suffix'}; + } else { $o->{var}{wiz_ldap_machine_suffix} = "ou=Computers" } + if ($samba->{global}{'ldap group suffix'}) { + $o->{var}{wiz_ldap_group_suffix} = $samba->{global}{'ldap group suffix'}; + } else { $o->{var}{wiz_ldap_group_suffix} = "ou=Groups" } + if ($samba->{global}{'ldap user suffix'}) { + $o->{var}{wiz_ldap_user_suffix} = $samba->{global}{'ldap user suffix'}; + } else { $o->{var}{wiz_ldap_user_suffix} = "ou=Users" } }, data => [ { label => N("Passdb backend"), val => \$o->{var}{wiz_passdb_backend}, help => "ldapsam:ldap://" }, @@ -288,22 +288,24 @@ $o->{pages} = { pre => sub { $o->{var}{wiz_workgroup} ||= $samba->{global}{workgroup}; $o->{var}{wiz_netbios} ||= $samba->{global}{netbios}; + $o->{var}{wiz_netbios_name} ||= $samba->{global}{"netbios name"}; }, data => [ { label => N("Workgroup:"), val => \$o->{var}{wiz_workgroup} }, + { label => N("Netbios name:"), val => \$o->{var}{wiz_netbios_name} }, ], complete => sub { if (!$o->{var}{wiz_workgroup}) { $::in->ask_warn(N("Error"), N("The Workgroup is wrong.")); - return 1 - } else { return 0 }; + return 1; + } else { return 0 } }, next => 'ask_banner', }, ask_banner => { name => N("Server Banner.") . "\n\n" . N("The banner is the way this server will be described in the Windows workstations."), pre => sub { - $o->{var}{wiz_banner} ||= $samba->{global}{'server string'} + $o->{var}{wiz_banner} ||= $samba->{global}{'server string'}; }, data => [ { label => N("Banner:"), val => \$o->{var}{wiz_banner}, help => "Samba Server %v" }, @@ -311,8 +313,8 @@ $o->{pages} = { complete => sub { if (!$o->{var}{wiz_banner}) { $::in->ask_warn(N("Error"), N("The Server Banner is incorrect.")); - return 1 - } else { return 0 }; + return 1; + } else { return 0 } }, next => 'ask_log', }, @@ -369,7 +371,7 @@ sub new { sub check() { $> and return 1; - $wiz->{net}->is_dhcp() and return 2; + $wiz->{net}->is_dhcp and return 2; 0; } @@ -380,8 +382,8 @@ sub global_special_options() { # detect Samba type 3 is standalone if ($o->{var}{wiz_type} == "3") { - $samba->{global}{'security'} = "share"; - exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'}; + $samba->{global}{security} = "share"; + exists $samba->{global}{domain_master} and delete $samba->{global}{domain_master}; exists $samba->{global}{'domain logons'} and delete $samba->{global}{'domain logons'}; exists $samba->{global}{'wins support'} and delete $samba->{global}{'wins support'}; exists $samba->{global}{'os level'} and delete $samba->{global}{'os level'}; @@ -451,7 +453,7 @@ sub map_unxigroup_ntgroup { sub write_conf_restart_smb { $samba->write_conf("/etc/samba/smb.conf"); if (services::is_service_running('smb')) { - services::restart('smb') + services::restart('smb'); } else { services::start('smb') } } @@ -463,6 +465,7 @@ sub do_it { my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server...")); # global section $samba->{global}{workgroup} = $o->{var}{wiz_workgroup}; + exists $o->{var}{wiz_netbios_name} and $samba->{global}{"netbios name"} = $o->{var}{wiz_netbios_name}; $samba->{global}{'server string'} = $o->{var}{wiz_banner}; # add special global options -- cgit v1.2.1