Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 80423 invoked from network); 10 Apr 2008 16:12:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Apr 2008 16:12:33 -0000 Received: (qmail 94356 invoked by uid 500); 10 Apr 2008 16:12:27 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 94307 invoked by uid 500); 10 Apr 2008 16:12:27 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 94256 invoked by uid 99); 10 Apr 2008 16:12:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2008 09:12:26 -0700 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [137.65.248.127] (HELO lucius.provo.novell.com) (137.65.248.127) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2008 16:11:36 +0000 Received: from INET-PRV1-MTA by lucius.provo.novell.com with Novell_GroupWise; Thu, 10 Apr 2008 10:11:52 -0600 Message-Id: <47FDE7DB.6720.00AC.0@novell.com> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Thu, 10 Apr 2008 10:11:46 -0600 From: "Brad Nicholes" To: Subject: Re: svn commit: r646582 - /httpd/httpd/trunk/modules/ldap/util_ldap.c References: <20080409224936.BA4F21A9832@eris.apache.org> <47FDAFE4.4070806@apache.org> In-Reply-To: <47FDAFE4.4070806@apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org >>> On 4/10/2008 at 12:12 AM, in message <47FDAFE4.4070806@apache.org>, Ruediger Pluem wrote: > On 10.04.2008 00:49, bnicholes@apache.org wrote: >> Author: bnicholes Date: Wed Apr 9 15:49:31 2008 New Revision: 646582 >> >> URL: http://svn.apache.org/viewvc?rev=646582&view=rev Log: Move the >> initialization of rebind to the post_config handler so that it is done > during >> the actual module load stage rather than the preload stage. If done during >> 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 this > 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 segfaults. 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. Brad