summaryrefslogtreecommitdiffstats
path: root/ldap_wizard
diff options
context:
space:
mode:
authorVicent Guardiola <vguardiola@mandriva.com>2004-08-13 03:46:45 +0000
committerVicent Guardiola <vguardiola@mandriva.com>2004-08-13 03:46:45 +0000
commitdf0ba8098a6c09b5a6b587568631fbed9503b8ac (patch)
treee306e6c8331940a44884d693b43529b38263d0ea /ldap_wizard
parent5290ef2fb7a9fe8ae5562ca2af8bd9a64f7a029b (diff)
downloaddrakwizard-df0ba8098a6c09b5a6b587568631fbed9503b8ac.tar
drakwizard-df0ba8098a6c09b5a6b587568631fbed9503b8ac.tar.gz
drakwizard-df0ba8098a6c09b5a6b587568631fbed9503b8ac.tar.bz2
drakwizard-df0ba8098a6c09b5a6b587568631fbed9503b8ac.tar.xz
drakwizard-df0ba8098a6c09b5a6b587568631fbed9503b8ac.zip
Add function for save an old config
Diffstat (limited to 'ldap_wizard')
-rw-r--r--ldap_wizard/Ldap.pm31
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 {