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

Re: Operational attribute plugins

I have committed a first implementation of this. It's subject to
change: I would really prefer to conform the API to the Sun ONE
DS API, except I can't find any documentation that explains
how it works (yet).

The architecture is as follows:

1. A plugin registers a callback as SLAPI_PLUGIN_OPATTR_COALESCE_FN.

2. When sending a search entry, the front-end will call all
   plugins registered for the above, with the entry set as
3. The plugins can add additional attributes to be returned
   to the client by manipulating the SLAPI_PLUGIN_OPATTR_COALESCE_DATA
   parameter block value. It is a Slapi_AttrSet, which is an
   opaque handle to a list of Attributes.

Here's the example plugin I'm about to test:

static dnt_opattr_coalesce(Slapi_PBlock *pb)
  Slapi_AttrSet *attrs;
  Slapi_Entry *entry;
  Slapi_ValueSet *vals;
  Slapi_Value *value;
  char *dn;
  if (slapi_pblock_get(pb, SLAPI_PLUGIN_OPATTR_COALESCE_DATA, (void **)&attrs) != 0 ||
      slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY, (void **)&entry) != 0) { 
          return -1;
  dn = slapi_entry_get_dn(entry);
  value = slapi_value_new_string(dn);
  vals = slapi_valueset_new();
  slapi_valueset_add_value(vals, value);

  if (slapi_x_attrset_merge(attrs, "distinguishedName", vals) != 0) {
          return -1;

  return 0;

It should set the "distinguishedName" attribute to the entry's
distinguished name. 

As I said, I'd really prefer to use the Sun ONE computed/virtual
attribute API, so don't get too attached to this... the advantage
of this is that it's quite simple and has minimum intrusion on the
slapd front-end.

-- Luke

Luke Howard | PADL Software Pty Ltd | www.padl.com