3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2018 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 $SYNCPROV = syncprovno; then
20 echo "Syncrepl provider overlay not available, test skipped"
25 echo " This test tracks a case where it was not possible to modify the syncprov overlay configuration"
26 echo " when the provider is dynamically configured for replication."
27 echo " See http://www.openldap.org/its/index.cgi/?findid=8616 for more information"
33 mkdir -p $TESTDIR $DBDIR1 $PRODIR $CFPRO
35 $SLAPPASSWD -g -n >$CONFIGPWF
38 ITSDIR=$DATADIR/regressions/its$ITS
40 echo "Starting provider slapd on TCP/IP port $PORT1..."
41 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd-provider.ldif > $CONFLDIF
42 $SLAPADD -F $CFPRO -n 0 -l $CONFLDIF
43 $SLAPD -F $CFPRO -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
45 if test $WAIT != 0 ; then
53 echo "Using ldapsearch to check that provider slapd is running..."
54 for i in 0 1 2 3 4 5; do
55 $LDAPSEARCH -s base -b "" -H $URI1 \
56 'objectclass=*' > /dev/null 2>&1
58 if test $RC = 0 ; then
61 echo "Waiting 5 seconds for slapd to start..."
65 if test $RC != 0 ; then
66 echo "ldapsearch failed ($RC)!"
67 test $KILLSERVERS != no && kill -HUP $KILLPIDS
71 echo "Populating database on provider..."
72 $LDAPADD -D $MANAGERDN -H $URI1 -w $PASSWD << EOMODS >> $TESTOUT 2>&1
79 dn: ou=LDAPRoles,dc=example,dc=com
81 objectClass: organizationalUnit
84 dn: dc=users,dc=example,dc=com
90 dn: uid=johndoe,dc=users,dc=example,dc=com
92 objectClass: inetOrgPerson
98 dn: cn=replicator,ou=LDAPRoles,dc=example,dc=com
100 objectClass: simpleSecurityObject
101 objectClass: organizationalRole
107 if test $RC != 0 ; then
108 echo "ldapadd failed ($RC)!"
109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 if [ "$SYNCPROV" = syncprovmod ]; then
114 echo "Configuring syncprov module on the provider..."
115 $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
116 dn: cn=module,cn=config
117 objectClass: olcModuleList
119 olcModulePath: $TESTWD/../servers/slapd/overlays
120 olcModuleLoad: syncprov.la
123 if test $RC != 0 ; then
124 echo "ldapadd failed for moduleLoad ($RC)!"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
130 echo "Configuring replication on the provider..."
131 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
132 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
134 objectClass: olcOverlayConfig
135 objectClass: olcConfig
137 objectClass: olcSyncprovConfig
138 olcOverlay: {0}syncprov
139 olcSpSessionLog: 10000
140 olcSpCheckpoint: 100 10
144 if test $RC != 0 ; then
145 echo "ldapmodify failed ($RC)!"
146 test $KILLSERVERS != no && kill -HUP $KILLPIDS
152 echo "Setting olcSpNoPresent to TRUE on the provider..."
153 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
154 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
156 replace: olcSpNoPresent
161 if test $RC != 0 ; then
162 echo "ldapmodify failed ($RC)!"
163 test $KILLSERVERS != no && kill -HUP $KILLPIDS
169 echo "Changing olcSpNoPresent to FALSE on the provider..."
170 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
171 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
173 replace: olcSpNoPresent
174 olcSpNoPresent: FALSE
178 if test $RC != 0 ; then
179 echo "ldapmodify failed ($RC)!"
180 test $KILLSERVERS != no && kill -HUP $KILLPIDS
186 echo "Changing olcSpNoPresent back to TRUE on the provider..."
187 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
188 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
190 replace: olcSpNoPresent
195 if test $RC != 0 ; then
196 echo "ldapmodify failed ($RC)!"
197 test $KILLSERVERS != no && kill -HUP $KILLPIDS
203 echo "Setting olcSpReloadHint to TRUE on the provider..."
204 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
205 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
207 replace: olcSpReloadHint
208 olcSpReloadHint: TRUE
212 if test $RC != 0 ; then
213 echo "ldapmodify failed ($RC)!"
214 test $KILLSERVERS != no && kill -HUP $KILLPIDS
220 echo "Changing olcSpReloadHint to FALSE on the provider..."
221 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
222 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
224 replace: olcSpReloadHint
225 olcSpReloadHint: FALSE
229 if test $RC != 0 ; then
230 echo "ldapmodify failed ($RC)!"
231 test $KILLSERVERS != no && kill -HUP $KILLPIDS
237 echo "Changing olcSpReloadHint back to TRUE on the provider..."
238 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
239 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
241 replace: olcSpReloadHint
242 olcSpReloadHint: TRUE
246 if test $RC != 0 ; then
247 echo "ldapmodify failed ($RC)!"
248 test $KILLSERVERS != no && kill -HUP $KILLPIDS
252 test $KILLSERVERS != no && kill -HUP $KILLPIDS
255 echo ">>>>> Test succeeded"
257 test $KILLSERVERS != no && wait