]> git.sur5r.net Git - openldap/commitdiff
Add a referrals/manageDsaIT test (depends on order of reference return)
authorKurt Zeilenga <kurt@openldap.org>
Mon, 21 Oct 2002 19:11:27 +0000 (19:11 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 21 Oct 2002 19:11:27 +0000 (19:11 +0000)
tests/data/referrals.ldif
tests/data/referrals.out [new file with mode: 0644]
tests/data/slapd-referrals.conf [new file with mode: 0644]
tests/scripts/defines.sh
tests/scripts/test016-ref [new file with mode: 0755]

index 54911cb0a6132a80fdeaeb6c3610ee33c6d94264..dfa34a7fb800d838dfdb35ead68da6d5a110871b 100644 (file)
@@ -4,23 +4,17 @@ objectclass: country
 
 dn: o=ABC,c=US
 o: ABC
-ref: ldap//hostA/o=abc,c=us    HostA
-ref: ldap//hostB/o=abc,c=us    HostB
+ref: ldap://hostA/o=abc,c=us HostA
+ref: ldap://hostB/o=abc,c=us HostB
 objectclass: referral
 objectclass: extensibleObject
 
 dn: o=XYZ,c=US
 o: XYZ
-ref: ldap//hostC/o=xyz,c=us    HostC
+ref: ldap://hostC/o=xyz,c=us HostC
 objectclass: referral
 objectclass: extensibleObject
 
-dn: o=Alias,c=US
-o: Alias
-aliasedObjectName: o=University of Michigan,c=US
-objectclass: alias
-objectclass: extensibleObject
-
 dn: o=University of Michigan,c=US
 o: University of Michigan
 objectclass: organization
@@ -33,18 +27,3 @@ sn: Manager
 description: Manager of the directory
 userpassword:: c2VjcmV0
 objectclass: person
-
-dn: cn=Alias,o=University of Michigan,c=US
-cn: Alias
-aliasedobjectname: cn=Manager,o=University of Michigan,c=US
-objectclass: extensibleObject
-
-dn: cn=Circular,o=University of Michigan,c=US
-cn: Circular
-aliasedobjectname: cn=Circular,o=University of Michigan,c=US
-objectclass: extensibleObject
-
-dn: cn=Subordinate,o=University of Michigan,c=US
-cn: Subordinate
-aliasedobjectname: cn=Subordinate,cn=Alias,o=University of Michigan,c=US
-objectclass: extensibleObject
diff --git a/tests/data/referrals.out b/tests/data/referrals.out
new file mode 100644 (file)
index 0000000..9cad1be
--- /dev/null
@@ -0,0 +1,227 @@
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectClass=referral)
+# requesting: * ref 
+# with manageDSAit critical control
+#
+
+# ABC, US
+dn: o=ABC,c=US
+o: ABC
+ref: ldap://hostA/o=abc,c=us HostA
+ref: ldap://hostB/o=abc,c=us HostB
+objectClass: referral
+objectClass: extensibleObject
+
+# XYZ, US
+dn: o=XYZ,c=US
+o: XYZ
+ref: ldap://hostC/o=xyz,c=us HostC
+objectClass: referral
+objectClass: extensibleObject
+
+# search result
+search: 2
+result: 0 Success
+
+# numResponses: 3
+# numEntries: 2
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectClass=referral)
+# requesting: * ref 
+# with manageDSAit critical control
+#
+
+# ABC, US
+dn: o=ABC,c=US
+o: ABC
+ref: ldap://hostA/o=abc,c=us HostA
+ref: ldap://hostB/o=abc,c=us HostB
+objectClass: referral
+objectClass: extensibleObject
+
+# search result
+search: 2
+result: 0 Success
+
+# numResponses: 2
+# numEntries: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectClass=referral)
+# requesting: * ref 
+# with manageDSAit critical control
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/uid=xxx,o=abc,c=us??sub
+ref: ldap://hostB/uid=xxx,o=abc,c=us??sub
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# US
+dn: c=US
+
+# search result
+search: 2
+result: 0 Success
+
+# numResponses: 2
+# numEntries: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search reference
+ref: ldap://hostA/o=abc,c=us??base
+ref: ldap://hostB/o=abc,c=us??base
+
+# search reference
+ref: ldap://hostC/o=xyz,c=us??base
+
+# University of Michigan, US
+dn: o=University of Michigan,c=US
+
+# search result
+search: 2
+result: 0 Success
+
+# numResponses: 4
+# numEntries: 1
+# numReferences: 2
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search reference
+ref: ldap://hostA/o=abc,c=us??sub
+ref: ldap://hostB/o=abc,c=us??sub
+
+# search reference
+ref: ldap://hostC/o=xyz,c=us??sub
+
+# US
+dn: c=US
+
+# University of Michigan, US
+dn: o=University of Michigan,c=US
+
+# Manager, University of Michigan, US
+dn: cn=Manager,o=University of Michigan,c=US
+
+# search result
+search: 2
+result: 0 Success
+
+# numResponses: 6
+# numEntries: 3
+# numReferences: 2
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/o=abc,c=us??base
+ref: ldap://hostB/o=abc,c=us??base
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/o=abc,c=us??one
+ref: ldap://hostB/o=abc,c=us??one
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/o=abc,c=us??sub
+ref: ldap://hostB/o=abc,c=us??sub
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/uid=xxx,o=abc,c=us??base
+ref: ldap://hostB/uid=xxx,o=abc,c=us??base
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/uid=xxx,o=abc,c=us??one
+ref: ldap://hostB/uid=xxx,o=abc,c=us??one
+
+# numResponses: 1
+# extended LDIF
+#
+# LDAPv3
+# filter: (objectclass=*)
+# requesting: 1.1 
+#
+
+# search result
+search: 2
+result: 10 Referral
+matchedDN: o=ABC,c=US
+ref: ldap://hostA/uid=xxx,o=abc,c=us??sub
+ref: ldap://hostB/uid=xxx,o=abc,c=us??sub
+
+# numResponses: 1
diff --git a/tests/data/slapd-referrals.conf b/tests/data/slapd-referrals.conf
new file mode 100644 (file)
index 0000000..03255fb
--- /dev/null
@@ -0,0 +1,23 @@
+# $OpenLDAP$
+#
+# referral slapd config -- for testing
+#
+ucdata-path    ./ucdata
+include ./schema/core.schema
+include ./schema/cosine.schema
+include ./schema/inetorgperson.schema
+include ./schema/openldap.schema
+pidfile     ./test-db/slapd.pid
+argsfile    ./test-db/slapd.args
+
+#######################################################################
+# ldbm database definitions
+#######################################################################
+
+database       @BACKEND@
+suffix         "c=US"
+directory      ./test-db
+rootdn         "cn=Manager,o=University of Michigan,c=US"
+rootpw         secret
+#ldbm#index            objectClass eq
+#bdb#index             objectClass eq
index 304e43c416b291ff93318742380f745a78ab2f63..407ed220a97ddab89dffcc5d32b974c49ee846a5 100755 (executable)
@@ -10,6 +10,7 @@ CONF=$DATADIR/slapd.conf
 MCONF=$DATADIR/slapd-master.conf
 PWCONF=$DATADIR/slapd-pw.conf
 ACLCONF=$DATADIR/slapd-acl.conf
