This file is indexed.

/usr/share/dirsrv/updates/91subtreereindex.pl is in 389-ds-base 1.3.7.10-1ubuntu1.

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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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;

    my $config = $conn->search("cn=config", "base", "(objectclass=*)");
    if (!$config) {
        push @errs, ['error_finding_config_entry', 'cn=config',
                     $conn->getErrorString()];
        return @errs;
    }

    ($rc, @errs) = isOffline($inf, $inst, $conn);
    if (!$rc) {
        return @errs;
    }

    my $dbconf = $conn->search("cn=config,cn=ldbm database,cn=plugins,cn=config", "base", "(objectclass=*)");
    if (!$dbconf) {
        push @errs, ['error_finding_config_entry',
                     'cn=config,cn=ldbm database,cn=plugins,cn=config',
                     $conn->getErrorString()];
        return @errs;
    }

    # Get the value of nsslapd-subtree-rename-switch.
    my $switch = $dbconf->getValues('nsslapd-subtree-rename-switch');
    if ("" eq $switch) {
        return (); # subtree-rename-switch does not exist; do nothing.
    } elsif ("off" eq $switch || "OFF" eq $switch) {
        return (); # subtree-rename-switch is OFF; do nothing.
    }

    my $dbdir = $dbconf->getValues('nsslapd-directory');
    my $dbversion0 = $dbdir . "/DBVERSION";
    my $is_rdn_format = 0;
    my $dbversionstr = "";
    if (!open(DBVERSION, "$dbversion0")) {
        push @errs, ['error_opening_file', $dbversion0, $!];
        return @errs;
    } else {
        while (<DBVERSION>) {
            if ($_ =~ /rdn-format/) {
                $is_rdn_format = 1;
                $dbversionstr = $_;
                if ($_ =~ /rdn-format-1/) {
                    $is_rdn_format = 2;
                }
                elsif ($_ =~ /rdn-format-2/) {
                    $is_rdn_format = 3;
                }
                elsif ($_ =~ /rdn-format-/) {
                    # assume greater than -2
                    $is_rdn_format = 4;
                }
            }
        }
        close DBVERSION;

        if (3 <= $is_rdn_format) {
            return (); # DB already has the new rdn format.
        }

        if (0 == $is_rdn_format) {
            push @errs, ['error_format_error', 'database'];
            return @errs;
        }
    }

    my $instconf = $conn->search("cn=ldbm database,cn=plugins,cn=config", "onelevel", "(objectclass=*)");
    if (!$instconf) {
        push @errs, ['error_finding_config_entry',
                     'cn=*,cn=ldbm database,cn=plugins,cn=config',
                     $conn->getErrorString()];
        return @errs;
    }

    my $instancedir = $config->getValues('nsslapd-instancedir');
    my $reindex = $instancedir . "/db2index";

    while ($instconf) {
        my $backend= $instconf->getValues('cn');
        if (($backend eq "config") || ($backend eq "monitor")) {
            goto NEXT;
        }
        my $instdbdir = $instconf->getValues('nsslapd-directory');
        my $dbversion1 = $instdbdir . "/DBVERSION";
        if (!open(DBVERSION, "$dbversion1")) {
            push @errs, ['error_opening_file', $dbversion1, $!];
            goto NEXT;
        } else {
            my $versionstr = "";
            while (<DBVERSION>) {
                if ($_ =~ /rdn-format/) {
                    $is_rdn_format = 1;
                    $versionstr = $_;
                    if ($_ =~ /rdn-format-1/) {
                        $is_rdn_format = 2;
                    }
                    if ($_ =~ /rdn-format-2/) {
                        $is_rdn_format = 3;
                    }
                }
            }
            close DBVERSION;
    
            if (3 == $is_rdn_format) {
                # DB already has the new rdn format.
                goto NEXT;
            }
    
            if (0 == $is_rdn_format) {
                push @errs, ['error_format_error', $instdbdir];
                goto NEXT;
            }

            # reindex entryrdn
            my $rc = system("$reindex -n $backend -t entryrdn");

            # update instance DBVERSION file
            if ($versionstr ne "") {
                if (!open(DBVERSION, "> $dbversion1")) {
                    push @errs, ['error_opening_file', $dbversion1, $!];
                } else {
                    $versionstr =~ s,rdn\-format\-1/,rdn\-format\-2/,;
                    $versionstr =~ s,rdn\-format/,rdn\-format\-2/,;
                    print DBVERSION $versionstr; # not chomp'd above, already has newline
                    close DBVERSION;
                }
            }
        }
NEXT:
        $instconf = $conn->nextEntry();
    }

    # update main DBVERSION file
    if (!open(DBVERSION, "> $dbversion0")) {
        push @errs, ['error_opening_file', $dbversion0, $!];
    } else {
        $dbversionstr =~ s,rdn\-format\-1/,rdn\-format\-2/,;
        $dbversionstr =~ s,rdn\-format/,rdn\-format\-2/,;
        print DBVERSION $dbversionstr; # not chomp'd above, already has newline
        close DBVERSION;
    }

    return @errs;
}