3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2016 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
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>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 if test $PPOLICY = ppolicyno; then
20 echo "Password policy overlay not available, test skipped"
24 if test $SYNCPROV = syncprovno; then
25 echo "Syncrepl provider overlay not available, test skipped"
28 if test $ACCESSLOG = accesslogno; then
29 echo "Accesslog overlay not available, test skipped"
32 if test $BACKEND = ldif ; then
33 # Onelevel search does not return entries in order of creation or CSN.
34 echo "$BACKEND backend unsuitable for syncprov logdb, test skipped"
38 echo "This test tracks a case where changes are not refreshed when an old db is reloaded"
39 echo "See http://www.openldap.org/its/index.cgi/?findid=8800 for more information."
46 $SLAPPASSWD -g -n >$CONFIGPWF
49 ITSDIR=$DATADIR/regressions/its$ITS
53 while [ $n -le $MMR ]; do
54 echo "Initializing server configuration for MMR$n..."
56 CFDIR=${XDIR}$n/slapd.d
58 mkdir -p ${XDIR}$n $DBDIR.1 $DBDIR.2 $CFDIR
59 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd-provider${n}.ldif > $CONFLDIF
60 $SLAPADD -F $CFDIR -n 0 -l $CONFLDIF
61 $SLAPADD -F $CFDIR -q -b $BASEDN -l $ITSDIR/its8800db.ldif
67 while [ $n -le $MMR ]; do
68 MYURI=`eval echo '$URI'$n`
69 MYLOG=`eval echo '$LOG'$n`
70 CFDIR=${XDIR}$n/slapd.d
72 echo "Starting provider slapd on TCP/IP URI $MYURI"
73 $SLAPD -F $CFDIR -h $MYURI -d $LVL $TIMING > $MYLOG 2>&1 &
76 if test $WAIT != 0 ; then
80 KILLPIDS="$PID $KILLPIDS"
86 echo "Using ldapsearch to check that provider slapd is running..."
87 for i in 0 1 2 3 4 5; do
88 $LDAPSEARCH -s base -b "" -H $MYURI \
89 'objectclass=*' > /dev/null 2>&1
91 if test $RC = 0 ; then
94 echo "Waiting 5 seconds for slapd to start..."
98 if test $RC != 0 ; then
99 echo "ldapsearch failed ($RC)!"
100 test $KILLSERVERS != no && kill -HUP $KILLPIDS
106 echo "Sleeping 10 seconds to allow stabalization..."
109 echo "Looping failed authentications for 50 users 10 times each..."
111 while [ $user -le 300 ]; do
113 echo -n "user $user..."
114 while [ $auths -le 10 ]; do
115 $LDAPSEARCH -x -H $URI1 -D uid=user.$user,ou=user,dc=example,dc=com -w wrongpass uid=fred >/dev/null 2>&1
117 if test $RC = 0 ; then
118 echo "ldapsearch succeeded when it should have failed"
121 auths=`expr $auths + 1`
124 user=`expr $user + 1`
127 echo -n "Sleeping 1 minute to ensure consumers catch up..."
131 echo -n "Stopping MMR1 slapd..."
134 KILLPIDS=`echo "$KILLPIDS " | sed -e "s/ $MPID / /"`;
138 echo -n "Wiping primary and accesslog databases for MMR1..."
139 DBDIR="$TESTDIR/srv1/db"
140 CFDIR="$TESTDIR/srv1/slapd.d"
141 mv $DBDIR.1 $DBDIR.1.orig
142 mv $DBDIR.2 $DBDIR.2.orig
143 mkdir -p $DBDIR.1 $DBDIR.2
144 $SLAPADD -F $CFDIR -q -b $BASEDN -l $ITSDIR/its8800db.ldif
147 echo "Starting provider1 slapd on TCP/IP URI $URI1"
148 CFDIR="$TESTDIR/srv1/slapd.d"
149 $SLAPD -F $CFDIR -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
152 if test $WAIT != 0 ; then
156 KILLPIDS="$PID $KILLPIDS"
159 echo "Using ldapsearch to check that provider slapd is running..."
160 for i in 0 1 2 3 4 5; do
161 $LDAPSEARCH -s base -b "" -H $URI1 \
162 'objectclass=*' > /dev/null 2>&1
164 if test $RC = 0 ; then
167 echo "Waiting 5 seconds for slapd to start..."
171 if test $RC != 0 ; then
172 echo "ldapsearch failed ($RC)!"
173 test $KILLSERVERS != no && kill -HUP $KILLPIDS
178 echo "Sleeping 5 minutes to allow databases to sync..."
181 echo "Comparing resulting databases..."
184 while [ $n -le 4 ]; do
185 CFDIR=${XDIR}$n/slapd.d
186 $SLAPCAT -F $CFDIR -b $BASEDN -l $TESTDIR/finaldb-$n.ldif
191 while [ $n -le 4 ]; do
192 diff $TESTDIR/finaldb-1.ldif $TESTDIR/finaldb-$n.ldif > /dev/null 2>&1
194 if test $RC != 0 ; then
195 echo "ERROR: Final LDIF files differ"
196 test $KILLSERVERS != no && kill -HUP $KILLPIDS
202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
204 echo ">>>>> Test succeeded"
206 test $KILLSERVERS != no && wait