nss_ldap broken

Sean McNeil sean at mcneil.com
Fri Mar 26 13:00:44 PST 2004


OK, I think I understand this problem...

When I have my nsswitch.conf setup as follows, I get seg11s:

passwd: files ldap
group: files ldap

This appears to be an issue with any external nss_*.so.1 module that
uses pthread.  It looks to me it is about the following:

/*
 * Cleanup
 */
static void
nss_atexit(void)
{
	(void)_pthread_rwlock_wrlock(&nss_lock);
	VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap),
	    (vector_free_elem)ns_dbt_free);
	VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod),
	    (vector_free_elem)ns_mod_free);
	(void)_pthread_rwlock_unlock(&nss_lock);
}

In my case, the nss_ldap.so.1 module was loaded which pulls in
libpthread.  I'm not sure how this works without a libpthred, but it
would appear that unless libpthread.so is loaded everything is OK.  But
now, it has been loaded and the rwlock_wrlock() works, but then it has
been unloaded before rwlock_unlock() gets called.

Would using

#include <reentrant.h>
rwlock_wrlock()
rwlock_unlock()

macros fix this?

Cheers,
Sean




More information about the freebsd-current mailing list