File nss_ldap-ldapconn-leak-bug418.dif of Package nss_ldap

bnc#659100, PADL#418

Index: nss_ldap-265/ldap-nss.c
===================================================================
--- nss_ldap-265.orig/ldap-nss.c
+++ nss_ldap-265/ldap-nss.c
@@ -1234,9 +1234,14 @@ do_init (void)
 	}
     }
 
-  __session.ls_conn = NULL;
+  /* looks like a problem. could be initialized, but not connected */
+  if (__session.ls_state != LS_UNINITIALIZED)
+    {
+      debug ("<== do_init (already initialized)");
+      goto initialized;
+    }
+
   __session.ls_timestamp = 0;
-  __session.ls_state = LS_UNINITIALIZED;
 
 #if defined(HAVE_PTHREAD_ONCE) && defined(HAVE_PTHREAD_ATFORK)
   if (pthread_once (&__once, do_atfork_setup) != 0)
@@ -1356,6 +1361,7 @@ do_init (void)
 
   debug ("<== do_init (initialized session)");
 
+initialized:
   return NSS_SUCCESS;
 }
 
@@ -1575,6 +1581,7 @@ do_open (void)
 	}
       else
 	{
+	  syslog(LOG_ERR, "nss-ldap: do_open: do_start_tls failed:stat=%d", stat);
 	  do_close ();
 	  debug ("<== do_open (TLS startup failed)");
 	  return stat;
openSUSE Build Service is sponsored by