]> git.sur5r.net Git - openldap/blob - tests/data/regressions/its8667/its8667
Happy New Year
[openldap] / tests / data / regressions / its8667 / its8667
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2018 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
18
19 echo ""
20 echo "  This test tracks a case where the -g flag to slapcat fails to work"
21 echo "  correctly, exporting the subordinate dbs as well as the root db."
22 echo "  See http://www.openldap.org/its/index.cgi/?findid=8667 for more information."
23 echo ""
24
25 DBDIR1=$TESTDIR/db.1.a
26 DBDIR2=$TESTDIR/db.2.a
27 DBDIR3=$TESTDIR/db.3.a
28 DBDIR4=$TESTDIR/db.4.a
29 CFPRO=$TESTDIR/slapd.d
30
31 mkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3 $DBDIR4 $CFPRO
32
33 $SLAPPASSWD -g -n >$CONFIGPWF
34
35 ITS=8667
36 ITSDIR=$DATADIR/regressions/its$ITS
37
38 echo "Starting slapd on TCP/IP port $PORT1..."
39 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.ldif > $CONFLDIF
40 $SLAPADD -F $CFPRO -n 0 -l $CONFLDIF
41
42 echo "Populating root database..."
43 $SLAPADD -F $CFPRO -b "dc=example,dc=com" -l $ITSDIR/root.ldif >> $TESTOUT 2>&1
44 RC=$?
45 if test $RC != 0 ; then
46         echo "slapadd failed for root database ($RC)!"
47         exit $RC
48 fi
49
50 echo "Populating accounting database..."
51 $SLAPADD -F $CFPRO -b "dc=accounting,dc=example,dc=com" -l $ITSDIR/accounting.ldif >> $TESTOUT 2>&1
52 RC=$?
53 if test $RC != 0 ; then
54         echo "slapadd failed for accounting database ($RC)!"
55         exit $RC
56 fi
57
58 echo "Populating administrative database..."
59 $SLAPADD -F $CFPRO -b "dc=administrative,dc=example,dc=com" -l $ITSDIR/administrative.ldif >> $TESTOUT 2>&1
60 RC=$?
61 if test $RC != 0 ; then
62         echo "slapadd failed for administrative database ($RC)!"
63         exit $RC
64 fi
65
66 echo "Populating janitorial database..."
67 $SLAPADD -F $CFPRO -b "dc=janitorial,dc=example,dc=com" -l $ITSDIR/janitorial.ldif >> $TESTOUT 2>&1
68 RC=$?
69 if test $RC != 0 ; then
70         echo "slapadd failed for janitorial database ($RC)!"
71         exit $RC
72 fi
73
74 echo "Using slapcat -g to export only the root database..."
75 $SLAPCAT -F $CFPRO -g -b "dc=example,dc=com" -l $TESTDIR/slapcat.out >> $TESTOUT 2>&1
76 RC=$?
77
78 if test $RC != 0 ; then
79         echo "slapcat -g failed for root databse ($RC)!"
80         exit $RC
81 fi
82
83 echo "Verifying Administrative subordinate is not found..."
84 grep "dn: ou=Administrative,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
85 RC=$?
86
87 if test $RC = 0 ; then
88         echo "test failed - Administrative subordinate found."
89         echo "This is a regression of ITS8667"
90         exit 1
91 fi
92
93 echo "Verifying Accounting subordinate is not found..."
94 grep "dn: ou=Accounting,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
95 RC=$?
96
97 if test $RC = 0 ; then
98         echo "test failed - Accounting subordinate found."
99         echo "This is a regression of ITS8667"
100         exit 1
101 fi
102
103 echo "Verifying Janitorial subordinate is not found..."
104 grep "dn: ou=Janitorial,dc=example,dc=com" $TESTDIR/slapcat.out >> $TESTOUT 2>&1
105 RC=$?
106
107 if test $RC = 0 ; then
108         echo "test failed - Janitorial subordinate found."
109         echo "This is a regression of ITS8667"
110         exit 1
111 fi
112
113 echo
114 echo ">>>>> Test succeeded"
115
116 exit 0