5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 echo "running defines.sh"
14 . $SRCDIR/scripts/defines.sh
16 echo "Cleaning up in $DBDIR..."
20 echo "Running slapadd to build slapd database..."
21 . $CONFFILTER $BACKEND < $ACLCONF > $DBCONF
22 $SLAPADD -f $DBCONF -l $LDIFORDERED
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
29 echo "Starting slapd on TCP/IP port $PORT..."
30 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
33 echo "Testing slapd access control..."
34 for i in 0 1 2 3 4 5; do
35 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
36 'objectclass=*' > /dev/null 2>&1
38 if test $RC = 1 ; then
39 echo "Waiting 5 seconds for slapd to start..."
44 if test $RC != 0 ; then
45 echo "ldapsearch failed ($RC)!"
50 cat /dev/null > $SEARCHOUT
53 # Try to read an entry inside the Alumni Association container. It should
54 # give us nothing if we're not bound, and should return all attributes
55 # if we're bound as anyone under UM.
57 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT "objectclass=*" \
60 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT \
61 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
65 # Try to add a "member" attribute to the "All Staff" group. It should
66 # fail when we add some DN other than our own, and should succeed when
69 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj > \
70 $TESTOUT 2>&1 << EOMODS1
72 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
75 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
79 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
80 $TESTOUT 2>&1 << EOMODS2
83 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
86 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
90 # Try to modify the "All Staff" group. Two attempts are made:
91 # 1) bound as "James A Jones 1" - should fail
92 # 2) bound as "Barbara Jensen" - should succeed
94 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
95 $TESTOUT 2>&1 << EOMODS3
97 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
103 $LDAPMODIFY -D "$BJORNSDN" -h localhost -p $PORT -w bjorn >> \
104 $TESTOUT 2>&1 << EOMODS4
108 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
118 echo "Using ldapsearch to retrieve all the entries..."
119 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
120 'objectClass=*' | . $LDIFFILTER >> $SEARCHOUT 2>&1
123 if test $RC != 0 ; then
124 echo "ldapsearch failed ($RC)!"
130 echo "Filtering ldapsearch results..."
131 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
132 echo "Filtering original ldif used to create database..."
133 . $LDIFFILTER < $LDIF > $LDIFFLT
134 echo "Comparing filter output..."
135 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
137 if test $? != 0 ; then
138 echo "comparison failed - modify operations did not complete correctly"
142 echo ">>>>> Test succeeded"