12de962bdSlukem#! /bin/sh 2d11b170bStron# $OpenLDAP$ 32de962bdSlukem## This work is part of OpenLDAP Software <http://www.openldap.org/>. 42de962bdSlukem## 5*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation. 62de962bdSlukem## All rights reserved. 72de962bdSlukem## 82de962bdSlukem## Redistribution and use in source and binary forms, with or without 92de962bdSlukem## modification, are permitted only as authorized by the OpenLDAP 102de962bdSlukem## Public License. 112de962bdSlukem## 122de962bdSlukem## A copy of this license is available in the file LICENSE in the 132de962bdSlukem## top-level directory of the distribution or, alternatively, at 142de962bdSlukem## <http://www.OpenLDAP.org/license.html>. 152de962bdSlukem 162de962bdSlukemecho "running defines.sh" 172de962bdSlukem. $SRCDIR/scripts/defines.sh 182de962bdSlukem 192de962bdSlukemmkdir -p $TESTDIR $DBDIR1 202de962bdSlukem 212de962bdSlukemecho "Starting slapd on TCP/IP port $PORT1..." 22*e670fd5cSchristos. $CONFFILTER $BACKEND < $PWCONF > $CONF1 23*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 242de962bdSlukemPID=$! 252de962bdSlukemif test $WAIT != 0 ; then 262de962bdSlukem echo PID $PID 272de962bdSlukem read foo 282de962bdSlukemfi 292de962bdSlukemKILLPIDS="$PID" 302de962bdSlukem 312de962bdSlukemsleep 1 322de962bdSlukem 332de962bdSlukemecho "Using ldapsearch to check that slapd is running..." 342de962bdSlukemfor i in 0 1 2 3 4 5; do 35*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 362de962bdSlukem 'objectclass=*' > /dev/null 2>&1 372de962bdSlukem RC=$? 382de962bdSlukem if test $RC = 0 ; then 392de962bdSlukem break 402de962bdSlukem fi 412de962bdSlukem echo "Waiting 5 seconds for slapd to start..." 422de962bdSlukem sleep 5 432de962bdSlukemdone 442de962bdSlukem 452de962bdSlukemecho "Using ldapadd to populate the database..." 46*e670fd5cSchristos$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD < \ 472de962bdSlukem $LDIFPASSWD > $TESTOUT 2>&1 482de962bdSlukemRC=$? 492de962bdSlukemif test $RC != 0 ; then 502de962bdSlukem echo "ldapadd failed ($RC)!" 512de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 522de962bdSlukem exit $RC 532de962bdSlukemfi 542de962bdSlukem 552de962bdSlukemecho > $SEARCHOUT 562de962bdSlukemecho > $TESTOUT 572de962bdSlukem 582de962bdSlukemecho "Using ldapsearch to verify population ..." 592de962bdSlukemecho "++ Initial search" >> $SEARCHOUT 60*e670fd5cSchristos$LDAPSEARCH -H $URI1 \ 612de962bdSlukem -D "$MANAGERDN" -w $PASSWD \ 622de962bdSlukem -b "$BASEDN" \ 632de962bdSlukem 'objectclass=*' >> $SEARCHOUT 2>&1 642de962bdSlukem 652de962bdSlukemecho "Using ldappasswd to test a few error conditions ..." 662de962bdSlukemecho "Pass 0" >> $TESTOUT 67*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 682de962bdSlukem -w secret -a "" -s newsecret \ 692de962bdSlukem -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 702de962bdSlukemRC=$? 712de962bdSlukemif test $RC = 0 ; then 722de962bdSlukem echo "ldappasswd unexpectantly passed ($RC)! old empty" 732de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 742de962bdSlukem exit 1 752de962bdSlukemfi 76*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 772de962bdSlukem -w secret -a oldsecret -s "" \ 782de962bdSlukem -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 792de962bdSlukemRC=$? 802de962bdSlukemif test $RC = 0 ; then 812de962bdSlukem echo "ldappasswd unexpectantly passed ($RC)! new empty" 822de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 832de962bdSlukem exit 1 842de962bdSlukemfi 85*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 862de962bdSlukem -w secret -a oldsecret -s newsecret \ 872de962bdSlukem -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 882de962bdSlukemRC=$? 892de962bdSlukemif test $RC = 0 ; then 902de962bdSlukem echo "ldappasswd unexpectantly passed ($RC)! wrong old" 912de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 922de962bdSlukem exit 1 932de962bdSlukemfi 942de962bdSlukem 952de962bdSlukemecho "Using ldappasswd (PASS 1) ..." 962de962bdSlukemecho "Pass 1" >> $TESTOUT 97*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 982de962bdSlukem -w secret -s newsecret \ 992de962bdSlukem -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 1002de962bdSlukemRC=$? 1012de962bdSlukemif test $RC != 0 ; then 1022de962bdSlukem echo "ldappasswd failed ($RC)!" 1032de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1042de962bdSlukem exit $RC 1052de962bdSlukemfi 106*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1072de962bdSlukem -w $PASSWD -s newsecret \ 1082de962bdSlukem -D "$MANAGERDN" "cn=smd5, $BASEDN" >> $TESTOUT 2>&1 1092de962bdSlukemRC=$? 1102de962bdSlukemif test $RC != 0 ; then 1112de962bdSlukem echo "ldappasswd failed ($RC)!" 1122de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1132de962bdSlukem exit $RC 1142de962bdSlukemfi 115*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1162de962bdSlukem -w secret -s newsecret \ 1172de962bdSlukem -D "cn=sha, $BASEDN" >> $TESTOUT 2>&1 1182de962bdSlukemRC=$? 1192de962bdSlukemif test $RC != 0 ; then 1202de962bdSlukem echo "ldappasswd failed ($RC)!" 1212de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1222de962bdSlukem exit $RC 1232de962bdSlukemfi 124*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1252de962bdSlukem -w secret -s newsecret \ 1262de962bdSlukem -D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1 1272de962bdSlukemRC=$? 1282de962bdSlukemif test $RC != 0 ; then 1292de962bdSlukem echo "ldappasswd failed ($RC)!" 1302de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1312de962bdSlukem exit $RC 1322de962bdSlukemfi 1332de962bdSlukem 1342de962bdSlukemecho "" >> $TESTOUT 1352de962bdSlukemecho "Pass 2" >> $TESTOUT 1362de962bdSlukemecho "Using ldappasswd (PASS 2) ..." 137*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1382de962bdSlukem -w newsecret \ 1392de962bdSlukem -D "cn=md5, $BASEDN" >> $TESTOUT 2>&1 1402de962bdSlukemRC=$? 1412de962bdSlukemif test $RC != 0 ; then 1422de962bdSlukem echo "ldappasswd failed ($RC)!" 1432de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1442de962bdSlukem exit $RC 1452de962bdSlukemfi 146*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1472de962bdSlukem -w newsecret \ 1482de962bdSlukem -D "cn=smd5, $BASEDN" >> $TESTOUT 2>&1 1492de962bdSlukemRC=$? 1502de962bdSlukemif test $RC != 0 ; then 1512de962bdSlukem echo "ldappasswd failed ($RC)!" 1522de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1532de962bdSlukem exit $RC 1542de962bdSlukemfi 155*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1562de962bdSlukem -w newsecret \ 1572de962bdSlukem -D "cn=sha, $BASEDN" >> $TESTOUT 2>&1 1582de962bdSlukemRC=$? 1592de962bdSlukemif test $RC != 0 ; then 1602de962bdSlukem echo "ldappasswd failed ($RC)!" 1612de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1622de962bdSlukem exit $RC 1632de962bdSlukemfi 164*e670fd5cSchristos$LDAPPASSWD -H $URI1 \ 1652de962bdSlukem -w newsecret \ 1662de962bdSlukem -D "cn=ssha, $BASEDN" >> $TESTOUT 2>&1 1672de962bdSlukemRC=$? 1682de962bdSlukemif test $RC != 0 ; then 1692de962bdSlukem echo "ldappasswd failed ($RC)!" 1702de962bdSlukem test $KILLSERVERS != no && kill -HUP $KILLPIDS 1712de962bdSlukem exit $RC 1722de962bdSlukemfi 1732de962bdSlukem 1742de962bdSlukemecho "Logging end state with ldapsearch..." 1752de962bdSlukemecho "" >> $TESTOUT 1762de962bdSlukemecho "++ End search" >> $TESTOUT 177*e670fd5cSchristos$LDAPSEARCH -H $URI1 \ 1782de962bdSlukem -D "$MANAGERDN" -w $PASSWD \ 1792de962bdSlukem -b "$BASEDN" \ 1802de962bdSlukem 'objectclass=*' >> $TESTOUT 2>&1 1812de962bdSlukem 1822de962bdSlukem 1832de962bdSlukemtest $KILLSERVERS != no && kill -HUP $KILLPIDS 1842de962bdSlukem 1852de962bdSlukemecho ">>>>> Test succeeded" 1862de962bdSlukem 1872de962bdSlukemtest $KILLSERVERS != no && wait 1882de962bdSlukem 1892de962bdSlukemexit 0 190