5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
14 echo "Cleaning up in $DBDIR..."
18 echo "Running slapadd to build slapd database..."
19 . $CONFFILTER $BACKEND $MONITORDB < $ACLCONF > $DBCONF
20 $SLAPADD -f $DBCONF -l $LDIFORDERED
22 if test $RC != 0 ; then
23 echo "slapadd failed ($RC)!"
27 echo "Starting slapd on TCP/IP port $PORT..."
28 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
30 if test $WAIT != 0 ; then
35 echo "Testing slapd access control..."
36 for i in 0 1 2 3 4 5; do
37 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
38 'objectclass=*' > /dev/null 2>&1
40 if test $RC = 0 ; then
43 echo "Waiting 5 seconds for slapd to start..."
47 if test $RC != 0 ; then
48 echo "ldapsearch failed ($RC)!"
53 cat /dev/null > $SEARCHOUT
56 # Try to read an entry inside the Alumni Association container. It should
57 # give us nothing if we're not bound, and should return all attributes
58 # if we're bound as anyone under UM.
60 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT "objectclass=*" \
63 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT \
64 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
67 # Check group access. Try to modify Babs' entry. Two attempts:
68 # 1) bound as "James A Jones 1" - should fail
69 # 2) bound as "Bjorn Jensen" - should succeed
71 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
72 $TESTOUT 2>&1 << EOMODS5
81 $LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT -w bjorn >> \
82 $TESTOUT 2>&1 << EOMODS6
86 homephone: +1 313 555 5444
91 # Try to add a "member" attribute to the "All Staff" group. It should
92 # fail when we add some DN other than our own, and should succeed when
95 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj > \
96 $TESTOUT 2>&1 << EOMODS1
98 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
101 uniquemember: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US
105 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
106 $TESTOUT 2>&1 << EOMODS2
109 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
112 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
116 # Try to modify the "All Staff" group. Two attempts are made:
117 # 1) bound as "James A Jones 1" - should fail
118 # 2) bound as "Barbara Jensen" - should succeed
120 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
121 $TESTOUT 2>&1 << EOMODS3
123 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
129 $LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT -w bjorn >> \
130 $TESTOUT 2>&1 << EOMODS4
134 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
144 echo "Using ldapsearch to retrieve all the entries..."
145 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
146 'objectClass=*' >> $SEARCHOUT 2>&1
149 if test $RC != 0 ; then
150 echo "ldapsearch failed ($RC)!"
156 echo "Filtering ldapsearch results..."
157 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
158 echo "Filtering original ldif used to create database..."
159 . $LDIFFILTER < $LDIF > $LDIFFLT
160 echo "Comparing filter output..."
161 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
163 if test $? != 0 ; then
164 echo "comparison failed - modify operations did not complete correctly"
168 echo ">>>>> Test succeeded"