1#! /bin/sh 2# $OpenLDAP$ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 1998-2021 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 16echo "running defines.sh" 17. $SRCDIR/scripts/defines.sh 18 19if test $SYNCPROV = syncprovno; then 20 echo "Syncrepl provider overlay not available, test skipped" 21 exit 0 22fi 23 24mkdir -p $TESTDIR $DBDIR1 25 26echo "This test checks for pending operations to resume correctly" 27echo "after they were stopped by a writer getting blocked by a full" 28echo "socket output buffer. It uses a search with syncrepl control" 29echo "and multiple modifications to generate enough responses to" 30echo "fill the output buffer." 31echo "" 32 33# 34# Test replication: 35# - start provider 36# - populate over ldap 37# - start persistent search and ignoring responses 38# - perform some repeated adds/deletes to fill buffer 39# - abandon persistent search and issue new search 40# - if the bug is present, this will timeout. 41# 42 43echo "Starting provider slapd on TCP/IP port $PORT1..." 44. $CONFFILTER $BACKEND < $SRPROVIDERCONF > $CONF1 45$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 46PID=$! 47if test $WAIT != 0 ; then 48 echo PID $PID 49 read foo 50fi 51KILLPIDS="$PID" 52 53sleep 1 54 55echo "Using ldapsearch to check that provider slapd is running..." 56for i in 0 1 2 3 4 5; do 57 $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 58 'objectclass=*' > /dev/null 2>&1 59 RC=$? 60 if test $RC = 0 ; then 61 break 62 fi 63 echo "Waiting 5 seconds for slapd to start..." 64 sleep 5 65done 66 67if test $RC != 0 ; then 68 echo "ldapsearch failed ($RC)!" 69 test $KILLSERVERS != no && kill -HUP $KILLPIDS 70 exit $RC 71fi 72 73echo "Using ldapadd to populate the provider directory..." 74$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD < \ 75 $LDIFORDERED > /dev/null 2>&1 76RC=$? 77if test $RC != 0 ; then 78 echo "ldapadd failed ($RC)!" 79 test $KILLSERVERS != no && kill -HUP $KILLPIDS 80 exit $RC 81fi 82 83echo "Starting persistent search and modifications..." 84echo '(Ignore the "press Enter to continue" that appears below)' 85( sleep 3; echo "" 1>&2; $PROGDIR/slapd-addel -H $URI1 -D "$MANAGERDN" -w $PASSWD -l 4000 -f $DATADIR/do_add.1 1>&2; \ 86echo "" ) | $LDAPSEARCH -b "$BASEDN" -H $URI1 -E sync=rp -e backlog -l $SLEEP1 87 88if test $? != 0 ; then 89 echo "ldapsearch failed - write waiter didn't resume pending ops" 90 test $KILLSERVERS != no && kill -HUP $KILLPIDS 91 exit 1 92fi 93 94test $KILLSERVERS != no && kill -HUP $KILLPIDS 95 96echo ">>>>> Test succeeded" 97 98test $KILLSERVERS != no && wait 99 100exit 0 101