Browse Source

Resolves: bug 252190
Bug Description: 7.1 to 8.0 Migration Bug
Reviewed by: nhosoi (Thanks!)
Files: see diff
Branch: HEAD
Fix Description: Although the directory server always creates key/cert databases, the admin server does not. So, just log a message and skip if they do not exist. Also was missing some message resources for various errors.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no

Rich Megginson 18 năm trước cách đây
mục cha
commit
eeded7b8d3
2 tập tin đã thay đổi với 35 bổ sung15 xóa
  1. 30 15
      ldap/admin/src/scripts/Migration.pm.in
  2. 5 0
      ldap/admin/src/scripts/migrate-ds.res

+ 30 - 15
ldap/admin/src/scripts/Migration.pm.in

@@ -293,24 +293,39 @@ sub migrateSecurityFiles {
         $self->msg('new_secdir_error', $destdir, $!);
         return 0;
     } else {
-        $self->log($INFO, "Copying $oldroot/alias/$inst-cert8.db to $destdir/cert8.db\n");
-        if (system ("cp -p $oldroot/alias/$inst-cert8.db $destdir/cert8.db")) {
-            $self->msg($FATAL, 'error_copying_certdb', "$oldroot/alias/$inst-cert8.db",
-                       "$destdir/cert8.db", $!);
-            return 0;
+        if (-f "$oldroot/alias/$inst-cert8.db") {
+            $self->log($INFO, "Copying $oldroot/alias/$inst-cert8.db to $destdir/cert8.db\n");
+            if (system ("cp -p $oldroot/alias/$inst-cert8.db $destdir/cert8.db")) {
+                $self->msg($FATAL, 'error_copying_certdb', "$oldroot/alias/$inst-cert8.db",
+                           "$destdir/cert8.db", $!);
+                return 0;
+            }
+        } else {
+            $self->log($DEBUG, "No file to migrate: $oldroot/alias/$inst-cert8.db\n");
         }
-        $self->log($INFO, "Copying $oldroot/alias/$inst-key3.db to $destdir/key3.db\n");
-        if (system ("cp -p $oldroot/alias/$inst-key3.db $destdir/key3.db")) {
-            $self->msg($FATAL, 'error_copying_keydb', "$oldroot/alias/$inst-key3.db",
-                       "$destdir/key3.db", $!);
-            return 0;
+
+        if (-f "$oldroot/alias/$inst-key3.db") {
+            $self->log($INFO, "Copying $oldroot/alias/$inst-key3.db to $destdir/key3.db\n");
+            if (system ("cp -p $oldroot/alias/$inst-key3.db $destdir/key3.db")) {
+                $self->msg($FATAL, 'error_copying_keydb', "$oldroot/alias/$inst-key3.db",
+                           "$destdir/key3.db", $!);
+                return 0;
+            }
+        } else {
+            $self->log($DEBUG, "No file to migrate: $oldroot/alias/$inst-key3.db\n");
         }
-        $self->log($INFO, "Copying $oldroot/alias/secmod.db to $destdir/secmod.db\n");
-        if (system ("cp -p $oldroot/alias/secmod.db $destdir/secmod.db")) {
-            $self->msg($FATAL, 'error_copying_secmoddb', "$oldroot/alias/secmod.db",
-                       "$destdir/secmod.db", $!);
-            return 0;
+
+        if (-f "$oldroot/alias/secmod.db") {
+            $self->log($INFO, "Copying $oldroot/alias/secmod.db to $destdir/secmod.db\n");
+            if (system ("cp -p $oldroot/alias/secmod.db $destdir/secmod.db")) {
+                $self->msg($FATAL, 'error_copying_secmoddb', "$oldroot/alias/secmod.db",
+                           "$destdir/secmod.db", $!);
+                return 0;
+            }
+        } else {
+            $self->log($DEBUG, "No file to migrate: $oldroot/alias/secmod.db\n");
         }
+
         if (-f "$oldroot/alias/$inst-pin.txt") {
             $self->log($INFO, "Copying $oldroot/alias/$inst-pin.txt to $destdir/pin.txt\n");
             if (system ("cp -p $oldroot/alias/$inst-pin.txt $destdir/pin.txt")) {

+ 5 - 0
ldap/admin/src/scripts/migrate-ds.res

@@ -12,3 +12,8 @@ error_copying_dbfile = Could not copy database file '%s' to '%s'.  Error: %s\n
 error_dbsrcdir_not_exist = Could not copy from the database source directory '%s' because it does not exist.  Please check your configuration.\n
 error_no_instances = Could not find any instances in the old directory '%s' to migrate.\n
 error_removing_temp_db_files = Could not remove the temporary db files in '%s' to clear the directory in preparation for the migrated db files.  Error: %s\n
+error_copying_certdb = Could not copy the certificate database file '%s' to '%s'.  Error: %s\n
+error_copying_keydb = Could not copy the private key database file '%s' to '%s'.  Error: %s\n
+error_copying_secmoddb = Could not copy the security module database file '%s' to '%s'.  Error: %s\n
+error_copying_pinfile = Could not copy the key database PIN file '%s' to '%s'.  Error: %s\n
+error_copying_certmap = Could not copy the client certificate mapping file '%s' to '%s'.  Error: %s\n