1 1.1 lukem #! /bin/sh 2 1.1 lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>. 3 1.1 lukem ## 4 1.1.1.10 christos ## Copyright 1998-2024 The OpenLDAP Foundation. 5 1.1 lukem ## All rights reserved. 6 1.1 lukem ## 7 1.1 lukem ## Redistribution and use in source and binary forms, with or without 8 1.1 lukem ## modification, are permitted only as authorized by the OpenLDAP 9 1.1 lukem ## Public License. 10 1.1 lukem ## 11 1.1 lukem ## A copy of this license is available in the file LICENSE in the 12 1.1 lukem ## top-level directory of the distribution or, alternatively, at 13 1.1 lukem ## <http://www.OpenLDAP.org/license.html>. 14 1.1 lukem 15 1.1 lukem echo "running defines.sh" 16 1.1 lukem . $SRCDIR/scripts/defines.sh 17 1.1 lukem 18 1.1 lukem if test $DYNLIST = "dynlistno" ; then 19 1.1 lukem echo "dynlist overlay not available, test skipped" 20 1.1 lukem exit 0 21 1.1 lukem fi 22 1.1 lukem 23 1.1.1.3 adam if test $BACKEND = ldif ; then 24 1.1.1.3 adam # dynlist+ldif fails because back-ldif lacks bi_op_compare() 25 1.1.1.3 adam echo "$BACKEND backend unsuitable for dynlist overlay, test skipped" 26 1.1.1.3 adam exit 0 27 1.1.1.3 adam fi 28 1.1.1.3 adam 29 1.1 lukem mkdir -p $TESTDIR $DBDIR1 30 1.1 lukem 31 1.1 lukem $SLAPPASSWD -g -n >$CONFIGPWF 32 1.1 lukem echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf 33 1.1 lukem 34 1.1.1.9 christos DBIX=2 35 1.1.1.4 tron 36 1.1 lukem echo "Running slapadd to build slapd database..." 37 1.1.1.9 christos . $CONFFILTER $BACKEND < $DYNLISTCONF > $CONF1 38 1.1.1.9 christos $SLAPADD -f $CONF1 -l $LDIFORDERED 39 1.1 lukem RC=$? 40 1.1 lukem if test $RC != 0 ; then 41 1.1 lukem echo "slapadd failed ($RC)!" 42 1.1 lukem exit $RC 43 1.1 lukem fi 44 1.1 lukem 45 1.1 lukem 46 1.1 lukem echo "Starting slapd on TCP/IP port $PORT1..." 47 1.1.1.9 christos $SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 48 1.1 lukem PID=$! 49 1.1 lukem if test $WAIT != 0 ; then 50 1.1 lukem echo PID $PID 51 1.1 lukem read foo 52 1.1 lukem fi 53 1.1 lukem KILLPIDS="$PID" 54 1.1 lukem 55 1.1 lukem sleep 1 56 1.1 lukem 57 1.1 lukem echo "Testing slapd searching..." 58 1.1 lukem for i in 0 1 2 3 4 5; do 59 1.1.1.9 christos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 60 1.1 lukem '(objectclass=*)' > /dev/null 2>&1 61 1.1 lukem RC=$? 62 1.1 lukem if test $RC = 0 ; then 63 1.1 lukem break 64 1.1 lukem fi 65 1.1 lukem echo "Waiting 5 seconds for slapd to start..." 66 1.1 lukem sleep 5 67 1.1 lukem done 68 1.1 lukem 69 1.1 lukem if test $RC != 0 ; then 70 1.1 lukem echo "ldapsearch failed ($RC)!" 71 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 72 1.1 lukem exit $RC 73 1.1 lukem fi 74 1.1 lukem 75 1.1 lukem cat /dev/null > $SEARCHOUT 76 1.1 lukem 77 1.1 lukem LISTDN="ou=Dynamic Lists,$BASEDN" 78 1.1 lukem echo "Adding a dynamic list..." 79 1.1.1.9 christos $LDAPADD -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 80 1.1 lukem > $TESTOUT 2>&1 << EOMODS 81 1.1 lukem dn: $LISTDN 82 1.1 lukem objectClass: organizationalUnit 83 1.1 lukem ou: Dynamic Lists 84 1.1 lukem 85 1.1 lukem dn: cn=Dynamic List,$LISTDN 86 1.1 lukem objectClass: groupOfURLs 87 1.1 lukem cn: Dynamic List 88 1.1 lukem memberURL: ldap:///ou=People,${BASEDN}?cn,mail?sub?(objectClass=person) 89 1.1 lukem EOMODS 90 1.1 lukem 91 1.1 lukem echo "Testing list search of all attrs..." 92 1.1 lukem echo "# Testing list search of all attrs..." >> $SEARCHOUT 93 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 94 1.1 lukem '(cn=Dynamic List)' '*' \ 95 1.1 lukem >> $SEARCHOUT 2>&1 96 1.1 lukem RC=$? 97 1.1 lukem if test $RC != 0 ; then 98 1.1 lukem echo "ldapsearch failed ($RC)!" 99 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 100 1.1 lukem exit $RC 101 1.1 lukem fi 102 1.1 lukem 103 1.1 lukem echo "Testing list search of a listed attr..." 104 1.1 lukem echo "# Testing list search of a listed attr..." >> $SEARCHOUT 105 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 106 1.1 lukem '(cn=Dynamic List)' mail \ 107 1.1 lukem >> $SEARCHOUT 2>&1 108 1.1 lukem RC=$? 109 1.1 lukem if test $RC != 0 ; then 110 1.1 lukem echo "ldapsearch failed ($RC)!" 111 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 112 1.1 lukem exit $RC 113 1.1 lukem fi 114 1.1 lukem 115 1.1 lukem echo "Testing list search of a non-listed attr..." 116 1.1 lukem echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT 117 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 118 1.1 lukem '(cn=Dynamic List)' objectClass \ 119 1.1 lukem >> $SEARCHOUT 2>&1 120 1.1 lukem RC=$? 121 1.1 lukem if test $RC != 0 ; then 122 1.1 lukem echo "ldapsearch failed ($RC)!" 123 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 124 1.1 lukem exit $RC 125 1.1 lukem fi 126 1.1 lukem 127 1.1 lukem echo "Testing list search with (critical) manageDSAit..." 128 1.1 lukem echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT 129 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 -MM \ 130 1.1 lukem '(cn=Dynamic List)' '*' \ 131 1.1 lukem >> $SEARCHOUT 2>&1 132 1.1 lukem RC=$? 133 1.1 lukem if test $RC != 0 ; then 134 1.1 lukem echo "ldapsearch failed ($RC)!" 135 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 136 1.1 lukem exit $RC 137 1.1 lukem fi 138 1.1 lukem 139 1.1.1.9 christos echo "Testing filtered search with all attrs..." 140 1.1.1.9 christos echo "# Testing filtered search with all attrs..." >> $SEARCHOUT 141 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 142 1.1.1.9 christos '(mail=jdoe (at] woof.net)' '*' \ 143 1.1.1.9 christos >> $SEARCHOUT 2>&1 144 1.1.1.9 christos RC=$? 145 1.1.1.9 christos if test $RC != 0 ; then 146 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 147 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 148 1.1.1.9 christos exit $RC 149 1.1.1.9 christos fi 150 1.1.1.9 christos 151 1.1.1.9 christos echo "Testing filtered search of a listed attr..." 152 1.1.1.9 christos echo "# Testing filtered search of a listed attr..." >> $SEARCHOUT 153 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 154 1.1.1.9 christos '(mail=jdoe (at] woof.net)' mail \ 155 1.1.1.9 christos >> $SEARCHOUT 2>&1 156 1.1.1.9 christos RC=$? 157 1.1.1.9 christos if test $RC != 0 ; then 158 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 159 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 160 1.1.1.9 christos exit $RC 161 1.1.1.9 christos fi 162 1.1.1.9 christos 163 1.1.1.9 christos echo "Testing filtered search of a non-listed attr..." 164 1.1.1.9 christos echo "# Testing filtered search of a non-listed attr..." >> $SEARCHOUT 165 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 166 1.1.1.9 christos '(mail=jdoe (at] woof.net)' objectClass \ 167 1.1.1.9 christos >> $SEARCHOUT 2>&1 168 1.1.1.9 christos RC=$? 169 1.1.1.9 christos if test $RC != 0 ; then 170 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 171 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 172 1.1.1.9 christos exit $RC 173 1.1.1.9 christos fi 174 1.1.1.9 christos 175 1.1.1.9 christos echo "Testing filtered search of a non-present attr..." 176 1.1.1.9 christos echo "# Testing filtered search of a non-present attr..." >> $SEARCHOUT 177 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 178 1.1.1.9 christos '(mail=nobody@nowhere)' objectClass \ 179 1.1.1.9 christos >> $SEARCHOUT 2>&1 180 1.1.1.9 christos RC=$? 181 1.1.1.9 christos if test $RC != 0 ; then 182 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 183 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 184 1.1.1.9 christos exit $RC 185 1.1.1.9 christos fi 186 1.1.1.9 christos 187 1.1 lukem echo "Testing list compare..." 188 1.1 lukem echo "# Testing list compare..." >> $SEARCHOUT 189 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 190 1.1 lukem "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \ 191 1.1 lukem >> $SEARCHOUT 2>&1 192 1.1 lukem RC=$? 193 1.1 lukem case $RC in 194 1.1 lukem 5) 195 1.1 lukem echo "ldapcompare returned FALSE ($RC)!" 196 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 197 1.1 lukem exit $RC 198 1.1 lukem ;; 199 1.1 lukem 6) 200 1.1 lukem echo "ldapcompare returned TRUE ($RC)" 201 1.1 lukem ;; 202 1.1 lukem 0) 203 1.1 lukem echo "ldapcompare returned success ($RC)!" 204 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 205 1.1.1.10 christos exit 1 206 1.1 lukem ;; 207 1.1 lukem *) 208 1.1 lukem echo "ldapcompare failed ($RC)!" 209 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 210 1.1 lukem exit $RC 211 1.1 lukem ;; 212 1.1 lukem esac 213 1.1 lukem echo "" >> $SEARCHOUT 214 1.1 lukem 215 1.1 lukem echo "Testing list compare (should return FALSE)..." 216 1.1 lukem echo "# Testing list compare (should return FALSE)..." >> $SEARCHOUT 217 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 218 1.1 lukem "cn=Dynamic List,$LISTDN" "cn:FALSE" \ 219 1.1 lukem >> $SEARCHOUT 2>&1 220 1.1 lukem RC=$? 221 1.1 lukem case $RC in 222 1.1 lukem 5) 223 1.1 lukem echo "ldapcompare returned FALSE ($RC)" 224 1.1 lukem ;; 225 1.1 lukem 6) 226 1.1 lukem echo "ldapcompare returned TRUE ($RC)!" 227 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 228 1.1 lukem exit $RC 229 1.1 lukem ;; 230 1.1 lukem 0) 231 1.1 lukem echo "ldapcompare returned success ($RC)!" 232 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 233 1.1.1.10 christos exit 1 234 1.1 lukem ;; 235 1.1 lukem *) 236 1.1 lukem echo "ldapcompare failed ($RC)!" 237 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 238 1.1 lukem exit $RC 239 1.1 lukem ;; 240 1.1 lukem esac 241 1.1 lukem echo "" >> $SEARCHOUT 242 1.1 lukem 243 1.1 lukem echo "Testing list compare (should return UNDEFINED)..." 244 1.1 lukem echo "# Testing list compare (should return UNDEFINED)..." >> $SEARCHOUT 245 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 246 1.1 lukem "cn=Dynamic List,$LISTDN" "dc:UNDEFINED" \ 247 1.1 lukem >> $SEARCHOUT 2>&1 248 1.1 lukem RC=$? 249 1.1 lukem case $RC in 250 1.1 lukem 5) 251 1.1 lukem echo "ldapcompare returned FALSE ($RC)!" 252 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 253 1.1 lukem exit $RC 254 1.1 lukem ;; 255 1.1 lukem 6) 256 1.1 lukem echo "ldapcompare returned TRUE ($RC)!" 257 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 258 1.1 lukem exit $RC 259 1.1 lukem ;; 260 1.1 lukem 16|32) 261 1.1 lukem echo "ldapcompare returned UNDEFINED ($RC)" 262 1.1 lukem ;; 263 1.1 lukem 0) 264 1.1 lukem echo "ldapcompare returned success ($RC)!" 265 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 266 1.1.1.10 christos exit 1 267 1.1 lukem ;; 268 1.1 lukem *) 269 1.1 lukem echo "ldapcompare failed ($RC)" 270 1.1 lukem ;; 271 1.1 lukem esac 272 1.1 lukem echo "" >> $SEARCHOUT 273 1.1 lukem 274 1.1 lukem echo "Testing list compare with manageDSAit..." 275 1.1 lukem echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT 276 1.1.1.9 christos $LDAPCOMPARE -H $URI1 -MM \ 277 1.1 lukem "cn=Dynamic List,$LISTDN" "cn:Bjorn Jensen" \ 278 1.1 lukem >> $SEARCHOUT 2>&1 279 1.1 lukem RC=$? 280 1.1 lukem case $RC in 281 1.1 lukem 5) 282 1.1 lukem echo "ldapcompare returned FALSE ($RC)" 283 1.1 lukem ;; 284 1.1 lukem 6) 285 1.1 lukem echo "ldapcompare returned TRUE ($RC)!" 286 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 287 1.1 lukem exit $RC 288 1.1 lukem ;; 289 1.1 lukem 0) 290 1.1 lukem echo "ldapcompare returned success ($RC)!" 291 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 292 1.1.1.10 christos exit 1 293 1.1 lukem ;; 294 1.1 lukem *) 295 1.1 lukem echo "ldapcompare failed ($RC)!" 296 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 297 1.1 lukem exit $RC 298 1.1 lukem ;; 299 1.1 lukem esac 300 1.1 lukem echo "" >> $SEARCHOUT 301 1.1 lukem 302 1.1 lukem echo "Reconfiguring slapd..." 303 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 304 1.1 lukem $TESTOUT 2>&1 << EOMODS 305 1.1 lukem version: 1 306 1.1.1.4 tron dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 307 1.1 lukem changetype: modify 308 1.1.1.9 christos delete: olcDynListAttrSet 309 1.1.1.9 christos olcDynListAttrSet: {0} 310 1.1 lukem - 311 1.1.1.9 christos add: olcDynListAttrSet 312 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL sn:cn mail 313 1.1.1.2 lukem - 314 1.1.1.2 lukem EOMODS 315 1.1.1.2 lukem 316 1.1.1.9 christos RC=$? 317 1.1.1.9 christos if test $RC != 0 ; then 318 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 319 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 320 1.1.1.9 christos exit $RC 321 1.1.1.9 christos fi 322 1.1.1.9 christos 323 1.1.1.2 lukem echo "==========================================================" >> $LOG1 324 1.1.1.2 lukem 325 1.1.1.2 lukem echo "Testing attribute mapping" 326 1.1.1.2 lukem 327 1.1.1.2 lukem echo "Testing list search of all (mapped) attrs..." 328 1.1.1.2 lukem echo "# Testing list search of all (mapped) attrs..." >> $SEARCHOUT 329 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 330 1.1.1.2 lukem '(cn=Dynamic List)' '*' \ 331 1.1.1.2 lukem >> $SEARCHOUT 2>&1 332 1.1.1.2 lukem RC=$? 333 1.1.1.2 lukem if test $RC != 0 ; then 334 1.1.1.2 lukem echo "ldapsearch failed ($RC)!" 335 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 336 1.1.1.2 lukem exit $RC 337 1.1.1.2 lukem fi 338 1.1.1.2 lukem 339 1.1.1.2 lukem echo "Testing list search of a (mapped) listed attr..." 340 1.1.1.2 lukem echo "# Testing list search of a (mapped) listed attr..." >> $SEARCHOUT 341 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 342 1.1.1.2 lukem '(cn=Dynamic List)' sn \ 343 1.1.1.2 lukem >> $SEARCHOUT 2>&1 344 1.1.1.2 lukem RC=$? 345 1.1.1.2 lukem if test $RC != 0 ; then 346 1.1.1.2 lukem echo "ldapsearch failed ($RC)!" 347 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 348 1.1.1.2 lukem exit $RC 349 1.1.1.2 lukem fi 350 1.1.1.2 lukem 351 1.1.1.2 lukem echo "Testing list search of a (n unmapped) listed attr..." 352 1.1.1.2 lukem echo "# Testing list search of a (n unmapped) listed attr..." >> $SEARCHOUT 353 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 354 1.1.1.2 lukem '(cn=Dynamic List)' mail \ 355 1.1.1.2 lukem >> $SEARCHOUT 2>&1 356 1.1.1.2 lukem RC=$? 357 1.1.1.2 lukem if test $RC != 0 ; then 358 1.1.1.2 lukem echo "ldapsearch failed ($RC)!" 359 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 360 1.1.1.2 lukem exit $RC 361 1.1.1.2 lukem fi 362 1.1.1.2 lukem 363 1.1.1.2 lukem echo "Testing list compare (mapped attrs) ..." 364 1.1.1.2 lukem echo "# Testing list compare (mapped attrs) ..." >> $SEARCHOUT 365 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 366 1.1.1.2 lukem "cn=Dynamic List,$LISTDN" "sn:Bjorn Jensen" \ 367 1.1.1.2 lukem >> $SEARCHOUT 2>&1 368 1.1.1.2 lukem RC=$? 369 1.1.1.2 lukem case $RC in 370 1.1.1.2 lukem 5) 371 1.1.1.2 lukem echo "ldapcompare returned FALSE ($RC)!" 372 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 373 1.1.1.2 lukem exit $RC 374 1.1.1.2 lukem ;; 375 1.1.1.2 lukem 6) 376 1.1.1.2 lukem echo "ldapcompare returned TRUE ($RC)" 377 1.1.1.2 lukem ;; 378 1.1.1.2 lukem 0) 379 1.1.1.2 lukem echo "ldapcompare returned success ($RC)!" 380 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 381 1.1.1.10 christos exit 1 382 1.1.1.2 lukem ;; 383 1.1.1.2 lukem *) 384 1.1.1.2 lukem echo "ldapcompare failed ($RC)!" 385 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 386 1.1.1.2 lukem exit $RC 387 1.1.1.2 lukem ;; 388 1.1.1.2 lukem esac 389 1.1.1.2 lukem echo "" >> $SEARCHOUT 390 1.1.1.2 lukem 391 1.1.1.2 lukem echo "Testing list compare (mapped attrs; should return FALSE)..." 392 1.1.1.2 lukem echo "# Testing list compare (mapped attrs; should return FALSE)..." >> $SEARCHOUT 393 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 394 1.1.1.2 lukem "cn=Dynamic List,$LISTDN" "sn:FALSE" \ 395 1.1.1.2 lukem >> $SEARCHOUT 2>&1 396 1.1.1.2 lukem RC=$? 397 1.1.1.2 lukem case $RC in 398 1.1.1.2 lukem 5) 399 1.1.1.2 lukem echo "ldapcompare returned FALSE ($RC)" 400 1.1.1.2 lukem ;; 401 1.1.1.2 lukem 6) 402 1.1.1.2 lukem echo "ldapcompare returned TRUE ($RC)!" 403 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 404 1.1.1.2 lukem exit $RC 405 1.1.1.2 lukem ;; 406 1.1.1.2 lukem 0) 407 1.1.1.2 lukem echo "ldapcompare returned success ($RC)!" 408 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 409 1.1.1.10 christos exit 1 410 1.1.1.2 lukem ;; 411 1.1.1.2 lukem *) 412 1.1.1.2 lukem echo "ldapcompare failed ($RC)!" 413 1.1.1.2 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 414 1.1.1.2 lukem exit $RC 415 1.1.1.2 lukem ;; 416 1.1.1.2 lukem esac 417 1.1.1.2 lukem echo "" >> $SEARCHOUT 418 1.1.1.2 lukem 419 1.1.1.2 lukem echo "Reconfiguring slapd..." 420 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 421 1.1.1.2 lukem $TESTOUT 2>&1 << EOMODS 422 1.1.1.2 lukem version: 1 423 1.1.1.4 tron dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 424 1.1.1.2 lukem changetype: modify 425 1.1.1.9 christos delete: olcDynListAttrSet 426 1.1.1.9 christos olcDynListAttrSet: {0} 427 1.1.1.2 lukem - 428 1.1.1.9 christos add: olcDynListAttrSet 429 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL member 430 1.1.1.2 lukem - 431 1.1 lukem EOMODS 432 1.1 lukem 433 1.1.1.9 christos RC=$? 434 1.1.1.9 christos if test $RC != 0 ; then 435 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 436 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 437 1.1.1.9 christos exit $RC 438 1.1.1.9 christos fi 439 1.1.1.9 christos 440 1.1 lukem echo "==========================================================" >> $LOG1 441 1.1 lukem 442 1.1 lukem echo "Adding a dynamic list..." 443 1.1.1.9 christos $LDAPADD -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 444 1.1 lukem > $TESTOUT 2>&1 << EOMODS 445 1.1 lukem dn: cn=Dynamic List of Members,$LISTDN 446 1.1 lukem objectClass: groupOfURLs 447 1.1 lukem cn: Dynamic List of Members 448 1.1 lukem memberURL: ldap:///ou=People,${BASEDN}??sub?(objectClass=person) 449 1.1 lukem EOMODS 450 1.1 lukem 451 1.1 lukem echo "Testing list search of all attrs..." 452 1.1 lukem echo "# Testing list search of all attrs..." >> $SEARCHOUT 453 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 454 1.1 lukem '(cn=Dynamic List of Members)' '*' \ 455 1.1 lukem >> $SEARCHOUT 2>&1 456 1.1 lukem RC=$? 457 1.1 lukem if test $RC != 0 ; then 458 1.1 lukem echo "ldapsearch failed ($RC)!" 459 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 460 1.1 lukem exit $RC 461 1.1 lukem fi 462 1.1 lukem 463 1.1 lukem echo "Testing list search of a listed attr..." 464 1.1 lukem echo "# Testing list search of a listed attr..." >> $SEARCHOUT 465 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 466 1.1 lukem '(cn=Dynamic List of Members)' member \ 467 1.1 lukem >> $SEARCHOUT 2>&1 468 1.1 lukem RC=$? 469 1.1 lukem if test $RC != 0 ; then 470 1.1 lukem echo "ldapsearch failed ($RC)!" 471 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 472 1.1 lukem exit $RC 473 1.1 lukem fi 474 1.1 lukem 475 1.1 lukem echo "Testing list search of a non-listed attr..." 476 1.1 lukem echo "# Testing list search of a non-listed attr..." >> $SEARCHOUT 477 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 478 1.1 lukem '(cn=Dynamic List of Members)' objectClass \ 479 1.1 lukem >> $SEARCHOUT 2>&1 480 1.1 lukem RC=$? 481 1.1 lukem if test $RC != 0 ; then 482 1.1 lukem echo "ldapsearch failed ($RC)!" 483 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 484 1.1 lukem exit $RC 485 1.1 lukem fi 486 1.1 lukem 487 1.1 lukem echo "Testing list search with (critical) manageDSAit..." 488 1.1 lukem echo "# Testing list search with (critical) manageDSAit..." >> $SEARCHOUT 489 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 -MM \ 490 1.1 lukem '(&(cn=Dynamic List of Members)(objectClass=groupOfURLs))' '*' \ 491 1.1 lukem >> $SEARCHOUT 2>&1 492 1.1 lukem RC=$? 493 1.1 lukem if test $RC != 0 ; then 494 1.1 lukem echo "ldapsearch failed ($RC)!" 495 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 496 1.1 lukem exit $RC 497 1.1 lukem fi 498 1.1 lukem 499 1.1 lukem CMPDN="$BJORNSDN" 500 1.1 lukem echo "Testing list compare..." 501 1.1 lukem echo "# Testing list compare..." >> $SEARCHOUT 502 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 503 1.1 lukem "cn=Dynamic List of Members,$LISTDN" "member:$CMPDN" \ 504 1.1 lukem >> $SEARCHOUT 2>&1 505 1.1 lukem RC=$? 506 1.1 lukem case $RC in 507 1.1 lukem 5) 508 1.1 lukem echo "ldapcompare returned FALSE ($RC)!" 509 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 510 1.1 lukem exit $RC 511 1.1 lukem ;; 512 1.1 lukem 6) 513 1.1 lukem echo "ldapcompare returned TRUE ($RC)" 514 1.1 lukem ;; 515 1.1 lukem 0) 516 1.1 lukem echo "ldapcompare returned success ($RC)!" 517 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 518 1.1.1.10 christos exit 1 519 1.1 lukem ;; 520 1.1 lukem *) 521 1.1 lukem echo "ldapcompare failed ($RC)!" 522 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 523 1.1 lukem exit $RC 524 1.1 lukem ;; 525 1.1 lukem esac 526 1.1 lukem echo "" >> $SEARCHOUT 527 1.1 lukem 528 1.1.1.7 christos CMPDN="$BADBJORNSDN" 529 1.1.1.7 christos echo "Testing list compare (should return FALSE)..." 530 1.1.1.7 christos echo "# Testing list compare... (should return FALSE)" >> $SEARCHOUT 531 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 532 1.1.1.7 christos "cn=Dynamic List of Members,$LISTDN" "member:$CMPDN" \ 533 1.1.1.7 christos >> $SEARCHOUT 2>&1 534 1.1.1.7 christos RC=$? 535 1.1.1.7 christos case $RC in 536 1.1.1.7 christos 5) 537 1.1.1.7 christos echo "ldapcompare returned FALSE ($RC)" 538 1.1.1.7 christos ;; 539 1.1.1.7 christos 6) 540 1.1.1.7 christos echo "ldapcompare returned TRUE ($RC)!" 541 1.1.1.7 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 542 1.1.1.7 christos exit $RC 543 1.1.1.7 christos ;; 544 1.1.1.7 christos 0) 545 1.1.1.7 christos echo "ldapcompare returned success ($RC)!" 546 1.1.1.7 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 547 1.1.1.10 christos exit 1 548 1.1.1.7 christos ;; 549 1.1.1.7 christos *) 550 1.1.1.7 christos echo "ldapcompare failed ($RC)!" 551 1.1.1.7 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 552 1.1.1.7 christos exit $RC 553 1.1.1.7 christos ;; 554 1.1.1.7 christos esac 555 1.1.1.7 christos echo "" >> $SEARCHOUT 556 1.1.1.7 christos 557 1.1.1.7 christos CMPDN="$BJORNSDN" 558 1.1 lukem echo "Testing list compare (should return FALSE)..." 559 1.1 lukem echo "# Testing list compare (should return FALSE)..." >> $SEARCHOUT 560 1.1.1.9 christos $LDAPCOMPARE -H $URI1 \ 561 1.1 lukem "cn=Dynamic List of Members,$LISTDN" "member:cn=Foo Bar" \ 562 1.1 lukem >> $SEARCHOUT 2>&1 563 1.1 lukem RC=$? 564 1.1 lukem case $RC in 565 1.1 lukem 5) 566 1.1 lukem echo "ldapcompare returned FALSE ($RC)" 567 1.1 lukem ;; 568 1.1 lukem 6) 569 1.1 lukem echo "ldapcompare returned TRUE ($RC)!" 570 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 571 1.1 lukem exit $RC 572 1.1 lukem ;; 573 1.1 lukem 0) 574 1.1 lukem echo "ldapcompare returned success ($RC)!" 575 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 576 1.1.1.10 christos exit 1 577 1.1 lukem ;; 578 1.1 lukem *) 579 1.1 lukem echo "ldapcompare failed ($RC)!" 580 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 581 1.1 lukem exit $RC 582 1.1 lukem ;; 583 1.1 lukem esac 584 1.1 lukem echo "" >> $SEARCHOUT 585 1.1 lukem 586 1.1.1.9 christos echo "Testing list compare with manageDSAit (should return UNDEFINED)..." 587 1.1.1.9 christos echo "# Testing list compare with manageDSAit (should return UNDEFINED)..." >> $SEARCHOUT 588 1.1.1.9 christos $LDAPCOMPARE -H $URI1 -MM \ 589 1.1 lukem "cn=Dynamic List,$LISTDN" "member:$CMPDN" \ 590 1.1 lukem >> $SEARCHOUT 2>&1 591 1.1 lukem RC=$? 592 1.1 lukem case $RC in 593 1.1 lukem 5) 594 1.1 lukem echo "ldapcompare returned FALSE ($RC)" 595 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 596 1.1.1.9 christos exit $RC 597 1.1 lukem ;; 598 1.1 lukem 6) 599 1.1 lukem echo "ldapcompare returned TRUE ($RC)!" 600 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 601 1.1 lukem exit $RC 602 1.1 lukem ;; 603 1.1.1.9 christos 16|32) 604 1.1.1.9 christos echo "ldapcompare returned UNDEFINED ($RC)" 605 1.1.1.9 christos ;; 606 1.1 lukem 0) 607 1.1 lukem echo "ldapcompare returned success ($RC)!" 608 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 609 1.1.1.10 christos exit 1 610 1.1 lukem ;; 611 1.1 lukem *) 612 1.1 lukem echo "ldapcompare failed ($RC)!" 613 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 614 1.1 lukem exit $RC 615 1.1 lukem ;; 616 1.1 lukem esac 617 1.1 lukem echo "" >> $SEARCHOUT 618 1.1 lukem 619 1.1 lukem echo "==========================================================" >> $LOG1 620 1.1 lukem 621 1.1 lukem echo "Testing dgIdentity..." 622 1.1 lukem 623 1.1 lukem # Set ACL, require authentication to get list contents 624 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 625 1.1 lukem $TESTOUT 2>&1 << EOMODS 626 1.1 lukem version: 1 627 1.1.1.4 tron dn: olcDatabase={$DBIX}$BACKEND,cn=config 628 1.1 lukem changetype: modify 629 1.1 lukem add: olcAccess 630 1.1 lukem olcAccess: to dn.base="cn=Dynamic List of Members,$LISTDN" by * read 631 1.1 lukem olcAccess: to * by users read by * search 632 1.1 lukem EOMODS 633 1.1 lukem 634 1.1.1.9 christos RC=$? 635 1.1.1.9 christos if test $RC != 0 ; then 636 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 637 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 638 1.1.1.9 christos exit $RC 639 1.1.1.9 christos fi 640 1.1.1.9 christos 641 1.1 lukem echo "Testing list search without dgIdentity..." 642 1.1 lukem echo "# Testing list search without dgIdentity..." >> $SEARCHOUT 643 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 644 1.1 lukem '(cn=Dynamic List of Members)' '*' \ 645 1.1 lukem >> $SEARCHOUT 2>&1 646 1.1 lukem RC=$? 647 1.1 lukem if test $RC != 0 ; then 648 1.1 lukem echo "ldapsearch failed ($RC)!" 649 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 650 1.1 lukem exit $RC 651 1.1 lukem fi 652 1.1 lukem 653 1.1.1.9 christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 654 1.1 lukem > $TESTOUT 2>&1 << EOMODS 655 1.1 lukem dn: cn=Dynamic List of Members,$LISTDN 656 1.1 lukem changetype: modify 657 1.1 lukem add: objectClass 658 1.1 lukem objectClass: dgIdentityAux 659 1.1 lukem - 660 1.1 lukem add: dgIdentity 661 1.1 lukem dgIdentity: $CMPDN 662 1.1 lukem EOMODS 663 1.1 lukem 664 1.1.1.9 christos RC=$? 665 1.1.1.9 christos if test $RC != 0 ; then 666 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 667 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 668 1.1.1.9 christos exit $RC 669 1.1.1.9 christos fi 670 1.1.1.9 christos 671 1.1 lukem echo "Testing list search with dgIdentity..." 672 1.1 lukem echo "# Testing list search with dgIdentity..." >> $SEARCHOUT 673 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 674 1.1 lukem '(cn=Dynamic List of Members)' '*' \ 675 1.1 lukem >> $SEARCHOUT 2>&1 676 1.1 lukem RC=$? 677 1.1 lukem if test $RC != 0 ; then 678 1.1 lukem echo "ldapsearch failed ($RC)!" 679 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 680 1.1 lukem exit $RC 681 1.1 lukem fi 682 1.1 lukem 683 1.1 lukem echo "Testing dgAuthz..." 684 1.1 lukem 685 1.1 lukem CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" 686 1.1.1.9 christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 687 1.1 lukem > $TESTOUT 2>&1 << EOMODS 688 1.1 lukem dn: cn=Dynamic List of Members,$LISTDN 689 1.1 lukem changetype: modify 690 1.1 lukem add: dgAuthz 691 1.1 lukem dgAuthz: dn:$BABSDN 692 1.1 lukem EOMODS 693 1.1 lukem 694 1.1.1.9 christos RC=$? 695 1.1.1.9 christos if test $RC != 0 ; then 696 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 697 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 698 1.1.1.9 christos exit $RC 699 1.1.1.9 christos fi 700 1.1.1.9 christos 701 1.1 lukem echo "Testing list search with dgIdentity and dgAuthz anonymously..." 702 1.1 lukem echo "# Testing list search with dgIdentity and dgAuthz anonymously..." >> $SEARCHOUT 703 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 704 1.1 lukem '(cn=Dynamic List of Members)' '*' \ 705 1.1 lukem >> $SEARCHOUT 2>&1 706 1.1 lukem RC=$? 707 1.1 lukem if test $RC != 0 ; then 708 1.1 lukem echo "ldapsearch failed ($RC)!" 709 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 710 1.1 lukem exit $RC 711 1.1 lukem fi 712 1.1 lukem 713 1.1 lukem echo "Testing list search with dgIdentity and dgAuthz as the authorized identity..." 714 1.1 lukem echo "# Testing list search with dgIdentity and dgAuthz as the authorized identity..." >> $SEARCHOUT 715 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 716 1.1 lukem -D "$BABSDN" -w bjensen \ 717 1.1 lukem '(cn=Dynamic List of Members)' '*' \ 718 1.1 lukem >> $SEARCHOUT 2>&1 719 1.1 lukem RC=$? 720 1.1 lukem if test $RC != 0 ; then 721 1.1 lukem echo "ldapsearch failed ($RC)!" 722 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 723 1.1 lukem exit $RC 724 1.1 lukem fi 725 1.1 lukem 726 1.1.1.9 christos echo "Reconfiguring slapd..." 727 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 728 1.1.1.9 christos $TESTOUT 2>&1 << EOMODS 729 1.1.1.9 christos version: 1 730 1.1.1.9 christos dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 731 1.1.1.9 christos changetype: modify 732 1.1.1.9 christos delete: olcDynListAttrSet 733 1.1.1.9 christos olcDynListAttrSet: {0} 734 1.1.1.9 christos - 735 1.1.1.9 christos add: olcDynListAttrSet 736 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL member+memberOf 737 1.1.1.9 christos - 738 1.1.1.9 christos EOMODS 739 1.1.1.9 christos 740 1.1.1.9 christos RC=$? 741 1.1.1.9 christos if test $RC != 0 ; then 742 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 743 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 744 1.1.1.9 christos exit $RC 745 1.1.1.9 christos fi 746 1.1.1.9 christos 747 1.1.1.9 christos echo "==========================================================" >> $LOG1 748 1.1.1.9 christos 749 1.1.1.9 christos echo "Testing memberOf functionality..." 750 1.1.1.9 christos echo "# Testing memberOf functionality..." >> $SEARCHOUT 751 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 752 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 753 1.1.1.9 christos '(cn=Mark Elliot)' '*' 'memberOf' \ 754 1.1.1.9 christos >> $SEARCHOUT 2>&1 755 1.1.1.9 christos RC=$? 756 1.1.1.9 christos if test $RC != 0 ; then 757 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 758 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 759 1.1.1.9 christos exit $RC 760 1.1.1.9 christos fi 761 1.1.1.9 christos 762 1.1.1.9 christos echo "Testing filtered memberOf functionality..." 763 1.1.1.9 christos echo "# Testing filtered memberOf functionality..." >> $SEARCHOUT 764 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 765 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 766 1.1.1.10 christos "(&(memberOf=cn=Dynamic List of Members,ou=Dynamic Lists,$BASEDN)(cn=Mark Elliot))" '*' 'memberOf' \ 767 1.1.1.10 christos >> $SEARCHOUT 2>&1 768 1.1.1.10 christos RC=$? 769 1.1.1.10 christos if test $RC != 0 ; then 770 1.1.1.10 christos echo "ldapsearch failed ($RC)!" 771 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 772 1.1.1.10 christos exit $RC 773 1.1.1.10 christos fi 774 1.1.1.10 christos 775 1.1.1.10 christos echo "Testing filtered member functionality..." 776 1.1.1.10 christos echo "# Testing filtered member functionality..." >> $SEARCHOUT 777 1.1.1.10 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 778 1.1.1.10 christos -D "$BABSDN" -w bjensen \ 779 1.1.1.10 christos "(member=cn=Jane Doe,ou=Alumni Association,ou=People,$BASEDN)" \ 780 1.1.1.9 christos >> $SEARCHOUT 2>&1 781 1.1.1.9 christos RC=$? 782 1.1.1.9 christos if test $RC != 0 ; then 783 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 784 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 785 1.1.1.9 christos exit $RC 786 1.1.1.9 christos fi 787 1.1.1.9 christos 788 1.1.1.9 christos echo "Reconfiguring slapd..." 789 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 790 1.1.1.9 christos $TESTOUT 2>&1 << EOMODS 791 1.1.1.9 christos version: 1 792 1.1.1.9 christos dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 793 1.1.1.9 christos changetype: modify 794 1.1.1.9 christos delete: olcDynListAttrSet 795 1.1.1.9 christos olcDynListAttrSet: {0} 796 1.1.1.9 christos - 797 1.1.1.9 christos add: olcDynListAttrSet 798 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL member+memberOf@groupOfNames 799 1.1.1.9 christos - 800 1.1.1.9 christos EOMODS 801 1.1.1.9 christos 802 1.1.1.9 christos RC=$? 803 1.1.1.9 christos if test $RC != 0 ; then 804 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 805 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 806 1.1.1.9 christos exit $RC 807 1.1.1.9 christos fi 808 1.1.1.9 christos 809 1.1.1.9 christos echo "==========================================================" >> $LOG1 810 1.1.1.9 christos 811 1.1.1.9 christos echo "Testing static group memberOf functionality..." 812 1.1.1.9 christos echo "# Testing static group memberOf functionality..." >> $SEARCHOUT 813 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 814 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 815 1.1.1.9 christos '(cn=Mark Elliot)' '*' 'memberOf' \ 816 1.1.1.9 christos >> $SEARCHOUT 2>&1 817 1.1.1.9 christos RC=$? 818 1.1.1.9 christos if test $RC != 0 ; then 819 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 820 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 821 1.1.1.9 christos exit $RC 822 1.1.1.9 christos fi 823 1.1.1.9 christos 824 1.1.1.10 christos echo "Testing static group member compare..." 825 1.1.1.10 christos echo "# Testing static group member compare..." >> $SEARCHOUT 826 1.1.1.10 christos $LDAPCOMPARE -H $URI1 \ 827 1.1.1.10 christos "cn=all staff,ou=groups,$BASEDN" "member:cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN" >> $SEARCHOUT 828 1.1.1.10 christos RC=$? 829 1.1.1.10 christos case $RC in 830 1.1.1.10 christos 5) 831 1.1.1.10 christos echo "ldapcompare returned FALSE ($RC)!" 832 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 833 1.1.1.10 christos exit $RC 834 1.1.1.10 christos ;; 835 1.1.1.10 christos 6) 836 1.1.1.10 christos echo "ldapcompare returned TRUE ($RC)" 837 1.1.1.10 christos ;; 838 1.1.1.10 christos 0) 839 1.1.1.10 christos echo "ldapcompare returned success ($RC)!" 840 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 841 1.1.1.10 christos exit 1 842 1.1.1.10 christos ;; 843 1.1.1.10 christos *) 844 1.1.1.10 christos echo "ldapcompare failed ($RC)!" 845 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 846 1.1.1.10 christos exit $RC 847 1.1.1.10 christos ;; 848 1.1.1.10 christos esac 849 1.1.1.10 christos echo "" >> $SEARCHOUT 850 1.1.1.10 christos 851 1.1.1.10 christos echo "Testing static group non-member compare (should return FALSE)..." 852 1.1.1.10 christos echo "# Testing static group non-member compare (should return FALSE)..." >> $SEARCHOUT 853 1.1.1.10 christos $LDAPCOMPARE -H $URI1 \ 854 1.1.1.10 christos "cn=all staff,ou=groups,$BASEDN" "member:cn=Not A User,ou=Alumni Association,ou=People,$BASEDN" >> $SEARCHOUT 855 1.1.1.10 christos RC=$? 856 1.1.1.10 christos case $RC in 857 1.1.1.10 christos 5) 858 1.1.1.10 christos echo "ldapcompare returned FALSE ($RC)" 859 1.1.1.10 christos ;; 860 1.1.1.10 christos 6) 861 1.1.1.10 christos echo "ldapcompare returned TRUE ($RC)!" 862 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 863 1.1.1.10 christos exit $RC 864 1.1.1.10 christos ;; 865 1.1.1.10 christos 0) 866 1.1.1.10 christos echo "ldapcompare returned success ($RC)!" 867 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 868 1.1.1.10 christos exit 1 869 1.1.1.10 christos ;; 870 1.1.1.10 christos *) 871 1.1.1.10 christos echo "ldapcompare failed ($RC)!" 872 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 873 1.1.1.10 christos exit $RC 874 1.1.1.10 christos ;; 875 1.1.1.10 christos esac 876 1.1.1.10 christos echo "" >> $SEARCHOUT 877 1.1.1.10 christos 878 1.1.1.9 christos echo "Reconfiguring slapd..." 879 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 880 1.1.1.9 christos $TESTOUT 2>&1 << EOMODS 881 1.1.1.9 christos version: 1 882 1.1.1.9 christos dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 883 1.1.1.9 christos changetype: modify 884 1.1.1.9 christos delete: olcDynListAttrSet 885 1.1.1.9 christos olcDynListAttrSet: {0} 886 1.1.1.9 christos - 887 1.1.1.9 christos add: olcDynListAttrSet 888 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL member+memberOf* 889 1.1.1.9 christos - 890 1.1.1.9 christos EOMODS 891 1.1.1.9 christos 892 1.1.1.9 christos RC=$? 893 1.1.1.9 christos if test $RC != 0 ; then 894 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 895 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 896 1.1.1.9 christos exit $RC 897 1.1.1.9 christos fi 898 1.1.1.9 christos 899 1.1.1.9 christos echo "==========================================================" >> $LOG1 900 1.1.1.9 christos 901 1.1.1.9 christos echo "Adding a couple dynamic groups..." 902 1.1.1.9 christos $LDAPADD -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 903 1.1.1.9 christos > $TESTOUT 2>&1 << EOMODS 904 1.1.1.9 christos dn: cn=The Smiths,$LISTDN 905 1.1.1.9 christos objectClass: groupOfURLs 906 1.1.1.9 christos cn: The Smiths 907 1.1.1.9 christos memberURL: ldap:///ou=People,${BASEDN}??sub?(sn=Smith) 908 1.1.1.9 christos description: Smith family 909 1.1.1.9 christos 910 1.1.1.9 christos dn: cn=Meta Group,$LISTDN 911 1.1.1.9 christos objectClass: groupOfURLs 912 1.1.1.9 christos cn: Meta Group 913 1.1.1.9 christos memberURL: ldap:///${LISTDN}??sub?(description=Smith%20family) 914 1.1.1.9 christos EOMODS 915 1.1.1.9 christos 916 1.1.1.9 christos RC=$? 917 1.1.1.9 christos if test $RC != 0 ; then 918 1.1.1.9 christos echo "ldapadd failed ($RC)!" 919 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 920 1.1.1.9 christos exit $RC 921 1.1.1.9 christos fi 922 1.1.1.9 christos 923 1.1.1.9 christos echo "Testing nested dynamic group functionality..." 924 1.1.1.9 christos echo "# Testing nested dynamic group functionality..." >> $SEARCHOUT 925 1.1.1.9 christos $LDAPSEARCH -S "" -b "$LISTDN" -H $URI1 \ 926 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 927 1.1.1.9 christos '(objectclass=*)' '*' 'memberOf' \ 928 1.1.1.9 christos >> $SEARCHOUT 2>&1 929 1.1.1.9 christos RC=$? 930 1.1.1.9 christos if test $RC != 0 ; then 931 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 932 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 933 1.1.1.9 christos exit $RC 934 1.1.1.9 christos fi 935 1.1.1.9 christos 936 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 937 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 938 1.1.1.9 christos '(cn=Mark Elliot)' '*' 'memberOf' \ 939 1.1.1.9 christos >> $SEARCHOUT 2>&1 940 1.1.1.9 christos RC=$? 941 1.1.1.9 christos if test $RC != 0 ; then 942 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 943 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 944 1.1.1.9 christos exit $RC 945 1.1.1.9 christos fi 946 1.1.1.9 christos 947 1.1.1.9 christos echo "Reconfiguring slapd..." 948 1.1.1.9 christos $LDAPMODIFY -x -D cn=config -H $URI1 -y $CONFIGPWF > \ 949 1.1.1.9 christos $TESTOUT 2>&1 << EOMODS 950 1.1.1.9 christos version: 1 951 1.1.1.9 christos dn: olcOverlay={0}dynlist,olcDatabase={$DBIX}$BACKEND,cn=config 952 1.1.1.9 christos changetype: modify 953 1.1.1.9 christos delete: olcDynListAttrSet 954 1.1.1.9 christos olcDynListAttrSet: {0} 955 1.1.1.9 christos - 956 1.1.1.9 christos add: olcDynListAttrSet 957 1.1.1.9 christos olcDynListAttrSet: groupOfURLs memberURL member+memberOf@groupOfNames* 958 1.1.1.9 christos olcDynListAttrSet: labeledURIObject labeledURI uniqueMember+seeAlso@groupOfUniqueNames 959 1.1.1.9 christos - 960 1.1.1.9 christos EOMODS 961 1.1.1.9 christos 962 1.1.1.9 christos RC=$? 963 1.1.1.9 christos if test $RC != 0 ; then 964 1.1.1.9 christos echo "ldapmodify failed ($RC)!" 965 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 966 1.1.1.9 christos exit $RC 967 1.1.1.9 christos fi 968 1.1.1.9 christos 969 1.1.1.9 christos echo "==========================================================" >> $LOG1 970 1.1.1.9 christos 971 1.1.1.9 christos echo "Adding a couple static groups..." 972 1.1.1.9 christos $LDAPADD -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 973 1.1.1.9 christos > $TESTOUT 2>&1 << EOMODS 974 1.1.1.9 christos dn: cn=The Jensens,ou=Groups,$BASEDN 975 1.1.1.9 christos objectClass: groupOfnames 976 1.1.1.9 christos cn: The Jensens 977 1.1.1.9 christos member: cn=Bjorn Jensen,ou=Information Technology DivisioN,ou=People,$BASEDN 978 1.1.1.9 christos member: cn=Barbara Jensen,ou=Information Technology DivisioN,ou=People,$BASEDN 979 1.1.1.9 christos 980 1.1.1.9 christos dn: cn=JJs,ou=Groups,$BASEDN 981 1.1.1.9 christos objectClass: groupOfnames 982 1.1.1.9 christos cn: JJs 983 1.1.1.9 christos member: cn=James A Jones 1,ou=Alumni Association,ou=People,$BASEDN 984 1.1.1.9 christos member: cn=James A Jones 2,ou=Information Technology Division,ou=People,$BASEDN 985 1.1.1.9 christos member: cn=The Jensens,ou=Groups,$BASEDN 986 1.1.1.9 christos EOMODS 987 1.1.1.9 christos 988 1.1.1.9 christos RC=$? 989 1.1.1.9 christos if test $RC != 0 ; then 990 1.1.1.9 christos echo "ldapadd failed ($RC)!" 991 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 992 1.1.1.9 christos exit $RC 993 1.1.1.9 christos fi 994 1.1.1.9 christos 995 1.1.1.9 christos echo "Testing nested static group functionality..." 996 1.1.1.9 christos echo "# Testing nested static group functionality..." >> $SEARCHOUT 997 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 998 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 999 1.1.1.9 christos '(sn=Jensen)' '*' 'memberOf' \ 1000 1.1.1.9 christos >> $SEARCHOUT 2>&1 1001 1.1.1.9 christos RC=$? 1002 1.1.1.9 christos if test $RC != 0 ; then 1003 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1004 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1005 1.1.1.9 christos exit $RC 1006 1.1.1.9 christos fi 1007 1.1.1.9 christos 1008 1.1.1.9 christos echo "Adding another nested group..." 1009 1.1.1.9 christos $LDAPADD -v -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 1010 1.1.1.9 christos > $TESTOUT 2>&1 << EOMODS 1011 1.1.1.9 christos dn: cn=Bonus Group,ou=Groups,$BASEDN 1012 1.1.1.9 christos objectClass: groupOfnames 1013 1.1.1.9 christos cn: Bonus Group 1014 1.1.1.9 christos member: cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN 1015 1.1.1.9 christos member: cn=Meta Group,$LISTDN 1016 1.1.1.9 christos EOMODS 1017 1.1.1.9 christos 1018 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 1019 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 1020 1.1.1.9 christos '(sn=Hampster)' '*' 'memberOf' \ 1021 1.1.1.9 christos >> $SEARCHOUT 2>&1 1022 1.1.1.9 christos RC=$? 1023 1.1.1.9 christos if test $RC != 0 ; then 1024 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1025 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1026 1.1.1.9 christos exit $RC 1027 1.1.1.9 christos fi 1028 1.1.1.9 christos 1029 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 1030 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 1031 1.1.1.9 christos '(sn=Doe)' '*' 'memberOf' \ 1032 1.1.1.9 christos >> $SEARCHOUT 2>&1 1033 1.1.1.9 christos RC=$? 1034 1.1.1.9 christos if test $RC != 0 ; then 1035 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1036 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1037 1.1.1.9 christos exit $RC 1038 1.1.1.9 christos fi 1039 1.1.1.9 christos 1040 1.1.1.9 christos $LDAPSEARCH -S "" -b "ou=People,$BASEDN" -H $URI1 \ 1041 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 1042 1.1.1.9 christos '(sn=Smith)' '*' 'memberOf' \ 1043 1.1.1.9 christos >> $SEARCHOUT 2>&1 1044 1.1.1.9 christos RC=$? 1045 1.1.1.9 christos if test $RC != 0 ; then 1046 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1047 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1048 1.1.1.9 christos exit $RC 1049 1.1.1.9 christos fi 1050 1.1.1.9 christos 1051 1.1.1.9 christos echo "Testing filtered nested memberOf functionality..." 1052 1.1.1.9 christos echo "# Testing filtered nested memberOf functionality..." >> $SEARCHOUT 1053 1.1.1.9 christos 1054 1.1.1.9 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 1055 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 1056 1.1.1.9 christos "(memberOf=cn=bonus group,ou=groups,$BASEDN)" '*' 'memberOf' \ 1057 1.1.1.9 christos >> $SEARCHOUT 2>&1 1058 1.1.1.9 christos RC=$? 1059 1.1.1.9 christos if test $RC != 0 ; then 1060 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1061 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1062 1.1.1.9 christos exit $RC 1063 1.1.1.9 christos fi 1064 1.1.1.9 christos 1065 1.1.1.10 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 1066 1.1.1.10 christos -D "$BABSDN" -w bjensen \ 1067 1.1.1.10 christos "(&(uid=jjones)(memberOf=cn=jjs,ou=groups,$BASEDN))" 'uid' \ 1068 1.1.1.10 christos >> $SEARCHOUT 2>&1 1069 1.1.1.10 christos RC=$? 1070 1.1.1.10 christos if test $RC != 0 ; then 1071 1.1.1.10 christos echo "ldapsearch failed ($RC)!" 1072 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1073 1.1.1.10 christos exit $RC 1074 1.1.1.10 christos fi 1075 1.1.1.10 christos 1076 1.1.1.10 christos echo "Testing negated filtered memberOf functionality..." 1077 1.1.1.10 christos echo "# Testing negated filtered memberOf functionality..." >> $SEARCHOUT 1078 1.1.1.10 christos 1079 1.1.1.10 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 1080 1.1.1.10 christos -D "$BABSDN" -w bjensen \ 1081 1.1.1.10 christos "(&(objectClass=OpenLDAPperson)(!(memberOf=cn=Alumni Assoc Staff,ou=groups,$BASEDN)))" '*' 'memberOf' \ 1082 1.1.1.10 christos >> $SEARCHOUT 2>&1 1083 1.1.1.10 christos RC=$? 1084 1.1.1.10 christos if test $RC != 0 ; then 1085 1.1.1.10 christos echo "ldapsearch failed ($RC)!" 1086 1.1.1.10 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1087 1.1.1.10 christos exit $RC 1088 1.1.1.10 christos fi 1089 1.1.1.10 christos 1090 1.1.1.9 christos echo "Testing filtered nested member functionality..." 1091 1.1.1.9 christos echo "# Testing filtered nested member functionality..." >> $SEARCHOUT 1092 1.1.1.9 christos 1093 1.1.1.9 christos $LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \ 1094 1.1.1.9 christos -D "$BABSDN" -w bjensen \ 1095 1.1.1.9 christos "(member=cn=Jennifer Smith,ou=Alumni Association,ou=People,$BASEDN)" '*' 'memberOf' \ 1096 1.1.1.9 christos >> $SEARCHOUT 2>&1 1097 1.1.1.9 christos RC=$? 1098 1.1.1.9 christos if test $RC != 0 ; then 1099 1.1.1.9 christos echo "ldapsearch failed ($RC)!" 1100 1.1.1.9 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS 1101 1.1.1.9 christos exit $RC 1102 1.1.1.9 christos fi 1103 1.1.1.9 christos 1104 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1105 1.1 lukem 1106 1.1 lukem LDIF=$DYNLISTOUT 1107 1.1 lukem 1108 1.1 lukem echo "Filtering ldapsearch results..." 1109 1.1.1.3 adam $LDIFFILTER < $SEARCHOUT > $SEARCHFLT 1110 1.1 lukem echo "Filtering original ldif used to create database..." 1111 1.1.1.3 adam $LDIFFILTER < $LDIF > $LDIFFLT 1112 1.1 lukem echo "Comparing filter output..." 1113 1.1 lukem $CMP $SEARCHFLT $LDIFFLT > $CMPOUT 1114 1.1 lukem 1115 1.1 lukem if test $? != 0 ; then 1116 1.1 lukem echo "Comparison failed" 1117 1.1 lukem exit 1 1118 1.1 lukem fi 1119 1.1 lukem 1120 1.1 lukem echo ">>>>> Test succeeded" 1121 1.1 lukem 1122 1.1 lukem test $KILLSERVERS != no && wait 1123 1.1 lukem 1124 1.1 lukem exit 0 1125