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 -z 1 "(|(name=Elliot)(description=*hiker*))" \ 28*e670fd5cSchristos >> $SEARCHOUT 2>&1 29*e670fd5cSchristosRC=$? 30*e670fd5cSchristoscase $RC in 31*e670fd5cSchristos0) 32*e670fd5cSchristos echo "ldapsearch should have failed ($RC)!" 33*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 34*e670fd5cSchristos exit 1 35*e670fd5cSchristos ;; 36*e670fd5cSchristos4) 37*e670fd5cSchristos echo "sizelimit reached ($RC)" 38*e670fd5cSchristos ;; 39*e670fd5cSchristos*) 40*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 41*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 42*e670fd5cSchristos exit $RC 43*e670fd5cSchristos ;; 44*e670fd5cSchristosesac 45*e670fd5cSchristos 46*e670fd5cSchristosecho "Testing searches listing variants where limits just fit..." 47*e670fd5cSchristosecho "# Testing searches listing variants where limits just fit..." >> $SEARCHOUT 48*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -s one -H $URI1 \ 49*e670fd5cSchristos -z 3 >> $SEARCHOUT 2>&1 50*e670fd5cSchristosRC=$? 51*e670fd5cSchristosif test $RC != 0 ; then 52*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 53*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 54*e670fd5cSchristos exit $RC 55*e670fd5cSchristosfi 56*e670fd5cSchristos 57*e670fd5cSchristosecho "Testing searches filtering on variants going over the specified limit..." 58*e670fd5cSchristosecho "# Testing searches filtering on variants going over the specified limit..." >> $SEARCHOUT 59*e670fd5cSchristos$LDAPSEARCH -b "$BASEDN" -H $URI1 \ 60*e670fd5cSchristos -z 1 "(name=Alumni Association)" \ 61*e670fd5cSchristos >> $SEARCHOUT 2>&1 62*e670fd5cSchristosRC=$? 63*e670fd5cSchristoscase $RC in 64*e670fd5cSchristos0) 65*e670fd5cSchristos echo "ldapsearch should have failed ($RC)!" 66*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 67*e670fd5cSchristos exit 1 68*e670fd5cSchristos ;; 69*e670fd5cSchristos4) 70*e670fd5cSchristos echo "sizelimit reached ($RC)" 71*e670fd5cSchristos ;; 72*e670fd5cSchristos*) 73*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 74*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 75*e670fd5cSchristos exit $RC 76*e670fd5cSchristos ;; 77*e670fd5cSchristosesac 78*e670fd5cSchristos 79*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 80*e670fd5cSchristos 81*e670fd5cSchristosLDIF=data/test010-out.ldif 82*e670fd5cSchristos 83*e670fd5cSchristosecho "Filtering ldapsearch results..." 84*e670fd5cSchristos$LDIFFILTER -s e < $SEARCHOUT > $SEARCHFLT 85*e670fd5cSchristosecho "Filtering expected entries..." 86*e670fd5cSchristos$LDIFFILTER -s e < $LDIF > $LDIFFLT 87*e670fd5cSchristosecho "Comparing filter output..." 88*e670fd5cSchristos$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 89*e670fd5cSchristos 90*e670fd5cSchristosif test $? != 0 ; then 91*e670fd5cSchristos echo "Comparison failed" 92*e670fd5cSchristos exit 1 93*e670fd5cSchristosfi 94*e670fd5cSchristos 95*e670fd5cSchristosecho ">>>>> Test succeeded" 96*e670fd5cSchristos 97*e670fd5cSchristostest $KILLSERVERS != no && wait 98*e670fd5cSchristos 99*e670fd5cSchristosexit 0 100