From 47be79d4f3ae5420e27b3af3d27e81600c859860 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 25 Aug 2007 00:14:56 +0000 Subject: [PATCH] Use dynamic config, test dgIdentity --- tests/data/dynlist.out | 29 +++++++++ tests/data/slapd-dynlist.conf | 6 +- tests/scripts/test044-dynlist | 108 ++++++++++++++++++++-------------- 3 files changed, 98 insertions(+), 45 deletions(-) diff --git a/tests/data/dynlist.out b/tests/data/dynlist.out index 1dde3108d4..c6b5be3079 100644 --- a/tests/data/dynlist.out +++ b/tests/data/dynlist.out @@ -127,3 +127,32 @@ FALSE # Testing list compare with manageDSAit... FALSE +# Testing list search without dgIdentity... +dn: cn=Dynamic List of Members,ou=Dynamic Lists,dc=example,dc=com +objectClass: groupOfURLs +cn: Dynamic List of Members +memberURL: ldap:///ou=People,dc=example,dc=com??sub?(objectClass=person) + +# Testing list search with dgIdentity... +dn: cn=Dynamic List of Members,ou=Dynamic Lists,dc=example,dc=com +objectClass: groupOfURLs +objectClass: dgIdentityAux +cn: Dynamic List of Members +memberURL: ldap:///ou=People,dc=example,dc=com??sub?(objectClass=person) +dgIdentity: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=ex + ample,dc=com +member: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=exam + ple,dc=com +member: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=exampl + e,dc=com +member: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com +member: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com +member: cn=James A Jones 2,ou=Information Technology Division,ou=People,dc=exa + mple,dc=com +member: cn=Jane Doe,ou=Alumni Association,ou=People,dc=example,dc=com +member: cn=Jennifer Smith,ou=Alumni Association,ou=People,dc=example,dc=com +member: cn=John Doe,ou=Information Technology Division,ou=People,dc=example,dc + =com +member: cn=Mark Elliot,ou=Alumni Association,ou=People,dc=example,dc=com +member: cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com + diff --git a/tests/data/slapd-dynlist.conf b/tests/data/slapd-dynlist.conf index 2a219599f9..ef2b13ad94 100644 --- a/tests/data/slapd-dynlist.conf +++ b/tests/data/slapd-dynlist.conf @@ -47,5 +47,9 @@ rootpw secret #hdb#index objectClass eq #hdb#index cn,sn,uid pres,eq,sub +# we'll reconfigure the attrset dynamically overlay dynlist -### DO NOT ADD ANY DIRECTIVE BELOW THIS; TEST APPENDS STUFF ### +dynlist-attrset groupOfURLs memberURL + +database config +include @TESTDIR@/configpw.conf diff --git a/tests/scripts/test044-dynlist b/tests/scripts/test044-dynlist index ef3e94c883..02032be291 100755 --- a/tests/scripts/test044-dynlist +++ b/tests/scripts/test044-dynlist @@ -22,6 +22,9 @@ fi mkdir -p $TESTDIR $DBDIR1 +$SLAPPASSWD -g -n >$CONFIGPWF +echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf + echo "Running slapadd to build slapd database..." . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF $SLAPADD -f $ADDCONF -l $LDIFORDERED @@ -32,15 +35,6 @@ if test $RC != 0 ; then fi . $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1 -echo "dynlist-attrset groupOfURLs memberURL" >> $CONF1 - -echo "Running slapindex to index slapd database..." -$SLAPINDEX -f $CONF1 -RC=$? -if test $RC != 0 ; then - echo "warning: slapindex failed ($RC)" - echo " assuming no indexing support" -fi echo "Starting slapd on TCP/IP port $PORT1..." $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 & @@ -250,45 +244,21 @@ case $RC in esac echo "" >> $SEARCHOUT -echo "Stopping slapd..." -kill -HUP $KILLPIDS -wait $KILLPIDS - echo "Reconfiguring slapd..." -. $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1 -echo "dynlist-attrset groupOfURLs memberURL member" >> $CONF1 +$LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \ + $TESTOUT 2>&1 << EOMODS +version: 1 +dn: olcOverlay={0}dynlist,olcDatabase={2}$BACKEND,cn=config +changetype: modify +delete: olcDLattrSet +olcDLattrSet: {0} +- +add: olcDLattrSet +olcDLattrSet: groupOfURLs memberURL member +EOMODS echo "==========================================================" >> $LOG1 -echo "Starting slapd on TCP/IP port $PORT1..." -$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 & -PID=$! -if test $WAIT != 0 ; then - echo PID $PID - read foo -fi -KILLPIDS="$PID" - -sleep 1 - -echo "Testing slapd searching..." -for i in 0 1 2 3 4 5; do - $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \ - '(objectclass=*)' > /dev/null 2>&1 - RC=$? - if test $RC = 0 ; then - break - fi - echo "Waiting 5 seconds for slapd to start..." - sleep 5 -done - -if test $RC != 0 ; then - echo "ldapsearch failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi - echo "Adding a dynamic list..." $LDAPADD -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \ > $TESTOUT 2>&1 << EOMODS @@ -431,6 +401,56 @@ case $RC in esac echo "" >> $SEARCHOUT +echo "==========================================================" >> $LOG1 + +echo "Testing dgIdentity..." + +# Set ACL, require authentication to get list contents +$LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \ + $TESTOUT 2>&1 << EOMODS +version: 1 +dn: olcDatabase={2}$BACKEND,cn=config +changetype: modify +add: olcAccess +olcAccess: to dn.base="cn=Dynamic List of Members,$LISTDN" by * read +olcAccess: to * by users read by * search +EOMODS + +echo "Testing list search without dgIdentity..." +echo "# Testing list search without dgIdentity..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \ + '(cn=Dynamic List of Members)' '*' \ + >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \ + > $TESTOUT 2>&1 << EOMODS +dn: cn=Dynamic List of Members,$LISTDN +changetype: modify +add: objectClass +objectClass: dgIdentityAux +- +add: dgIdentity +dgIdentity: $CMPDN +EOMODS + +echo "Testing list search with dgIdentity..." +echo "# Testing list search with dgIdentity..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \ + '(cn=Dynamic List of Members)' '*' \ + >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + test $KILLSERVERS != no && kill -HUP $KILLPIDS LDIF=$DYNLISTOUT -- 2.39.5