5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
20 echo "Cleaning up in $DBDIR..."
24 echo "Running slapadd to build slapd database..."
25 . $CONFFILTER $BACKEND < $ACLCONF > $DBCONF
26 $SLAPADD -f $DBCONF -l $LDIFORDERED
28 if test $RC != 0 ; then
29 echo "slapadd failed ($RC)!"
33 echo "Starting slapd on TCP/IP port $PORT..."
34 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
36 if test $WAIT != 0 ; then
41 echo "Testing slapd access control..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 1 ; then
47 echo "Waiting 5 seconds for slapd to start..."
52 if test $RC != 0 ; then
53 echo "ldapsearch failed ($RC)!"
58 cat /dev/null > $SEARCHOUT
61 # Try to read an entry inside the Alumni Association container. It should
62 # give us nothing if we're not bound, and should return all attributes
63 # if we're bound as anyone under UM.
65 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT "objectclass=*" \
68 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT \
69 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
73 # Try to add a "member" attribute to the "All Staff" group. It should
74 # fail when we add some DN other than our own, and should succeed when
77 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj > \
78 $TESTOUT 2>&1 << EOMODS1
80 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
83 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
87 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
88 $TESTOUT 2>&1 << EOMODS2
91 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
94 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
98 # Try to modify the "All Staff" group. Two attempts are made:
99 # 1) bound as "James A Jones 1" - should fail
100 # 2) bound as "Barbara Jensen" - should succeed
102 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
103 $TESTOUT 2>&1 << EOMODS3
105 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
111 $LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT -w bjorn >> \
112 $TESTOUT 2>&1 << EOMODS4
116 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
126 echo "Using ldapsearch to retrieve all the entries..."
127 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
128 'objectClass=*' >> $SEARCHOUT 2>&1
131 if test $RC != 0 ; then
132 echo "ldapsearch failed ($RC)!"
138 echo "Filtering ldapsearch results..."
139 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
140 echo "Filtering original ldif used to create database..."
141 . $LDIFFILTER < $LDIF > $LDIFFLT
142 echo "Comparing filter output..."
143 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
145 if test $? != 0 ; then
146 echo "comparison failed - modify operations did not complete correctly"
150 echo ">>>>> Test succeeded"