1 #! /bin/sh 2 ## $OpenLDAP$ 3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4 ## 5 ## Copyright 2016-2024 The OpenLDAP Foundation. 6 ## All rights reserved. 7 ## 8 ## Redistribution and use in source and binary forms, with or without 9 ## modification, are permitted only as authorized by the OpenLDAP 10 ## Public License. 11 ## 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>. 15 ## 16 ## ACKNOWLEDGEMENTS: 17 ## This module was written in 2016 by Ondej Kuznk for Symas Corp. 18 19 echo "running defines.sh" 20 . $SRCDIR/scripts/defines.sh 21 22 . ${SCRIPTDIR}/common.sh 23 24 echo "Testing searches against regular entries..." 25 echo "# Testing searches against regular entries..." >> $SEARCHOUT 26 $LDAPSEARCH -b "$BASEDN" -H $URI1 \ 27 -z 1 "(|(name=Elliot)(description=*hiker*))" \ 28 >> $SEARCHOUT 2>&1 29 RC=$? 30 case $RC in 31 0) 32 echo "ldapsearch should have failed ($RC)!" 33 test $KILLSERVERS != no && kill -HUP $KILLPIDS 34 exit 1 35 ;; 36 4) 37 echo "sizelimit reached ($RC)" 38 ;; 39 *) 40 echo "ldapsearch failed ($RC)!" 41 test $KILLSERVERS != no && kill -HUP $KILLPIDS 42 exit $RC 43 ;; 44 esac 45 46 echo "Testing searches listing variants where limits just fit..." 47 echo "# Testing searches listing variants where limits just fit..." >> $SEARCHOUT 48 $LDAPSEARCH -b "$BASEDN" -s one -H $URI1 \ 49 -z 3 >> $SEARCHOUT 2>&1 50 RC=$? 51 if test $RC != 0 ; then 52 echo "ldapsearch failed ($RC)!" 53 test $KILLSERVERS != no && kill -HUP $KILLPIDS 54 exit $RC 55 fi 56 57 echo "Testing searches filtering on variants going over the specified limit..." 58 echo "# Testing searches filtering on variants going over the specified limit..." >> $SEARCHOUT 59 $LDAPSEARCH -b "$BASEDN" -H $URI1 \ 60 -z 1 "(name=Alumni Association)" \ 61 >> $SEARCHOUT 2>&1 62 RC=$? 63 case $RC in 64 0) 65 echo "ldapsearch should have failed ($RC)!" 66 test $KILLSERVERS != no && kill -HUP $KILLPIDS 67 exit 1 68 ;; 69 4) 70 echo "sizelimit reached ($RC)" 71 ;; 72 *) 73 echo "ldapsearch failed ($RC)!" 74 test $KILLSERVERS != no && kill -HUP $KILLPIDS 75 exit $RC 76 ;; 77 esac 78 79 test $KILLSERVERS != no && kill -HUP $KILLPIDS 80 81 LDIF=data/test010-out.ldif 82 83 echo "Filtering ldapsearch results..." 84 $LDIFFILTER -s e < $SEARCHOUT > $SEARCHFLT 85 echo "Filtering expected entries..." 86 $LDIFFILTER -s e < $LDIF > $LDIFFLT 87 echo "Comparing filter output..." 88 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT 89 90 if test $? != 0 ; then 91 echo "Comparison failed" 92 exit 1 93 fi 94 95 echo ">>>>> Test succeeded" 96 97 test $KILLSERVERS != no && wait 98 99 exit 0 100