directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <>
Subject Re: Relaxed/quirks mode and OIDs
Date Fri, 28 Aug 2015 16:10:02 GMT
Le 28/08/15 17:32, Radovan Semancik a écrit :
> 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?
The fact is that we are a bit too strict in this check. I think we
should have something like :

        if ( !Oid.isOid( oid, quirkMode ) )

to avoid having an error when teh OID is not valid.

> 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 see...

> 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

Or pass the quirkMode as a parameter to a new isOid() method.

> 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 would go for that mode.

> I can quickly implement any of these options. But as usual, I need a
> blessing :-)
There is no reason to ask for a blessing ! being part of the team, your
voice has teh same weight than any of ours. Now, opening such a
discussion is teh right way to do, because such a modification might
have some impact you don't know about. In any case, thanks for those
experiments and findings ! This is making teh API moving in the right
direction !

Thanks !

View raw message