diff options
Diffstat (limited to 'ldap_wizard/Ldap.pm')
-rw-r--r-- | ldap_wizard/Ldap.pm | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/ldap_wizard/Ldap.pm b/ldap_wizard/Ldap.pm index cf5b8b06..6a3bd768 100644 --- a/ldap_wizard/Ldap.pm +++ b/ldap_wizard/Ldap.pm @@ -47,8 +47,6 @@ my $o = { nom => '', prenom => '', }, - needed_rpm => [ 'openldap-server' ], - defaultimage => "/usr/share/wizards/proxy_wizard/images/proxy.png" }; @@ -57,7 +55,7 @@ my $ldap_suffix=join(',dc=', split(/\./, chomp_(`hostname -f`))); $ldap_suffix =~ s/[^,]*,//; my $conf_file = "/etc/sysconfig/ldapconf"; my $LDAPCONF = "/etc/openldap/slapd.conf"; - +my $rootdn_cn = "Admin"; ##### Read conf file is exist my $hostname = `hostname`; @@ -67,7 +65,6 @@ if (-f $conf_file) { my %conf = getVarsFromSh($conf_file); $o->{var}{suffix} = $conf{suffix}; $o->{var}{rootdn} = $conf{rootdn}; - $o->{var}{rootpass} = $conf{rootpass}; $o->{var}{srv} = $conf{srv}; $o->{var}{defou} = $conf{users}; } else { @@ -144,11 +141,12 @@ $o->{pages} = { name => N("Configuring LDAP Server"), data => [ { label => N("LDAP Suffix:\n ex: dc=example,dc=com\n"), val => \$o->{var}{suffix}, help => N("aide p") }, - { label => N("LDAP Administrator:\n ex: cn=root,dc=example,dc=com"), val => \$o->{var}{rootdn}, help => N("aide p") }, + { label => N("LDAP Administrator:\n "), val => \$o->{var}{rootdn}, help => N("aide p") }, { label => N("LDAP Password:"), hidden => 1, val => \$o->{var}{rootpass}, help => N("aide p") }, { label => N("LDAP Password (again):"), hidden => 1, val => \$o->{var}{rootpass2}, help => N("aide p") }, ], complete => sub { + if (!$o->{var}{suffix}) { $::in->ask_warn(N("Error"), N("You must enter a suffix for LDAP.")); return 1; @@ -161,8 +159,9 @@ $o->{pages} = { $::in->ask_warn(N("Error"), N("The passwords do not match")); return 1; } + #$o->{var}{rootdn} = "cn=".$rootdn_cn.$o->{var}{suffix}, }, - next => 'summary_set_srv', + next => 'summary_set_srv' }, summary_add_user => { name => N("Confirmation of the user to create"), @@ -181,10 +180,7 @@ $o->{pages} = { { label => N("Organisation LDAP:"), type => 'field', fixed_val => \$o->{var}{suffix} }, { label => N("Administrator LDAP:"), type => 'field', fixed_val => \$o->{var}{rootdn} }, # { label => N("Arbo LDAP:"), type => 'field', fixed_val => " " }, - { label => N(""), type => 'field', fixed_val => $o->{var}{suffix} }, - { label => N(""), type => 'field', fixed_val => " ou=hosts" }, - { label => N(""), type => 'field', fixed_val => " ou=groups" }, - { label => N(""), type => 'field', fixed_val => " ou=users" }, + { label => N(""), type => 'field', fixed_val => \$o->{var}{suffix} }, ], post => \&do_it_setldap, next => 'end' @@ -206,6 +202,7 @@ $o->{pages} = { }; sub do_it_setldap { + return if $::testing; if (!-f $LDAPCONF) { die "no $LDAPCONF found"; @@ -242,11 +239,11 @@ sub do_it_setldap { my $cryptpass = crypt($o->{var}{rootpass}, "crypt"); if (any { /^rootpw/ } cat_($LDAPCONF)) { substInFile { - #s/rootpw.*/rootpw $cryptpass/; + #s/rootpw.*/rootpw $cryptpass/; s/rootpw.*/rootpw $o->{var}{rootpass}/; } $LDAPCONF; } else { - #append_to_file($LDAPCONF, "rootpw {CRYPT}$cryptpass"); + #append_to_file($LDAPCONF, "rootpw {CRYPT}$cryptpass"); append_to_file($LDAPCONF, "rootpw $o->{var}{rootpass}"); } |