+RCONF=$DATADIR/slapd-referrals.conf
 MASTERCONF=$DATADIR/slapd-repl-master.conf
 SLAVECONF=$DATADIR/slapd-repl-slave.conf
 REFSLAVECONF=$DATADIR/slapd-ref-slave.conf
@@ -47,6 +48,7 @@ SLAPD="../servers/slapd/slapd -s0"
 SLURPD=../servers/slurpd/slurpd
 LDAPPASSWD="$CLIENTDIR/ldappasswd $TOOLARGS"
 LDAPSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $TOOLARGS -LLL"
+LDAPRSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $TOOLARGS"
 LDAPMODIFY="$CLIENTDIR/ldapmodify $TOOLPROTO $TOOLARGS"
 LDAPADD="$CLIENTDIR/ldapadd $TOOLPROTO $TOOLARGS"
 LDAPMODRDN="$CLIENTDIR/ldapmodrdn $TOOLPROTO $TOOLARGS"
@@ -66,7 +68,9 @@ LDIFPASSWD=$DATADIR/passwd.ldif
 LDIFPASSWDOUT=$DATADIR/passwd-out.ldif
 LDIFLANG=$DATADIR/test-lang.ldif
 LDIFLANGOUT=$DATADIR/lang-out.ldif
+LDIFREF=$DATADIR/referrals.ldif
 MONITOR=""
