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

RE: dynamic module load failure, resolved



Hi,

I've dug a bit deeper into the problem and found the (trivial)
solution.Since I'm probably not the only one to make this mistake, I'll give
a brief explanation.
The dynamic module support in slapd is based on libtool. When slapd
encounters a 'moduleload' directive in it's configuration it will try to
load the specfied shared object using libtool's lt_dlopen() call.
Subsequently it tries to find the module's initialization routine by calling
lt_dlsym(module_handle, "init_module"). Even though slapd is looking for a
symbol (routine) called "init_module" the actual routine is called
<module_name>_LTX_init_module, eg. back_passwd_LTX_init_module. This is a
libtool feature: it (lt_dlsym) will search for
<module_name>_LTX_<symbol_name> when requesting <symbol_name>. This way
multiple modules can export the same symbol without having clashing names
when linking statically. However this feature works only with libtool
archives not with generic shared objects! And the latter case lt_dlsym will
simply search for <symbol_name> without the prefix. Libtool archives are the
filenames ending with '.la', eg. back_passwd.la. 
So the correct directive in the slapd config should have been "moduleload
back_passwd.la" and not "moduleload back_passwd.so".
Unfortunately "init_module" is an existing function under the Linux OS, for
the initialization of kernel modules. Therefore the lt_dlsym call does
succeed even if you load the ".so" instead of the ".la". Subsequently the
call to this routine fails with either EPERM or EFAIL. Rather confusing!
  
Bastiaan Bakker 


> -----Oorspronkelijk bericht-----
> Van:	Bastiaan Bakker [SMTP:bastiaan.bakker@lifeline.nl]
> Verzonden:	Thursday, April 20, 2000 9:25 AM
> Aan:	'openldap-devel@openldap.org'
> Onderwerp:	dynamic module load failure
> 
> Hi,
> 
> Finally I'm back working on OpenLDAP again. I tried a build of OpenLDAP
> from
> the CVS HEAD today (2000/4/19) with dynamic backend modules on a RedHat
> 6.1
> i386 Linux system, as per:
> ./configure --prefix=/home/bastiaan/openldap -enable-dynamic
> --enable-modules --disable-slurpd --enable-passwd
> --with-passwd-module=dynamic --enable-shell --with-shell-module=dynamic
> --enable-ldbm --with-ldbm-module=dynamic
> 
> OpenLDAP builds OK, but slapd fails to load any dynamic modules:
> 
> line 32 (modulepath /home/bastiaan/openldap/libexec/openldap)
> line 33 (moduleload back_passwd.so)
> loaded module back_passwd.so
> module back_passwd.so: init_module() failed
> ./slapd.conf: line 33: failed to load or initialize module back_passwd.so
> 
> slapd.conf contains the standard prologue followed by:
> 
> modulepath /home/bastiaan/openldap/libexec/openldap
> moduleload back_passwd.so
> 
> database        passwd
> suffix          "dc=oven, dc=lifeline, dc=office"
> 
> 
> The same configuration with a slapd with static backend modules runs
> without
> problems. Am I doing something wrong or does the current CVS revision not
> work with dynamic backend modules? 
> 
> Regards,
> 
> Bastiaan Bakker
> LifeLine Networks BV
>