Issue 6580 - slapi extended operation not executed
Summary: slapi extended operation not executed
Status: UNCONFIRMED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.21
Hardware: All All
: --- enhancement
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-22 16:09 UTC by gianluigi.nigro@passepartout.sm
Modified: 2020-03-19 19:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ando@openldap.org 2010-06-22 15:36:47 UTC
changed notes
Comment 1 gianluigi.nigro@passepartout.sm 2010-06-22 16:09:41 UTC
Full_Name: gianluigi nigro
Version: 2.4.21
OS: Linux CentOS release 5.5  ( i686)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (89.186.39.1)


An extended operation with slapi plugin does not work, it is never executed
because slapd doesnt look for an extended operation registered in a plugin
(debugging slapd i verified that the list struct extop_list -extended.c,
function find_extop, line 208 - contains only built-in extended operation).


1) The initialization function look like this:
�
  char** oids = (char**) slapi_ch_malloc( 2 * sizeof( char * ) );
  oids[0] = 1.3.6.1.4.1.35746.2.11.1";
  oids[1] = NULL;
�
i_ret = slapi_pblock_set(pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, oids );
  if( i_ret == 0 )
    i_ret = slapi_pblock_set(pb, SLAPI_PLUGIN_EXT_OP_FN, (void*) extop1_start
);
  if( i_ret != 0 )
    slapi_log_error( SLAPI_LOG_PLUGIN, "extop1_init",
    "[ERROR] registrazione %s\n", pluginDescription.spd_description );
  
2) slapd.conf look like this:
...
pluginlog /var/log/caronte/plugin.log
plugin extendedop  /opt/ldap/slapi/libextop1-plugin.so extop1_init ...


After server restart:
a) the log file plugin.log tell me that the plugin was successfully registered:
...
06/17/10 10:43:53 plugin_pblock_new: Registered plugin my-plugin 0.1 [mycompany]
(description plugin) ...

b) and the rootDSE object contains information about my extended operation, an
'ldapsearch -x -s base -b "" "(objectclass=*)" +' output like this:
...
supportedControl: 1.3.6.1.1.12
supportedExtension: 1.3.6.1.4.1.35746.2.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.3
supportedExtension: 1.3.6.1.1.8

But, when i perform the extended operation, no plugin is executed and i get the
error code 2 and the slapd log file look like this:
Jun 17 09:53:03 linux-setup slapd[11969]: conn=1000 op=1 EXT
oid=1.3.6.1.4.1.35746.2.11.1 Jun 17 09:57:33 linux-setup slapd[11969]: conn=1000
op=1 do_extended: unsupported operation "1.3.6.1.4.1.35746.2.11.1"
Jun 17 09:57:33 linux-setup slapd[11969]: conn=1000 op=1 RESULT tag=120 err=2
text=unsupported extended operation

Is it a bug or a lack of implementation?

Comment 2 ando@openldap.org 2010-06-22 22:36:02 UTC
No clue about the slapi way, but extended operations can be successfully
registered using OpenLDAP's native API, load_extop2().  See for example
overlays/dds.c

p.

Comment 3 gianluigi.nigro@passepartout.sm 2010-06-25 20:02:31 UTC
Hi,
the issue is that in release 2.4.21 is not possible execute an exended operation registered in a plugin: THIS way doesnt work because slapd (in extended.c fe_extended(), line 199) only look for built-in extended operations and not plugin-defined extended operations (in a plugin calling slapi_pblock_set() with SLAPI_EXT_OP_RET_OID and SLAPI_EXT_OP_RET_VALUE).

In fe_extended() I tried to extend the search to all extended operations and now things start to work, but the main question concerns the choice of backend.

Uploaded files:

servers-slapd-extended.patch -> gianluigi.nigro1-100625.patch
servers-slapd-slapi-slapi_overlay.patch -> gianluigi.nigro2-100625.patch

