Bug 450742 - server should pass in config entry to plugin init function
server should pass in config entry to plugin init function
Product: 389
Classification: Community
Component: Server - Plugins (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Rich Megginson
Ben Levenson
Depends On:
Blocks: 389_1.2.10
  Show dependency treegraph
Reported: 2008-06-10 15:11 EDT by Nalin Dahyabhai
Modified: 2015-12-10 13:37 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-12-10 13:37:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Nalin Dahyabhai 2008-06-10 15:11:38 EDT
In a plugin which needs to read its configuration before the directory server
drops privileges, it would be very helpful to have the name and contents of the
plugin's configuration entry provided for the initialization function.  (In my
case I need to bind to a privileged port, and I want to allow the administrator
to specify a port so that I don't have to use bindresvport(), so that a hole can
be punched in a firewall).

Currently SLAPI_TARGET_DN isn't set, and attempts to locate the entry using
slapi_search_internal_set_pb()/slapi_search_internal_callback_pb() cause the
server to crash.

(Rich suggested using nsslapd-pluginArg0, and I can work with that for now.)
Comment 1 Rich Megginson 2008-06-10 16:23:06 EDT
In a plugin start function, the plugin receives the plugin config entry in the
pblock parameter SLAPI_ADD_ENTRY e.g. from pam_passthru:

static int
pam_passthru_bindpreop_start( Slapi_PBlock *pb )
    int rc;
    Slapi_Entry *config_e = NULL; /* entry containing plugin config */


	    "=> pam_passthru_bindpreop_start\n" );

    if ( slapi_pblock_get( pb, SLAPI_ADD_ENTRY, &config_e ) != 0 ) {
			 "missing config entry\n" );
	return( -1 );

    /* process config using config_e */

We should do the same for plugin init, for those cases where the plugin must
have access to its config during the init phase.
Comment 4 Martin Kosek 2012-01-04 08:44:39 EST
Upstream ticket:
Comment 5 Rich Megginson 2012-01-06 11:54:50 EST
commit b6d3ba77683722ed8b88994a637ba64fa18e57a1
Author: Rich Megginson <rmeggins@redhat.com>
Date:   Wed Oct 5 16:53:30 2011 -0600

    pass the plugin config entry to the plugin init function
    A plugin init function can get the plugin config entry (that is, its own
    config entry) by using the pblock parameter SLAPI_PLUGIN_CONFIG_ENTRY
    my_plugin_init(Slapi_PBlock *pb)
      Slapi_Entry *my_config_entry = NULL;
      slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &my_config_entry);
    Reviewed by: nkinder, nhosoi (Thanks!)

Note You need to log in before you can comment on or make changes to this bug.