2
# $OpenLDAP: pkg/ldap/tests/scripts/test010-passwd,v 1.26.2.3 2008/02/11 23:26:51 kurt Exp $
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
## Copyright 1998-2008 The OpenLDAP Foundation.
6
## All rights reserved.
8
## Redistribution and use in source and binary forms, with or without
9
## modification, are permitted only as authorized by the OpenLDAP
12
## A copy of this license is available in the file LICENSE in the
13
## top-level directory of the distribution or, alternatively, at
14
## <http://www.OpenLDAP.org/license.html>.
16
echo "running defines.sh"
17
. $SRCDIR/scripts/defines.sh
19
mkdir -p $TESTDIR $DBDIR1
21
echo "Starting slapd on TCP/IP port $PORT1..."
22
. $CONFFILTER $BACKEND $MONITORDB < $PWCONF > $CONF1
23
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
25
if test $WAIT != 0 ; then
33
echo "Using ldapsearch to check that slapd is running..."
34
for i in 0 1 2 3 4 5; do
35
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
36
'objectclass=*' > /dev/null 2>&1
38
if test $RC = 0 ; then
41
echo "Waiting 5 seconds for slapd to start..."
45
echo "Using ldapadd to populate the database..."
46
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
47
$LDIFPASSWD > $TESTOUT 2>&1
49
if test $RC != 0 ; then
50
echo "ldapadd failed ($RC)!"
51
test $KILLSERVERS != no && kill -HUP $KILLPIDS
58
echo "Using ldapsearch to verify population ..."
59
echo "++ Initial search" >> $SEARCHOUT
60
$LDAPSEARCH -h $LOCALHOST -p $PORT1 \
61
-D "$MANAGERDN" -w $PASSWD \
63
'objectclass=*' >> $SEARCHOUT 2>&1
65
echo "Using ldappasswd to test a few error conditions ..."
66
echo "Pass 0" >> $TESTOUT
67
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
68
-w secret -a "" -s newsecret \
69
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
71
if test $RC = 0 ; then
72
echo "ldappasswd unexpectantly passed ($RC)! old empty"
73
test $KILLSERVERS != no && kill -HUP $KILLPIDS
76
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
77
-w secret -a oldsecret -s "" \
78
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
80
if test $RC = 0 ; then
81
echo "ldappasswd unexpectantly passed ($RC)! new empty"
82
test $KILLSERVERS != no && kill -HUP $KILLPIDS
85
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
86
-w secret -a oldsecret -s newsecret \
87
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
89
if test $RC = 0 ; then
90
echo "ldappasswd unexpectantly passed ($RC)! wrong old"
91
test $KILLSERVERS != no && kill -HUP $KILLPIDS
95
echo "Using ldappasswd (PASS 1) ..."
96
echo "Pass 1" >> $TESTOUT
97
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
98
-w secret -s newsecret \
99
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
101
if test $RC != 0 ; then
102
echo "ldappasswd failed ($RC)!"
103
test $KILLSERVERS != no && kill -HUP $KILLPIDS
106
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
107
-w $PASSWD -s newsecret \
108
-D "$MANAGERDN" "cn=smd5, $BASEDN" >> $TESTOUT 2>&1
110
if test $RC != 0 ; then
111
echo "ldappasswd failed ($RC)!"
112
test $KILLSERVERS != no && kill -HUP $KILLPIDS
115
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
116
-w secret -s newsecret \
117
-D "cn=sha, $BASEDN" >> $TESTOUT 2>&1
119
if test $RC != 0 ; then
120
echo "ldappasswd failed ($RC)!"
121
test $KILLSERVERS != no && kill -HUP $KILLPIDS
124
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
125
-w secret -s newsecret \
126
-D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1
128
if test $RC != 0 ; then
129
echo "ldappasswd failed ($RC)!"
130
test $KILLSERVERS != no && kill -HUP $KILLPIDS
135
echo "Pass 2" >> $TESTOUT
136
echo "Using ldappasswd (PASS 2) ..."
137
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
139
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
141
if test $RC != 0 ; then
142
echo "ldappasswd failed ($RC)!"
143
test $KILLSERVERS != no && kill -HUP $KILLPIDS
146
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
148
-D "cn=smd5, $BASEDN" >> $TESTOUT 2>&1
150
if test $RC != 0 ; then
151
echo "ldappasswd failed ($RC)!"
152
test $KILLSERVERS != no && kill -HUP $KILLPIDS
155
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
157
-D "cn=sha, $BASEDN" >> $TESTOUT 2>&1
159
if test $RC != 0 ; then
160
echo "ldappasswd failed ($RC)!"
161
test $KILLSERVERS != no && kill -HUP $KILLPIDS
164
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
166
-D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1
168
if test $RC != 0 ; then
169
echo "ldappasswd failed ($RC)!"
170
test $KILLSERVERS != no && kill -HUP $KILLPIDS
174
echo "Logging end state with ldapsearch..."
176
echo "++ End search" >> $TESTOUT
177
$LDAPSEARCH -h $LOCALHOST -p $PORT1 \
178
-D "$MANAGERDN" -w $PASSWD \
180
'objectclass=*' >> $TESTOUT 2>&1
183
test $KILLSERVERS != no && kill -HUP $KILLPIDS
185
echo ">>>>> Test succeeded"
187
test $KILLSERVERS != no && wait