xref: /netbsd-src/external/bsd/openldap/dist/tests/scripts/test082-remoteauth (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1*e670fd5cSchristos#! /bin/sh
2*e670fd5cSchristos# $OpenLDAP$
3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4*e670fd5cSchristos##
5*e670fd5cSchristos## Copyright 2016-2021 Ondřej Kuzník, Symas Corp.
6*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation.
7*e670fd5cSchristos## All rights reserved.
8*e670fd5cSchristos##
9*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without
10*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP
11*e670fd5cSchristos## Public License.
12*e670fd5cSchristos##
13*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the
14*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at
15*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>.
16*e670fd5cSchristos
17*e670fd5cSchristosecho "running defines.sh"
18*e670fd5cSchristos. $SRCDIR/scripts/defines.sh
19*e670fd5cSchristos
20*e670fd5cSchristosif test $WITH_TLS = no ; then
21*e670fd5cSchristos    echo "TLS support not available, test skipped"
22*e670fd5cSchristos    exit 0
23*e670fd5cSchristosfi
24*e670fd5cSchristos
25*e670fd5cSchristosif test $REMOTEAUTH = remoteauthno; then
26*e670fd5cSchristos    echo "RemoteAuth overlay not available, test skipped"
27*e670fd5cSchristos    exit 0
28*e670fd5cSchristosfi
29*e670fd5cSchristos
30*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1 $DBDIR2 $TESTDIR/confdir
31*e670fd5cSchristoscp -r $DATADIR/tls $TESTDIR
32*e670fd5cSchristos
33*e670fd5cSchristos. $CONFFILTER < $DATADIR/remoteauth/default_domain > $TESTDIR/default_domain
34*e670fd5cSchristos
35*e670fd5cSchristos. $CONFFILTER $BACKEND < $TLSCONF > $CONF1
36*e670fd5cSchristos
37*e670fd5cSchristos$SLAPPASSWD -g -n >$CONFIGPWF
38*e670fd5cSchristosecho "database config" >>$CONF1
39*e670fd5cSchristosecho "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >>$CONF1
40*e670fd5cSchristosecho "TLSCACertificateFile $TESTDIR/tls/ca/certs/testsuiteCA.crt" >>$CONF1
41*e670fd5cSchristos
42*e670fd5cSchristos$SLAPD -Tt -n 0 -f $CONF1 -F $TESTDIR/confdir -d $LVL > $LOG1 2>&1
43*e670fd5cSchristosRC=$?
44*e670fd5cSchristosif test $RC != 0 ; then
45*e670fd5cSchristos    echo "slaptest failed ($RC)!"
46*e670fd5cSchristos    exit $RC
47*e670fd5cSchristosfi
48*e670fd5cSchristos
49*e670fd5cSchristosecho -n "Running slapadd to build slapd database... "
50*e670fd5cSchristos$SLAPADD -F $TESTDIR/confdir -l $LDIFORDERED
51*e670fd5cSchristosRC=$?
52*e670fd5cSchristosif test $RC != 0 ; then
53*e670fd5cSchristos    echo "slapadd failed ($RC)!"
54*e670fd5cSchristos    exit $RC
55*e670fd5cSchristosfi
56*e670fd5cSchristos
57*e670fd5cSchristosecho "DB tweaks..."
58*e670fd5cSchristos$SLAPMODIFY -F $TESTDIR/confdir >>$LOG1 2>&1 <<EOMODS
59*e670fd5cSchristosdn: $MELLIOTDN
60*e670fd5cSchristoschangetype: modify
61*e670fd5cSchristosadd: o
62*e670fd5cSchristoso: self
63*e670fd5cSchristos-
64*e670fd5cSchristosreplace: seeAlso
65*e670fd5cSchristosseeAlso: $BJORNSDN
66*e670fd5cSchristos
67*e670fd5cSchristosdn: $JOHNDDN
68*e670fd5cSchristoschangetype: modify
69*e670fd5cSchristosreplace: seeAlso
70*e670fd5cSchristosseeAlso: $BJORNSDN
71*e670fd5cSchristosEOMODS
72*e670fd5cSchristosRC=$?
73*e670fd5cSchristosif test $RC != 0 ; then
74*e670fd5cSchristos    echo "slapmodify failed ($RC)!"
75*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
76*e670fd5cSchristos    exit $RC
77*e670fd5cSchristosfi
78*e670fd5cSchristos
79*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT1 for configuration..."
80*e670fd5cSchristos$SLAPD -F $TESTDIR/confdir -h $URI1 -d $LVL >> $LOG1 2>&1 &
81*e670fd5cSchristosREMOTEAUTH_PID=$!
82*e670fd5cSchristosif test $WAIT != 0 ; then
83*e670fd5cSchristos    echo REMOTEAUTH_PID $REMOTEAUTH_PID
84*e670fd5cSchristos    read foo
85*e670fd5cSchristosfi
86*e670fd5cSchristosKILLPIDS="$REMOTEAUTH_PID"
87*e670fd5cSchristos
88*e670fd5cSchristossleep $SLEEP0
89*e670fd5cSchristos
90*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
91*e670fd5cSchristos    $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
92*e670fd5cSchristos        'objectclass=*' > /dev/null 2>&1
93*e670fd5cSchristos    RC=$?
94*e670fd5cSchristos    if test $RC = 0 ; then
95*e670fd5cSchristos        break
96*e670fd5cSchristos    fi
97*e670fd5cSchristos    echo "Waiting ${SLEEP1} seconds for slapd to start..."
98*e670fd5cSchristos    sleep ${SLEEP1}
99*e670fd5cSchristosdone
100*e670fd5cSchristos
101*e670fd5cSchristosif [ "$REMOTEAUTH" = remoteauthmod ]; then
102*e670fd5cSchristos$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF \
103*e670fd5cSchristos    >> $TESTOUT 2>&1 <<EOMOD
104*e670fd5cSchristosdn: cn=module,cn=config
105*e670fd5cSchristosobjectClass: olcModuleList
106*e670fd5cSchristoscn: module
107*e670fd5cSchristosolcModulePath: $TESTWD/../servers/slapd/overlays
108*e670fd5cSchristosolcModuleLoad: remoteauth.la
109*e670fd5cSchristosEOMOD
110*e670fd5cSchristosRC=$?
111*e670fd5cSchristosif test $RC != 0 ; then
112*e670fd5cSchristos    echo "ldapmodify failed ($RC)!"
113*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
114*e670fd5cSchristos    exit $RC
115*e670fd5cSchristosfi
116*e670fd5cSchristosfi
117*e670fd5cSchristos
118*e670fd5cSchristosecho "Loading test remoteauth configuration..."
119*e670fd5cSchristos. $CONFFILTER $BACKEND < $DATADIR/remoteauth/config.ldif | \
120*e670fd5cSchristos$LDAPADD -v -D cn=config -H $URI1 -y $CONFIGPWF \
121*e670fd5cSchristos    >> $TESTOUT 2>&1
122*e670fd5cSchristosRC=$?
123*e670fd5cSchristosif test $RC != 0 ; then
124*e670fd5cSchristos    echo "ldapadd failed ($RC)!"
125*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
126*e670fd5cSchristos    exit $RC
127*e670fd5cSchristosfi
128*e670fd5cSchristos
129*e670fd5cSchristosecho -n "Preparing second server on $URI2 and $SURIP3... "
130*e670fd5cSchristos. $CONFFILTER $BACKEND < $TLSCONF | sed -e "s,$DBDIR1,$DBDIR2," > $CONF2
131*e670fd5cSchristos
132*e670fd5cSchristosecho -n "loading data... "
133*e670fd5cSchristos$SLAPADD -f $CONF2 -l $LDIFORDERED
134*e670fd5cSchristosRC=$?
135*e670fd5cSchristosif test $RC != 0 ; then
136*e670fd5cSchristos    echo "slapadd failed ($RC)!"
137*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
138*e670fd5cSchristos    exit $RC
139*e670fd5cSchristosfi
140*e670fd5cSchristos
141*e670fd5cSchristosecho -n "tweaking DB contents... "
142*e670fd5cSchristos$SLAPMODIFY -f $CONF2 >>$LOG2 2>&1 <<EOMODS
143*e670fd5cSchristosdn: $BJORNSDN
144*e670fd5cSchristoschangetype: modify
145*e670fd5cSchristosreplace: userPassword
146*e670fd5cSchristosuserPassword: bjorn2
147*e670fd5cSchristosEOMODS
148*e670fd5cSchristosRC=$?
149*e670fd5cSchristosif test $RC != 0 ; then
150*e670fd5cSchristos    echo "slapmodify failed ($RC)!"
151*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
152*e670fd5cSchristos    exit $RC
153*e670fd5cSchristosfi
154*e670fd5cSchristos
155*e670fd5cSchristosecho "starting up... "
156*e670fd5cSchristos$SLAPD -f $CONF2 -h "$URI2 $SURIP3" -d $LVL > $LOG2 2>&1 &
157*e670fd5cSchristosBACKEND_PID=$!
158*e670fd5cSchristosif test $WAIT != 0 ; then
159*e670fd5cSchristos    echo BACKEND_PID $BACKEND_PID
160*e670fd5cSchristos    read foo
161*e670fd5cSchristosfi
162*e670fd5cSchristosKILLPIDS="$KILLPIDS $BACKEND_PID"
163*e670fd5cSchristos
164*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
165*e670fd5cSchristos    $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
166*e670fd5cSchristos        'objectclass=*' > /dev/null 2>&1
167*e670fd5cSchristos    RC=$?
168*e670fd5cSchristos    if test $RC = 0 ; then
169*e670fd5cSchristos        break
170*e670fd5cSchristos    fi
171*e670fd5cSchristos    echo "Waiting ${SLEEP1} seconds for slapd to start..."
172*e670fd5cSchristos    sleep ${SLEEP1}
173*e670fd5cSchristosdone
174*e670fd5cSchristos
175*e670fd5cSchristosif test $RC != 0 ; then
176*e670fd5cSchristos    echo "failed ($RC)!"
177*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
178*e670fd5cSchristos    exit $RC
179*e670fd5cSchristosfi
180*e670fd5cSchristos
181*e670fd5cSchristos. $CONFFILTER $BACKEND < $TLSCONF > $CONF1
182*e670fd5cSchristos
183*e670fd5cSchristosecho "TLSCACertificateFile $TESTDIR/tls/ca/certs/testsuiteCA.crt" >>$CONF1
184*e670fd5cSchristosecho "database config" >>$CONF1
185*e670fd5cSchristosecho "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >>$CONF1
186*e670fd5cSchristos
187*e670fd5cSchristos# We check basic remoteauth operation and generated configuration in these
188*e670fd5cSchristos# circumstances:
189*e670fd5cSchristos# 1. configured online through cn=config (what we set up above)
190*e670fd5cSchristos# 2. the server from 1. restarted (loading from cn=config on startup)
191*e670fd5cSchristos# 3. configured and started through a slapd.conf
192*e670fd5cSchristos#
193*e670fd5cSchristos# All of the above should present the same behaviour and cn=config output
194*e670fd5cSchristos
195*e670fd5cSchristosecho "Saving generated config before server restart..."
196*e670fd5cSchristosecho "# search output from dynamically configured server..." >> $SERVER1OUT
197*e670fd5cSchristos$LDAPSEARCH -D cn=config -H $URI1 -y $CONFIGPWF \
198*e670fd5cSchristos    -b "olcOverlay={0}remoteauth,olcDatabase={1}$BACKEND,cn=config" \
199*e670fd5cSchristos    >> $SERVER1OUT 2>&1
200*e670fd5cSchristosRC=$?
201*e670fd5cSchristosif test $RC != 0 ; then
202*e670fd5cSchristos    echo "ldapsearch failed ($RC)!"
203*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
204*e670fd5cSchristos    exit $RC
205*e670fd5cSchristosfi
206*e670fd5cSchristos
207*e670fd5cSchristosecho -n "Checking bind handling... "
208*e670fd5cSchristos
209*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$BJORNSDN" -w bjorn >/dev/null
210*e670fd5cSchristosRC=$?
211*e670fd5cSchristosif test $RC != 0 ; then
212*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
213*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
214*e670fd5cSchristos    exit $RC
215*e670fd5cSchristosfi
216*e670fd5cSchristosecho -n "1 "
217*e670fd5cSchristos
218*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$JOHNDDN" -w bjorn2 >/dev/null
219*e670fd5cSchristosRC=$?
220*e670fd5cSchristosif test $RC != 0 ; then
221*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
222*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
223*e670fd5cSchristos    exit $RC
224*e670fd5cSchristosfi
225*e670fd5cSchristosecho -n "2 "
226*e670fd5cSchristos
227*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$MELLIOTDN" -w bjorn >/dev/null
228*e670fd5cSchristosRC=$?
229*e670fd5cSchristosif test $RC != 0 ; then
230*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
231*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
232*e670fd5cSchristos    exit $RC
233*e670fd5cSchristosfi
234*e670fd5cSchristosecho -n "3 "
235*e670fd5cSchristos
236*e670fd5cSchristosecho "ok"
237*e670fd5cSchristos
238*e670fd5cSchristosecho "Stopping slapd on TCP/IP port $PORT1..."
239*e670fd5cSchristoskill -HUP $REMOTEAUTH_PID
240*e670fd5cSchristosKILLPIDS="$BACKEND_PID"
241*e670fd5cSchristossleep $SLEEP0
242*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT1..."
243*e670fd5cSchristos$SLAPD -F $TESTDIR/confdir -h $URI1 -d $LVL >> $LOG1 2>&1 &
244*e670fd5cSchristosREMOTEAUTH_PID=$!
245*e670fd5cSchristosif test $WAIT != 0 ; then
246*e670fd5cSchristos    echo REMOTEAUTH_PID $REMOTEAUTH_PID
247*e670fd5cSchristos    read foo
248*e670fd5cSchristosfi
249*e670fd5cSchristosKILLPIDS="$KILLPIDS $REMOTEAUTH_PID"
250*e670fd5cSchristos
251*e670fd5cSchristossleep $SLEEP0
252*e670fd5cSchristos
253*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
254*e670fd5cSchristos    $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
255*e670fd5cSchristos        'objectclass=*' > /dev/null 2>&1
256*e670fd5cSchristos    RC=$?
257*e670fd5cSchristos    if test $RC = 0 ; then
258*e670fd5cSchristos        break
259*e670fd5cSchristos    fi
260*e670fd5cSchristos    echo "Waiting ${SLEEP1} seconds for slapd to start..."
261*e670fd5cSchristos    sleep ${SLEEP1}
262*e670fd5cSchristosdone
263*e670fd5cSchristos
264*e670fd5cSchristosecho "Saving generated config after server restart..."
265*e670fd5cSchristosecho "# search output from dynamically configured server after restart..." >> $SERVER2OUT
266*e670fd5cSchristos$LDAPSEARCH -D cn=config -H $URI1 -y $CONFIGPWF \
267*e670fd5cSchristos    -b "olcOverlay={0}remoteauth,olcDatabase={1}$BACKEND,cn=config" \
268*e670fd5cSchristos    >> $SERVER2OUT 2>&1
269*e670fd5cSchristosRC=$?
270*e670fd5cSchristosif test $RC != 0 ; then
271*e670fd5cSchristos    echo "ldapsearch failed ($RC)!"
272*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
273*e670fd5cSchristos    exit $RC
274*e670fd5cSchristosfi
275*e670fd5cSchristos
276*e670fd5cSchristosecho -n "Checking bind handling... "
277*e670fd5cSchristos
278*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$BJORNSDN" -w bjorn >/dev/null
279*e670fd5cSchristosRC=$?
280*e670fd5cSchristosif test $RC != 0 ; then
281*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
282*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
283*e670fd5cSchristos    exit $RC
284*e670fd5cSchristosfi
285*e670fd5cSchristosecho -n "1 "
286*e670fd5cSchristos
287*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$JOHNDDN" -w bjorn2 >/dev/null
288*e670fd5cSchristosRC=$?
289*e670fd5cSchristosif test $RC != 0 ; then
290*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
291*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
292*e670fd5cSchristos    exit $RC
293*e670fd5cSchristosfi
294*e670fd5cSchristosecho -n "2 "
295*e670fd5cSchristos
296*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$MELLIOTDN" -w bjorn >/dev/null
297*e670fd5cSchristosRC=$?
298*e670fd5cSchristosif test $RC != 0 ; then
299*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
300*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
301*e670fd5cSchristos    exit $RC
302*e670fd5cSchristosfi
303*e670fd5cSchristosecho -n "3 "
304*e670fd5cSchristos
305*e670fd5cSchristosecho "ok"
306*e670fd5cSchristos
307*e670fd5cSchristosecho "Stopping slapd on TCP/IP port $PORT1..."
308*e670fd5cSchristoskill -HUP $REMOTEAUTH_PID
309*e670fd5cSchristosKILLPIDS="$BACKEND_PID"
310*e670fd5cSchristossleep $SLEEP0
311*e670fd5cSchristos
312*e670fd5cSchristosecho "Testing slapd.conf support..."
313*e670fd5cSchristossed -e "s,database\\s*monitor,\\
314*e670fd5cSchristosTLSCACertificateFile $TESTDIR/tls/ca/certs/testsuiteCA.crt\\
315*e670fd5cSchristos\\
316*e670fd5cSchristos#remoteauthmod#moduleload ../servers/slapd/overlays/remoteauth.la\\
317*e670fd5cSchristosinclude $TESTDIR/remoteauth.conf\\
318*e670fd5cSchristos\\
319*e670fd5cSchristosdatabase monitor," $TLSCONF | . $CONFFILTER $BACKEND >$CONF1
320*e670fd5cSchristosecho "database config" >>$CONF1
321*e670fd5cSchristosecho "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >>$CONF1
322*e670fd5cSchristos
323*e670fd5cSchristos. $CONFFILTER $BACKEND < $DATADIR/remoteauth/remoteauth.conf >$TESTDIR/remoteauth.conf
324*e670fd5cSchristos
325*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT1..."
326*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL >> $LOG1 2>&1 &
327*e670fd5cSchristosREMOTEAUTH_PID=$!
328*e670fd5cSchristosif test $WAIT != 0 ; then
329*e670fd5cSchristos    echo REMOTEAUTH_PID $REMOTEAUTH_PID
330*e670fd5cSchristos    read foo
331*e670fd5cSchristosfi
332*e670fd5cSchristosKILLPIDS="$KILLPIDS $REMOTEAUTH_PID"
333*e670fd5cSchristos
334*e670fd5cSchristossleep $SLEEP0
335*e670fd5cSchristos
336*e670fd5cSchristosfor i in 0 1 2 3 4 5; do
337*e670fd5cSchristos    $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
338*e670fd5cSchristos        'objectclass=*' > /dev/null 2>&1
339*e670fd5cSchristos    RC=$?
340*e670fd5cSchristos    if test $RC = 0 ; then
341*e670fd5cSchristos        break
342*e670fd5cSchristos    fi
343*e670fd5cSchristos    echo "Waiting ${SLEEP1} seconds for slapd to start..."
344*e670fd5cSchristos    sleep ${SLEEP1}
345*e670fd5cSchristosdone
346*e670fd5cSchristos
347*e670fd5cSchristosecho "Saving generated config from a slapd.conf sourced server..."
348*e670fd5cSchristosecho "# search output from server running from slapd.conf..." >> $SERVER3OUT
349*e670fd5cSchristos$LDAPSEARCH -D cn=config -H $URI1 -y $CONFIGPWF \
350*e670fd5cSchristos    -b "olcOverlay={0}remoteauth,olcDatabase={1}$BACKEND,cn=config" \
351*e670fd5cSchristos    >> $SERVER3OUT 2>&1
352*e670fd5cSchristosRC=$?
353*e670fd5cSchristosif test $RC != 0 ; then
354*e670fd5cSchristos    echo "ldapsearch failed ($RC)!"
355*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
356*e670fd5cSchristos    exit $RC
357*e670fd5cSchristosfi
358*e670fd5cSchristos
359*e670fd5cSchristosecho -n "Checking bind handling... "
360*e670fd5cSchristos
361*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$BJORNSDN" -w bjorn >/dev/null
362*e670fd5cSchristosRC=$?
363*e670fd5cSchristosif test $RC != 0 ; then
364*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
365*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
366*e670fd5cSchristos    exit $RC
367*e670fd5cSchristosfi
368*e670fd5cSchristosecho -n "1 "
369*e670fd5cSchristos
370*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$JOHNDDN" -w bjorn2 >/dev/null
371*e670fd5cSchristosRC=$?
372*e670fd5cSchristosif test $RC != 0 ; then
373*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
374*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
375*e670fd5cSchristos    exit $RC
376*e670fd5cSchristosfi
377*e670fd5cSchristosecho -n "2 "
378*e670fd5cSchristos
379*e670fd5cSchristos$LDAPWHOAMI -H $URI1 -x -D "$MELLIOTDN" -w bjorn >/dev/null
380*e670fd5cSchristosRC=$?
381*e670fd5cSchristosif test $RC != 0 ; then
382*e670fd5cSchristos    echo "ldapwhoami failed ($RC)!"
383*e670fd5cSchristos    test $KILLSERVERS != no && kill -HUP $KILLPIDS
384*e670fd5cSchristos    exit $RC
385*e670fd5cSchristosfi
386*e670fd5cSchristosecho -n "3 "
387*e670fd5cSchristos
388*e670fd5cSchristosecho "ok"
389*e670fd5cSchristos
390*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS
391*e670fd5cSchristos
392*e670fd5cSchristos# LDIFFILTER doesn't (un)wrap long lines yet, so the result would differ
393*e670fd5cSchristos#. $CONFFILTER $BACKEND < $DATADIR/remoteauth/config.ldif \
394*e670fd5cSchristos#    | $LDIFFILTER -s a > $SERVER6FLT
395*e670fd5cSchristos
396*e670fd5cSchristos# We've already filtered out the ordering markers, now sort the entries
397*e670fd5cSchristosecho "Filtering ldapsearch results..."
398*e670fd5cSchristos$LDIFFILTER -s a < $SERVER1OUT > $SERVER1FLT
399*e670fd5cSchristos$LDIFFILTER -s a < $SERVER2OUT > $SERVER2FLT
400*e670fd5cSchristos$LDIFFILTER -s a < $SERVER3OUT > $SERVER3FLT
401*e670fd5cSchristosecho "Filtering expected entries..."
402*e670fd5cSchristos
403*e670fd5cSchristosecho "Comparing filter output..."
404*e670fd5cSchristos#$CMP $SERVER6FLT $SERVER1FLT > $CMPOUT && \
405*e670fd5cSchristos$CMP $SERVER1FLT $SERVER2FLT > $CMPOUT && \
406*e670fd5cSchristos$CMP $SERVER2FLT $SERVER3FLT > $CMPOUT
407*e670fd5cSchristos
408*e670fd5cSchristosif test $? != 0 ; then
409*e670fd5cSchristos	echo "Comparison failed"
410*e670fd5cSchristos	exit 1
411*e670fd5cSchristosfi
412*e670fd5cSchristos
413*e670fd5cSchristosecho ">>>>> Test succeeded"
414*e670fd5cSchristos
415*e670fd5cSchristostest $KILLSERVERS != no && wait
416*e670fd5cSchristos
417*e670fd5cSchristosexit 0
418