[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts DSCreate.pm.in, 1.8, 1.9

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Dec 17 20:08:49 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20094/ldapserver/ldap/admin/src/scripts

Modified Files:
	DSCreate.pm.in 
Log Message:
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



Index: DSCreate.pm.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/DSCreate.pm.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DSCreate.pm.in	18 Oct 2007 01:41:13 -0000	1.8
+++ DSCreate.pm.in	17 Dec 2007 20:08:46 -0000	1.9
@@ -459,10 +459,14 @@
 
 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 @@
         }
         
         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 @@
         }
         # $templdif now contains the ldif to import
         $ldiffile = $templdif;
+        $istempldif = 1;
     }
     if (!$ldiffile) {
         return ();
@@ -503,8 +509,12 @@
     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);




More information about the Fedora-directory-commits mailing list