1*e670fd5cSchristos#! /bin/sh 2*e670fd5cSchristos## $OpenLDAP$ 3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4*e670fd5cSchristos## 5*e670fd5cSchristos## Copyright 2016-2021 The OpenLDAP Foundation. 6*e670fd5cSchristos## All rights reserved. 7*e670fd5cSchristos## 8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without 9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP 10*e670fd5cSchristos## Public License. 11*e670fd5cSchristos## 12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the 13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at 14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>. 15*e670fd5cSchristos## 16*e670fd5cSchristos## ACKNOWLEDGEMENTS: 17*e670fd5cSchristos## This module was written in 2016 by Ondřej Kuzník for Symas Corp. 18*e670fd5cSchristos 19*e670fd5cSchristosecho "running defines.sh" 20*e670fd5cSchristos. $SRCDIR/scripts/defines.sh 21*e670fd5cSchristos 22*e670fd5cSchristos. ${SCRIPTDIR}/common.sh 23*e670fd5cSchristos 24*e670fd5cSchristosecho "Testing searches against regular entries..." 25*e670fd5cSchristosecho "# Testing searches against regular entries..." >> $SEARCHOUT 26*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -H $URI1 \ 27*e670fd5cSchristos "(|(name=Elliot)(description=*hiker*))" \ 28*e670fd5cSchristos >> $SEARCHOUT 2>&1 29*e670fd5cSchristosRC=$? 30*e670fd5cSchristosif test $RC != 0 ; then 31*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 32*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 33*e670fd5cSchristos exit $RC 34*e670fd5cSchristosfi 35*e670fd5cSchristos 36*e670fd5cSchristosecho "Testing searches listing variants..." 37*e670fd5cSchristosecho >> $SEARCHOUT 38*e670fd5cSchristosecho "# Testing searches listing variants..." >> $SEARCHOUT 39*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -s one -H $URI1 \ 40*e670fd5cSchristos >> $SEARCHOUT 2>&1 41*e670fd5cSchristosRC=$? 42*e670fd5cSchristosif test $RC != 0 ; then 43*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 44*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 45*e670fd5cSchristos exit $RC 46*e670fd5cSchristosfi 47*e670fd5cSchristos 48*e670fd5cSchristosecho >> $SEARCHOUT 49*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -s base -H $URI1 \ 50*e670fd5cSchristos >> $SEARCHOUT 2>&1 51*e670fd5cSchristosRC=$? 52*e670fd5cSchristosif test $RC != 0 ; then 53*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 54*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 55*e670fd5cSchristos exit $RC 56*e670fd5cSchristosfi 57*e670fd5cSchristos 58*e670fd5cSchristosecho >> $SEARCHOUT 59*e670fd5cSchristos$LDAPSEARCH -s base -H $URI1 \ 60*e670fd5cSchristos -b "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" \ 61*e670fd5cSchristos '(ou=Information Technology Division)' \ 62*e670fd5cSchristos >> $SEARCHOUT 2>&1 63*e670fd5cSchristosRC=$? 64*e670fd5cSchristosif test $RC != 0 ; then 65*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 66*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 67*e670fd5cSchristos exit $RC 68*e670fd5cSchristosfi 69*e670fd5cSchristos 70*e670fd5cSchristosecho >> $SEARCHOUT 71*e670fd5cSchristos$LDAPSEARCH -b "cn=ITD Staff,ou=Groups,$BASEDN" -s base -H $URI1 \ 72*e670fd5cSchristos >> $SEARCHOUT 2>&1 73*e670fd5cSchristosRC=$? 74*e670fd5cSchristosif test $RC != 0 ; then 75*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 76*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 77*e670fd5cSchristos exit $RC 78*e670fd5cSchristosfi 79*e670fd5cSchristos 80*e670fd5cSchristosecho "Testing searches filtering on variants..." 81*e670fd5cSchristosecho >> $SEARCHOUT 82*e670fd5cSchristosecho "# Testing searches filtering on variants..." >> $SEARCHOUT 83*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -H $URI1 \ 84*e670fd5cSchristos "(st=Alumni Association)" st \ 85*e670fd5cSchristos >> $SEARCHOUT 2>&1 86*e670fd5cSchristosRC=$? 87*e670fd5cSchristosif test $RC != 0 ; then 88*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 89*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 90*e670fd5cSchristos exit $RC 91*e670fd5cSchristosfi 92*e670fd5cSchristos 93*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 94*e670fd5cSchristos 95*e670fd5cSchristosLDIF=data/test003-out.ldif 96*e670fd5cSchristos 97*e670fd5cSchristosecho "Filtering ldapsearch results..." 98*e670fd5cSchristos$LDIFFILTER -s e < $SEARCHOUT > $SEARCHFLT 99*e670fd5cSchristosecho "Filtering expected entries..." 100*e670fd5cSchristos$LDIFFILTER -s e < $LDIF > $LDIFFLT 101*e670fd5cSchristosecho "Comparing filter output..." 102*e670fd5cSchristos$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 103*e670fd5cSchristos 104*e670fd5cSchristosif test $? != 0 ; then 105*e670fd5cSchristos echo "Comparison failed" 106*e670fd5cSchristos exit 1 107*e670fd5cSchristosfi 108*e670fd5cSchristos 109*e670fd5cSchristosecho ">>>>> Test succeeded" 110*e670fd5cSchristos 111*e670fd5cSchristostest $KILLSERVERS != no && wait 112*e670fd5cSchristos 113*e670fd5cSchristosexit 0 114