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

! +035 -> 35 ??



I'm trying to understand how the syntaxes and matching rules work - how they are supposed to work in v3 and how they actually work in openldap. I don't find it very clear at all.

In the source file schema_init.c I find a lot of syntax definitions, and the routines that do the work. For instance, I find:

- an entry with a definition of the "Integer" syntax, with pointers to
 three routines called
 integerValidate, integerNormalize, integerPretty

- those three routines themselves.
 integerValidate says whether a string is or isn't a valid integer
   value (i.e. non-empty digit string with an optional + or - prefix)
 integerNormalize changes a valid integer string into a normalized
   form; e.g. +035 -> 35
 integerPretty is a dummy routine (NULL).

Now how are these three routines used by the server?

For integerValidate it seems quite clear. If I try to store a string such as "abc" into an uidNumber attribute (which has syntax "Integer") I get a "value contains invalid data" response.

But integerNormalize doesn't seem to be used by the server at all the way I would expect it to be:

- It doesn't normalize the values I store. If I try to store into
 uidNumber a value such as "+035", then that is precisely what gets
 stored, unchanged.

- Once I have stored such a non-normalized value, I cannot search
 for it! The filter "(uidNumber=+035)" does not match, nor does
 "(uidNumber=35)".

- On the other hand, if I store the normalized form "35", I can
 retrieve it both with "(uidNumber=35)"
 and with              "(uidNumber=+035)"!

Is that the way it is supposed to be? Are the normalization routines there only to normalize search filters, which are then applied to non-normalized values? It seems strange to me!

I'm on openldap-2.0.7. I haven't changed anything in the nis.schema file where uidNumber is described.

Also: what are the "pretty" routines there for?

---
David Olivier
Klebs gardien Alpages CRI courrier brebis Lyon 2 Lumière