[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: bug searching for 'attr==+=' (ITS#267)



Hi Kurt,

I just downloaded and built OPENLDAP_STABLE from cvs, just to make
sure I'm testing a recent version. I got the same bug.  I'll include
my conf file below.

Hmmm... you say you can't reproduce it.  What version are you testing?
Here are some possible differences between our test environments:

(1) I am testing OPENLDAP_STABLE from cvs.

(2) I use 'schemacheck off'

(3) I use the unindexed field 'badsearch'.

My recipe for viewing the bug is as follows (commands are executed in
/bin/bash)

(1) download OPENLDAP_STABLE and install to /home/noel/ldap
    
    cvs get -r OPENLDAP_STABLE ldap
    ./configure --prefix=/home/noel/ldap
    make depend && make && make install

(2) use my slapd.conf (attached below)

    cp slapd.conf /home/noel/ldap/etc/openldap/slapd.conf

(3) source ldap-vars (attached below)
    
    . ldap-vars

(3) create a fresh database with init-db:

    sh -x ./init-db

(4) run bug-search openldap-=+= (attached below)

    sh -x bug-openldap-search=+=


Let me know how it goes for you.

--Noel


> Date: Sat, 21 Aug 1999 23:15:29 -0700
> From: "Kurt D. Zeilenga" <Kurt@OpenLDAP.Org>
> 
> I have not been able to duplicate this issue.
> 
> I added the following entry to slapd running with
> tests/data/slapd-master.conf and test.ldif loaded:
> 
> dn: cn=bug, o=University of Michigan, c=US
> cn: bug
> sn: =+=
> description: test =+= for *=+= =+=* and *=+=*
> objectclass: person
> objectclass: top
> 
> I used 'sn' instead of 'badsearch' so as not to violate schema rules.
> 
> I then issued:
> 
> ldapsearch -L -p 9009 -b "o=University of Michigan, c=US" 'sn==+='
> ldapsearch -L -p 9009 -b "o=University of Michigan, c=US" 'sn=*=+='
> ldapsearch -L -p 9009 -b "o=University of Michigan, c=US" 'sn==+=*'
> ldapsearch -L -p 9009 -b "o=University of Michigan, c=US" 'sn=*=+=*'
> ldapsearch -L -p 9009 -b "o=University of Michigan, c=US" 'description=*=+=*'
> 
> and all returned:
> 
> dn: cn=bug, o=University of Michigan, c=US
> cn: bug
> sn: =+=
> description: test =+= for *=+= =+=* and *=+=*
> objectclass: person
> objectclass: top
> creatorsname: cn=Manager, o=University of Michigan, c=US
> createtimestamp: 19990822060045Z
> 
> as expected.  I then remove the 'sn' index slapd-master.conf,
> rebuild the database, and retested with same results.
> 
> Are you sure you properly protected the '*' from your command
> shell?
> 
> 	Kurt

----------------------------------------------------------------------
slapd.conf
----------------------------------------------------------------------
include         /home/noel/ldap/etc/openldap/slapd.at.conf
include         /home/noel/ldap/etc/openldap/slapd.oc.conf
schemacheck     off

pidfile         /home/noel/ldap/var/slapd.pid
argsfile        /home/noel/ldap/var/slapd.args

#######################################################################
# ldbm database definitions
#######################################################################

database        ldbm
suffix          "o=Your Organization Name, c=CA"
directory       /home/noel/ldap/db
rootdn          "cn=root, o=Your Organization Name, c=CA"
rootpw          secret

----------------------------------------------------------------------
ldap-vars
----------------------------------------------------------------------
#! /bin/sh

LDAP_BASE="o=Your Organization Name, c=CA"
LDAP_BIND="cn=root, o=Your Organization Name, c=CA"
LDAP_PASS="secret"
LDAP_PORT=8003
LDAP_HOST=magma

export LDAP_BASE LDAP_BIND LDAP_PASS LDAP_PORT LDAP_HOST

----------------------------------------------------------------------
init-db
----------------------------------------------------------------------
#! /bin/sh

DIR=/home/noel/ldap
CONF=$DIR/etc/openldap/slapd.conf
tmp=/tmp/init-$$.ldif

cat >$tmp <<EOF
dn: $LDAP_BASE
objectclass: top
objectclass: organization
creatorsname: $LDAP_BASE
EOF
$DIR/sbin/ldif2ldbm -f $CONF
$DIR/libexec/slapd -p $LDAP_PORT -f $DIR_CONF

----------------------------------------------------------------------
bug-openldap-search-=+=
----------------------------------------------------------------------
#! /bin/sh
# bug-openldap-search-=+=
# Noel Burton-Krahn <noel@burton-krahn.com>
# Aug 19, 1999
# 
# This script reproduces a bug in openldap.  It seems that sometimes
# vals which contain the sting '=+=' cannot be found with wildcards.
# 
# This has been tested with OPENLDAP_STABLE as of Aug 23, 1999.
#
#     noel@home$ uname -a
#     Linux magma.itsd.gov.bc.ca 2.0.36 #1 Tue Oct 13 22:17:11 EDT 1998 i686 unknown

echo "testing ldap server at $LDAP_HOST:$LDAP_PORT"
echo -n "date: "
date

ldapadd -v -p "$LDAP_PORT" -D "$LDAP_BIND" -w "$LDAP_PASS" <<EOF
dn: cn=noel-bug,$LDAP_BASE
cn: noel-bug
sn: bug
badsearch: =+=
description: A bug in openldap's wildcard search?
description: If you search for 'badsearch==+=', you should get this record.
description: However, if you search for 'badsearch=*=+=', 'badsearch=*=+=*',
description: or 'badsearch==+=*', you won't.  It seems that wildcards and 
desctiption: the string '=+=' don't mix.
description: Note: A search for 'description=*=+=*' works.  Why?
EOF

search='badsearch==+='
echo "search: $search should work"
ldapsearch -p "$LDAP_PORT" -b "$LDAP_BASE" $search
echo

search='description=*=+=*'
echo "search: $search should work"
ldapsearch -p "$LDAP_PORT" -b "$LDAP_BASE" $search
echo

for search in "*=+=" "*=+=*" "=+=*"; do
    search="badsearch=$search"
    echo "search: $search should work (BUG: it doesn't)"
    ldapsearch -p "$LDAP_PORT" -b "$LDAP_BASE" $search
    echo
done

ldapdelete -v -p "$LDAP_PORT" -D "$LDAP_BIND" -w "$LDAP_PASS" "cn=noel-bug,$LDAP_BASE"