[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: NIS scheme

At 04:13 PM 7/20/00 -0500, Randy Kunkee wrote:
>I looked at your code to implement substring matching in IA5strings.

Better to look at a simple equality match function first...

>To me it was by no means straightforward either what you were doing or
>why.  Is there some sort of guide somewhere on how to go about writing
>new syntax rules, filter implementations, etc.?

Not yet...  like with most of OpenLDAP, it's code by example.
Here is a brief explanation of the system works.

For each syntax there are two key functions which must be
provided, validate and normalize.  Validate checks that the
value conforms to syntax, normalize rewrites the value into
a normalized form for the purposes of matching.  So, for
an IA5 strings, the validate checks to ensure all octets
are IA5 and the normalizer removes leading, trailing and
duplicate spaces.

For each matching rule, there is one key function, the matcher.
The matcher takes a normalized (per its syntax) asserted value
and a normalized (per its syntax) stored value and matches
them.  For caseIgnoreIA5Match, the match does a strcasecmp().
For caseExactIA5Match, the match does a strcmp().

For caseIgnoreIA5Match, the asserted value is actually a
SubstringsAssertion containing initial, any, and final values.
The matching requires stepping through these values to see if
they "match" the stored value.  There are a number of border
conditions due to handling of spaces which makes the
implementation not as straightforward as you would think
it would be.

I just took a quick look at the NIS schema.  It appears that
only one routine needs to be implemented, a validator for
syntax (net group triple).  No normalizer
is needed as no matching rules act upon values of this