diff options
-rw-r--r-- | ldap_wizard/Ldap.pm | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/ldap_wizard/Ldap.pm b/ldap_wizard/Ldap.pm index 806d9d84..1d43e3cd 100644 --- a/ldap_wizard/Ldap.pm +++ b/ldap_wizard/Ldap.pm @@ -21,11 +21,10 @@ use Net::LDAP::Util qw(ldap_error_text); #} my $o = { - name => N("Add POSIX account"), + name => N("Configuration OpenLDAP Server "), var => { defou => 'ou=Users', - srv => '', - dom => 'mandrakesoft.com', + srv => 'localhost', suffix => '', rootdn => '', rootpass => '', @@ -74,25 +73,25 @@ if (-f $conf_file) { } my %level = ( - 1 => N("Configure a LDAP server"), - 2 => N("Add user in LDAP server"), + 1 => N("Configure OpenLDAP server"), + 2 => N("Add user in OpenLDAP server"), ); $o->{pages} = { welcome => { - name => N("LDAP configuration wizard") . "\n\n" . N("Setup a LDAP server."), + name => N("OpenLDAP configuration wizard") . "\n\n" . N("Setup a OpenLDAP server."), no_back => 1, pre => sub { $o->{var}{wiz_level} ||= 1; }, post => sub { if ($o->{var}{wiz_level} == 2) { - ! -f $conf_file and $::in->ask_warn(N("Error"), N("You must setup a LDAP server first.")) and return 'set_srv'; + ! -f $conf_file and $::in->ask_warn(N("Error"), N("You must setup a OpenLDAP server first.")) and return 'set_srv'; return 'add_userposix'; } if ($o->{var}{wiz_level} == 1) { - ! -f $conf_file and $::in->ask_yesorno(N("Information "), N("wold you like save an existing OpenLDAP configuration ?")) and return 'sav_old_conf'; + ! -f $conf_file and $::in->ask_yesorno(N("Information "), N("would you like save an existing OpenLDAP configuration ?")) and return 'sav_old_conf'; return 'set_srv'; } }, @@ -104,7 +103,8 @@ $o->{pages} = { sav_old_conf => { name => N("Save an existing configuration"), - next => 'set_srv' + post => \&sav_conf, + next => 'set_srv' }, add_userposix => { @@ -123,7 +123,7 @@ $o->{pages} = { return 1; } if (!$o->{var}{uid}) { - $::in->ask_warn(N("Error"), N("You must enter a valid User Name.")); + $::in->ask_warn(N("Error"), N("You must enter a valid User Name.")); return 1; } } @@ -295,8 +295,10 @@ sub init_ldap { $o->{var}{rootdn} =~ /cn=(\w+),/ and my $cnadmin = $1; +print "$o->{var}{rootdn}\n"; +print "$o->{var}{rootpass}\n"; my $LDAP; - open($LDAP, "| ldapadd -x -D '$o->{var}{rootdn}' -w $o->{var}{rootpass}"); + open($LDAP, "| ldapadd -x -h $o->{var}{srv} -D '$o->{var}{rootdn}' -w $o->{var}{rootpass}"); print $LDAP <<RootLdif; dn: $o->{var}{suffix} @@ -338,12 +340,13 @@ RootLdif sub do_it_user_add { return if $::testing; - my $_ldap = ldap_connect($o); my $_mesg = add_user($o); } -sub do_it_modif { - modif_krb5($o); +sub sav_conf { + system("slapcat -l /root/ldap-sav.ldiff"); + system("cp /etc/openldap/slapd.conf /root/"); + system("rm -fr /var/lib/ldap/*") } sub new { |