Home | History | Annotate | Line # | Download | only in scripts
      1       1.1     lukem #! /bin/sh
      2   1.1.1.4      tron # $OpenLDAP$
      3       1.1     lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
      4       1.1     lukem ##
      5  1.1.1.10  christos ## Copyright 1998-2024 The OpenLDAP Foundation.
      6       1.1     lukem ## All rights reserved.
      7       1.1     lukem ##
      8       1.1     lukem ## Redistribution and use in source and binary forms, with or without
      9       1.1     lukem ## modification, are permitted only as authorized by the OpenLDAP
     10       1.1     lukem ## Public License.
     11       1.1     lukem ##
     12       1.1     lukem ## A copy of this license is available in the file LICENSE in the
     13       1.1     lukem ## top-level directory of the distribution or, alternatively, at
     14       1.1     lukem ## <http://www.OpenLDAP.org/license.html>.
     15       1.1     lukem 
     16       1.1     lukem echo "running defines.sh"
     17       1.1     lukem . $SRCDIR/scripts/defines.sh
     18       1.1     lukem 
     19       1.1     lukem if test $PPOLICY = ppolicyno; then 
     20       1.1     lukem 	echo "Password policy overlay not available, test skipped"
     21       1.1     lukem 	exit 0
     22       1.1     lukem fi 
     23       1.1     lukem 
     24       1.1     lukem mkdir -p $TESTDIR $DBDIR1
     25       1.1     lukem 
     26   1.1.1.2     lukem $SLAPPASSWD -g -n >$CONFIGPWF
     27   1.1.1.2     lukem echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
     28   1.1.1.2     lukem 
     29       1.1     lukem echo "Starting slapd on TCP/IP port $PORT1..."
     30   1.1.1.9  christos . $CONFFILTER $BACKEND < $PPOLICYCONF > $CONF1
     31   1.1.1.9  christos $SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 &
     32       1.1     lukem PID=$!
     33       1.1     lukem if test $WAIT != 0 ; then
     34       1.1     lukem     echo PID $PID
     35       1.1     lukem     read foo
     36       1.1     lukem fi
     37       1.1     lukem KILLPIDS="$PID"
     38       1.1     lukem 
     39       1.1     lukem USER="uid=nd, ou=People, dc=example, dc=com"
     40       1.1     lukem PASS=testpassword
     41   1.1.1.9  christos PWADMIN="uid=ndadmin, ou=People, dc=example, dc=com"
     42   1.1.1.9  christos ADMINPASSWD=testpw
     43       1.1     lukem 
     44       1.1     lukem sleep 1
     45       1.1     lukem 
     46       1.1     lukem echo "Using ldapsearch to check that slapd is running..."
     47       1.1     lukem for i in 0 1 2 3 4 5; do
     48   1.1.1.9  christos 	$LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \
     49       1.1     lukem 		'objectclass=*' > /dev/null 2>&1
     50       1.1     lukem 	RC=$?
     51       1.1     lukem 	if test $RC = 0 ; then
     52       1.1     lukem 		break
     53       1.1     lukem 	fi
     54       1.1     lukem 	echo "Waiting 5 seconds for slapd to start..."
     55       1.1     lukem 	sleep 5
     56       1.1     lukem done
     57       1.1     lukem if test $RC != 0 ; then
     58       1.1     lukem 	echo "ldapsearch failed ($RC)!"
     59       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
     60       1.1     lukem 	exit $RC
     61       1.1     lukem fi
     62       1.1     lukem 
     63       1.1     lukem echo /dev/null > $TESTOUT
     64       1.1     lukem 
     65   1.1.1.9  christos echo "Testing redundant ppolicy instance..."
     66   1.1.1.9  christos $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
     67   1.1.1.9  christos dn: olcOverlay=ppolicy,olcDatabase={1}$BACKEND,cn=config
     68   1.1.1.9  christos objectClass: olcOverlayConfig
     69   1.1.1.9  christos objectClass: olcPPolicyConfig
     70   1.1.1.9  christos olcOverlay: ppolicy
     71   1.1.1.9  christos olcPPolicyDefault: cn=duplicate policy,ou=policies,dc=example,dc=com
     72   1.1.1.9  christos EOF
     73   1.1.1.9  christos RC=$?
     74   1.1.1.9  christos if test $RC = 0 ; then
     75   1.1.1.9  christos 	echo "ldapadd should have failed ($RC)!"
     76   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
     77   1.1.1.9  christos 	exit 1
     78   1.1.1.9  christos fi
     79   1.1.1.9  christos 
     80       1.1     lukem echo "Using ldapadd to populate the database..."
     81  1.1.1.10  christos $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD \
     82   1.1.1.9  christos 	< $LDIFPPOLICY >> $TESTOUT 2>&1
     83       1.1     lukem RC=$?
     84       1.1     lukem if test $RC != 0 ; then
     85       1.1     lukem 	echo "ldapadd failed ($RC)!"
     86       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
     87       1.1     lukem 	exit $RC
     88       1.1     lukem fi
     89       1.1     lukem 
     90       1.1     lukem echo "Testing account lockout..."
     91   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w wrongpw >$SEARCHOUT 2>&1
     92       1.1     lukem sleep 2
     93   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w wrongpw >>$SEARCHOUT 2>&1
     94       1.1     lukem sleep 2
     95   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w wrongpw >>$SEARCHOUT 2>&1
     96       1.1     lukem sleep 2
     97   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w wrongpw >> $SEARCHOUT 2>&1
     98   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS >> $SEARCHOUT 2>&1
     99       1.1     lukem COUNT=`grep "Account locked" $SEARCHOUT | wc -l`
    100       1.1     lukem if test $COUNT != 2 ; then
    101       1.1     lukem 	echo "Account lockout test failed"
    102       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    103       1.1     lukem 	exit 1
    104       1.1     lukem fi
    105       1.1     lukem 
    106  1.1.1.10  christos DELAYATTR=`$LDAPSEARCH -D "$MANAGERDN" -H $URI1 -w $PASSWD -b "$USER" -E accountUsability 1.1`
    107  1.1.1.10  christos echo "$DELAYATTR" >> $SEARCHOUT
    108  1.1.1.10  christos DELAY=`echo "$DELAYATTR" | sed -n -e 's/.*seconds_before_unlock=\([[:digit:]]*\)/\1/p'`
    109       1.1     lukem 
    110   1.1.1.9  christos echo "Waiting $DELAY seconds for lockout to reset..."
    111   1.1.1.9  christos sleep $DELAY
    112   1.1.1.9  christos sleep 1
    113   1.1.1.9  christos 
    114   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    115       1.1     lukem 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    116       1.1     lukem RC=$?
    117       1.1     lukem if test $RC != 0 ; then
    118       1.1     lukem 	echo "ldapsearch failed ($RC)!"
    119       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    120       1.1     lukem 	exit $RC
    121       1.1     lukem fi
    122       1.1     lukem 
    123  1.1.1.10  christos DELAYATTR=`$LDAPSEARCH -D "$MANAGERDN" -H $URI1 -w $PASSWD -b "$USER" -E accountUsability 1.1`
    124  1.1.1.10  christos echo "$DELAYATTR" >> $SEARCHOUT
    125  1.1.1.10  christos DELAY=`echo "$DELAYATTR" | sed -n -e 's/.*expire=\([[:digit:]]*\)/\1/p'`
    126   1.1.1.9  christos 
    127       1.1     lukem echo "Testing password expiration"
    128   1.1.1.9  christos echo "Waiting $DELAY seconds for password to expire..."
    129   1.1.1.9  christos sleep $DELAY
    130   1.1.1.9  christos sleep 1
    131       1.1     lukem 
    132   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    133       1.1     lukem 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    134       1.1     lukem sleep 2
    135   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    136       1.1     lukem 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    137       1.1     lukem sleep 2
    138   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    139       1.1     lukem 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    140       1.1     lukem sleep 2
    141   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    142       1.1     lukem 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    143       1.1     lukem RC=$?
    144       1.1     lukem if test $RC = 0 ; then
    145       1.1     lukem 	echo "Password expiration failed ($RC)!"
    146       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    147       1.1     lukem 	exit 1
    148       1.1     lukem fi
    149       1.1     lukem 
    150       1.1     lukem COUNT=`grep "grace logins" $SEARCHOUT | wc -l`
    151       1.1     lukem if test $COUNT != 3 ; then
    152       1.1     lukem 	echo "Password expiration test failed"
    153       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    154       1.1     lukem 	exit 1
    155       1.1     lukem fi
    156       1.1     lukem 
    157       1.1     lukem echo "Resetting password to clear expired status"
    158   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    159       1.1     lukem 	-w secret -s $PASS \
    160       1.1     lukem 	-D "$MANAGERDN" "$USER" >> $TESTOUT 2>&1
    161       1.1     lukem RC=$?
    162       1.1     lukem if test $RC != 0 ; then
    163       1.1     lukem 	echo "ldappasswd failed ($RC)!"
    164       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    165       1.1     lukem 	exit $RC
    166       1.1     lukem fi
    167       1.1     lukem 
    168       1.1     lukem echo "Filling password history..."
    169   1.1.1.9  christos $LDAPMODIFY -v -D "$USER" -H $URI1 -w $PASS >> \
    170       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    171   1.1.1.9  christos dn: $USER
    172       1.1     lukem changetype: modify
    173       1.1     lukem delete: userpassword
    174   1.1.1.2     lukem userpassword: $PASS
    175       1.1     lukem -
    176       1.1     lukem replace: userpassword
    177       1.1     lukem userpassword: 20urgle12-1
    178       1.1     lukem 
    179   1.1.1.9  christos dn: $USER
    180       1.1     lukem changetype: modify
    181       1.1     lukem delete: userpassword
    182       1.1     lukem userpassword: 20urgle12-1
    183       1.1     lukem -
    184       1.1     lukem replace: userpassword
    185       1.1     lukem userpassword: 20urgle12-2
    186       1.1     lukem 
    187   1.1.1.9  christos dn: $USER
    188       1.1     lukem changetype: modify
    189       1.1     lukem delete: userpassword
    190       1.1     lukem userpassword: 20urgle12-2
    191       1.1     lukem -
    192       1.1     lukem replace: userpassword
    193       1.1     lukem userpassword: 20urgle12-3
    194       1.1     lukem 
    195   1.1.1.9  christos dn: $USER
    196       1.1     lukem changetype: modify
    197       1.1     lukem delete: userpassword
    198       1.1     lukem userpassword: 20urgle12-3
    199       1.1     lukem -
    200       1.1     lukem replace: userpassword
    201       1.1     lukem userpassword: 20urgle12-4
    202       1.1     lukem 
    203   1.1.1.9  christos dn: $USER
    204       1.1     lukem changetype: modify
    205       1.1     lukem delete: userpassword
    206       1.1     lukem userpassword: 20urgle12-4
    207       1.1     lukem -
    208       1.1     lukem replace: userpassword
    209       1.1     lukem userpassword: 20urgle12-5
    210       1.1     lukem 
    211   1.1.1.9  christos dn: $USER
    212       1.1     lukem changetype: modify
    213       1.1     lukem delete: userpassword
    214       1.1     lukem userpassword: 20urgle12-5
    215       1.1     lukem -
    216       1.1     lukem replace: userpassword
    217       1.1     lukem userpassword: 20urgle12-6
    218       1.1     lukem 
    219       1.1     lukem EOMODS
    220       1.1     lukem RC=$?
    221       1.1     lukem if test $RC != 0 ; then
    222       1.1     lukem 	echo "ldapmodify failed ($RC)!"
    223       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    224       1.1     lukem 	exit $RC
    225       1.1     lukem fi
    226       1.1     lukem echo "Testing password history..."
    227   1.1.1.9  christos $LDAPMODIFY -v -D "$USER" -H $URI1 -w 20urgle12-6 >> \
    228       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    229   1.1.1.9  christos dn: $USER
    230       1.1     lukem changetype: modify
    231       1.1     lukem delete: userPassword
    232       1.1     lukem userPassword: 20urgle12-6
    233       1.1     lukem -
    234       1.1     lukem replace: userPassword
    235       1.1     lukem userPassword: 20urgle12-2
    236       1.1     lukem 
    237       1.1     lukem EOMODS
    238       1.1     lukem RC=$?
    239       1.1     lukem if test $RC = 0 ; then
    240       1.1     lukem 	echo "ldapmodify failed ($RC)!"
    241       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    242       1.1     lukem 	exit 1
    243       1.1     lukem fi
    244       1.1     lukem 
    245   1.1.1.9  christos echo "Testing failed logins when password/policy missing..."
    246   1.1.1.9  christos 
    247   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 \
    248   1.1.1.9  christos 	-D "uid=test, ou=People,$BASEDN" -w hasnopolicy \
    249   1.1.1.9  christos 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    250   1.1.1.9  christos RC=$?
    251   1.1.1.9  christos if test $RC = 0 ; then
    252   1.1.1.9  christos 	echo "Password accepted ($RC)!"
    253   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    254   1.1.1.9  christos 	exit 1
    255   1.1.1.9  christos fi
    256   1.1.1.9  christos 
    257   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$BASEDN" -w hasnopw \
    258   1.1.1.9  christos 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    259   1.1.1.9  christos RC=$?
    260   1.1.1.9  christos if test $RC = 0 ; then
    261   1.1.1.9  christos 	echo "Password accepted ($RC)!"
    262   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    263   1.1.1.9  christos 	exit 1
    264   1.1.1.9  christos fi
    265   1.1.1.9  christos 
    266   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$MANAGERDN" -w $PASSWD -b "$BASEDN" \* \+ > $SEARCHOUT 2>&1
    267   1.1.1.9  christos COUNT=`grep "pwdFailureTime" $SEARCHOUT | wc -l`
    268   1.1.1.9  christos if test $COUNT != 0 ; then
    269   1.1.1.9  christos 	echo "Failed login stored on an account without policy and or password"
    270   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    271   1.1.1.9  christos 	exit 1
    272   1.1.1.9  christos fi
    273   1.1.1.9  christos 
    274       1.1     lukem echo "Testing forced reset..."
    275       1.1     lukem 
    276   1.1.1.9  christos $LDAPMODIFY -v -D "$PWADMIN" -H $URI1 -w $ADMINPASSWD >> \
    277       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    278   1.1.1.9  christos dn: $USER
    279       1.1     lukem changetype: modify
    280       1.1     lukem replace: userPassword
    281   1.1.1.2     lukem userPassword: $PASS
    282       1.1     lukem 
    283       1.1     lukem EOMODS
    284       1.1     lukem RC=$?
    285       1.1     lukem if test $RC != 0 ; then
    286       1.1     lukem 	echo "ldapmodify failed ($RC)!"
    287       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    288       1.1     lukem 	exit $RC
    289       1.1     lukem fi
    290       1.1     lukem 
    291   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    292       1.1     lukem 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    293       1.1     lukem RC=$?
    294       1.1     lukem if test $RC = 0 ; then
    295       1.1     lukem 	echo "Forced reset failed ($RC)!"
    296       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    297       1.1     lukem 	exit 1
    298       1.1     lukem fi
    299       1.1     lukem 
    300       1.1     lukem COUNT=`grep "Operations are restricted" $SEARCHOUT | wc -l`
    301       1.1     lukem if test $COUNT != 1 ; then
    302       1.1     lukem 	echo "Forced reset test failed"
    303       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    304       1.1     lukem 	exit 1
    305       1.1     lukem fi
    306       1.1     lukem 
    307       1.1     lukem echo "Clearing forced reset..."
    308       1.1     lukem 
    309   1.1.1.9  christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD >> \
    310       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    311   1.1.1.9  christos dn: $USER
    312       1.1     lukem changetype: modify
    313       1.1     lukem delete: pwdReset
    314       1.1     lukem 
    315       1.1     lukem EOMODS
    316       1.1     lukem RC=$?
    317       1.1     lukem if test $RC != 0 ; then
    318       1.1     lukem 	echo "ldapmodify failed ($RC)!"
    319       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    320       1.1     lukem 	exit $RC
    321       1.1     lukem fi
    322       1.1     lukem 
    323   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    324       1.1     lukem 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    325       1.1     lukem RC=$?
    326       1.1     lukem if test $RC != 0 ; then
    327       1.1     lukem 	echo "Clearing forced reset failed ($RC)!"
    328       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    329       1.1     lukem 	exit $RC
    330       1.1     lukem fi
    331       1.1     lukem 
    332       1.1     lukem echo "Testing Safe modify..."
    333       1.1     lukem 
    334   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    335       1.1     lukem 	-w $PASS -s failexpect \
    336       1.1     lukem 	-D "$USER" >> $TESTOUT 2>&1
    337       1.1     lukem RC=$?
    338       1.1     lukem if test $RC = 0 ; then
    339       1.1     lukem 	echo "Safe modify test 1 failed ($RC)!"
    340       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    341       1.1     lukem 	exit 1
    342       1.1     lukem fi
    343       1.1     lukem 
    344       1.1     lukem sleep 2
    345       1.1     lukem 
    346   1.1.1.2     lukem OLDPASS=$PASS
    347   1.1.1.2     lukem PASS=successexpect
    348   1.1.1.2     lukem 
    349   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    350   1.1.1.2     lukem 	-w $OLDPASS -s $PASS -a $OLDPASS \
    351       1.1     lukem 	-D "$USER" >> $TESTOUT 2>&1
    352       1.1     lukem RC=$?
    353       1.1     lukem if test $RC != 0 ; then
    354       1.1     lukem 	echo "Safe modify test 2 failed ($RC)!"
    355       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    356       1.1     lukem 	exit $RC
    357       1.1     lukem fi
    358       1.1     lukem 
    359       1.1     lukem echo "Testing length requirement..."
    360   1.1.1.2     lukem # check control in response (ITS#5711)
    361   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    362   1.1.1.2     lukem 	-w $PASS -a $PASS -s 2shr \
    363   1.1.1.2     lukem 	-D "$USER" -e ppolicy > ${TESTOUT}.2 2>&1
    364       1.1     lukem RC=$?
    365       1.1     lukem cat ${TESTOUT}.2 >> $TESTOUT
    366       1.1     lukem if test $RC = 0 ; then
    367       1.1     lukem 	echo "Length requirement test failed ($RC)!"
    368       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    369       1.1     lukem 	exit 1
    370       1.1     lukem fi
    371       1.1     lukem COUNT=`grep "Password fails quality" ${TESTOUT}.2 | wc -l`
    372       1.1     lukem if test $COUNT != 1 ; then
    373       1.1     lukem 	echo "Length requirement test failed"
    374       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    375       1.1     lukem 	exit 1
    376       1.1     lukem fi
    377   1.1.1.2     lukem COUNT=`grep "Password is too short for policy" ${TESTOUT}.2 | wc -l`
    378   1.1.1.2     lukem if test $COUNT != 1 ; then
    379   1.1.1.2     lukem 	echo "Control not returned in response"
    380   1.1.1.2     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    381   1.1.1.2     lukem 	exit 1
    382   1.1.1.2     lukem fi
    383       1.1     lukem 
    384   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    385   1.1.1.9  christos 	-w $PASS -a $PASS -s passwordthatistoolong \
    386   1.1.1.9  christos 	-D "$USER" -e ppolicy > ${TESTOUT}.2 2>&1
    387   1.1.1.9  christos RC=$?
    388   1.1.1.9  christos cat ${TESTOUT}.2 >> $TESTOUT
    389   1.1.1.9  christos COUNT=`grep "Password is too long for policy" ${TESTOUT}.2 | wc -l`
    390   1.1.1.9  christos if test $COUNT != 1 ; then
    391   1.1.1.9  christos 	echo "Control not returned in response"
    392   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    393   1.1.1.9  christos 	exit 1
    394   1.1.1.9  christos fi
    395   1.1.1.9  christos 
    396       1.1     lukem echo "Testing hashed length requirement..."
    397       1.1     lukem 
    398   1.1.1.9  christos $LDAPMODIFY -H $URI1 -D "$USER" -w $PASS > \
    399       1.1     lukem 	${TESTOUT}.2 2>&1 << EOMODS
    400       1.1     lukem dn: $USER
    401       1.1     lukem changetype: modify
    402       1.1     lukem delete: userPassword
    403   1.1.1.2     lukem userPassword: $PASS
    404       1.1     lukem -
    405       1.1     lukem add: userPassword
    406       1.1     lukem userPassword: {MD5}xxxxxx
    407       1.1     lukem 
    408       1.1     lukem EOMODS
    409       1.1     lukem RC=$?
    410       1.1     lukem cat ${TESTOUT}.2 >> $TESTOUT
    411       1.1     lukem if test $RC = 0 ; then
    412       1.1     lukem 	echo "Hashed length requirement test failed ($RC)!"
    413       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    414       1.1     lukem 	exit 1
    415       1.1     lukem fi
    416       1.1     lukem COUNT=`grep "Password fails quality" ${TESTOUT}.2 | wc -l`
    417       1.1     lukem if test $COUNT != 1 ; then
    418       1.1     lukem 	echo "Hashed length requirement test failed"
    419       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    420       1.1     lukem 	exit 1
    421       1.1     lukem fi
    422       1.1     lukem 
    423       1.1     lukem echo "Testing multiple password add/modify checks..."
    424       1.1     lukem 
    425   1.1.1.9  christos $LDAPMODIFY -H $URI1 -D "$MANAGERDN" -w $PASSWD >> \
    426       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    427       1.1     lukem dn: cn=Add Should Fail, ou=People, dc=example, dc=com
    428       1.1     lukem changetype: add
    429       1.1     lukem objectClass: inetOrgPerson
    430       1.1     lukem cn: Add Should Fail
    431       1.1     lukem sn: Fail
    432       1.1     lukem userPassword: firstpw
    433       1.1     lukem userPassword: secondpw
    434       1.1     lukem EOMODS
    435       1.1     lukem RC=$?
    436       1.1     lukem if test $RC = 0 ; then
    437       1.1     lukem 	echo "Multiple password add test failed ($RC)!"
    438       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    439       1.1     lukem 	exit 1
    440       1.1     lukem fi
    441       1.1     lukem 
    442   1.1.1.9  christos $LDAPMODIFY -H $URI1 -D "$MANAGERDN" -w $PASSWD >> \
    443       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    444       1.1     lukem dn: $USER
    445       1.1     lukem changetype: modify
    446       1.1     lukem add: userPassword
    447       1.1     lukem userPassword: firstpw
    448       1.1     lukem userPassword: secondpw
    449       1.1     lukem EOMODS
    450       1.1     lukem RC=$?
    451       1.1     lukem if test $RC = 0 ; then
    452       1.1     lukem 	echo "Multiple password modify add test failed ($RC)!"
    453       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    454       1.1     lukem 	exit 1
    455       1.1     lukem fi
    456       1.1     lukem 
    457   1.1.1.9  christos $LDAPMODIFY -H $URI1 -D "$MANAGERDN" -w $PASSWD >> \
    458       1.1     lukem 	$TESTOUT 2>&1 << EOMODS
    459       1.1     lukem dn: $USER
    460       1.1     lukem changetype: modify
    461       1.1     lukem replace: userPassword
    462       1.1     lukem userPassword: firstpw
    463       1.1     lukem userPassword: secondpw
    464       1.1     lukem EOMODS
    465       1.1     lukem RC=$?
    466       1.1     lukem if test $RC = 0 ; then
    467       1.1     lukem 	echo "Multiple password modify replace test failed ($RC)!"
    468       1.1     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    469       1.1     lukem 	exit 1
    470       1.1     lukem fi
    471       1.1     lukem 
    472   1.1.1.9  christos echo "Testing idle password expiration"
    473   1.1.1.9  christos echo "Reconfiguring policy to replace expiration with idle expiration..."
    474   1.1.1.9  christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD >> \
    475   1.1.1.9  christos 	$TESTOUT 2>&1 << EOMODS
    476   1.1.1.9  christos dn: cn=Standard Policy, ou=Policies, dc=example, dc=com
    477   1.1.1.9  christos changetype: modify
    478   1.1.1.9  christos delete: pwdMaxAge
    479   1.1.1.9  christos -
    480   1.1.1.9  christos add: pwdMaxIdle
    481   1.1.1.9  christos pwdMaxIdle: 15
    482   1.1.1.9  christos 
    483   1.1.1.9  christos EOMODS
    484   1.1.1.9  christos RC=$?
    485   1.1.1.9  christos if test $RC != 0 ; then
    486   1.1.1.9  christos 	echo "ldapmodify failed ($RC)!"
    487   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    488   1.1.1.9  christos 	exit $RC
    489   1.1.1.9  christos fi
    490   1.1.1.9  christos 
    491   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    492   1.1.1.9  christos 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    493   1.1.1.9  christos 
    494  1.1.1.10  christos DELAYATTR=`$LDAPSEARCH -D "$MANAGERDN" -H $URI1 -w $PASSWD -b "$USER" -E accountUsability 1.1`
    495  1.1.1.10  christos echo "$DELAYATTR" >> $SEARCHOUT
    496  1.1.1.10  christos DELAY=`echo "$DELAYATTR" | sed -n -e 's/.*expire=\([[:digit:]]*\)/\1/p'`
    497   1.1.1.9  christos 
    498   1.1.1.9  christos echo "Waiting $DELAY seconds for password to expire..."
    499   1.1.1.9  christos sleep $DELAY
    500   1.1.1.9  christos sleep 1
    501   1.1.1.9  christos 
    502   1.1.1.9  christos $LDAPSEARCH -e ppolicy -H $URI1 -D "$USER" -w $PASS \
    503   1.1.1.9  christos 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    504   1.1.1.9  christos RC=$?
    505   1.1.1.9  christos if test $RC != 49 ; then
    506   1.1.1.9  christos 	echo "Password idle expiration failed ($RC)!"
    507   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    508   1.1.1.9  christos 	exit 1
    509   1.1.1.9  christos fi
    510   1.1.1.9  christos 
    511   1.1.1.9  christos echo "Reverting policy changes..."
    512   1.1.1.9  christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD >> \
    513   1.1.1.9  christos 	$TESTOUT 2>&1 << EOMODS
    514   1.1.1.9  christos dn: cn=Standard Policy, ou=Policies, dc=example, dc=com
    515   1.1.1.9  christos changetype: modify
    516   1.1.1.9  christos delete: pwdMaxIdle
    517   1.1.1.9  christos -
    518   1.1.1.9  christos add: pwdMaxAge
    519   1.1.1.9  christos pwdMaxAge: 30
    520   1.1.1.9  christos 
    521   1.1.1.9  christos EOMODS
    522   1.1.1.9  christos RC=$?
    523   1.1.1.9  christos if test $RC != 0 ; then
    524   1.1.1.9  christos 	echo "ldapmodify failed ($RC)!"
    525   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    526   1.1.1.9  christos 	exit $RC
    527   1.1.1.9  christos fi
    528   1.1.1.9  christos 
    529   1.1.1.2     lukem if test "$BACKLDAP" != "ldapno" && test "$SYNCPROV" != "syncprovno"  ; then 
    530   1.1.1.2     lukem echo ""
    531   1.1.1.2     lukem echo "Setting up policy state forwarding test..."
    532   1.1.1.2     lukem 
    533   1.1.1.2     lukem mkdir $DBDIR2
    534   1.1.1.2     lukem sed -e "s,$DBDIR1,$DBDIR2," < $CONF1 > $CONF2
    535   1.1.1.2     lukem echo "Starting slapd consumer on TCP/IP port $PORT2..."
    536   1.1.1.9  christos $SLAPD -f $CONF2 -h $URI2 -d $LVL > $LOG2 2>&1 &
    537   1.1.1.2     lukem PID=$!
    538   1.1.1.2     lukem if test $WAIT != 0 ; then
    539   1.1.1.2     lukem     echo PID $PID
    540   1.1.1.2     lukem     read foo
    541   1.1.1.2     lukem fi
    542   1.1.1.2     lukem KILLPIDS="$KILLPIDS $PID"
    543   1.1.1.2     lukem 
    544   1.1.1.2     lukem echo "Configuring syncprov on provider..."
    545   1.1.1.2     lukem if [ "$SYNCPROV" = syncprovmod ]; then
    546   1.1.1.2     lukem 	$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
    547   1.1.1.2     lukem dn: cn=module,cn=config
    548   1.1.1.2     lukem objectclass: olcModuleList
    549   1.1.1.2     lukem cn: module
    550   1.1.1.2     lukem olcModulePath: $TESTWD/../servers/slapd/overlays
    551   1.1.1.2     lukem olcModuleLoad: syncprov.la
    552   1.1.1.2     lukem 
    553   1.1.1.2     lukem EOF
    554   1.1.1.2     lukem 	RC=$?
    555   1.1.1.2     lukem 	if test $RC != 0 ; then
    556   1.1.1.2     lukem 		echo "ldapadd failed for moduleLoad ($RC)!"
    557   1.1.1.2     lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    558   1.1.1.2     lukem 		exit $RC
    559   1.1.1.2     lukem 	fi
    560   1.1.1.2     lukem fi
    561   1.1.1.2     lukem 
    562   1.1.1.2     lukem $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
    563   1.1.1.2     lukem dn: olcOverlay={1}syncprov,olcDatabase={1}$BACKEND,cn=config
    564   1.1.1.2     lukem objectClass: olcOverlayConfig
    565   1.1.1.2     lukem objectClass: olcSyncProvConfig
    566   1.1.1.2     lukem olcOverlay: {1}syncprov
    567   1.1.1.2     lukem 
    568   1.1.1.2     lukem EOF
    569   1.1.1.2     lukem RC=$?
    570   1.1.1.2     lukem if test $RC != 0 ; then
    571   1.1.1.2     lukem     echo "ldapadd failed for provider database config ($RC)!"
    572   1.1.1.2     lukem     test $KILLSERVERS != no && kill -HUP $KILLPIDS
    573   1.1.1.2     lukem     exit $RC
    574   1.1.1.2     lukem fi
    575   1.1.1.2     lukem 
    576   1.1.1.2     lukem echo "Using ldapsearch to check that slapd is running..."
    577   1.1.1.2     lukem for i in 0 1 2 3 4 5; do
    578   1.1.1.2     lukem 	$LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \
    579   1.1.1.2     lukem 		'objectclass=*' > /dev/null 2>&1
    580   1.1.1.2     lukem 	RC=$?
    581   1.1.1.2     lukem 	if test $RC = 0 ; then
    582   1.1.1.2     lukem 		break
    583   1.1.1.2     lukem 	fi
    584   1.1.1.2     lukem 	echo "Waiting 5 seconds for slapd to start..."
    585   1.1.1.2     lukem 	sleep 5
    586   1.1.1.2     lukem done
    587   1.1.1.2     lukem if test $RC != 0 ; then
    588   1.1.1.2     lukem 	echo "ldapsearch failed ($RC)!"
    589   1.1.1.2     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    590   1.1.1.2     lukem 	exit $RC
    591   1.1.1.2     lukem fi
    592   1.1.1.2     lukem 
    593   1.1.1.2     lukem echo "Configuring syncrepl on consumer..."
    594   1.1.1.2     lukem if [ "$BACKLDAP" = ldapmod ]; then
    595   1.1.1.2     lukem 	$LDAPADD -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
    596   1.1.1.2     lukem dn: cn=module,cn=config
    597   1.1.1.2     lukem objectclass: olcModuleList
    598   1.1.1.2     lukem cn: module
    599   1.1.1.2     lukem olcModulePath: $TESTWD/../servers/slapd/back-ldap
    600   1.1.1.2     lukem olcModuleLoad: back_ldap.la
    601   1.1.1.2     lukem 
    602   1.1.1.2     lukem EOF
    603   1.1.1.2     lukem 	RC=$?
    604   1.1.1.2     lukem 	if test $RC != 0 ; then
    605   1.1.1.2     lukem 		echo "ldapadd failed for moduleLoad ($RC)!"
    606   1.1.1.2     lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    607   1.1.1.2     lukem 		exit $RC
    608   1.1.1.2     lukem 	fi
    609   1.1.1.2     lukem fi
    610   1.1.1.2     lukem $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
    611   1.1.1.2     lukem dn: olcOverlay={0}chain,olcDatabase={-1}frontend,cn=config
    612   1.1.1.2     lukem changetype: add
    613   1.1.1.2     lukem objectClass: olcOverlayConfig
    614   1.1.1.2     lukem objectClass: olcChainConfig
    615   1.1.1.2     lukem olcOverlay: {0}chain
    616   1.1.1.2     lukem 
    617   1.1.1.2     lukem dn: olcDatabase=ldap,olcOverlay={0}chain,olcDatabase={-1}frontend,cn=config
    618   1.1.1.2     lukem changetype: add
    619   1.1.1.2     lukem objectClass: olcLDAPConfig
    620   1.1.1.2     lukem objectClass: olcChainDatabase
    621   1.1.1.2     lukem olcDBURI: $URI1
    622   1.1.1.2     lukem olcDbIDAssertBind: bindmethod=simple
    623   1.1.1.2     lukem   binddn="cn=manager,dc=example,dc=com"
    624   1.1.1.2     lukem   credentials=secret
    625   1.1.1.2     lukem   mode=self
    626   1.1.1.2     lukem 
    627   1.1.1.2     lukem dn: olcDatabase={1}$BACKEND,cn=config
    628   1.1.1.2     lukem changetype: modify
    629   1.1.1.2     lukem add: olcSyncrepl
    630   1.1.1.2     lukem olcSyncrepl: rid=1
    631   1.1.1.2     lukem   provider=$URI1
    632   1.1.1.2     lukem   binddn="cn=manager,dc=example,dc=com"
    633   1.1.1.2     lukem   bindmethod=simple
    634   1.1.1.2     lukem   credentials=secret
    635   1.1.1.2     lukem   searchbase="dc=example,dc=com"
    636   1.1.1.2     lukem   type=refreshAndPersist
    637   1.1.1.2     lukem   retry="3 5 300 5"
    638   1.1.1.2     lukem -
    639   1.1.1.2     lukem add: olcUpdateref
    640   1.1.1.2     lukem olcUpdateref: $URI1
    641   1.1.1.2     lukem -
    642   1.1.1.2     lukem 
    643   1.1.1.2     lukem dn: olcOverlay={0}ppolicy,olcDatabase={1}$BACKEND,cn=config
    644   1.1.1.2     lukem changetype: modify
    645   1.1.1.2     lukem replace: olcPPolicyForwardUpdates
    646   1.1.1.2     lukem olcPPolicyForwardUpdates: TRUE
    647   1.1.1.2     lukem -
    648   1.1.1.2     lukem 
    649   1.1.1.2     lukem EOF
    650   1.1.1.2     lukem RC=$?
    651   1.1.1.2     lukem if test $RC != 0 ; then
    652   1.1.1.2     lukem 	echo "ldapmodify failed ($RC)!"
    653   1.1.1.2     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    654   1.1.1.2     lukem 	exit $RC
    655   1.1.1.2     lukem fi
    656   1.1.1.2     lukem 
    657   1.1.1.2     lukem echo "Waiting for consumer to sync..."
    658   1.1.1.2     lukem sleep $SLEEP1
    659   1.1.1.2     lukem 
    660   1.1.1.2     lukem echo "Testing policy state forwarding..."
    661   1.1.1.2     lukem $LDAPSEARCH -H $URI2 -D "$USER" -w wrongpw >$SEARCHOUT 2>&1
    662   1.1.1.4      tron RC=$?
    663   1.1.1.4      tron if test $RC != 49 ; then
    664   1.1.1.4      tron 	echo "ldapsearch should have failed with 49, got ($RC)!"
    665   1.1.1.4      tron 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    666   1.1.1.4      tron 	exit 1
    667   1.1.1.4      tron fi
    668   1.1.1.4      tron 
    669   1.1.1.2     lukem $LDAPSEARCH -H $URI1 -D "$MANAGERDN" -w $PASSWD -b "$USER" \* \+ >> $SEARCHOUT 2>&1
    670   1.1.1.2     lukem COUNT=`grep "pwdFailureTime" $SEARCHOUT | wc -l`
    671   1.1.1.2     lukem if test $COUNT != 1 ; then
    672   1.1.1.2     lukem 	echo "Policy state forwarding failed"
    673   1.1.1.2     lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    674   1.1.1.2     lukem 	exit 1
    675   1.1.1.2     lukem fi
    676   1.1.1.2     lukem 
    677   1.1.1.2     lukem # End of chaining test
    678   1.1.1.2     lukem 
    679   1.1.1.2     lukem fi
    680   1.1.1.2     lukem 
    681   1.1.1.9  christos echo ""
    682   1.1.1.9  christos echo "Testing obsolete Netscape ppolicy controls..."
    683   1.1.1.9  christos echo "Enabling Netscape controls..."
    684   1.1.1.9  christos $LDAPMODIFY -v -D cn=config -H $URI1 -y $CONFIGPWF >> \
    685   1.1.1.9  christos 	$TESTOUT 2>&1 << EOMODS
    686   1.1.1.9  christos dn: olcOverlay={0}ppolicy,olcDatabase={1}$BACKEND,cn=config
    687   1.1.1.9  christos changetype: modify
    688   1.1.1.9  christos replace: olcPPolicySendNetscapeControls
    689   1.1.1.9  christos olcPPolicySendNetscapeControls: TRUE
    690   1.1.1.9  christos -
    691   1.1.1.9  christos 
    692   1.1.1.9  christos EOMODS
    693   1.1.1.9  christos RC=$?
    694   1.1.1.9  christos if test $RC != 0 ; then
    695   1.1.1.9  christos 	echo "ldapmodify failed ($RC)!"
    696   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    697   1.1.1.9  christos 	exit $RC
    698   1.1.1.9  christos fi
    699   1.1.1.9  christos 
    700   1.1.1.9  christos echo "Reconfiguring policy to remove grace logins..."
    701   1.1.1.9  christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD >> \
    702   1.1.1.9  christos 	$TESTOUT 2>&1 << EOMODS
    703   1.1.1.9  christos dn: cn=Standard Policy, ou=Policies, dc=example, dc=com
    704   1.1.1.9  christos changetype: modify
    705   1.1.1.9  christos delete: pwdGraceAuthnLimit
    706   1.1.1.9  christos -
    707   1.1.1.9  christos replace: pwdMaxAge
    708   1.1.1.9  christos pwdMaxAge: 15
    709   1.1.1.9  christos -
    710   1.1.1.9  christos 
    711   1.1.1.9  christos EOMODS
    712   1.1.1.9  christos RC=$?
    713   1.1.1.9  christos if test $RC != 0 ; then
    714   1.1.1.9  christos 	echo "ldapmodify failed ($RC)!"
    715   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    716   1.1.1.9  christos 	exit $RC
    717   1.1.1.9  christos fi
    718   1.1.1.9  christos 
    719   1.1.1.9  christos OLDPASS=$PASS
    720   1.1.1.9  christos PASS=newpass
    721   1.1.1.9  christos $LDAPPASSWD -H $URI1 \
    722   1.1.1.9  christos 	-w secret -s $PASS \
    723   1.1.1.9  christos 	-D "$MANAGERDN" "$USER" >> $TESTOUT 2>&1
    724   1.1.1.9  christos RC=$?
    725   1.1.1.9  christos if test $RC != 0 ; then
    726   1.1.1.9  christos 	echo "Setting new password failed ($RC)!"
    727   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    728   1.1.1.9  christos 	exit $RC
    729   1.1.1.9  christos fi
    730   1.1.1.9  christos 
    731   1.1.1.9  christos echo "Clearing forced reset..."
    732   1.1.1.9  christos $LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD >> \
    733   1.1.1.9  christos 	$TESTOUT 2>&1 << EOMODS
    734   1.1.1.9  christos dn: $USER
    735   1.1.1.9  christos changetype: modify
    736   1.1.1.9  christos delete: pwdReset
    737   1.1.1.9  christos 
    738   1.1.1.9  christos EOMODS
    739   1.1.1.9  christos 
    740  1.1.1.10  christos DELAYATTR=`$LDAPSEARCH -D "$MANAGERDN" -H $URI1 -w $PASSWD -b "$USER" -E accountUsability 1.1`
    741  1.1.1.10  christos echo "$DELAYATTR" >> $TESTOUT
    742  1.1.1.10  christos DELAY=`echo "$DELAYATTR" | sed -n -e 's/.*expire=\([[:digit:]]*\)/\1/p'`
    743   1.1.1.9  christos DELAY=`expr $DELAY - 10`
    744   1.1.1.9  christos 
    745   1.1.1.9  christos echo "Testing password expiration"
    746   1.1.1.9  christos echo "Waiting $DELAY seconds for password to expire..."
    747   1.1.1.9  christos sleep $DELAY
    748   1.1.1.9  christos 
    749   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w $PASS \
    750   1.1.1.9  christos 	-b "$BASEDN" -s base > $SEARCHOUT 2>&1
    751   1.1.1.9  christos sleep 3
    752   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w $PASS \
    753   1.1.1.9  christos 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    754   1.1.1.9  christos sleep 3
    755   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w $PASS \
    756   1.1.1.9  christos 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    757   1.1.1.9  christos sleep 3
    758   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w $PASS \
    759   1.1.1.9  christos 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    760   1.1.1.9  christos sleep 3
    761   1.1.1.9  christos $LDAPSEARCH -H $URI1 -D "$USER" -w $PASS \
    762   1.1.1.9  christos 	-b "$BASEDN" -s base >> $SEARCHOUT 2>&1
    763   1.1.1.9  christos RC=$?
    764   1.1.1.9  christos if test $RC = 0 ; then
    765   1.1.1.9  christos 	echo "Password expiration failed ($RC)!"
    766   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    767   1.1.1.9  christos 	exit 1
    768   1.1.1.9  christos fi
    769   1.1.1.9  christos COUNT=`grep "PasswordExpiring" $SEARCHOUT | wc -l`
    770   1.1.1.9  christos if test $COUNT = 0 ; then
    771   1.1.1.9  christos 	echo "Password expiring warning test failed!"
    772   1.1.1.9  christos 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    773   1.1.1.9  christos 	exit 1
    774   1.1.1.9  christos fi
    775   1.1.1.9  christos 
    776       1.1     lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
    777       1.1     lukem 
    778       1.1     lukem echo ">>>>> Test succeeded"
    779       1.1     lukem 
    780       1.1     lukem test $KILLSERVERS != no && wait
    781       1.1     lukem 
    782       1.1     lukem exit 0
    783