3 if test $# -eq 0 ; then
8 if test $# -eq 1 ; then
12 echo "running defines.sh $SRCDIR $BACKEND"
13 . $SRCDIR/scripts/defines.sh
15 echo "Cleaning up in $DBDIR..."
19 echo "Running ldif2ldbm to build slapd database..."
20 $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools
22 if test $RC != 0 ; then
23 echo "ldif2ldbm failed!"
27 echo "Starting slapd on TCP/IP port $PORT..."
28 $SLAPD -f $ACLCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
31 echo "Testing slapd access control..."
32 for i in 0 1 2 3 4 5; do
33 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
34 'objectclass=*' > /dev/null 2>&1
36 if test $RC = 1 ; then
37 echo "Waiting 5 seconds for slapd to start..."
42 if test $RC != 0 ; then
43 echo "ldapsearch failed!"
48 cat /dev/null > $SEARCHOUT
51 # Try to read an entry inside the Alumni Association container. It should
52 # give us nothing if we're not bound, and should return all attributes
53 # if we're bound as anyone under UM.
55 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT "objectclass=*" \
58 $LDAPSEARCH -b "$JAJDN" -h localhost -p $PORT \
59 -D "$BABSDN" -w bjensen "objectclass=*" >> $SEARCHOUT 2>&1
63 # Try to add a "member" attribute to the "All Staff" group. It should
64 # fail when we add some DN other than our own, and should succeed when
67 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj > \
68 $TESTOUT 2>&1 << EOMODS1
70 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
73 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
77 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
78 $TESTOUT 2>&1 << EOMODS2
81 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
84 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
88 # Try to modify the "All Staff" group. Two attempts are made:
89 # 1) bound as "James A Jones 1" - should fail
90 # 2) bound as "Barbara Jensen" - should succeed
92 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
93 $TESTOUT 2>&1 << EOMODS3
95 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
101 $LDAPMODIFY -D "$BJORNSDN" -h localhost -p $PORT -w bjorn >> \
102 $TESTOUT 2>&1 << EOMODS4
106 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
112 telephonenumber: +1 810 555 1212
116 echo "Using ldapsearch to retrieve all the entries..."
117 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
118 'objectClass=*' | . $SRCDIR/scripts/acfilter.sh >> $SEARCHOUT 2>&1
121 if test $RC != 0 ; then
122 echo "ldapsearch failed!"
128 echo "Filtering ldapsearch results..."
129 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
130 echo "Filtering original ldif used to create database..."
131 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
132 echo "Comparing filter output..."
133 cmp $SEARCHFLT $LDIFFLT
135 if test $? != 0 ; then
136 echo "comparison failed - modify operations did not complete correctly"
140 echo ">>>>> Test succeeded"