Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Mar 2004 06:59:34 -0600
From:      "Jacques A. Vidrine" <nectar@FreeBSD.org>
To:        Sean McNeil <sean@mcneil.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: nss_ldap broken
Message-ID:  <20040326125934.GA68357@madman.celabo.org>
In-Reply-To: <1080273717.18231.10.camel@server.mcneil.com>
References:  <1080273717.18231.10.camel@server.mcneil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 25, 2004 at 08:01:58PM -0800, Sean McNeil wrote:
> Hi everyone,
> 
> I'm getting frustrated trying to figure out what is wrong here.  I get
> seg 11 on any program that initializes the nss_ldap module but doesn't
> actually use it.  For instance, I have both passwd and group looking at
> "files ldap".  So if I do something like
> 
> ls -l /
> 
> it works with no problem as I have a directory in there with a group
> only in ldap.  But if I do
> 
> ls -l /etc
> 
> I will get a seg11...
> 
> #0  0x28214800 in ?? ()
> #1  0x2816bdb5 in _nsdbtput () from /lib/libc.so.5
> #2  0x2818e95b in __cxa_finalize () from /lib/libc.so.5
> #3  0x2818e67c in exit () from /lib/libc.so.5
> #4  0x08049b68 in free ()
> #5  0x08049279 in free ()

Can you rebuild ls and libc with symbols and mail me the stack trace
from that?

At first I thought that perhaps something was invoking nsdispatch() in
an atexit handler *after* nss_atexit had run, but even so that would
be more or less safe.

> I've looked at the nss_atexit and can't see what could possibly be the
> problem.  There is only one thing I can think of (just came to mind
> while writing this).  The lock nss_lock seems to be kept after
> nss_configure and never released unless a call to dispatch is called
> where it will lock then unlock.  Yet this would appear to be the same
> for any of the builtins.

Hmm, it does seem that there is an error situation where that could
be the case, but the problem description above doesn't follow from
that case.  The patch will fix it.  (The situation would occur if
/etc/nsswitch.conf existed, but was not readable.)

> Does anyone have any insight into what this might be?  I would love to
> have it working again.

I will try to reproduce here.  So far no luck.
-- 
Jacques Vidrine / nectar@celabo.org / jvidrine@verio.net / nectar@freebsd.org


Index: net/nsdispatch.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/nsdispatch.c,v
retrieving revision 1.10
diff -c -r1.10 nsdispatch.c
*** net/nsdispatch.c	15 Mar 2004 08:14:35 -0000	1.10
--- net/nsdispatch.c	26 Mar 2004 12:53:57 -0000
***************
*** 339,346 ****
  	if (result != 0)
  		goto fin2;
  	_nsyyin = fopen(path, "r");
! 	if (_nsyyin == NULL)
  		goto fin;
  	VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap),
  	    (vector_free_elem)ns_dbt_free);
  	VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod),
--- 339,348 ----
  	if (result != 0)
  		goto fin2;
  	_nsyyin = fopen(path, "r");
! 	if (_nsyyin == NULL) {
! 		result = errno;
  		goto fin;
+ 	}
  	VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap),
  	    (vector_free_elem)ns_dbt_free);
  	VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod),
***************
*** 354,360 ****
  	confmod = statbuf.st_mtime;
  fin:
  	(void)_pthread_rwlock_unlock(&nss_lock);
! 	result = _pthread_rwlock_rdlock(&nss_lock);
  fin2:
  	(void)_pthread_mutex_unlock(&conf_lock);
  	return (result);
--- 356,363 ----
  	confmod = statbuf.st_mtime;
  fin:
  	(void)_pthread_rwlock_unlock(&nss_lock);
! 	if (result == 0)
! 		result = _pthread_rwlock_rdlock(&nss_lock);
  fin2:
  	(void)_pthread_mutex_unlock(&conf_lock);
  	return (result);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040326125934.GA68357>