From d6b26d6782affa8b27daf351fc60dd50c7583b93 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Thu, 11 Mar 2004 10:54:15 +0000 Subject: fix pb of password add test to password (mismatch or null password) --- kolab_wizard/Kolab.pm | 85 ++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 39 deletions(-) (limited to 'kolab_wizard') diff --git a/kolab_wizard/Kolab.pm b/kolab_wizard/Kolab.pm index 63172bb3..efab5d30 100755 --- a/kolab_wizard/Kolab.pm +++ b/kolab_wizard/Kolab.pm @@ -30,8 +30,8 @@ my $wiz = new MDK::Wizard::Wizcommon; my $HOSTNAME = chomp_(`hostname`); my $IPSERVER = $wiz->{net}->itf_get("IPADDR"); if (!$IPSERVER) { - my $interface = 'eth0'; - ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m; + my $interface = 'eth0'; + ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m; } my $DOMAINNAME = chomp_(`domainname`); my $kolab_config = "/etc/kolab/kolab.conf"; @@ -51,46 +51,48 @@ my $o = { password => '', }, needed_rpm => [ 'kolab-server', 'postfix', 'openldap-servers', 'proftpd' ], -# defaultimage => $ENV{__WIZ_HOME__}, + # defaultimage => $ENV{__WIZ_HOME__}, }; $o->{pages} = { welcome => { - name => N("Welcome to the Kolab Groupware server configuration Wizard.") . "\n\n" . N("Kolab is a secure, scalable and reliable groupware server. Some of the major features include: a web administration interface, a shared address book with provision for mailbox users as well as contacts and a POP3 as well as IMAP4(rev1) access to mail") . "\n\n" . N("Warning: Kolab needs to configure many other services: Proftpd, LDAP, Cyrus, Postfix, Imap, Saslauth. Wizard will make a backup of all your previous configuration files for these services."), + name => N("Welcome to the Kolab Groupware server configuration Wizard.") . "\n\n" . N("Kolab is a secure, scalable and reliable groupware server. Some of the major features include: a web administration interface, a shared address book with provision for mailbox users as well as contacts and a POP3 as well as IMAP4(rev1) access to mail") . "\n\n" . N("Warning: Kolab needs to configure many other services: Proftpd, LDAP, Cyrus, Postfix, Imap, Saslauth. Wizard will make a backup of all your previous configuration files for these services."), no_back => 1, next => 'password', }, -# hostname => { -# name => N("Hostname"), -# data => [ -# { label => N("Hostname:"), val => \$o->{var}{HOSTNAME} }, -# { label => N("Mail domain:"), val => \$o->{var}{maildomain} }, -# ], -# next => 'password', -# }, + # hostname => { + # name => N("Hostname"), + # data => [ + # { label => N("Hostname:"), val => \$o->{var}{HOSTNAME} }, + # { label => N("Mail domain:"), val => \$o->{var}{maildomain} }, + # ], + # next => 'password', + # }, password => { name => N("Enter pasword for the manager account of Kolab server."), + complete => sub { + if ($o->{var}{password} ne $o->{var}{password2} || $o->{var}{password} eq "") { + $::in->ask_warn(N("Error:"), N("Password mismatch, or null password, please correct.")); + return 1; + } + }, data => [ - { label => N("Password:"), val => \$o->{var}{password} }, - { label => N("Password again:"), val => \$o->{var}{password2} }, + { + label => N("Password:"), val => \$o->{var}{password} }, + { + label => N("Password again:"), val => \$o->{var}{password2} }, ], - post => \&check_password, next => 'summary', }, - warning => { - name => N("Warning.") . "\n\n", - next => 'summary' - }, - error => { - name => N("Error.") . "\n\n", - next => 'config', - }, summary => { name => N("The wizard will now configure Kolab server with these parameters"), data => [ - { label => N("Hostname:"), fixed_val => \$o->{var}{HOSTNAME} }, - { label => N("Password:"), fixed_val => \$o->{var}{password} }, - { label => N("Mail domain:"), fixed_val => \$o->{var}{maildomain} }, + { + label => N("Hostname:"), fixed_val => \$o->{var}{HOSTNAME} }, + { + label => N("Password:"), fixed_val => \$o->{var}{password} }, + { + label => N("Mail domain:"), fixed_val => \$o->{var}{maildomain} }, ], post => \&do_it, next => 'end', @@ -99,18 +101,18 @@ $o->{pages} = { name => N("Congratulations") . "\n\n" . N("The kolab server is now configured and running. Log in as 'manager' with the password you entered at https://127.0.0.1/kolab/admin/"), end => 1, next => 0, - }, -}; + }, + }; sub new { - my ($class) = @_; - bless { - o => $o, - }, $class; + my ($class) = @_; + bless { + o => $o, + }, $class; } sub backup_conf { - my @conf = qw(/etc/postfix/main.cf + my @conf = qw(/etc/postfix/main.cf /etc/postfix/master.cf /etc/postfix/transport /etc/postfix/virtual @@ -120,15 +122,15 @@ sub backup_conf { /etc/openldap/slapd.conf /etc/sysconfig/saslauthd ); - - foreach (@conf) { - -f $_ and MDK::Common::cp_af($_, $_.".orig"); - } - cp_af("/var/lib/ldap/", "/var/lib/ldap.orig"); + + foreach (@conf) { + -f $_ and MDK::Common::cp_af($_, $_.".orig"); + } + cp_af("/var/lib/ldap/", "/var/lib/ldap.orig"); } sub check_password { - $o->{var}{password} ne $o->{var}{password2} or return 'passwd'; + } @@ -138,6 +140,7 @@ sub do_it { my $w = $in->wait_message(N("Kolab server"), N("Configuring Kolab server on your system...")); backup_conf(); system("service $_ stop") foreach qw(ldap saslauthd cyrus-imapd httpd postfix); + system("groupadd -g 60001 kolab"); open(F, "|/usr/sbin/kolab_bootstrap.real -b\n"); print F "$o->{var}{HOSTNAME} @@ -146,6 +149,10 @@ $o->{var}{password} "; close F; + substInFile { + s/bind_pw :.*/bind_pw : $o-{var}{password}/; + } $kolab_config ; + system("chkconfig --level 35 $_ off") foreach qw(ldap saslauthd cyrus-imapd httpd postfix); system("service kolab-server restart"); undef $w; -- cgit v1.2.1