[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
First step in new schema support
I am about to commit my changes that add the ability to define and
keep schemas with the new syntax in RFC2252. Some of these changes,
were already committed, c.f. libraries/libldap/schema.c and
include/ldap_schema.h.
The facilities in the abovementioned files permit parsing the string
representation of object class and attribute type definitions into
some handy structures and dumping them in RFC2252 format. They are
meant to be rather general so that clients can use them to parse
schemas read from servers and slapd itself can use them during
startup to load the schema.
To minimally use this, a lot of changes are needed. To fully exploit
them, many more changes are necessary that affect structures passed
around between many places in slapd.
In the spirit of 'releasing often', I will commit the changes that
'minimally use it' to avoid stopping advances in some related areas,
such as schema publishing though LDAP.
So please see this as a first step in the direction I think we will
be taking. All tests pass with ldbm, I will start testing against
bdb2 immediately (there is very little now that is backend-specific,
just the dubious attempt to create the 'dn' attribute on init.c).
Even if all tests pass, there may be some alligators hiding in the
swamp waiting to bite.
I will give now some background on the changes. First of all, old
schemas are still read and converted to the new format. It is even
possible to mix definitions in both syntaxes. But the old syntax
is going away, possibly after a couple of releases. We do not
have any support yet for syntaxes, matching rules nor anything else.
Just objectclasses and attributetypes. All entities loaded from
the schema are cast into internal slapd structures that contain
a field of the same type as those mentioned above for general use
plus convenience pointers and other data. Attribute types contain
a temporary field sat_syntax_compat that represents the attribute
syntax value. This field is part of the artifact necessary to
permit committing now an incomplete development. That field will
disappear as soon as we have proper support for syntaxes and
matching rules.
Some highlights per file:
servers/slapd/attr.c
The old global_at is gone, we have now a hidden avl called
attr_index and a linear list attr_list. The new avl is
different in that it keeps just *one* name and a pointer to
the internal stucture, so each attribute is indexed once per
each descriptor known for it and once more with its oid, if
known. The old method required a linear search at times.
The old struct asyntaxinfo is gone, replaced by a struct
aindexrec. An at_find routine is provided that returns the
pointer to the internal structure defining the attribute type.
No matter how the attribute type is requested, the same pointer
value is returned. In fact, attribute identity checks can be
done by comparing pointers. Some routines are added such as
at_add called from schemaparse.c to create the internal
structure, plus routines to manipulate arrays of pointers to
those structures (these are used in objectclasses, for instance).
servers/slapd/config.c
Detects whether the definition uses the new or the old syntax
and calls appropriate routines. For old syntax attribute type
definitions, attr_syntax_config (that is heavily modified) in
attr.c is called, otherwise parse_at in schemaparse.c is called.
For objectclasses, either parse_oc_old or parse_oc, both in
schemaparse.c, are called.
servers/slapd/schema.c
This file is redefined to take care of general processing and
checking of the schema plus objectclasses (we did not have an
objectclass.c, we might want or not). Objectclasses now have
their own avl, multiply indexed, oc_index plus a linked list
oc_list. It mirrors the arrangement for attribute types. The
struct objclass is gone, replaced by a new structure. Routine
oc_find (that existed) has been redefined to return a pointer
to the corresponding structure.
servers/slapd/schema.c
parse_oc has been renamed (and heavily modified) to parse_oc_old,
a new parse_oc is provided for the new schema syntax.
Well, that was it. Please review, test and send any comments, to the
list if possible.
Julio