More for translucent

This commit is contained in:
Howard Chu 2005-03-10 04:35:57 +00:00
parent 3f9ec92c74
commit aad140151e
14 changed files with 1930 additions and 955 deletions

1911
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -266,9 +266,9 @@ OL_ARG_ENABLE(refint,[ --enable-refint Referential Integrity overlay no|yes
no, [no yes mod])
OL_ARG_ENABLE(rwm,[ --enable-rwm Rewrite/Remap overlay no|yes|mod],
no, [no yes mod])
OL_ARG_ENABLE(syncprov,[ --enable-syncprov Syncrepl Provider overlay no|yes|mod],
OL_ARG_ENABLE(syncprov,[ --enable-syncprov Syncrepl Provider overlay no|yes|mod],
yes, [no yes mod])
OL_ARG_ENABLE(translucent,[ --enable-translucent Translucent Proxy overlay no|yes|mod],
OL_ARG_ENABLE(translucent,[ --enable-translucent Translucent Proxy overlay no|yes|mod],
no, [no yes mod])
OL_ARG_ENABLE(unique,[ --enable-unique Attribute Uniqueness overlay no|yes|mod],
no, [no yes mod])
@ -530,6 +530,7 @@ BUILD_PROXYCACHE=no
BUILD_REFINT=no
BUILD_RWM=no
BUILD_SYNCPROV=no
BUILD_TRANSLUCENT=no
BUILD_UNIQUE=no
SLAPD_DYNAMIC_OVERLAYS=
@ -2875,6 +2876,17 @@ if test "$ol_enable_syncprov" != no ; then
AC_DEFINE_UNQUOTED(SLAPD_OVER_SYNCPROV,$MFLAG,[define for Syncrepl Provider overlay])
fi
if test "$ol_enable_translucent" != no ; then
BUILD_TRANSLUCENT=$ol_enable_translucent
if test "$ol_enable_translucent" = mod ; then
MFLAG=SLAPD_MOD_DYNAMIC
SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS translucent.la"
else
MFLAG=SLAPD_MOD_STATIC
fi
AC_DEFINE_UNQUOTED(SLAPD_OVER_TRANSLUCENT,$MFLAG,[define for Translucent Proxy overlay])
fi
if test "$ol_enable_unique" != no ; then
BUILD_UNIQUE=$ol_enable_unique
if test "$ol_enable_unique" = mod ; then
@ -2952,6 +2964,7 @@ dnl overlays
AC_SUBST(BUILD_REFINT)
AC_SUBST(BUILD_RWM)
AC_SUBST(BUILD_SYNCPROV)
AC_SUBST(BUILD_TRANSLUCENT)
AC_SUBST(BUILD_UNIQUE)
AC_SUBST(BUILD_SLURPD)

View File

@ -3,11 +3,11 @@
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.\" $OpenLDAP$
.SH NAME
slapo-translucent \- Proxy Override overlay
slapo-translucent \- Translucent Proxy overlay
.SH SYNOPSIS
ETCDIR/slapd.conf
.SH DESCRIPTION
The Proxy Override overlay can be used with a backend database such as
The Translucent Proxy overlay can be used with a backend database such as
.BR slapd-bdb (5)
to create a "translucent proxy". Entries retrieved from a remote LDAP
server may have some or all attributes overridden, or new attributes
@ -31,12 +31,12 @@ operation will perform a comparison with attributes defined in the local
database record (if any) before any comparison is made with data in the
remote database.
.SH CONFIGURATION
The Proxy Override overlay uses a remote LDAP server which is configured
The Translucent Proxy overlay uses a remote LDAP server which is configured
with the options shown in
.BR slapd-ldap (5).
These
.B slapd.conf
options are specific to the Proxy Override overlay; they may appear anywhere
options are specific to the Translucent Proxy overlay; they may appear anywhere
after the
.B overlay
directive and before any subsequent
@ -61,7 +61,7 @@ must be created by hand. Glue records are always created for a
operation.
.SH CAVEATS
.LP
The Proxy Override overlay will disable schema checking in the local database,
The Translucent Proxy overlay will disable schema checking in the local database,
so that an entry consisting of overlay attributes need not adhere to the
complete schema.
.LP

View File

@ -1064,6 +1064,9 @@
/* define for Syncrepl Provider overlay */
#undef SLAPD_OVER_SYNCPROV
/* define for Translucent Proxy overlay */
#undef SLAPD_OVER_TRANSLUCENT
/* define for Attribute Uniqueness overlay */
#undef SLAPD_OVER_UNIQUE

View File

@ -0,0 +1,52 @@
# stand-alone slapd config -- for testing (with translucent overlay)
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2004 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
include ./schema/nis.schema
#
pidfile ./testrun/slapd.2.pid
argsfile ./testrun/slapd.2.args
#mod#modulepath ../servers/slapd/back-@BACKEND@/:../servers/slapd/back-ldap/:../servers/slapd/overlays
#mod#moduleload back_@BACKEND@.la
#mod#moduleload back_ldap.la
#translucentmod#modulepath ../servers/slapd/overlays
#translucentmod#moduleload translucent.la
#######################################################################
# database definitions
#######################################################################
database @BACKEND@
suffix "o=translucent"
directory ./testrun/db.2.a
rootdn "o=translucent"
rootpw secret
index objectClass eq
index cn,sn,uid pres,eq,sub
overlay translucent
translucent_no_glue
# XXX this uri really shouldn't be hardcoded
uri @URI1@
lastmod off
acl-authcDN uid=binder,o=translucent
acl-passwd bindtest

View File

@ -0,0 +1,41 @@
# stand-alone slapd config -- for testing (with translucent overlay)
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2004 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
include ./schema/nis.schema
#
pidfile ./testrun/slapd.1.pid
argsfile ./testrun/slapd.1.args
#mod#modulepath ../servers/slapd/back-@BACKEND@/:../servers/slapd/overlays
#mod#moduleload back_@BACKEND@.la
#######################################################################
# database definitions
#######################################################################
database @BACKEND@
suffix "o=translucent"
directory ./testrun/db.1.a
rootdn "o=translucent"
rootpw secret
index objectClass eq
index cn,sn,uid pres,eq,sub

View File

@ -0,0 +1,10 @@
dn: uid=danger,ou=users,o=translucent
objectClass: inetOrgPerson
uid: danger
sn: danger
cn: henry
businessCategory: frontend-override
carLicense: LIVID
employeeType: special
departmentNumber: 9999999
roomNumber: 41L-535

View File

@ -0,0 +1,26 @@
# toplevel
dn: o=translucent
objectClass: top
objectClass: organization
o: translucent
description: backend database root
# backend OU
dn: ou=users,o=translucent
objectClass: top
objectClass: organizationalUnit
ou: users
description: backend user container root
# bind user for frontend connection
dn: uid=binder,o=translucent
objectClass: inetOrgPerson
uid: binder
sn: test
cn: binder
businessCategory: binder-test-user
displayName: Binder Test User
userPassword: bindtest

View File

@ -0,0 +1,42 @@
# typical user
dn: uid=danger,ou=users,o=translucent
objectClass: inetOrgPerson
uid: danger
sn: warning
cn: danger
businessCategory: backend-opaque
carLicense: BACK
departmentNumber: 7341
displayName: Warning
employeeNumber: 5150
employeeType: contractor
givenName: Danger Warning
# another example
dn: uid=example,ou=users,o=translucent
objectClass: inetOrgPerson
uid: example
sn: user
cn: example
businessCategory: backend-opaque
carLicense: SAMPLE
departmentNumber: 7341
displayName: Example
employeeNumber: 5150
employeeType: fulltime
givenName: Example User
#
dn: uid=fred,ou=users,o=translucent
objectClass: inetOrgPerson
uid: fred
sn: said
cn: said
businessCategory: backend-opaque
carLicense: RIGHT
departmentNumber: 9919
displayName: Right Said Fred
employeeNumber: 44199
employeeType: fulltime
givenName: Right Said

View File

@ -0,0 +1,40 @@
dn: uid=danger,ou=users,o=translucent
objectClass: inetOrgPerson
uid: danger
sn: danger
cn: henry
businessCategory: frontend-override
carLicense: LIVID
departmentNumber: 9999999
displayName: Warning
employeeNumber: 5150
employeeType: special
givenName: Danger Warning
roomNumber: 41L-535
dn: uid=example,ou=users,o=translucent
objectClass: inetOrgPerson
uid: example
sn: user
cn: example
businessCategory: backend-opaque
carLicense: SAMPLE
departmentNumber: 7341
displayName: Example
employeeNumber: 5150
employeeType: fulltime
givenName: Example User
dn: uid=fred,ou=users,o=translucent
objectClass: inetOrgPerson
uid: fred
sn: said
cn: said
businessCategory: backend-opaque
carLicense: RIGHT
departmentNumber: 9919
displayName: Right Said Fred
employeeNumber: 44199
employeeType: fulltime
givenName: Right Said

View File

@ -37,6 +37,7 @@ AC_glue=glue@BUILD_GLUE@
AC_pcache=pcache@BUILD_PROXYCACHE@
AC_ppolicy=ppolicy@BUILD_PPOLICY@
AC_refint=refint@BUILD_REFINT@
AC_translucent=translucent@BUILD_TRANSLUCENT@
AC_unique=unique@BUILD_UNIQUE@
AC_rwm=rwm@BUILD_RWM@
AC_syncprov=syncprov@BUILD_SYNCPROV@
@ -48,7 +49,7 @@ AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
export AC_bdb AC_hdb AC_ldap AC_ldbm AC_meta AC_monitor AC_relay AC_sql
export AC_glue AC_pcache AC_ppolicy AC_refint AC_unique AC_rwm AC_syncprov
export AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED
export AC_translucent AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED
if test ! -x ../servers/slapd/slapd ; then
echo "Could not locate slapd(8)"

View File

@ -47,6 +47,7 @@ sed -e "s/@BACKEND@/${BACKEND}/" \
-e "s/^#${AC_ppolicy}#//" \
-e "s/^#${AC_refint}#//" \
-e "s/^#${AC_syncprov}#//" \
-e "s/^#${AC_translucent}#//" \
-e "s/^#${AC_unique}#//" \
-e "s/^#${AC_rwm}#//" \
-e "s/^#${MON}#//" \

View File

@ -25,6 +25,7 @@ PROXYCACHE=${AC_pcache-pcacheno}
PPOLICY=${AC_ppolicy-ppolicyno}
REFINT=${AC_refint-refintno}
RWM=${AC_rwm-rwmno}
TRANSLUCENT=${AC_translucent-translucentno}
UNIQUE=${AC_unique-uniqueno}
SYNCPROV=${AC_syncprov-syncprovno}
WITH_SASL=${AC_WITH_SASL-no}
@ -85,6 +86,8 @@ CHAINCONF2=$DATADIR/slapd-chain2.conf
GLUESYNCCONF1=$DATADIR/slapd-glue-syncrepl1.conf
GLUESYNCCONF2=$DATADIR/slapd-glue-syncrepl2.conf
SQLCONF=$DATADIR/slapd-sql.conf
TRANSLUCENTLOCALCONF=$DATADIR/slapd-translucent-local.conf
TRANSLUCENTREMOTECONF=$DATADIR/slapd-translucent-remote.conf
CONF1=$TESTDIR/slapd.1.conf
CONF2=$TESTDIR/slapd.2.conf
@ -169,6 +172,10 @@ LDIFLDAPGLUE3=$DATADIR/test-ldapgluegroups.ldif
LDIFCOMPMATCH=$DATADIR/test-compmatch.ldif
LDIFCHAIN1=$DATADIR/test-chain1.ldif
LDIFCHAIN2=$DATADIR/test-chain2.ldif
LDIFTRANSLUCENTDATA=$DATADIR/test-translucent-data.ldif
LDIFTRANSLUCENTCONFIG=$DATADIR/test-translucent-config.ldif
LDIFTRANSLUCENTADD=$DATADIR/test-translucent-add.ldif
LDIFTRANSLUCENTMERGED=$DATADIR/test-translucent-merged.ldif
SQLADD=$DATADIR/sql-add.ldif
MONITOR=""
REFDN="c=US"
@ -182,6 +189,10 @@ JAJDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
REFINTDN="cn=Manager,o=refint"
UNIQUEDN="cn=Manager,o=unique"
EMPTYDNDN="cn=Manager,c=US"
TRANSLUCENTROOT="o=translucent"
TRANSLUCENTUSER="ou=users,o=translucent"
TRANSLUCENTDN="uid=binder,o=translucent"
TRANSLUCENTPASSWD="bindtest"
LOG1=$TESTDIR/slapd.1.log
LOG2=$TESTDIR/slapd.2.log
@ -245,6 +256,7 @@ CHAINMODOUT=$DATADIR/chainmod.out
GLUESYNCOUT=$DATADIR/gluesync.out
SQLREAD=$DATADIR/sql-read.out
SQLWRITE=$DATADIR/sql-write.out
TRANSLUCENTOUT=$DATADIR/translucent.search.out
# Just in case we linked the binaries dynamically
LD_LIBRARY_PATH=`pwd`/../libraries:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH

717
tests/scripts/test034-translucent Executable file
View File

@ -0,0 +1,717 @@
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2004 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
PERSONAL="(objectClass=inetOrgPerson)"
NOWHERE="/dev/null"
FAILURE="additional info:"
if test $TRANSLUCENT = translucentno ; then
echo "Translucent Proxy overlay not available, test skipped"
exit 0
fi
if test $BACKEND = ldbm ; then
echo "Translucent Proxy overlay not qualified for use with LDBM, skipping"
exit 0
fi
if test $AC_ldap = ldapno ; then
echo "Translucent Proxy overlay requires back-ldap backend, test skipped"
exit 0
fi
# configure backside
mkdir -p $TESTDIR $DBDIR1
. $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTREMOTECONF > $CONF1
echo "Running slapadd to build remote slapd database..."
$SLAPADD -f $CONF1 -l $LDIFTRANSLUCENTCONFIG
RC=$?
if test $RC != 0 ; then
echo "slapadd failed ($RC)!"
exit $RC
fi
echo "Starting remote slapd on TCP/IP port $PORT1..."
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
REMOTEPID="$PID"
KILLPIDS="$PID"
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for remote slapd to start..."
sleep 5
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
# configure frontside
mkdir -p $DBDIR2
. $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTLOCALCONF > $CONF2
echo "Starting local slapd on TCP/IP port $PORT2..."
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
LOCALPID="$PID"
KILLPIDS="$LOCALPID $REMOTEPID"
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for local slapd to start..."
sleep 5
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing slapd Translucent Proxy operations..."
echo "Testing search: no remote data defined..."
$LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" >$SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
if test -s $SEARCHOUT; then
echo "ldapsearch should have returned no records!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Populating remote database..."
$LDAPADD -D "$TRANSLUCENTROOT" -H $URI1 \
-w $PASSWD < $LDIFTRANSLUCENTDATA > $NOWHERE 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing search: remote database via local slapd..."
$LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
. $LDIFFILTER < $LDIFTRANSLUCENTDATA > $LDIFFLT
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "Comparison failed -- corruption from remote to local!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Testing add: prohibited local record..."
$LDAPADD -D "$TRANSLUCENTDN" -H $URI2 \
-w $TRANSLUCENTPASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
RC=$?
if test $RC != 50 ; then
echo "ldapadd failed ($RC), expected INSUFFICIENT ACCESS!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing add: valid local record, no_glue..."
$LDAPADD -v -v -v -D "$TRANSLUCENTROOT" -H $URI2 \
-w $PASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
RC=$?
if test $RC != 32 ; then
echo "ldapadd failed ($RC), expected NO SUCH OBJECT!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modrdn: valid local record, no_glue..."
$LDAPMODRDN -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
RC=$?
if test $RC != 32 ; then
echo "ldapmodrdn failed ($RC), expected NO SUCH OBJECT!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Shutting down local slapd..."
kill -HUP $LOCALPID
sleep 5
echo "Configuring local slapd without translucent_no_glue..."
. $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTLOCALCONF | \
grep -v translucent_no_glue > $CONF2
echo "Restarting local slapd on TCP/IP port $PORT2..."
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
LOCALPID="$PID"
KILLPIDS="$REMOTEPID $PID"
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for local slapd to start..."
sleep 5
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing add: valid local record..."
$LDAPADD -D "$TRANSLUCENTROOT" -H $URI2 \
-w $PASSWD < $LDIFTRANSLUCENTADD > $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing search: data merging..."
$LDAPSEARCH -H $URI2 -b "$TRANSLUCENTUSER" "$PERSONAL" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$CMP $SEARCHOUT $LDIFTRANSLUCENTMERGED > $CMPOUT
if test $? != 0 ; then
echo "Comparison failed -- local data failed to merge with remote!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Testing compare: valid local..."
$LDAPCOMPARE -z -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
"uid=danger,ou=users,o=translucent" "carLicense:LIVID"
RC=$?
if test $RC != 6 ; then
echo "ldapcompare failed ($RC), expected TRUE!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing compare: valid remote..."
$LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
"uid=binder,o=translucent" "businessCategory:binder-test-user"
RC=$?
if test $RC != 6 ; then
echo "ldapcompare failed ($RC), expected TRUE!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing compare: bogus local..."
$LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
"uid=danger,ou=users,o=translucent" "businessCategory:invalid-test-value"
RC=$?
if test $RC != 5 ; then
echo "ldapcompare failed ($RC), expected FALSE!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing compare: bogus remote..."
$LDAPCOMPARE -z -x -H $URI2 -w $TRANSLUCENTPASSWD -D $TRANSLUCENTDN \
"uid=binder,o=translucent" "businessCategory:invalid-test-value"
RC=$?
if test $RC != 5 ; then
echo "ldapcompare failed ($RC), expected FALSE!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modify: nonexistent record..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD
version: 1
dn: uid=bogus,ou=users,o=translucent
changetype: modify
replace: roomNumber
roomNumber: 31J-2112
EOF_MOD
RC=$?
if test $RC != 32 ; then
echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modify: valid local record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD1
version: 1
dn: uid=danger,ou=users,o=translucent
changetype: modify
replace: roomNumber
roomNumber: 9N-21
EOF_MOD1
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
if test "$ATTR" != "roomNumber: 9N-21" ; then
echo "modification failed!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Testing search: specific nonexistent remote attribute..."
$LDAPSEARCH -H $URI2 -b "uid=danger,ou=users,o=translucent" roomNumber > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modify: nonexistent local record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD2
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: modify
replace: roomNumber
roomNumber: 31J-2112
EOF_MOD2
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
ATTR=`grep roomNumber $SEARCHOUT` > $NOWHERE 2>&1
if test "$ATTR" != "roomNumber: 31J-2112" ; then
echo "modification failed!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Testing modify: valid remote record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD9
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: modify
delete: preferredLanguage
EOF_MOD9
RC=$?
if test $RC != 16 ; then
echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: valid local record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD4
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: modify
delete: roomNumber
EOF_MOD4
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modrdn: prohibited local record..."
$LDAPMODRDN -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
$TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
RC=$?
if test $RC != 50 ; then
echo "ldapmodrdn failed ($RC), expected INSUFFICIENT ACCESS!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modrdn: valid local record..."
$LDAPMODRDN -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 'uid=fred,ou=users,o=translucent' 'uid=someguy'
RC=$?
if test $RC != 0 ; then
echo "ldapmodrdn failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: prohibited local record..."
$LDAPMODIFY -v -D "$TRANSLUCENTDN" -H $URI2 -w $TRANSLUCENTPASSWD > \
$TESTOUT 2>&1 << EOF_DEL2
version: 1
dn: uid=someguy,ou=users,o=translucent
changetype: delete
EOF_DEL2
RC=$?
if test $RC != 50 ; then
echo "ldapadd failed ($RC), expected INSUFFICIENT ACCESS!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: valid local record..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_DEL3
version: 1
dn: uid=someguy,ou=users,o=translucent
changetype: delete
EOF_DEL3
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: valid remote record..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_DEL8
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: delete
EOF_DEL8
RC=$?
if test $RC != 32 ; then
echo "ldapmodify failed ($RC), expected NO SUCH OBJECT!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: nonexistent local record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_DEL1
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: modify
delete: roomNumber
EOF_DEL1
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing delete: valid local record, nonexistent attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD8
version: 1
dn: uid=danger,ou=users,o=translucent
changetype: modify
delete: preferredLanguage
EOF_MOD8
RC=$?
if test $RC != 16 ; then
echo "ldapmodify failed ($RC), expected NO SUCH ATTRIBUTE!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing modify: valid remote record, combination add-modify-delete..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD6
version: 1
dn: uid=fred,ou=users,o=translucent
changetype: modify
delete: carLicense
-
add: preferredLanguage
preferredLanguage: ISO8859-1
-
replace: employeeType
employeeType: consultant
EOF_MOD6
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPSEARCH -H $URI2 -b "uid=fred,ou=users,o=translucent" > $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
ATTR=`grep employeeType $SEARCHOUT` > $NOWHERE 2>&1
if test "$ATTR" != "employeeType: consultant" ; then
echo "modification failed!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
ATTR=`grep preferredLanguage $SEARCHOUT` > $NOWHERE 2>&1
if test "$ATTR" != "preferredLanguage: ISO8859-1" ; then
echo "modification failed!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Shutting down local slapd..."
kill -HUP $LOCALPID
sleep 5
echo "Configuring local slapd with translucent_strict..."
echo translucent_strict >> $CONF2
echo "Restarting slapd on TCP/IP port $PORT2..."
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
LOCALPID="$PID"
KILLPIDS="$REMOTEPID $PID"
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for local slapd to start..."
sleep 5
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing strict mode delete: nonexistent local attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD5
version: 1
dn: uid=example,ou=users,o=translucent
changetype: modify
delete: preferredLanguage
EOF_MOD5
RC=$?
if test $RC != 19 ; then
echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing strict mode delete: nonexistent remote attribute..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD3
version: 1
dn: uid=danger,ou=users,o=translucent
changetype: modify
delete: displayName
EOF_MOD3
RC=$?
if test $RC != 19 ; then
echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing strict mode modify: combination add-modify-delete..."
$LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \
$TESTOUT 2>&1 << EOF_MOD6
version: 1
dn: uid=example,ou=users,o=translucent
changetype: modify
delete: carLicense
-
add: preferredLanguage
preferredLanguage: ISO8859-1
-
replace: employeeType
employeeType: consultant
EOF_MOD6
RC=$?
if test $RC != 19 ; then
echo "ldapmodify failed ($RC), expected CONSTRAINT VIOLATION!"
grep "$FAILURE" $TESTOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo ">>>>> Test succeeded"
exit 0