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 $MEMBEROF = memberofno; then
20 echo "memberof overlay not available, test skipped"
25 echo " This test tracks a case where it was not possible to modify the memberof overlay configuration"
26 echo " when the provider is dynamically configured for replication."
27 echo " See http://www.openldap.org/its/index.cgi/?findid=8663 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 [ "$MEMBEROF" = memberofmod ]; then
114 echo "Configuring memberof 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: memberof.la
123 if test $RC != 0 ; then
124 echo "ldapadd failed for moduleLoad ($RC)!"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
130 echo "Configuring memberof on the provider..."
131 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
132 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
134 objectClass: olcOverlayConfig
135 objectClass: olcConfig
137 objectClass: olcMemberOf
138 olcMemberOfGroupOC: groupOfNames
139 olcMemberOfMemberAD: member
140 olcMemberOfMemberOfAD: memberOf
141 olcMemberOfDN: cn=Manager,dc=example,dc=com
142 olcMemberOfDangling: ignore
143 olcMemberOfDanglingError: 13
144 olcMemberOfRefInt: FALSE
145 olcOverlay: {0}memberof
149 if test $RC != 0 ; then
150 echo "ldapmodify failed ($RC)!"
151 test $KILLSERVERS != no && kill -HUP $KILLPIDS
157 echo "Setting olcMemberOfRefInt to TRUE on the provider..."
158 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
159 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
161 replace: olcMemberOfRefInt
162 olcMemberOfRefInt: TRUE
166 if test $RC != 0 ; then
167 echo "ldapmodify failed ($RC)!"
168 test $KILLSERVERS != no && kill -HUP $KILLPIDS
174 echo "Changing olcMemberOfDangling to error on the provider..."
175 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
176 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
178 replace: olcMemberOfDangling
179 olcMemberOfDangling: error
183 if test $RC != 0 ; then
184 echo "ldapmodify failed ($RC)!"
185 test $KILLSERVERS != no && kill -HUP $KILLPIDS
191 echo "Changing olcMemberOfDanglingError to 20 on the provider..."
192 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
193 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
195 replace: olcMemberOfDanglingError
196 olcMemberOfDanglingError: 20
200 if test $RC != 0 ; then
201 echo "ldapmodify failed ($RC)!"
202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
208 echo "Setting olcMemberOfDN to cn=config on the provider..."
209 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
210 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
212 replace: olcMemberOfDN
213 olcMemberOfDN: cn=config
217 if test $RC != 0 ; then
218 echo "ldapmodify failed ($RC)!"
219 test $KILLSERVERS != no && kill -HUP $KILLPIDS
225 echo "Changing olcMemberOfGroupOC to groupOfUniqueNames on the provider..."
226 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
227 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
229 replace: olcMemberOfGroupOC
230 olcMemberOfGroupOC: groupOfNames
234 if test $RC != 0 ; then
235 echo "ldapmodify failed ($RC)!"
236 test $KILLSERVERS != no && kill -HUP $KILLPIDS
242 echo "Changing olcMemberOfMemberAD to uniqueMember on the provider..."
243 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
244 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
246 replace: olcMemberOfMemberAD
247 olcMemberOfMemberAD: uniqueMember
251 if test $RC != 0 ; then
252 echo "ldapmodify failed ($RC)!"
253 test $KILLSERVERS != no && kill -HUP $KILLPIDS
257 echo "Changing olcMemberOfMemberOfAD to owner on the provider..."
258 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
259 dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
261 replace: olcMemberOfMemberOfAD
262 olcMemberOfMemberOfAD: owner
266 if test $RC != 0 ; then
267 echo "ldapmodify failed ($RC)!"
268 test $KILLSERVERS != no && kill -HUP $KILLPIDS
272 test $KILLSERVERS != no && kill -HUP $KILLPIDS
275 echo ">>>>> Test succeeded"
277 test $KILLSERVERS != no && wait