Le 25/09/15 02:43, Syed Mudassir Ahmed a écrit :
> I am curious to know how ldap API can do that?

As the subschema tells where the schema is, we can load it on demand.
Actually, this is not what we do : we fetch teh schema from the rootDSE,
which always hold a reference to the schema (see later why we don't
fetch teh schema from the subschemaSubentry attrubte).

Once we know where the schema is stored, and assuming it is stored with
respect to teh RFC, it's all about loading all the schema elements into
a SchemaManager, and eventually check that the schema is consistent (and
sadly, none of the existing LDAP server out there - execpt ApacheDS -
is. Not that it's a bad thing, but we are extremely picky with the
respect of standards). As some LDAP server are a bit lax about teh
schema consistency, there is a relaxed mode taht allows us to load most
of teh server's schema.

Frankly, this is not perfect, and it's more a work in progress, but it
already works quite well with OpenLDAP and a few others.

Bottom line, behind the curtain, it's just a matter of reading teh AT,
OC and a few other elements, parsing them and store them. The process is
partially explained on
http://directory.apache.org/api/user-guide/4-schema-management.html
(this is not fully completed).

Why don't we load the schemaManager from the subschemaSubentry found in
each entry ? For two reasons :
- first because I don't know about any LDAP server that is defining more
than one schema for the entire server (although this is mandated by the
scpecification)
- and second because accordingly to RFC 2252, it was not mandatory to
store a subschemaSubentry in each entry, and apacheDS didn't do iut.
Obviously, this is a mistake that will be fixed soon.



Reply via email to