1999-12-13 02:45:06 +08:00
|
|
|
#! /bin/sh
|
|
|
|
# $OpenLDAP$
|
2003-11-29 04:00:23 +08:00
|
|
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
##
|
2005-01-02 04:49:32 +08:00
|
|
|
## Copyright 1998-2005 The OpenLDAP Foundation.
|
2003-11-29 04:00:23 +08:00
|
|
|
## 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>.
|
1999-12-13 02:45:06 +08:00
|
|
|
|
2000-10-02 06:46:52 +08:00
|
|
|
echo "running defines.sh"
|
1999-12-13 02:45:06 +08:00
|
|
|
. $SRCDIR/scripts/defines.sh
|
|
|
|
|
2003-10-22 13:14:08 +08:00
|
|
|
mkdir -p $TESTDIR $DBDIR1
|
1999-12-13 02:45:06 +08:00
|
|
|
|
2003-10-22 13:14:08 +08:00
|
|
|
echo "Starting slapd on TCP/IP port $PORT1..."
|
|
|
|
. $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $CONF1
|
|
|
|
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
1999-12-13 02:45:06 +08:00
|
|
|
PID=$!
|
2001-09-22 13:34:22 +08:00
|
|
|
if test $WAIT != 0 ; then
|
|
|
|
echo PID $PID
|
|
|
|
read foo
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
KILLPIDS="$PID"
|
1999-12-13 02:45:06 +08:00
|
|
|
|
|
|
|
echo "Using ldapsearch to check that slapd is running..."
|
|
|
|
for i in 0 1 2 3 4 5; do
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
'objectclass=*' > /dev/null 2>&1
|
|
|
|
RC=$?
|
2002-09-01 19:39:08 +08:00
|
|
|
if test $RC = 0 ; then
|
|
|
|
break
|
1999-12-13 02:45:06 +08:00
|
|
|
fi
|
2002-09-01 19:39:08 +08:00
|
|
|
echo "Waiting 5 seconds for slapd to start..."
|
|
|
|
sleep 5
|
1999-12-13 02:45:06 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
echo "Using ldapadd to populate the database..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
|
1999-12-13 02:45:06 +08:00
|
|
|
$LDIFPASSWD > $TESTOUT 2>&1
|
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldapadd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo > $SEARCHOUT
|
|
|
|
echo > $TESTOUT
|
|
|
|
|
|
|
|
echo "Using ldapsearch to verify population ..."
|
|
|
|
echo "++ Initial search" >> $SEARCHOUT
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-D "$MANAGERDN" -w $PASSWD \
|
|
|
|
-b "$BASEDN" \
|
|
|
|
'objectclass=*' >> $SEARCHOUT 2>&1
|
|
|
|
|
|
|
|
echo "Using ldappasswd (PASS 1) ..."
|
|
|
|
echo "Pass 1" >> $TESTOUT
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w secret -s newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
|
1999-12-13 02:45:06 +08:00
|
|
|
RC=$?
|
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
2000-10-11 10:14:57 +08:00
|
|
|
-w $PASSWD -s newsecret \
|
2002-05-17 17:11:30 +08:00
|
|
|
-D "$MANAGERDN" "cn=smd5, $BASEDN" >> $TESTOUT 2>&1
|
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w secret -s newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=sha, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w secret -s newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "" >> $TESTOUT
|
|
|
|
echo "Pass 2" >> $TESTOUT
|
|
|
|
echo "Using ldappasswd (PASS 2) ..."
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=smd5, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=sha, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
2003-10-22 13:14:08 +08:00
|
|
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
1999-12-13 02:45:06 +08:00
|
|
|
-w newsecret \
|
2000-09-07 02:55:31 +08:00
|
|
|
-D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1
|
2002-05-17 17:11:30 +08:00
|
|
|
RC=$?
|
1999-12-13 02:45:06 +08:00
|
|
|
if test $RC != 0 ; then
|
2000-07-05 06:11:12 +08:00
|
|
|
echo "ldappasswd failed ($RC)!"
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
exit $RC
|
|
|
|
fi
|
|
|
|
|
2005-02-28 00:46:45 +08:00
|
|
|
echo "Logging end state with ldapsearch..."
|
|
|
|
echo "" >> $TESTOUT
|
|
|
|
echo "++ Initial search" >> $TESTOUT
|
|
|
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 \
|
|
|
|
-D "$MANAGERDN" -w $PASSWD \
|
|
|
|
-b "$BASEDN" \
|
|
|
|
'objectclass=*' >> $TESTOUT 2>&1
|
|
|
|
|
|
|
|
|
2003-10-22 13:14:08 +08:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-12-13 02:45:06 +08:00
|
|
|
|
|
|
|
echo ">>>>> Test succeeded"
|
|
|
|
exit 0
|