summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-10-17 15:56:53 +0000
committerRich Megginson <rmeggins@redhat.com>2007-10-17 15:56:53 +0000
commit878c163528ed089dae1edb8295a6dd4ae842b9b4 (patch)
tree8115a780e28d31027f4561caad97538b59c79461
parent5f8cc8fc690ccf7f5dff4c8c6517fb3cde6b12c5 (diff)
downloadds-878c163528ed089dae1edb8295a6dd4ae842b9b4.tar.gz
ds-878c163528ed089dae1edb8295a6dd4ae842b9b4.tar.xz
ds-878c163528ed089dae1edb8295a6dd4ae842b9b4.zip
Resolves: bug 333291
Bug Description: Do not allow direct migration if the source db index has old IDL format Reviewed by: nkinder (Thanks!) Fix Description: Just before the attempt to copy the database directories, look at the DBVERSION file from the source. If it is determined that the source version is too old, just exit migration and output a helpful error message. Platforms tested: RHEL4 i386 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
-rw-r--r--ldap/admin/src/scripts/DSMigration.pm.in27
-rw-r--r--ldap/admin/src/scripts/migrate-ds.res6
2 files changed, 33 insertions, 0 deletions
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index d30cb097..a617e8c4 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -241,10 +241,37 @@ my %transformAttr =
'nsslapd-idl-switch' => \&migIdlSwitch
);
+sub getDBVERSION {
+ my $olddbdir = shift;
+ my $data = shift;
+
+ open DBVERSION, "$olddbdir/DBVERSION" or
+ return ('error_reading_dbversion', $olddbdir, $!);
+ my $line = <DBVERSION>;
+ close DBVERSION;
+ chomp($line);
+ my @foo = split("/", $line);
+ $data = \@foo;
+ return ();
+}
+
sub copyDatabaseDirs {
my $srcdir = shift;
my $destdir = shift;
my $filesonly = shift;
+ my @errs;
+
+ # check old DBVERSION file
+ my @verinfo;
+ if (@errs = getDBVERSION($srcdir, \@verinfo)) {
+ return @errs;
+ }
+
+ if ((($verinfo[0] =~ /^netscape/i) or ($verinfo[0] =~ /^iplanet/i)) and
+ (($verinfo[1] =~ /^6/) or ($verinfo[1] =~ /^5/) or ($verinfo[1] =~ /^4/))) {
+ return ('error_database_too_old', $srcdir, @verinfo);
+ }
+
if (-d $srcdir && ! -d $destdir && !$filesonly) {
debug(1, "Copying database directory $srcdir to $destdir\n");
if (system ("cp -p -r $srcdir $destdir")) {
diff --git a/ldap/admin/src/scripts/migrate-ds.res b/ldap/admin/src/scripts/migrate-ds.res
index f739196d..4051ce76 100644
--- a/ldap/admin/src/scripts/migrate-ds.res
+++ b/ldap/admin/src/scripts/migrate-ds.res
@@ -25,3 +25,9 @@ to the migration instructions for help with how to do this.\n\n
fixing_integer_attr_index = The index for the attribute '%s' in the database directory '%s' will be removed and re-created.\n\n
error_removing_index_file = Could not remove the index file '%s'. Error: %s\n\n
error_recreating_index_file = Could not re-create the index file '%s'. Error: %s\n\n
+error_reading_dbversion = Could not read the old database version information from '%s'. Error: %s\n\n
+error_database_too_old = The database at '%s' is version '%s/%s'.\
+This version cannot be migrated using the database binaries. You must\
+first convert the databases to LDIF format and use the cross platform\
+migration procedure. This procedure is documented in the migration\
+guide and in the help for this script.\n\n