Hi,

Again, I have a problem with bad LDAP servers.

The problem are LDAP servers that have non-standard OIDs. I mean either non-numeric OIDs, OIDs starting with other number than 0, 1 or 2 ... that sort of thing.

When the API is in the quirks/relaxed mode then the parsers will survive that. But not the registries. E.g. if there is an objectclass with bad OID then it die in OidRegistry:195:

        if ( !Oid.isOid( oid ) )
        {
            String message = I18n.err( I18n.ERR_04290 );

            LOG.debug( message );
            throw new LdapException( message );
        }

.. which is not a bad thing in itself. But this will also die in the quirks/relaxed mode. And it will die after the DefaultSchemaObjectRegistry.register() added the object to byName map. So, the result is that the object is in the byName map but it is not in the byOid map. This seems to me as an inconsistent behavior ... is this the right thing or is this a bug?

Also, this makes the API use very inconvenient. If I want to get all the object classes (even those with bad OIDs) then I need to do:

Iterator<String> oidsIterator = ((DefaultObjectClassRegistry) schemaManager.getObjectClassRegistry()).oidsIterator(); // iterate over that and fetch every ObjectClass explicitly ...

instead of simple

for (ObjectClass ldapObjectClass: schemaManager.getObjectClassRegistry()) { ...

So, writing robust LDAP clients with the API becomes a real pain.

I was tempted to just use the ugly way in my LDAP connector and forget about it ... but then I slapped myself. if it is a bug it should be fixed in the API and not worked around in the client code.

I think that we have two options:

1: simple: OidRegistry:195: remove the throw, leave it just as a warning

2: complex: add the concept of relaxed mode to the registries (OidRegistry class). Set this up when the registries are created. Skip the Oid.isOid() check when in relaxed mode.

I can quickly implement any of these options. But as usual, I need a blessing :-)

What do you think?

--
Radovan Semancik
Software Architect
evolveum.com

Reply via email to