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 1998-2021 The OpenLDAP Foundation. 6*e670fd5cSchristos## All rights reserved. 7*e670fd5cSchristos## 8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without 9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP 10*e670fd5cSchristos## Public License. 11*e670fd5cSchristos## 12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the 13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at 14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>. 15*e670fd5cSchristos 16*e670fd5cSchristosecho "running defines.sh" 17*e670fd5cSchristos. $SRCDIR/scripts/defines.sh 18*e670fd5cSchristos 19*e670fd5cSchristosif test $BACKLDAP = "ldapno" ; then 20*e670fd5cSchristos echo "LDAP backend not available, test skipped" 21*e670fd5cSchristos exit 0 22*e670fd5cSchristosfi 23*e670fd5cSchristosif test $RWM = "rwmno" ; then 24*e670fd5cSchristos echo "rwm (rewrite/remap) overlay not available, test skipped" 25*e670fd5cSchristos exit 0 26*e670fd5cSchristosfi 27*e670fd5cSchristos 28*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1 $DBDIR2 29*e670fd5cSchristos$SLAPPASSWD -g -n >$CONFIGPWF 30*e670fd5cSchristos 31*e670fd5cSchristos# 32*e670fd5cSchristos# Start slapd that acts as a remote LDAP server that will be proxied 33*e670fd5cSchristos# 34*e670fd5cSchristosecho "Running slapadd to build database for the remote slapd server..." 35*e670fd5cSchristos. $CONFFILTER $BACKEND < $CONF > $CONF1 36*e670fd5cSchristos$SLAPADD -f $CONF1 -l $LDIFORDERED 37*e670fd5cSchristosRC=$? 38*e670fd5cSchristosif test $RC != 0 ; then 39*e670fd5cSchristos echo "slapadd failed ($RC)!" 40*e670fd5cSchristos exit $RC 41*e670fd5cSchristosfi 42*e670fd5cSchristos 43*e670fd5cSchristosecho "Starting remote slapd server on TCP/IP port $PORT1..." 44*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 45*e670fd5cSchristosSERVERPID=$! 46*e670fd5cSchristosif test $WAIT != 0 ; then 47*e670fd5cSchristos echo SERVERPID $SERVERPID 48*e670fd5cSchristos read foo 49*e670fd5cSchristosfi 50*e670fd5cSchristos 51*e670fd5cSchristosecho "Using ldapsearch to check that slapd is running..." 52*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 53*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 54*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 55*e670fd5cSchristos RC=$? 56*e670fd5cSchristos if test $RC = 0 ; then 57*e670fd5cSchristos break 58*e670fd5cSchristos fi 59*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for slapd to start..." 60*e670fd5cSchristos sleep $SLEEP1 61*e670fd5cSchristosdone 62*e670fd5cSchristos 63*e670fd5cSchristosif test $RC != 0 ; then 64*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 65*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 66*e670fd5cSchristos exit $RC 67*e670fd5cSchristosfi 68*e670fd5cSchristos 69*e670fd5cSchristos# 70*e670fd5cSchristos# Start ldapd that will proxy for the remote server 71*e670fd5cSchristos# 72*e670fd5cSchristos# Proxy is configured with two slapd-ldap backends: 73*e670fd5cSchristos# - one with idle timeout set: dc=idle-timeout,$BASED 74*e670fd5cSchristos# - one with connection TTL set: dc=conn-ttl,$BASEDN 75*e670fd5cSchristos# 76*e670fd5cSchristosecho "Starting slapd proxy on TCP/IP port $PORT2..." 77*e670fd5cSchristos. $CONFFILTER $BACKEND < $DATADIR/slapd-proxytimeout.conf > $CONF2 78*e670fd5cSchristos$SLAPD -f $CONF2 -h $URI2 -d $LVL > $LOG2 2>&1 & 79*e670fd5cSchristosPROXYPID=$! 80*e670fd5cSchristosif test $WAIT != 0 ; then 81*e670fd5cSchristos echo PROXYPID $PROXYPID 82*e670fd5cSchristos read foo 83*e670fd5cSchristosfi 84*e670fd5cSchristos 85*e670fd5cSchristosKILLPIDS="$SERVERPID $PROXYPID" 86*e670fd5cSchristos 87*e670fd5cSchristosecho "Using ldapsearch to check that slapd is running..." 88*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 89*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \ 90*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 91*e670fd5cSchristos RC=$? 92*e670fd5cSchristos if test $RC = 0 ; then 93*e670fd5cSchristos break 94*e670fd5cSchristos fi 95*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for slapd to start..." 96*e670fd5cSchristos sleep $SLEEP1 97*e670fd5cSchristosdone 98*e670fd5cSchristos 99*e670fd5cSchristosif test $RC != 0 ; then 100*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 101*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 102*e670fd5cSchristos exit $RC 103*e670fd5cSchristosfi 104*e670fd5cSchristos 105*e670fd5cSchristos############################################################################## 106*e670fd5cSchristos# 107*e670fd5cSchristos# Test 1: Test that shared connections are timed out 108*e670fd5cSchristos# 109*e670fd5cSchristos 110*e670fd5cSchristosCONN_BEGINS=`date +%s` 111*e670fd5cSchristosCONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT` 112*e670fd5cSchristosecho "Create shared connection towards remote LDAP (time_t now=$CONN_BEGINS timeout=$CONN_EXPIRES)" 113*e670fd5cSchristos 114*e670fd5cSchristos$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \ 115*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 116*e670fd5cSchristos -H $URI2 \ 117*e670fd5cSchristos -w $PASSWD \ 118*e670fd5cSchristos 'objectclass=*' > $TESTOUT 2>&1 119*e670fd5cSchristosRC=$? 120*e670fd5cSchristosif test $RC != 0 ; then 121*e670fd5cSchristos echo "ldapsearch failed for base: dc=idle-timeout,$BASEDN ($RC)!" 122*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 123*e670fd5cSchristos exit $RC 124*e670fd5cSchristosfi 125*e670fd5cSchristos 126*e670fd5cSchristos$LDAPSEARCH -b "dc=conn-ttl,$BASEDN" \ 127*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 128*e670fd5cSchristos -H $URI2 \ 129*e670fd5cSchristos -w $PASSWD \ 130*e670fd5cSchristos 'objectclass=*' >> $TESTOUT 2>&1 131*e670fd5cSchristosRC=$? 132*e670fd5cSchristosif test $RC != 0 ; then 133*e670fd5cSchristos echo "ldapsearch failed for base: dc=conn-ttl,$BASEDN ($RC)!" 134*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 135*e670fd5cSchristos exit $RC 136*e670fd5cSchristosfi 137*e670fd5cSchristos 138*e670fd5cSchristos# Check that connections are established by searching for olmDbConnURI from Monitor 139*e670fd5cSchristos 140*e670fd5cSchristosecho "Checking that proxy has created connections towards backend (time_t now=`date +%s`)" 141*e670fd5cSchristos 142*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 143*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 144*e670fd5cSchristos -H $URI2 \ 145*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 146*e670fd5cSchristosRC=$? 147*e670fd5cSchristosif test $RC != 0 ; then 148*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server is not found ($RC)" 149*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 150*e670fd5cSchristos exit $RC 151*e670fd5cSchristosfi 152*e670fd5cSchristos 153*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 154*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 155*e670fd5cSchristos -H $URI2 \ 156*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 157*e670fd5cSchristosRC=$? 158*e670fd5cSchristosif test $RC != 0 ; then 159*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server is not found ($RC)" 160*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 161*e670fd5cSchristos exit $RC 162*e670fd5cSchristosfi 163*e670fd5cSchristos 164*e670fd5cSchristos# Wait for connections to be closed, either due to 165*e670fd5cSchristos# - idle-timeout and 166*e670fd5cSchristos# - conn-ttl 167*e670fd5cSchristos# sleep 2 second overtime for robustness of the test case 168*e670fd5cSchristosecho "Sleeping until idle-timeout and conn-ttl have passed" 169*e670fd5cSchristosNOW=`date +%s` 170*e670fd5cSchristossleep `expr $CONN_EXPIRES - $NOW + 2` 171*e670fd5cSchristos 172*e670fd5cSchristosecho "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)" 173*e670fd5cSchristos 174*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 175*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 176*e670fd5cSchristos -H $URI2 \ 177*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 178*e670fd5cSchristosRC=$? 179*e670fd5cSchristosif test $RC != 1 ; then 180*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server was not closed" 181*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 182*e670fd5cSchristos exit $RC 183*e670fd5cSchristosfi 184*e670fd5cSchristos 185*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 186*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 187*e670fd5cSchristos -H $URI2 \ 188*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 189*e670fd5cSchristosRC=$? 190*e670fd5cSchristosif test $RC != 1 ; then 191*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server was not closed" 192*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 193*e670fd5cSchristos exit $RC 194*e670fd5cSchristosfi 195*e670fd5cSchristos 196*e670fd5cSchristos 197*e670fd5cSchristos############################################################################## 198*e670fd5cSchristos# 199*e670fd5cSchristos# Test 2: Test that private connections are timed out 200*e670fd5cSchristos# 201*e670fd5cSchristos 202*e670fd5cSchristosCONN_BEGINS=`date +%s` 203*e670fd5cSchristosCONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT` 204*e670fd5cSchristosecho "Create private connection towards remote LDAP (time_t now=$CONN_BEGINS timeout=$CONN_EXPIRES)" 205*e670fd5cSchristos 206*e670fd5cSchristos# Create fifos that are used to pass searches from the test case to ldapsearch 207*e670fd5cSchristosrm -f $TESTDIR/ldapsearch1.fifo $TESTDIR/ldapsearch2.fifo 208*e670fd5cSchristosmkfifo $TESTDIR/ldapsearch1.fifo $TESTDIR/ldapsearch2.fifo 209*e670fd5cSchristos 210*e670fd5cSchristos# Execute ldapsearch on background and have it read searches from the fifo 211*e670fd5cSchristos$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \ 212*e670fd5cSchristos -D "cn=Barbara Jensen,ou=Information Technology Division,dc=idle-timeout,$BASEDN" \ 213*e670fd5cSchristos -H $URI2 \ 214*e670fd5cSchristos -w "bjensen" \ 215*e670fd5cSchristos -f $TESTDIR/ldapsearch1.fifo >> $TESTOUT 2>&1 & 216*e670fd5cSchristosLDAPSEARCHPIDS=$! 217*e670fd5cSchristos 218*e670fd5cSchristos$LDAPSEARCH -b "dc=conn-ttl,$BASEDN" \ 219*e670fd5cSchristos -D "cn=Barbara Jensen,ou=Information Technology Division,dc=conn-ttl,$BASEDN" \ 220*e670fd5cSchristos -H $URI2 \ 221*e670fd5cSchristos -w "bjensen" \ 222*e670fd5cSchristos -f $TESTDIR/ldapsearch2.fifo >> $TESTOUT 2>&1 & 223*e670fd5cSchristosLDAPSEARCHPIDS="$LDAPSEARCHPIDS $!" 224*e670fd5cSchristos 225*e670fd5cSchristos# Open fifos as file descriptor 226*e670fd5cSchristosexec 3>$TESTDIR/ldapsearch1.fifo 227*e670fd5cSchristosexec 4>$TESTDIR/ldapsearch2.fifo 228*e670fd5cSchristos 229*e670fd5cSchristos# Trigger LDAP connections towards the proxy by executing a search 230*e670fd5cSchristosecho 'objectclass=*' >&3 231*e670fd5cSchristosecho 'objectclass=*' >&4 232*e670fd5cSchristos 233*e670fd5cSchristos# wait for ldapsearches (running as background processes) to execute search operations 234*e670fd5cSchristossleep 2 235*e670fd5cSchristos 236*e670fd5cSchristosecho "Checking that proxy has created connections towards backend (time_t now=`date +%s`)" 237*e670fd5cSchristos 238*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 239*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 240*e670fd5cSchristos -H $URI2 \ 241*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 242*e670fd5cSchristosRC=$? 243*e670fd5cSchristosif test $RC != 0 ; then 244*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server is not found ($RC)" 245*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS $LDAPSEARCHPIDS 246*e670fd5cSchristos exit $RC 247*e670fd5cSchristosfi 248*e670fd5cSchristos 249*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 250*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 251*e670fd5cSchristos -H $URI2 \ 252*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 253*e670fd5cSchristosRC=$? 254*e670fd5cSchristosif test $RC != 0 ; then 255*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server is not found ($RC)" 256*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS $LDAPSEARCHPIDS 257*e670fd5cSchristos exit $RC 258*e670fd5cSchristosfi 259*e670fd5cSchristos 260*e670fd5cSchristos# Wait for connections to be closed, either due to 261*e670fd5cSchristos# - idle-timeout and 262*e670fd5cSchristos# - conn-ttl 263*e670fd5cSchristos# sleep 2 second overtime for robustness of the test case 264*e670fd5cSchristosecho "Sleeping until idle-timeout and conn-ttl have passed" 265*e670fd5cSchristosNOW=`date +%s` 266*e670fd5cSchristossleep `expr $CONN_EXPIRES - $NOW + 2` 267*e670fd5cSchristos 268*e670fd5cSchristosecho "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)" 269*e670fd5cSchristos 270*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 271*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 272*e670fd5cSchristos -H $URI2 \ 273*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 274*e670fd5cSchristosRC=$? 275*e670fd5cSchristosif test $RC != 1 ; then 276*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server was not closed" 277*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS $LDAPSEARCHPIDS 278*e670fd5cSchristos exit $RC 279*e670fd5cSchristosfi 280*e670fd5cSchristos 281*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 282*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 283*e670fd5cSchristos -H $URI2 \ 284*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 285*e670fd5cSchristosRC=$? 286*e670fd5cSchristosif test $RC != 1 ; then 287*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server was not closed" 288*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS $LDAPSEARCHPIDS 289*e670fd5cSchristos exit $RC 290*e670fd5cSchristosfi 291*e670fd5cSchristos 292*e670fd5cSchristos# Close the file descriptors associated with the fifos. 293*e670fd5cSchristos# This will trigger EOF to ldapsearch which will cause it to exit. 294*e670fd5cSchristosexec 3>&- 295*e670fd5cSchristosexec 4>&- 296*e670fd5cSchristos 297*e670fd5cSchristos 298*e670fd5cSchristos############################################################################## 299*e670fd5cSchristos# 300*e670fd5cSchristos# Test 3: Check that idle-timeout is reset on activity 301*e670fd5cSchristos# 302*e670fd5cSchristos 303*e670fd5cSchristosecho "Checking that idle-timeout is reset on activity" 304*e670fd5cSchristosCONN_BEGINS=`date +%s` 305*e670fd5cSchristosCONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT` 306*e670fd5cSchristosecho "Create cached connection: idle-timeout timeout starts (time_t now=$CONN_BEGINS, original_timeout=$CONN_EXPIRES)" 307*e670fd5cSchristos$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \ 308*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 309*e670fd5cSchristos -H $URI2 \ 310*e670fd5cSchristos -w $PASSWD \ 311*e670fd5cSchristos 'objectclass=*' >> $TESTOUT 2>&1 312*e670fd5cSchristosRC=$? 313*e670fd5cSchristosif test $RC != 0 ; then 314*e670fd5cSchristos echo "ldapsearch failed for base: dc=idle-timeout,$BASEDN ($RC)!" 315*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 316*e670fd5cSchristos exit $RC 317*e670fd5cSchristosfi 318*e670fd5cSchristos 319*e670fd5cSchristos# sleep until 2 seconds before idle-timeout, then extend the timeout by executing another search operation 320*e670fd5cSchristosNOW=`date +%s` 321*e670fd5cSchristossleep `expr $CONN_EXPIRES - $NOW - 2` 322*e670fd5cSchristos 323*e670fd5cSchristosCONN_BEGINS=`date +%s` 324*e670fd5cSchristosCONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT` 325*e670fd5cSchristosecho "Do another search to reset the timeout (time_t now=$CONN_BEGINS, new_timeout=$CONN_EXPIRES)" 326*e670fd5cSchristos$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \ 327*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 328*e670fd5cSchristos -H $URI2 \ 329*e670fd5cSchristos -w $PASSWD \ 330*e670fd5cSchristos 'objectclass=*' >> $TESTOUT 2>&1 331*e670fd5cSchristosRC=$? 332*e670fd5cSchristosif test $RC != 0 ; then 333*e670fd5cSchristos echo "ldapsearch failed for base: dc=idle-timeout,$BASEDN ($RC)!" 334*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 335*e670fd5cSchristos exit $RC 336*e670fd5cSchristosfi 337*e670fd5cSchristos 338*e670fd5cSchristos# sleep until 2 seconds before new extended idle-timeout, check that connection still exist 339*e670fd5cSchristosNOW=`date +%s` 340*e670fd5cSchristossleep `expr $CONN_EXPIRES - $NOW - 2` 341*e670fd5cSchristosecho "Check that connection is still alive due to idle-timeout reset (time_t now=`date +%s`)" 342*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 343*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 344*e670fd5cSchristos -H $URI2 \ 345*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 346*e670fd5cSchristosRC=$? 347*e670fd5cSchristosif test $RC != 0 ; then 348*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server is not found ($RC)" 349*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 350*e670fd5cSchristos exit $RC 351*e670fd5cSchristosfi 352*e670fd5cSchristos 353*e670fd5cSchristos# sleep until 2 seconds after timeout, check that connection does not exist 354*e670fd5cSchristosNOW=`date +%s` 355*e670fd5cSchristossleep `expr $CONN_EXPIRES - $NOW + 2` 356*e670fd5cSchristosecho "Check that connection is closed after extended idle-timeout has passed (time_t now=`date +%s`)" 357*e670fd5cSchristos$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \ 358*e670fd5cSchristos -D "cn=Manager,dc=local,dc=com" \ 359*e670fd5cSchristos -H $URI2 \ 360*e670fd5cSchristos -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null 361*e670fd5cSchristosRC=$? 362*e670fd5cSchristosif test $RC != 1 ; then 363*e670fd5cSchristos echo "Error: LDAP connection to remote LDAP server was not closed" 364*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 365*e670fd5cSchristos exit $RC 366*e670fd5cSchristosfi 367*e670fd5cSchristos 368*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 369*e670fd5cSchristos 370*e670fd5cSchristosecho ">>>>> Test succeeded" 371*e670fd5cSchristos 372*e670fd5cSchristostest $KILLSERVERS != no && wait 373*e670fd5cSchristos 374*e670fd5cSchristosexit 0 375