when using ldap_start_tls_s , /dev/urandom is opened but never seems to be close until the program exist,
which causes issues when a program uses pam_ldap in such a way that openvpn does,
e.g loop{
new connection;
dlopen(pamldap);
authenticate user using pam_ldap; // (open /dev/urandom);
dlclose(pamldap); // /dev/urandom is still open
}
Unfortunately, I am not sure if there is a way to close the TLS context from the API, even when unbinding.
For instance, when using the code below, stracing the code will show that /dev/urandom is not close even once finished with LDAP.
============
...
...
open("/etc/hosts", O_RDONLY) = 4
close(4) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
close(4) = 0
open("/lib/tls/i686/cmov/libnss_dns.so.2", O_RDONLY) = 4
close(4) = 0
close(4) = 0
open("/dev/urandom", O_RDONLY) = 4
open(NULL, O_RDONLY) = -1 EFAULT (Bad address)
close(3) = 0
===========
the ldap tools (ldapsearch....) do close properly /dev/urandom, but they use tool_destroy()/ldap_pvt_tls_destroy() which has not effect when I attempt to forward declare it and use it.