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"
84 echo "Using ldapsearch to check that provider slapd is running..."
85 for i in 0 1 2 3 4 5; do
86 $LDAPSEARCH -s base -b "" -H $MYURI \
87 'objectclass=*' > /dev/null 2>&1
89 if test $RC = 0 ; then
92 echo "Waiting 5 seconds for slapd to start..."
96 if test $RC != 0 ; then
97 echo "ldapsearch failed ($RC)!"
98 test $KILLSERVERS != no && kill -HUP $KILLPIDS
104 echo "Sleeping 10 seconds to allow stabalization..."
107 echo "Looping failed authentications for 50 users 10 times each..."
109 while [ $user -le 300 ]; do
111 echo -n "user $user..."
112 while [ $auths -le 10 ]; do
113 $LDAPSEARCH -x -H $URI1 -D uid=user.$user,ou=user,dc=example,dc=com -w wrongpass uid=fred >/dev/null 2>&1
115 if test $RC = 0 ; then
116 echo "ldapsearch succeeded when it should have failed"
119 auths=`expr $auths + 1`
122 user=`expr $user + 1`
125 echo -n "Sleeping 1 minute to ensure consumers catch up..."
129 echo -n "Stopping MMR1 slapd..."
130 kill -HUP "${PIDS[1]}"
135 echo -n "Wiping primary and accesslog databases for MMR1..."
136 DBDIR="$TESTDIR/srv1/db"
137 CFDIR="$TESTDIR/srv1/slapd.d"
138 mv $DBDIR.1 $DBDIR.1.orig
139 mv $DBDIR.2 $DBDIR.2.orig
140 mkdir -p $DBDIR.1 $DBDIR.2
141 $SLAPADD -F $CFDIR -q -b $BASEDN -l $ITSDIR/its8800db.ldif
144 echo "Starting provider1 slapd on TCP/IP URI $URI1"
145 CFDIR="$TESTDIR/srv1/slapd.d"
146 $SLAPD -F $CFDIR -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
149 if test $WAIT != 0 ; then
156 echo "Using ldapsearch to check that provider slapd is running..."
157 for i in 0 1 2 3 4 5; do
158 $LDAPSEARCH -s base -b "" -H $URI1 \
159 'objectclass=*' > /dev/null 2>&1
161 if test $RC = 0 ; then
164 echo "Waiting 5 seconds for slapd to start..."
170 while [ $n -le 4 ]; do
171 KILLPIDS="${PIDS[$n]} $KILLPIDS"
175 if test $RC != 0 ; then
176 echo "ldapsearch failed ($RC)!"
177 test $KILLSERVERS != no && kill -HUP $KILLPIDS
182 echo "Sleeping 5 minutes to allow databases to sync..."
185 echo "Comparing resulting databases..."
188 while [ $n -le 4 ]; do
189 CFDIR=${XDIR}$n/slapd.d
190 $SLAPCAT -F $CFDIR -b $BASEDN -l $TESTDIR/finaldb-$n.ldif
195 while [ $n -le 4 ]; do
196 diff $TESTDIR/finaldb-1.ldif $TESTDIR/finaldb-$n.ldif > /dev/null 2>&1
198 if test $RC != 0 ; then
199 echo "ERROR: Final LDIF files differ"
200 test $KILLSERVERS != no && kill -HUP $KILLPIDS
206 test $KILLSERVERS != no && kill -HUP $KILLPIDS
208 echo ">>>>> Test succeeded"
210 test $KILLSERVERS != no && wait