/usr/share/dirsrv/updates/90subtreerename.pl is in 389-ds-base 1.3.4.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Utils qw(normalizeDN);
use Mozilla::LDAP::API qw(:constant ldap_url_parse ldap_explode_dn);
use DSUpdate qw(isOffline);
sub runinst {
my ($inf, $inst, $dseldif, $conn) = @_;
my $rc, @errs;
($rc, @errs) = isOffline($inf, $inst, $conn);
if (!$rc) {
return @errs;
}
my $ent0 = $conn->search("cn=config", "base", "(objectclass=*)");
if (!$ent0) {
return ('error_finding_config_entry', 'cn=config',
$conn->getErrorString());
}
my $ent1 = $conn->search("cn=config,cn=ldbm database,cn=plugins,cn=config",
"base", "(objectclass=*)");
if (!$ent1) {
return ('error_finding_config_entry',
'cn=config,cn=ldbm database,cn=plugins,cn=config',
$conn->getErrorString());
}
# Get the value of nsslapd-subtree-rename-switch.
my $need_update = 0;
my $switch = $ent1->getValues('nsslapd-subtree-rename-switch');
if ("" eq $switch) {
$ent1->addValue('nsslapd-subtree-rename-switch', "on");
$need_update = 1;
} elsif ("off" eq $switch || "OFF" eq $switch) {
$ent1->setValues('nsslapd-subtree-rename-switch', "on");
$need_update = 1;
$conn->update($ent1);
}
if (1 == $need_update) {
$conn->update($ent1);
# Convert the database format from entrydn to entryrdn
my $instdir = $ent0->getValue('nsslapd-instancedir');
my $prog = $instdir . "/dn2rdn";
my $output = `$prog 2>&1`;
my $stat = $?;
if (0 != $stat) {
$ent1->setValues('nsslapd-subtree-rename-switch', "off");
$conn->update($ent1);
}
}
return ();
}
|