4 if test $# -eq 0 ; then
9 if test $# -eq 1 ; then
13 echo "running defines.sh $SRCDIR $BACKEND"
14 . $SRCDIR/scripts/defines.sh
16 echo "Cleaning up in $DBDIR..."
20 echo "Running slapadd to build slapd database..."
21 $LDIF2LDBM -f $CONF -l $LDIF
23 if test $RC != 0 ; then
24 echo "slapadd failed!"
28 echo "Starting slapd on TCP/IP port $PORT..."
29 $SLAPD -f $ACLCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
32 echo "Testing slapd access control..."
33 for i in 0 1 2 3 4 5; do
34 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
35 'objectclass=*' > /dev/null 2>&1
37 if test $RC = 1 ; then
38 echo "Waiting 5 seconds for slapd to start..."
43 if test $RC != 0 ; then
44 echo "ldapsearch failed!"
49 cat /dev/null > $SEARCHOUT
52 # Try to read an entry inside the Alumni Association container. It should
53 # give us nothing if we're not bound, and should return all attributes
54 # if we're bound as anyone under UM.
56 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT "objectclass=*" \
59 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT \
60 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
64 # Try to add a "member" attribute to the "All Staff" group. It should
65 # fail when we add some DN other than our own, and should succeed when
68 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj > \
69 $TESTOUT 2>&1 << EOMODS1
71 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
74 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
78 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
79 $TESTOUT 2>&1 << EOMODS2
82 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
85 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
89 # Try to modify the "All Staff" group. Two attempts are made:
90 # 1) bound as "James A Jones 1" - should fail
91 # 2) bound as "Barbara Jensen" - should succeed
93 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
94 $TESTOUT 2>&1 << EOMODS3
96 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
102 $LDAPMODIFY -D "$BJORNSDN" -h localhost -p $PORT -w bjorn >> \
103 $TESTOUT 2>&1 << EOMODS4
107 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
117 echo "Using ldapsearch to retrieve all the entries..."
118 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
119 'objectClass=*' | . $SRCDIR/scripts/acfilter.sh >> $SEARCHOUT 2>&1
122 if test $RC != 0 ; then
123 echo "ldapsearch failed!"
129 echo "Filtering ldapsearch results..."
130 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
131 echo "Filtering original ldif used to create database..."
132 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
133 echo "Comparing filter output..."
134 cmp $SEARCHFLT $LDIFFLT
136 if test $? != 0 ; then
137 echo "comparison failed - modify operations did not complete correctly"
141 echo ">>>>> Test succeeded"