This file is indexed.

/usr/sbin/db2ldif is in 389-ds-base 1.3.4.9-1.

This file is owned by root:root, with mode 0o755.

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
153
154
155
156
157
158
159
160
#!/bin/bash

. /usr/share/dirsrv/data/DSSharedLib

libpath_add "/usr/lib/x86_64-linux-gnu/dirsrv/"
libpath_add ""
libpath_add "/usr/lib/x86_64-linux-gnu"
libpath_add "/usr/lib/x86_64-linux-gnu"

export LD_LIBRARY_PATH
SHLIB_PATH=$LD_LIBRARY_PATH
export SHLIB_PATH

cwd=`pwd`

usage()
{
    echo "Usage: db2ldif [-Z serverID] {-n backend_instance}* | {-s includesuffix}* [{-x excludesuffix}*] [-a outputfile]"
    echo "               [-E] [-r] [-u] [-U] [-m] [-1] [-q] [-h]"
    echo "Note: either \"-n backend\" or \"-s includesuffix\" is required."
    echo "Options:"
    echo "        -Z serverID       - Server instance identifier"
    echo "        -n backend        - Backend database name.  Example: userRoot"
    echo "        -s inclduesuffix  - Suffix to include"
    echo "        -x                - Suffix to exclude"
    echo "        -a outputfile     - Name of the exported LDIF file"
    echo "        -r                - Include replication data"
    echo "        -E                - Decrypt attributes"
    echo "        -u                - Do not export the nsUniqueId attribute"
    echo "        -U                - Do not wrap long lines"
    echo "        -m                - Do not base64 encode values"
    echo "        -1                - Do not include version text"
    echo "        -q                - Quiet mode - suppresses output"
    echo "        -h                - Display usage" 
}

make_ldiffile()
{
    be=""
    while [ "$1" != "" ]
    do
        if [ "x$1" = "x-a" ]; then
            shift
            if [ `expr "$1" : "/.*"` -gt 0 ]; then 
	            if [ `expr "$1" : "/.*"` -gt 0 ]; then 
	                # full path 
	                echo $1 
	                return 1 
	            else 
	                echo $cwd/$1 
	                shift 
	                return 0 
	            fi 
            else 
                echo $cwd/$1 
                shift 
                return 0 
            fi
        elif [ "x$1" = "x-n" ]; then
            shift
            if [ -z "$be" ]; then
                be="$1"
            else
                tmpbe="$be"
                be="${tmpbe}-$1"
            fi
        elif [ "x$1" = "x-s" ]; then
            shift
            if [ -n "$1" ]; then
                rdn=`echo $1 | awk -F, '{print $1}'`
                rdnval=`echo $rdn | awk -F= '{print $2}'`
                if [ "$be" = "" ]; then
                    be="$rdnval"
                else
                    tmpbe="$be"
                    be="${tmpbe}-$rdnval"
                fi
            fi
        elif [ "x$1" = "x-M" ]; then
            be=""
        fi
        if [ -n "$1" ]; then
            shift
        fi
    done

    if [ -z "$be" ]; then
        echo /var/lib/dirsrv/slapd-$servid/ldif/$servid-`date +%Y_%m_%d_%H%M%S`.ldif
    else
        echo /var/lib/dirsrv/slapd-$servid/ldif/$servid-${be}-`date +%Y_%m_%d_%H%M%S`.ldif
    fi
    return 0
}

if [ $# -lt 2 ];
then
    usage
    exit 1
fi

while getopts "hZ:vd:D:ENa:rs:x:CSut:n:UmMo1qc:" flag
do
    case $flag in
        h) usage
           exit 0;;
        Z) servid=$OPTARG;; 
        n) benameopt="-n $OPTARG"
           required_param="yes";;
        s) includeSuffix="-s \"$OPTARG\""
           required_param="yes";;
        x) excludeSuffix="-x \"$OPTARG\"";;
        a) outputFile="-a \"$OPTARG\"";;
        d) args=$args" -d \"$OPTARG\"";;
        D) args=$args" -D \"$OPTARG\"";;
        N) args=$args" -N";;
        E) args=$args" -E";;
        S) args=$args" -S";;
        v) args=$args" -v";;
        r) args=$args" -r";;
        C) args=$args" -C";;
        u) args=$args" -u";;
        U) args=$args" -U";;
        m) args=$args" -m";;
        M) args=$args" -M";;
        1) args=$args" -1";;
        q) args=$args" -q";;        
        c) cwd=$OPTARG;;
        ?) usage
           exit 1;;
    esac
done

if [ "$required_param" != "yes" ]
then
    usage
    exit 1
fi

initfile=$(get_init_file "/etc/default" $servid)
if [ $? -eq 1 ]
then
    usage
    echo "You must supply a valid server instance identifier.  Use -Z to specify instance name"
    echo "Available instances: $initfile"
    exit 1
fi

servid=`normalize_server_id $initfile`
. $initfile

ldif_file=`make_ldiffile $@`
rn=$?

echo "Exported ldif file: $ldif_file"
if [ $rn -eq 1 ]
then
    eval /usr/sbin/ns-slapd db2ldif -D $CONFIG_DIR $benameopt $includeSuffix $excludeSuffix $outputFile $args
else
    eval /usr/sbin/ns-slapd db2ldif -D $CONFIG_DIR $benameopt $includeSuffix $excludeSuffix $args -a $ldif_file
fi