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

User-defined attribute options (Was: Suggestion: attribute;search)



Kurt D. Zeilenga writes:
>At 04:52 AM 2002-11-09, Hallvard B Furuseth wrote:
> 
>> Besides, I just finished coding user-defined attribute options:  Since I
>> thought I'd have to implement a new option anyway, I could just as well
>> generalize. 
> 
> I suggest that each of these user-defined attribute options have
> a common prefix (e.g, ";x-user").

I like ;x-user-, but I don't agree that such names should be enforced.
I've looked again at RFC2251, and all it says is

   Options beginning with "x-" are reserved for private experiments.

I think OpenLDAP should follow suit: Reserve a namespace for users, but
don't enforce it.  If the user wants a shorter option name and is
prepared to risk that OpenLDAP may use that option name in the future,
that's his decision.

(The same way, if OpenLDAP wants to define a new option some day, it
looks like a valid approach to not use the 'x-' prefix: Instead try to
get out an RFC with the option as soon as possible, while hoping that
nobody else will grab it first.  I don't know which way I'd prefer.)

> Coding wise, they would be just like language tag/range
> options... except the option name would have user defined meaning.

Actually I coded them as bit flags.  Each option defined in slapd.conf
gets its own bit.  That seemed to be quicker and easier.

Here is a preliminary patch, if anyone is interested:

  http://folk.uio.no/hbf/OpenLDAP/attr-options.txt

Yet to do:

- I'd like to handle ";binary" the same way as user-defined options,
  instead of having a special case for it, and move the binary flag
  from AttributeDescription.ad_flags to .ad_options.

- I could merge AttributeDescription.ad_flags and .ad_options into
  one value `ber_uint_t ad_flags'.  16 bits could be reserved for
  OpenLDAP flags and options, the rest for user-defined options.
  Flags like SLAP_DESC_LANG_RANGE would be in the most significant bits,
  predefined options like ;binary in the least significant bits.

- A slapd.conf directive 'access to attr=;options ...' which would apply
  to all attributes with those options.

- document (and maybe enforce) the ";x-user-" namespace.

-- 
Hallvard