directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Fwd: Re: [LDAP API] Schema aware connection
Date Tue, 15 Sep 2015 12:46:42 GMT
Le 15/09/15 14:39, Emmanuel Lécharny a écrit :
> Forwarding this mail who deserves to be sent to API@directory.a.o...
>
>
>
> Le 15/09/15 12:03, Emmanuel Lécharny a écrit :
>> Hi,
>>
>> Radovan has added some way to support schemas that have some slight
>> differences with the RFC, using the quirkmode flag. If you are using
>> tehe NetworkLdapConnection, it works this way :
>>
>>                     SchemaLoader schemaLoader = new DefaultSchemaLoader(
>> ldapConnection, true );
>>                     ldapConnection.loadSchema( schemaLoader );
>>
>> Thats fine, except if you have declared your ldapConnection thsi way :
>>
>>                     LdapConnection ldapConnection = new
>> LdapNetworkConnection( server.getServerName(), server.getPort() );
>>
>> because the LdapConnection interface does not expose the loadSchema(
>> schemaLoader ) method.
>>
>> I suggest we expose it.
>>
>> I also think we should extend the ldapConnection.loadSchema() method, in
>> order to spare the users from declaring a SchemaLoader on their own.
>> That would make the code looks like :
>>
>>
>>                     ldapConnection.loadSchemaRelaxed();
>>
>> which would replace
>>
>>                     SchemaLoader schemaLoader = new DefaultSchemaLoader(
>> ldapConnection, true );
>>                     ldapConnection.loadSchema( schemaLoader );
> It's a bit more complex that just using the quirkmode (which just relax
> the schema syntax). Sometime, we want to accept some inconsistencies in
> the schema itself. The relaxed mode is there to accept such schema, but
> it's not exposed.
>
> Typically, the loadSchema() methods starts with :
>
>
>     public void loadSchema( SchemaLoader loader ) throws LdapException
>     {
>         try
>         {
>             SchemaManager tmp = new DefaultSchemaManager( loader );
>            
>             tmp.loadAllEnabled();
>
>             if ( !tmp.getErrors().isEmpty() )
>             {
>                 String msg = "there are errors while loading the schema";
>                 LOG.error( msg + " {}", tmp.getErrors() );
>                 throw new LdapException( msg );
>             }
>             ...
>
> which creates a SchemaManager in strict mode. Obviously, the
> tmp.loadAllEnabled() will fail. We should propagate the 'relaxed' flag
> down to the SchemaManager.
>
>
>
>
I will give a clear example :

when you connect to an OpenLDAP server, and fetch the schema, you will
get a failure because some MatchingRule are using a Syntax which is not
loaded. Typically, a standard OpenLDAP server with core, cosine and
inetorgperson schemas will have 248 ATs, 34 OCs, and 72 Syntaxes (from
cn=schema,ou=config). The same server will expose only 32 Syntaxes (but
248 ATs and 63 OCs. Go fish...)

The 40 missing Syntaxes are syntaxes which have no associated
validators. That does not mean those syntax can't be used, though. The
pb is that we don't see them in the SchemaLoader, and we default by
rejecting the load.

At this point, one solution would be to signal those errors, but don't
stop and use default elements to replace the missing ones (ie, defining
a Syntax with no specific check).

I see no other ways to deal with that, becauee as Radovan says, it won't
be fixed any time soon...

thoughts ?


Mime
View raw message