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

Too many candidates on ldapsearch



Hi,

Here is something weird with some searches in our openldap 2.1.22 installation.

Slapd seems to be having trouble with a few filters. This happens when I build a filter with parts of names containing hyphens and spaces. Here is an example that should help me explain the problem...

I have an entry like this :

givenName : Marc-Andre
sn : Gaudreau
objectClass : udesPerson (as well as others)

When I perform a search with this filter :

(&(givenName=marc)(sn=gaudreau)(objectClass=udesPerson))

slapd takes as candidates all the entries in the directory and, after some time, returns the correct answer (no match). However, if I take one of these :

(&(givenName=mar)(sn=gaudreau)(objectClass=udesPerson))
(&(givenName=marc-)(sn=gaudreau)(objectClass=udesPerson))

slapd returns immediatly with the correct answer. It also returns immediatly when I omit the objectClass like this :

(&(givenName=marc)(sn=gaudreau))

The problem seems to happen pretty much whenever I cut the name just before a hyphen or a space character (There might be others as well). Correct indexes are defined for all the the attributes in this example. Here is a trace that might help solve the problem (sorry, it's a bit long):

...
Jan 26 10:08:38 magaudreau slapd[20521]: do_search
Jan 26 10:08:38 magaudreau slapd[20521]: >>> dnPrettyNormal: <dc=example,dc=com>
Jan 26 10:08:38 magaudreau slapd[20521]: <<< dnPrettyNormal: <dc=example,dc=com>, <dc=example,dc=com>
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_back_search
Jan 26 10:08:38 magaudreau slapd[20521]: dn2entry_r: dn: "dc=example,dc=com"
Jan 26 10:08:38 magaudreau slapd[20521]: => dn2id( "dc=example,dc=com" )
Jan 26 10:08:38 magaudreau slapd[20521]: ====> cache_find_entry_dn2id("dc=example,dc=com"): 6316 (1 tries)
Jan 26 10:08:38 magaudreau slapd[20521]: <= dn2id 6316 (in cache)
Jan 26 10:08:38 magaudreau slapd[20521]: => id2entry_r( 6316 )
Jan 26 10:08:38 magaudreau slapd[20521]: ====> cache_find_entry_id( 6316 ) "dc=example,dc=com" (found) (1 tries)
Jan 26 10:08:38 magaudreau slapd[20521]: <= id2entry_r( 6316 ) 0x849d508 (cache)
Jan 26 10:08:38 magaudreau slapd[20521]: search_candidates: base="dc=example,dc=com" s=2 d=0
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => list_candidates 0xa0
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => dn2idl( "@dc=example,dc=com" )
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => list_candidates 0xa1
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => equality_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_cache_open( "objectClass.dbb", 73, 600 )
Jan 26 10:08:38 magaudreau slapd[20521]: <= ldbm_cache_open (cache 3)
Jan 26 10:08:38 magaudreau slapd[20521]: => key_read
Jan 26 10:08:38 magaudreau slapd[20521]: <= index_read 0 candidates
Jan 26 10:08:38 magaudreau slapd[20521]: <= equality_candidates NULL
Jan 26 10:08:38 magaudreau slapd[20521]: <= equality_candidates 0
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 0
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => list_candidates 0xa0
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => equality_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_cache_open( "givenName.dbb", 73, 600 )
Jan 26 10:08:38 magaudreau slapd[20521]: <= ldbm_cache_open (cache 4)
Jan 26 10:08:38 magaudreau slapd[20521]: => key_read
Jan 26 10:08:38 magaudreau slapd[20521]: <= index_read 255 candidates
Jan 26 10:08:38 magaudreau slapd[20521]: <= equality_candidates 255
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 255
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => equality_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_cache_open( "sn.dbb", 73, 600 )
Jan 26 10:08:38 magaudreau slapd[20521]: <= ldbm_cache_open (cache 5)
Jan 26 10:08:38 magaudreau slapd[20521]: => key_read
Jan 26 10:08:38 magaudreau slapd[20521]: <= index_read 51 candidates
Jan 26 10:08:38 magaudreau slapd[20521]: <= equality_candidates 51
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 51
Jan 26 10:08:38 magaudreau slapd[20521]: => filter_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => equality_candidates
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_cache_open( "objectClass.dbb", 73, 600 )
Jan 26 10:08:38 magaudreau slapd[20521]: <= ldbm_cache_open (cache 3)
Jan 26 10:08:38 magaudreau slapd[20521]: => key_read
Jan 26 10:08:38 magaudreau slapd[20521]: <= index_read 49097 candidates
Jan 26 10:08:38 magaudreau slapd[20521]: <= equality_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= list_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= list_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= list_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: <= filter_candidates 49097
Jan 26 10:08:38 magaudreau slapd[20521]: ====> cache_return_entry_r( 6316 ): returned (0)
Jan 26 10:08:38 magaudreau slapd[20521]: => id2entry_r( 1 )
Jan 26 10:08:38 magaudreau slapd[20521]: => ldbm_cache_open( "id2entry.dbb", 73, 600 )
Jan 26 10:08:38 magaudreau slapd[20521]: <= ldbm_cache_open (cache 1)
Jan 26 10:08:38 magaudreau slapd[20521]: => str2entry
Jan 26 10:08:38 magaudreau slapd[20521]: >>> dnPrettyNormal: <uid=xxxx>
Jan 26 10:08:38 magaudreau slapd[20521]: <<< dnPrettyNormal: <uid=xxxx>, <uid=xxxx>
Jan 26 10:08:38 magaudreau slapd[20521]: <= str2entry(uid=xxxx) -> 0x84c0a60
Jan 26 10:08:38 magaudreau slapd[20521]: <= id2entry_r( 1 ) 0x84c0a60 (disk)
Jan 26 10:08:38 magaudreau slapd[20521]: ldbm_search: candidate entry 1 does not match filter
... (goes on for all candidates)


I'd be happy to post other informations that could help solve the problem.

Thanks.