httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <>
Subject Re: svn commit: r646582 - /httpd/httpd/trunk/modules/ldap/util_ldap.c
Date Thu, 10 Apr 2008 16:11:46 GMT
>>> On 4/10/2008 at 12:12 AM, in message <>,
Pluem <> wrote:
> On 10.04.2008 00:49, wrote:
>> Author: bnicholes Date: Wed Apr  9 15:49:31 2008 New Revision:
>> URL: Log: Move the
>> initialization of rebind to the post_config handler so that it is
> during
>> the actual module load stage rather than the preload stage.  If done
>> the preload stage, the pool passed into the initialization function
will be
>> cleared and all allocations will be freed.
> But isn't it the pconf pool in both cases? Currently I cannot follow
> argument. Mind to explain in more detail?
> Regards
> RĂ¼diger

What is happening is that when httpd is invoked, the first thing it
does is preload all of the modules to make sure that everything works. 
The preload of the modules also calls the util_ldap_create_config()
which subsequently calls apr_ldap_rebind_init().  In
apr_ldap_rebind_init() some allocations are done.  Actually a thread
mutex is created against the pool that was passed in.  In addition, the
clean up of the mutex was tied to the pool and the rebind init function
also assigned to a global static variable, the mutex handle.  Then when
the preload stage is complete, it clears the memory pool which also
causes the mutex to be destroy.  However the mutex handle, which is now
bogus, is still assigned to the global static variable.  Finally the
real module loading stage occurs and util_ldap_create_config() and
apr_ldap_rebind_init() are called again.  Only this time the
apr_ldap_rebind_init() sees that the mutex global static variable is no
longer NULL so it doesn't bother to recreate the mutex leaving a bogus
value in the static variable.  When an ldap authentication occurs later
and tries to use the bogus mutex handle, at least on NetWare, the code

The change was simply moving the init of the rebind functionality to a
location in the code where everything else is initialized and is also
protected so that the initialization only happens during the real module
load stage rather than the preload stage.


View raw message