5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
24 echo "Cleaning up in $DBDIR..."
28 echo "Running slapadd to build slapd database..."
29 . $CONFFILTER $BACKEND $MONITORDB < $ACLCONF > $DBCONF
30 $SLAPADD -f $DBCONF -l $LDIFORDERED
32 if test $RC != 0 ; then
33 echo "slapadd failed ($RC)!"
37 echo "Starting slapd on TCP/IP port $PORT..."
38 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
40 if test $WAIT != 0 ; then
45 echo "Testing slapd access control..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
48 'objectclass=*' > /dev/null 2>&1
50 if test $RC = 1 ; then
51 echo "Waiting 5 seconds for slapd to start..."
56 if test $RC != 0 ; then
57 echo "ldapsearch failed ($RC)!"
62 cat /dev/null > $SEARCHOUT
65 # Try to read an entry inside the Alumni Association container. It should
66 # give us nothing if we're not bound, and should return all attributes
67 # if we're bound as anyone under UM.
69 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT "objectclass=*" \
72 $LDAPSEARCH -b "$JAJDN" -h $LOCALHOST -p $PORT \
73 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
77 # Try to add a "member" attribute to the "All Staff" group. It should
78 # fail when we add some DN other than our own, and should succeed when
81 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj > \
82 $TESTOUT 2>&1 << EOMODS1
84 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
87 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
91 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
92 $TESTOUT 2>&1 << EOMODS2
95 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
98 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
102 # Try to modify the "All Staff" group. Two attempts are made:
103 # 1) bound as "James A Jones 1" - should fail
104 # 2) bound as "Barbara Jensen" - should succeed
106 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT -w jaj >> \
107 $TESTOUT 2>&1 << EOMODS3
109 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
115 $LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT -w bjorn >> \
116 $TESTOUT 2>&1 << EOMODS4
120 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
130 echo "Using ldapsearch to retrieve all the entries..."
131 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
132 'objectClass=*' >> $SEARCHOUT 2>&1
135 if test $RC != 0 ; then
136 echo "ldapsearch failed ($RC)!"
142 echo "Filtering ldapsearch results..."
143 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
144 echo "Filtering original ldif used to create database..."
145 . $LDIFFILTER < $LDIF > $LDIFFLT
146 echo "Comparing filter output..."
147 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
149 if test $? != 0 ; then
150 echo "comparison failed - modify operations did not complete correctly"
154 echo ">>>>> Test succeeded"