ldapsdk icon indicating copy to clipboard operation
ldapsdk copied to clipboard

CaseExactMatch is not respected by in-memory server for "importFromLDIF" data

Open fanf opened this issue 8 years ago • 2 comments

It seems that the "caseExactMatch" equality test is not respected for the in-memory server, but only for data coming from LDIF files loaded by "server.importFromLDIF(false, path)"

I tested with unboundid 3.2.0 and 2.3.6. With the following definition:

attributeTypes: ( 1.3.6.1.4.1.35061.1.1.300.5
  NAME 'localAccountName'
  DESC 'A local account name (login) on the server'
  EQUALITY caseExactMatch
  SUBSTR caseIgnoreSubstringsMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )

Then, adding an entry with "importFromLDIF" (before ".startListening", not sure if relevant) with

localAccountName: test
localAccountName: TEST

and the assert: ldap.server.assertValueExists(dn, "localAccountName", java.util.Arrays.asList("TEST","test")) lead to the error "no TEST".

On the other hand, if I'm adding by hand, with a modify request / add attribute value "TEST" on the entry, then the value is correctly added (and both "test" and "TEST" are present).

This not a very severe, but it took me some time to find the problem and workaround.

fanf avatar Mar 31 '17 13:03 fanf

I've just committed something that should fix this, as well as for the addEntries(String...) method.

As a workaround, instead of using:

server.importFromLDIF(false, path)`

You could use:

LDIFReader ldifReader = new LDIFReader(path);
ldifReader.setSchema(server.getSchema());
server.importFromLDIF(false, ldifReader);

dirmgr avatar Mar 31 '17 21:03 dirmgr

Thanks, I worked around the problem by adding the two entries with mod request once the server is up as it wasn't important to have them at load time (it's for an unit test).

fanf avatar Apr 03 '17 09:04 fanf