mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-06 06:59:54 -05:00
test sync replication with back-sql
This commit is contained in:
parent
6434721e42
commit
16e42fc78c
3 changed files with 774 additions and 0 deletions
78
tests/data/slapd-sql-syncrepl-master.conf
Normal file
78
tests/data/slapd-sql-syncrepl-master.conf
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# master slapd config -- for testing
|
||||
# $OpenLDAP$
|
||||
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
##
|
||||
## Copyright 1998-2005 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
|
||||
|
||||
#sqlmod#modulepath ../servers/slapd/back-sql/
|
||||
#sqlmod#moduleload back_sql.la
|
||||
#monitormod#modulepath ../servers/slapd/back-monitor/
|
||||
#monitormod#moduleload back_monitor.la
|
||||
|
||||
#
|
||||
# normal installations should protect root dse,
|
||||
# cn=monitor, cn=schema, and cn=config
|
||||
#
|
||||
|
||||
access to attr=userpassword
|
||||
by self =wx
|
||||
by anonymous =x
|
||||
|
||||
access to *
|
||||
by * read
|
||||
|
||||
#######################################################################
|
||||
# sql database definitions
|
||||
#######################################################################
|
||||
|
||||
database sql
|
||||
suffix "dc=example,dc=com"
|
||||
rootdn "cn=Manager,dc=example,dc=com"
|
||||
rootpw secret
|
||||
dbname example
|
||||
dbuser manager
|
||||
dbpasswd secret
|
||||
|
||||
#
|
||||
# rdbms specific directives
|
||||
#
|
||||
# IBM db2
|
||||
#ibmdb2#upper_func "ucase"
|
||||
#ibmdb2#upper_needs_cast "yes"
|
||||
#ibmdb2#concat_pattern "?||?"
|
||||
#ibmdb2#children_cond "ucase(ldap_entries.dn)=ucase(cast(? as varchar(255)))"
|
||||
#ibmdb2#create_needs_select "yes"
|
||||
#ibmdb2#insentry_stmt "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select case when max(id) is null then 1 else max(id) + 1 end from ldap_entries),?,?,?,?)"
|
||||
#
|
||||
# PostgreSQL
|
||||
#postgres#insentry_stmt "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select case when max(id) is null then 1 else max(id) + 1 end from ldap_entries),?,?,?,?)"
|
||||
#postgres#upper_func "upper"
|
||||
#postgres#strcast_func "text"
|
||||
#postgres#concat_pattern "?||?"
|
||||
#
|
||||
# MySQL
|
||||
#mysql#concat_pattern "concat(?,?)"
|
||||
|
||||
has_ldapinfo_dn_ru no
|
||||
|
||||
overlay syncprov
|
||||
|
||||
#monitor#database monitor
|
||||
|
|
@ -86,6 +86,7 @@ CHAINCONF2=$DATADIR/slapd-chain2.conf
|
|||
GLUESYNCCONF1=$DATADIR/slapd-glue-syncrepl1.conf
|
||||
GLUESYNCCONF2=$DATADIR/slapd-glue-syncrepl2.conf
|
||||
SQLCONF=$DATADIR/slapd-sql.conf
|
||||
SQLSRMASTERCONF=$DATADIR/slapd-sql-syncrepl-master.conf
|
||||
TRANSLUCENTLOCALCONF=$DATADIR/slapd-translucent-local.conf
|
||||
TRANSLUCENTREMOTECONF=$DATADIR/slapd-translucent-remote.conf
|
||||
METACONF=$DATADIR/slapd-meta.conf
|
||||
|
|
@ -209,7 +210,9 @@ SLAPADDLOG1=$TESTDIR/slapadd.1.log
|
|||
SLURPLOG=$TESTDIR/slurp.log
|
||||
|
||||
SEARCHOUT=$TESTDIR/ldapsearch.out
|
||||
SEARCHOUT2=$TESTDIR/ldapsearch2.out
|
||||
SEARCHFLT=$TESTDIR/ldapsearch.flt
|
||||
SEARCHFLT2=$TESTDIR/ldapsearch2.flt
|
||||
LDIFFLT=$TESTDIR/ldif.flt
|
||||
TESTOUT=$TESTDIR/test.out
|
||||
INITOUT=$TESTDIR/init.out
|
||||
|
|
|
|||
693
tests/scripts/sql-test901-syncrepl
Executable file
693
tests/scripts/sql-test901-syncrepl
Executable file
|
|
@ -0,0 +1,693 @@
|
|||
#! /bin/sh
|
||||
# $OpenLDAP$
|
||||
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||
##
|
||||
## Copyright 1998-2005 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
|
||||
|
||||
if test $BACKSQL = "sqlno" ; then
|
||||
echo "SQL backend not available, test skipped"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test $RDBMS = "rdbmsno" ; then
|
||||
echo "SQL test not requested, test skipped"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test "${RDBMSWRITE}" != "yes"; then
|
||||
echo "write test disabled for ${RDBMS}; set SLAPD_USE_SQLWRITE=yes to enable"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p $TESTDIR $DBDIR2A
|
||||
|
||||
echo "Starting slapd on TCP/IP port $PORT1..."
|
||||
. $CONFFILTER $BACKEND $MONITORDB < $SQLSRMASTERCONF > $CONF1
|
||||
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
||||
PID=$!
|
||||
if test $WAIT != 0 ; then
|
||||
echo PID $PID
|
||||
read foo
|
||||
fi
|
||||
KILLPIDS="$PID"
|
||||
|
||||
echo "Testing SQL backend write operations..."
|
||||
for i in 0 1 2 3 4 5; do
|
||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
||||
'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)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Starting slave slapd on TCP/IP port $PORT2..."
|
||||
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $CONF2
|
||||
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
|
||||
SLAVEPID=$!
|
||||
if test $WAIT != 0 ; then
|
||||
echo SLAVEPID $SLAVEPID
|
||||
read foo
|
||||
fi
|
||||
KILLPIDS="$KILLPIDS $SLAVEPID"
|
||||
|
||||
echo "Using ldapsearch to check that slave slapd is running..."
|
||||
for i in 0 1 2 3 4 5; do
|
||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
|
||||
'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)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
cat /dev/null > $SEARCHOUT
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries from the master..."
|
||||
echo "# Using ldapsearch to retrieve all the entries from the master..." \
|
||||
>> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
-D "$MANAGERDN" -w $PASSWD \
|
||||
"(!(objectClass=referral))" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
cat /dev/null > $SEARCHOUT2
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries from the slave..."
|
||||
echo "# Using ldapsearch to retrieve all the entries from the slave..." \
|
||||
>> $SEARCHOUT2
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT2 -b "$BASEDN" \
|
||||
-D "$UPDATEDN" -w $PASSWD \
|
||||
"(objectClass=*)" >> $SEARCHOUT2 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Filtering ldapsearch results from master..."
|
||||
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
||||
echo "Filtering ldapsearch results from slave..."
|
||||
. $LDIFFILTER < $SEARCHOUT2 > $SEARCHFLT2
|
||||
echo "Comparing filter output..."
|
||||
$CMP $SEARCHFLT $SEARCHFLT2 > $CMPOUT
|
||||
|
||||
if test $? != 0 ; then
|
||||
echo "Comparison failed"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /dev/null > $SEARCHOUT
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
case ${RDBMS} in
|
||||
# list here the RDBMSes whose mapping allows writes
|
||||
postgres|ibmdb2)
|
||||
MANAGERDN="cn=Manager,${BASEDN}"
|
||||
echo "Testing add..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
# Adding an organization...
|
||||
dn: o=An Org,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: organization
|
||||
o: An Org
|
||||
|
||||
# Adding an organization with an "auxiliary" objectClass..
|
||||
dn: dc=subnet,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: organization
|
||||
objectClass: dcObject
|
||||
o: SubNet
|
||||
dc: subnet
|
||||
|
||||
# Adding another organization with an "auxiliary" objectClass..
|
||||
dn: dc=subnet2,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: organization
|
||||
objectClass: dcObject
|
||||
o: SubNet 2
|
||||
dc: subnet2
|
||||
|
||||
# Adding a person...
|
||||
dn: cn=Lev Tolstoij,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: inetOrgPerson
|
||||
cn: Lev Tolstoij
|
||||
sn: Tolstoij
|
||||
givenName: Lev
|
||||
telephoneNumber: +39 02 XXXX YYYY
|
||||
telephoneNumber: +39 02 XXXX ZZZZ
|
||||
userPassword: tanja
|
||||
|
||||
# Adding a person with an "auxiliary" objectClass...
|
||||
dn: cn=Some One,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: inetOrgPerson
|
||||
objectClass: simpleSecurityObject
|
||||
cn: Some One
|
||||
sn: One
|
||||
givenName: Some
|
||||
telephoneNumber: +1 800 900 1234
|
||||
telephoneNumber: +1 800 900 1235
|
||||
userPassword: someone
|
||||
|
||||
# Adding a person in another subtree...
|
||||
dn: cn=SubNet User,dc=subnet,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: inetOrgPerson
|
||||
cn: SubNet User
|
||||
sn: User
|
||||
givenName: SubNet
|
||||
|
||||
# Adding a document...
|
||||
dn: documentTitle=War and Peace,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: document
|
||||
description: Historical novel
|
||||
documentTitle: War and Peace
|
||||
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
|
||||
documentIdentifier: document 3
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $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..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
# Deleting all telephone numbers...
|
||||
dn: cn=Some One,${BASEDN}
|
||||
changetype: modify
|
||||
delete: telephoneNumber
|
||||
-
|
||||
|
||||
# Adding a telephone number...
|
||||
dn: cn=Mitya Kovalev,${BASEDN}
|
||||
changetype: modify
|
||||
add: telephoneNumber
|
||||
telephoneNumber: +1 800 123 4567
|
||||
-
|
||||
|
||||
# Deleting a specific telephone number and adding a new one...
|
||||
dn: cn=Lev Tolstoij,${BASEDN}
|
||||
changetype: modify
|
||||
delete: telephoneNumber
|
||||
telephoneNumber: +39 02 XXXX YYYY
|
||||
-
|
||||
add: telephoneNumber
|
||||
telephoneNumber: +39 333 ZZZ 1234
|
||||
-
|
||||
|
||||
# Adding an author to a document...
|
||||
dn: documentTitle=book1,${BASEDN}
|
||||
changetype: modify
|
||||
add: documentAuthor
|
||||
documentAuthor: cn=Lev Tolstoij,${BASEDN}
|
||||
-
|
||||
|
||||
# Adding an author to another document...
|
||||
dn: documentTitle=book2,${BASEDN}
|
||||
changetype: modify
|
||||
add: documentAuthor
|
||||
documentAuthor: cn=Lev Tolstoij,${BASEDN}
|
||||
-
|
||||
|
||||
# Adding an "auxiliary" objectClass...
|
||||
dn: cn=Mitya Kovalev,${BASEDN}
|
||||
changetype: modify
|
||||
add: objectClass
|
||||
objectClass: simpleSecurityObject
|
||||
-
|
||||
|
||||
# Deleting an "auxiliary" objectClass...
|
||||
dn: cn=Some One,${BASEDN}
|
||||
changetype: modify
|
||||
delete: objectClass
|
||||
objectClass: simpleSecurityObject
|
||||
-
|
||||
|
||||
# Deleting userPasswords
|
||||
dn: cn=Lev Tolstoij,${BASEDN}
|
||||
changetype: modify
|
||||
delete: userPassword
|
||||
-
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $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..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
# Deleting a person...
|
||||
dn: cn=Torvlobnor Puzdoy,${BASEDN}
|
||||
changetype: delete
|
||||
|
||||
# Deleting a document...
|
||||
dn: documentTitle=book1,${BASEDN}
|
||||
changetype: delete
|
||||
|
||||
# Deleting an organization with an "auxiliary" objectClass...
|
||||
dn: dc=subnet2,${BASEDN}
|
||||
changetype: delete
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Testing rename..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
# Renaming an organization...
|
||||
dn: o=An Org,${BASEDN}
|
||||
changetype: modrdn
|
||||
newrdn: o=Renamed Org
|
||||
deleteoldrdn: 1
|
||||
|
||||
# Moving a person to another subtree...
|
||||
dn: cn=Lev Tolstoij,${BASEDN}
|
||||
changetype: modrdn
|
||||
newrdn: cn=Lev Tolstoij
|
||||
deleteoldrdn: 0
|
||||
newsuperior: dc=subnet,${BASEDN}
|
||||
|
||||
# Renaming a book...
|
||||
dn: documentTitle=book2,${BASEDN}
|
||||
changetype: modrdn
|
||||
newrdn: documentTitle=Renamed Book
|
||||
deleteoldrdn: 1
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Adding a child to a referral (should fail)..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: cn=Should Fail,ou=Referral,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: inetOrgPerson
|
||||
cn: Should Fail
|
||||
sn: Fail
|
||||
telephoneNumber: +39 02 23456789
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC = 0 ; then
|
||||
echo "ldapmodify should have failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Modifying a referral (should fail)..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Referral,${BASEDN}
|
||||
changetype: modify
|
||||
replace: ref
|
||||
ref: ldap://localhost:9009/
|
||||
-
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC = 0 ; then
|
||||
echo "ldapmodify should have failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Renaming a referral (should fail)..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Referral,${BASEDN}
|
||||
changetype: modrdn
|
||||
newrdn: ou=Renamed Referral
|
||||
deleteoldrdn: 1
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC = 0 ; then
|
||||
echo "ldapmodify should have failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Deleting a referral (should fail)..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Referral,${BASEDN}
|
||||
changetype: delete
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC = 0 ; then
|
||||
echo "ldapmodify should have failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Adding a referral..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Another Referral,${BASEDN}
|
||||
changetype: add
|
||||
objectClass: referral
|
||||
objectClass: extensibleObject
|
||||
ou: Another Referral
|
||||
ref: ldap://localhost:9009/
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Modifying a referral with manageDSAit..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Referral,${BASEDN}
|
||||
changetype: modify
|
||||
replace: ref
|
||||
ref: ldap://localhost:9009/
|
||||
-
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve the modified entry..."
|
||||
echo "# Using ldapsearch to retrieve the modified entry..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "ou=Referral,$BASEDN" -M \
|
||||
"objectClass=*" '*' ref >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Renaming a referral with manageDSAit..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Referral,${BASEDN}
|
||||
changetype: modrdn
|
||||
newrdn: ou=Renamed Referral
|
||||
deleteoldrdn: 1
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve the renamed entry..."
|
||||
echo "# Using ldapsearch to retrieve the renamed entry..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "ou=Renamed Referral,$BASEDN" -M \
|
||||
"objectClass=*" '*' ref >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Deleting a referral with manageDSAit..."
|
||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||
-h $LOCALHOST -p $PORT1 -M >> $TESTOUT 2>&1 << EOMODS
|
||||
version: 1
|
||||
|
||||
dn: ou=Renamed Referral,${BASEDN}
|
||||
changetype: delete
|
||||
EOMODS
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
BINDDN="cn=Mitya Kovalev,${BASEDN}"
|
||||
BINDPW="mit"
|
||||
NEWPW="newsecret"
|
||||
echo "Testing passwd change..."
|
||||
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
||||
-D "${BINDDN}" -w ${BINDPW} -s ${NEWPW} \
|
||||
"$BINDDN" >> $TESTOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldappasswd failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo -n "Testing bind with new secret... "
|
||||
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $NEWPW
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapwhoami failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
BINDDN="cn=Some One,${BASEDN}"
|
||||
BINDPW="someone"
|
||||
echo -n "Testing bind with newly added user... "
|
||||
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $BINDPW
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapwhoami failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
echo "# Using ldapsearch to retrieve all the entries..." >> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
"objectClass=*" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Filtering ldapsearch results..."
|
||||
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
||||
echo "Filtering modified ldif..."
|
||||
. $LDIFFILTER < $SQLWRITE > $LDIFFLT
|
||||
echo "Comparing filter output..."
|
||||
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
||||
|
||||
if test $? != 0 ; then
|
||||
echo "comparison failed - SQL mods search didn't succeed"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting 25 seconds for master to send changes..."
|
||||
sleep 25
|
||||
|
||||
cat /dev/null > $SEARCHOUT
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries from the master..."
|
||||
echo "# Using ldapsearch to retrieve all the entries from the master..." \
|
||||
>> $SEARCHOUT
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||
-D "$MANAGERDN" -w $PASSWD \
|
||||
"(!(objectClass=referral))" >> $SEARCHOUT 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
cat /dev/null > $SEARCHOUT2
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries from the slave..."
|
||||
echo "# Using ldapsearch to retrieve all the entries from the slave..." \
|
||||
>> $SEARCHOUT2
|
||||
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT2 -b "$BASEDN" \
|
||||
-D "$UPDATEDN" -w $PASSWD \
|
||||
"(objectClass=*)" >> $SEARCHOUT2 2>&1
|
||||
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Filtering ldapsearch results from master..."
|
||||
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
||||
echo "Filtering ldapsearch results from slave..."
|
||||
. $LDIFFILTER < $SEARCHOUT2 > $SEARCHFLT2
|
||||
echo "Comparing filter output..."
|
||||
$CMP $SEARCHFLT $SEARCHFLT2 > $CMPOUT
|
||||
|
||||
if test $? != 0 ; then
|
||||
echo "Comparison failed"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "apparently ${RDBMS} does not support writes; skipping..."
|
||||
;;
|
||||
esac
|
||||
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
|
||||
echo ">>>>> Test succeeded"
|
||||
exit 0
|
||||
|
||||
Loading…
Reference in a new issue