I've found and fixed the bug (attached) which I'll forward upstream too.

The first call, it sees __config undefined, so it allocates it, tries to
read the config file, fails and returns NSS_UNAVAIL.  The second
time however, __config is defined. This leads to the assertion failing.

The fix is just to move the file check before the allocation.

Adrian 
-- 
Adrian Bridgett - [EMAIL PROTECTED]
GPG key available on public key servers
--- libnss-ldap-251.orig/util.c
+++ libnss-ldap-251/util.c
@@ -776,6 +776,12 @@
   ldap_config_t *result;
   struct stat statbuf;
 
+  fp = fopen (NSS_LDAP_PATH_CONF, "r");
+  if (fp == NULL)
+    {
+      return NSS_UNAVAIL;
+    }
+
   if (bytesleft (*buffer, *buflen, ldap_config_t *) < sizeof (ldap_config_t))
     {
       return NSS_TRYAGAIN;
@@ -791,12 +797,6 @@
       return NSS_SUCCESS;
     }
 
-  fp = fopen (NSS_LDAP_PATH_CONF, "r");
-  if (fp == NULL)
-    {
-      return NSS_UNAVAIL;
-    }
-
   if (fstat (fileno (fp), &statbuf) == 0)
       result->ldc_mtime = statbuf.st_mtime;
   else

Reply via email to