summaryrefslogtreecommitdiffstats
path: root/tests/data/regressions/its8667/its8667
blob: 8bcc7f0f560a26f965620a71ede350d520e1a950 (plain)
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
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2022 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

echo "running defines.sh"
. $SRCDIR/scripts/defines.sh

echo ""
echo "  This test tracks a case where the -g flag to slapcat fails to work"
echo "  correctly, exporting the subordinate dbs as well as the root db."
echo "  See https://bugs.openldap.org/show_bug.cgi?id=8667 for more information."
echo ""

DBDIR1=$TESTDIR/db.1.a
DBDIR2=$TESTDIR/db.2.a
DBDIR3=$TESTDIR/db.3.a
DBDIR4=$TESTDIR/db.4.a
CFPRO=$TESTDIR/slapd.d

mkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3 $DBDIR4 $CFPRO

$SLAPPASSWD -g -n >$CONFIGPWF

ITS=8667
ITSDIR=$DATADIR/regressions/its$ITS

echo "Starting slapd on TCP/IP port $PORT1..."
. $CONFFILTER $BACKEND < $ITSDIR/slapd.ldif > $CONFLDIF
$SLAPADD -F $CFPRO -n 0 -l $CONFLDIF

echo "Populating root database..."
$SLAPADD -F $CFPRO -b "dc=example,dc=com" -l $ITSDIR/root.ldif >> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
	echo "slapadd failed for root database ($RC)!"
	exit $RC
fi

echo "Populating accounting database..."
$SLAPADD -F $CFPRO -b "dc=accounting,dc=example,dc=com" -l $ITSDIR/accounting.ldif >> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
	echo "slapadd failed for accounting database ($RC)!"
	exit $RC
fi

echo "Populating administrative database..."
$SLAPADD -F $CFPRO -b "dc=administrative,dc=example,dc=com" -l $ITSDIR/administrative.ldif >> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
	echo "slapadd failed for administrative database ($RC)!"
	exit $RC
fi

echo "Populating janitorial database..."
$SLAPADD -F $CFPRO -b "dc=janitorial,dc=example,dc=com" -l $ITSDIR/janitorial.ldif >> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
	echo "slapadd failed for janitorial database ($RC)!"
	exit $RC
fi

echo "Using slapcat -g to export only the root database..."
$SLAPCAT -F $CFPRO -g -b "dc=example,dc=com" -l $TESTDIR/slapcat.out >> $TESTOUT 2>&1
RC=$?

if test $RC != 0 ; then
        echo "slapcat -g failed for root databse ($RC)!"
        exit $RC
fi

echo "Verifying Administrative subordinate is not found..."
grep "dn: ou=Administrative,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
RC=$?

if test $RC = 0 ; then
        echo "test failed - Administrative subordinate found."
	echo "This is a regression of ITS8667"
        exit 1
fi

echo "Verifying Accounting subordinate is not found..."
grep "dn: ou=Accounting,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
RC=$?

if test $RC = 0 ; then
        echo "test failed - Accounting subordinate found."
	echo "This is a regression of ITS8667"
        exit 1
fi

echo "Verifying Janitorial subordinate is not found..."
grep "dn: ou=Janitorial,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
RC=$?

if test $RC = 0 ; then
        echo "test failed - Janitorial subordinate found."
	echo "This is a regression of ITS8667"
        exit 1
fi

echo
echo ">>>>> Test succeeded"

exit 0