diff options
Diffstat (limited to 'ldap/admin/src/scripts')
| -rw-r--r-- | ldap/admin/src/scripts/DSMigration.pm.in | 28 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/FileConn.pm | 5 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/Migration.pm.in | 1 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/Util.pm.in | 1 |
4 files changed, 30 insertions, 5 deletions
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in index d7a6336e..fd8ac04d 100644 --- a/ldap/admin/src/scripts/DSMigration.pm.in +++ b/ldap/admin/src/scripts/DSMigration.pm.in @@ -269,6 +269,7 @@ sub migrateNetscapeRoot { my $in = new Mozilla::LDAP::LDIF(*MYLDIF); while (my $ent = readOneEntry $in) { my $dn = $ent->getDN(); + next if (!$dn); # netscaperoot should not have the empty dn $dn =~ s/\bNetscape\b/@capbrand@/g; $ent->setDN($dn); foreach my $attr (keys %{$ent}) { @@ -305,6 +306,11 @@ sub migrateDatabases { my $deleteflag = 0; if ($fname =~ /NetscapeRoot.ldif$/) { $fname = migrateNetscapeRoot($fname); + # make sure $fname is owned by the server user + my $cfgent = $dest->search("cn=config", "base", "(objectclass=*)"); + my $user = $cfgent->getValues('nsslapd-localuser'); + my $uid = getpwnam $user; + chown $uid, -1, $fname; $deleteflag = 1; } my $cmd = "$inst_dir/ldif2db -n \"$dbname\" -i \"$fname\""; @@ -443,7 +449,14 @@ sub fixAttrsInEntry { for my $attr (keys %{$ent}) { my $lcattr = lc $attr; if ($transformAttr{$lcattr}) { - $ent->setValues($attr, &{$transformAttr{$lcattr}}($ent, $attr, $mig, $inst)); + my $newval = &{$transformAttr{$lcattr}}($ent, $attr, $mig, $inst); + if (!$newval) { + debug(2, "Removing attribute $attr from entry ", $ent->getDN(), "\n"); + $ent->remove($attr); + } else { + debug(2, "Setting new value $newval for attribute $attr in entry ", $ent->getDN(), "\n"); + $ent->setValues($attr, $newval); + } } } } @@ -484,8 +497,13 @@ sub mergeEntries { if (!$innewonly{$attr}) { my $oldval = $old->getValues($attr); my $newval = &{$transformAttr{$lcattr}}($old, $attr, $mig, $inst); - $new->setValues($attr, $newval); - debug(3, "mergeEntries: transformed old value $oldval to $newval\n"); + if (!$newval) { + debug(3, "Removing attribute $attr from entry ", $new->getDN(), "\n"); + $new->remove($attr); + } else { + debug(3, "Setting new value $newval for attribute $attr in entry ", $new->getDN(), "\n"); + $new->setValues($attr, $newval); + } } } elsif ($cn eq "internationalization plugin" and $lcattr eq "nsslapd-pluginarg0") { debug(3, "mergeEntries: using new value of internationalization plugin nsslapd-pluginarg0\n"); @@ -725,6 +743,10 @@ sub migrateDS { return 0; } + if (!$mig->{start_servers}) { + $inf->{slapd}->{start_server} = 0; + } + # create the new instance @errs = createDSInstance($inf); unlink($inf->{filename}); diff --git a/ldap/admin/src/scripts/FileConn.pm b/ldap/admin/src/scripts/FileConn.pm index 7e62d8b2..447f4aaf 100644 --- a/ldap/admin/src/scripts/FileConn.pm +++ b/ldap/admin/src/scripts/FileConn.pm @@ -411,7 +411,10 @@ sub update { return 0; } - $self->{$ndn}->{data} = $entry; + # The cloned entry will not contain the deleted attrs - the cloning + # process omits the deleted attrs via the Entry FETCH, FIRSTKEY, and NEXTKEY + # methods + $self->{$ndn}->{data} = cloneEntry($entry); $self->write(); return 1; diff --git a/ldap/admin/src/scripts/Migration.pm.in b/ldap/admin/src/scripts/Migration.pm.in index b1e6ccde..0192b97c 100644 --- a/ldap/admin/src/scripts/Migration.pm.in +++ b/ldap/admin/src/scripts/Migration.pm.in @@ -225,6 +225,7 @@ sub init { $self->{logfile} = $logfile; $self->{crossplatform} = $crossplatform; $self->{log} = new SetupLog($self->{logfile}, "migrate"); + $self->{start_servers} = 1; # start servers as soon as they are migrated # if user supplied inf file, use that to initialize if (defined($self->{inffile})) { $self->{inf} = new Inf($self->{inffile}); diff --git a/ldap/admin/src/scripts/Util.pm.in b/ldap/admin/src/scripts/Util.pm.in index ad7347ed..7dd89b9f 100644 --- a/ldap/admin/src/scripts/Util.pm.in +++ b/ldap/admin/src/scripts/Util.pm.in @@ -813,7 +813,6 @@ sub createInfFromConfig { print $outfh "RootDNPwd = ", $ent->getValues('nsslapd-rootpw'), "\n"; print $outfh "ServerPort = ", $ent->getValues('nsslapd-port'), "\n"; print $outfh "ServerIdentifier = $id\n"; - print $outfh "start_server= 0\n"; my $suffix; $ent = $conn->search("cn=ldbm database,cn=plugins,cn=config", |
