diff options
author | Rich Megginson <rmeggins@redhat.com> | 2007-12-17 20:08:46 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2007-12-17 20:08:46 +0000 |
commit | d396eab31583fd8f32484cd55f0c394133afb32b (patch) | |
tree | a35c27fa9e7cf18d0f78a8d9e39e05b4894f641e | |
parent | 8fd21035b334dac07d4001aed4668dc4243287e7 (diff) | |
download | ds-d396eab31583fd8f32484cd55f0c394133afb32b.tar.gz ds-d396eab31583fd8f32484cd55f0c394133afb32b.tar.xz ds-d396eab31583fd8f32484cd55f0c394133afb32b.zip |
Resolves: bug 425861
Bug Description: Instance creation through console is broken
Reviewed by: nhosoi (Thanks!)
Fix Description: This was caused by my fix for bug 420751. When I added the as_uid to fix the ACI for the admin user, I did not add the mapping everywhere it was used. Unfortunately, I found that the code I added it to could only be used with a live connection to the new directory server, not a FileConn to the dse.ldif. So I had to add a new function to add this ACI to the new root suffix after the server had been started.
Another problem with instance creation was that the org entries were not being added when creating a new instance in the console. The default should be to create them if nothing else was specified.
Another problem was that instance creation was leaving temp ldif files around.
I also had to make sure ServerAdminID was specified everywhere it was needed by dirserver.map, or this would also have broken ds_remove.
Platforms tested: RHEL5 x86_64
Flag Day: Yes - autotool file change in adminserver
Doc impact: no
-rw-r--r-- | ldap/admin/src/scripts/DSCreate.pm.in | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in index b7f037da..c32864ee 100644 --- a/ldap/admin/src/scripts/DSCreate.pm.in +++ b/ldap/admin/src/scripts/DSCreate.pm.in @@ -459,10 +459,14 @@ my %suffixTable = ( sub initDatabase { my $inf = shift; + my $istempldif = 0; # If the user has specified an LDIF file to use to initialize the database, # load it now my $ldiffile = $inf->{slapd}->{InstallLdifFile}; - if ($ldiffile && -f $ldiffile) { + if ($ldiffile =~ /none/i) { + debug(1, "No ldif file or org entries specified - no initial database will be created\n"); + return (); + } elsif ($ldiffile && -f $ldiffile) { debug(1, "Loading initial ldif file $ldiffile\n"); } elsif (($inf->{slapd}->{Suffix} =~ /^(.*?)=/) && $suffixTable{$1}) { my @errs; @@ -477,7 +481,8 @@ sub initDatabase { } my @ldiffiles = ($template, "$inf->{General}->{prefix}@templatedir@/template-baseacis.ldif"); - if (exists($inf->{slapd}->{InstallLdifFile}) and + # default is to create org entries unless explicitly set to none + if (!exists($inf->{slapd}->{InstallLdifFile}) or ($inf->{slapd}->{InstallLdifFile} =~ /suggest/i)) { push @ldiffiles, "$inf->{General}->{prefix}@templatedir@/template.ldif"; } @@ -495,6 +500,7 @@ sub initDatabase { } # $templdif now contains the ldif to import $ldiffile = $templdif; + $istempldif = 1; } if (!$ldiffile) { return (); @@ -503,8 +509,12 @@ sub initDatabase { my $cmd = "$inf->{slapd}->{inst_dir}/ldif2db -n userRoot -i \'$ldiffile\'"; $? = 0; # clear error condition my $output = `$cmd 2>&1`; - if ($?) { - return ('error_importing_ldif', $ldiffile, $?, $output); + my $result = $?; + if ($istempldif) { + unlink($ldiffile); + } + if ($result) { + return ('error_importing_ldif', $ldiffile, $result, $output); } debug(1, $output); |