-----Messaggio originale-----
Da: masarati@aero.polimi.it [mailto:masarati@aero.polimi.it] 
Inviato: mercoledì 23 giugno 2010 00:36
A: Gianluigi Nigro
Cc: openldap-its@openldap.org
Oggetto: ITS#6580

No clue about the slapi way, but extended operations can be successfully
registered using OpenLDAP's native API, load_extop2().  See for example
overlays/dds.c

p.




--------------------------------------------------------------------
Il contenuto di questo messaggio di posta elettronica e ogni eventuale documento a quest'ultimo allegato può contenere informazioni la cui riservatezza e' tutelata ed e' rivolto unicamente agli effettivi destinatari i quali prendono atto del carattere non strettamente personale dei messaggi di risposta, che potranno essere noti all'organizzazione aziendale. Sono vietati la riproduzione e l'uso di questo messaggio in mancanza di autorizzazione del destinatario. Se avete ricevuto questo messaggio per errore, vogliate cortesemente chiamarci immediatamente per telefono o fax  e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo  di non prendere cognizione della corrispondenza  tra altri soggetti.
Comment 4 ando@openldap.org 2010-06-25 22:50:26 UTC
> Hi,
> the issue is that in release 2.4.21 is not possible execute an exended
> operation registered in a plugin: THIS way doesnt work because slapd (in
> extended.c fe_extended(), line 199) only look for built-in extended
> operations and not plugin-defined extended operations (in a plugin calling
> slapi_pblock_set() with SLAPI_EXT_OP_RET_OID and SLAPI_EXT_OP_RET_VALUE).
>
> In fe_extended() I tried to extend the search to all extended operations
> and now things start to work, but the main question concerns the choice of
> backend.
>
> Uploaded files:
>
> servers-slapd-extended.patch -> gianluigi.nigro1-100625.patch
> servers-slapd-slapi-slapi_overlay.patch -> gianluigi.nigro2-100625.patch

I think this approach is not correct, in many senses.

First of all, you should use the native API instead of SLAPI.  In fact,
SLAPI is essentially unsupported.  It was intended to give the possibility
to somehow recycle software coded according to Netscape's API, but there's
little point in developing new code based on that interface.

Second, the whole purpose of implementing the slapi overlay was to avoid
the pervasive presence of #ifdef LDAP_SLAPI in baseline code.  So a more
appropriate approach would be to have the slapi overlay register the
extended operation using the native API, rather than having #ifdef
LDAP_SLAPI in extended.c to check that any extop was loaded using SLAPI,
as in gianluigi.nigro1-100625.patch.

I can't say anything about gianluigi.nigro2-100625.patch because the file
looks corrupted.

p.

Comment 5 gianluigi.nigro@passepartout.sm 2010-07-01 08:45:21 UTC
I think that is right for new implementations, but should be guaranteed
compatibility with the old interface (netscape slapi plugin). The patch
serves only this purpose (and I have a set of extended operations
written through that interfaces that I want to carry on openldap).


--------------------------------------------------------------------
Il contenuto di questo messaggio di posta elettronica e ogni eventuale documento a quest'ultimo allegato puo contenere informazioni la cui riservatezza e' tutelata ed e' rivolto unicamente agli effettivi destinatari i quali prendono atto del carattere non strettamente personale dei messaggi di risposta, che potranno essere noti all'organizzazione aziendale. Sono vietati la riproduzione e l'uso di questo messaggio in mancanza di autorizzazione del destinatario. Se avete ricevuto questo messaggio per errore, vogliate cortesemente chiamarci immediatamente per telefono o fax  e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo  di non prendere cognizione della corrispondenza  tra altri soggetti.

Comment 6 OpenLDAP project 2014-08-01 21:03:44 UTC
use load_extop2()?
Comment 7 Quanah Gibson-Mount 2017-03-28 00:12:39 UTC
moved from Incoming to Software Enhancements