+REFDN="c=US"
 BASEDN="o=University of Michigan,c=US"
 MANAGERDN="cn=Manager,o=University of Michigan,c=US"
 UPDATEDN="cn=Replica,o=University of Michigan,c=US"
@@ -87,6 +91,7 @@ SLAVEOUT=$DBDIR/slave.out
 SUBMASTEROUT=$DBDIR/submaster.out
 TESTOUT=$DBDIR/test.out
 INITOUT=$DBDIR/init.out
+REFERRALOUT=$DATADIR/referrals.out
 SEARCHOUTMASTER=$DATADIR/search.out.master
 SEARCHOUTX=$DATADIR/search.out.xsearch
 MODIFYOUTMASTER=$DATADIR/modify.out.master
diff --git a/tests/scripts/test016-ref b/tests/scripts/test016-ref
new file mode 100755 (executable)
index 0000000..686786d
--- /dev/null
@@ -0,0 +1,197 @@
+#! /bin/sh
+# $OpenLDAP$
+
+RCODE=10
+SRCDIR="."
+if test $# -ge 1 ; then
+       SRCDIR=$1; shift
+fi
+BACKEND=bdb
+if test $# -ge 1 ; then
+       BACKEND=$1; shift
+fi
+MONITORDB=no
+if test $# -ge 1 ; then
+       MONITORDB=$1; shift
+fi
+WAIT=0
+if test $# -ge 1 ; then
+       WAIT=1; shift
+fi
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
+echo "Cleaning up in $DBDIR..."
+
+rm -f $DBDIR/[!C]*
+
+echo "Running slapadd to build slapd database..."
+. $CONFFILTER $BACKEND $MONITORDB < $RCONF > $DBCONF
+$SLAPADD -f $DBCONF -l $LDIFREF
+RC=$?
+if test $RC != 0 ; then
+       echo "slapadd failed ($RC)!"
+       exit $RC
+fi
+
+echo "Starting slapd on TCP/IP port $PORT..."
+$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+    echo PID $PID
+    read foo
+fi
+
+echo "Testing slapd searching..."
+for i in 0 1 2 3 4 5; do
+       $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
+               '(objectclass=*)' > /dev/null 2>&1
+       RC=$?
+       if test $RC = 0 ; then
+               break
+       fi
+       echo "Waiting 5 seconds for slapd to start..."
+       sleep 5
+done
+
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+cat /dev/null > $SEARCHOUT
+
+echo "Testing ManageDsaIT searching at $REFDN..."
+$LDAPRSEARCH -S "" -MM -b "$REFDN" -h $LOCALHOST -p $PORT \
+       '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing ManageDsaIT searching at referral object..."
+$LDAPRSEARCH -S "" -MM -b "o=abc,$REFDN" -h $LOCALHOST -p $PORT \
+       '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing ManageDsaIT searching below referral object..."
+$LDAPRSEARCH -S "" -MM -b "uid=xxx,o=abc,$REFDN" -h $LOCALHOST -p $PORT \
+       '(objectClass=referral)' '*' ref >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+XREFDN="$REFDN"
+echo "Testing base searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing one-level searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing subtree searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       kill -HUP $PID
+       exit $RC
+fi
+
+XREFDN="o=abc,$REFDN"
+echo "Testing base searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing one-level searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing subtree searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+XREFDN="uid=xxx,o=abc,$REFDN"
+echo "Testing base searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s base -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing one-level searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s one -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+echo "Testing subtree searching at $XREFDN..."
+$LDAPRSEARCH -S "" -s sub -b "$XREFDN" -h $LOCALHOST -p $PORT 1.1 >> $SEARCHOUT 2>&1
+RC=$?
+if test $RC != $RCODE ; then
+       echo "ldapsearch: unexpected result ($RC)! (referral expected)"
+       kill -HUP $PID
+       exit $RC
+fi
+
+kill -HUP $PID
+LDIF=$SEARCHOUTMASTER
+echo "Filtering ldapsearch results..."
+. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+echo "Filtering expected LDIF for comparison..."
+. $LDIFFILTER < $REFERRALOUT > $LDIFFLT
+echo "Comparing filter output..."
+$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+
+if test $? != 0 ; then
+       echo "Comparison failed"
+       exit 1
+fi
+
+echo ">>>>> Test succeeded"
+
+
+exit 0