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
69 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
72 member: cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
76 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
77 $TESTOUT 2>&1 << EOMODS2
79 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
82 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
86 # Try to modify the "All Staff" group. Two attempts are made:
87 # 1) bound as "James A Jones 1" - should fail
88 # 2) bound as "Barbara Jensen" - should succeed
90 $LDAPMODIFY -D "$JAJDN" -h localhost -p $PORT -w jaj >> \
91 $TESTOUT 2>&1 << EOMODS3
93 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
99 $LDAPMODIFY -D "$BJORNSDN" -h localhost -p $PORT -w bjorn >> \
100 $TESTOUT 2>&1 << EOMODS4
101 dn: cn=ITD Staff, ou=Groups, o=University of Michigan, c=US
104 telephonenumber: +1 810 555 1212
107 echo "Using ldapsearch to retrieve all the entries..."
108 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
109 'objectClass=*' | . $SRCDIR/scripts/acfilter.sh >> $SEARCHOUT 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed!"
119 echo "Filtering ldapsearch results..."
120 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
121 echo "Filtering original ldif used to create database..."
122 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
123 echo "Comparing filter output..."
124 cmp $SEARCHFLT $LDIFFLT
126 if test $? != 0 ; then
127 echo "comparison failed - modify operations did not complete correctly"
131 echo ">>>>> Test succeeded"