+++ This bug was initially created as a clone of Bug #804229 +++ ... --- Additional comment from jdennis on 2012-03-19 14:30:38 CET --- re comment #6 Thanks Jan, yes I too was able to read the tls_m.c code and see what it does. What I was trying to suggest is that either ldap_ld_free() or some of the code in tls_m.c has things occurring in the wrong order, this should be obvious from the attached backtrace. Both Kai and I are suggesting that CERT_DestroyCertificate should not be called after the NSS context it was created from to was destroyed, it's the wrong order of operations. In other words what is happening is an SSL socket is created using an NSS context (i.e. the NSS context must exist prior to creating the SSL socket). But when the socket is disposed of the order of operations isn't mirrored in reverse. The socket should be disposed of first because it belongs to the NSS context, then the NSS context should be destroyed. But openldap is performing the opposite, it's destroying the NSS context first and then the socket. So it seems to me that openldap got this wrong due to one or both of the following: In ldap_ld_free() it first calls ldap_int_tls_destroy() which via the tls function pointers will call tlsm_ctx_free destroying the NSS context. Then later ldap_ld_free() calls ber_sockbuf_free() which via the tls function pointers calls NSS to close the socket. This is the wrong order of operations. So either ldap_int_tls_destroy() needs to be moved after ber_sockbuf_free() or what's performed in the tls functions exported by tls_m.c need to be modified it guarantees the right order of operations. Make sense now? --- Additional comment from jvcelak on 2012-03-19 16:01:22 CET --- (In reply to comment #7) > Thanks Jan, yes I too was able to read the tls_m.c code and see what it does. Sorry, I was trying to help. > In other words what is happening is an SSL socket is created using an NSS > context (i.e. the NSS context must exist prior to creating the SSL socket). But > when the socket is disposed of the order of operations isn't mirrored in > reverse. The socket should be disposed of first because it belongs to the NSS > context, then the NSS context should be destroyed. But openldap is performing > the opposite, it's destroying the NSS context first and then the socket. True. > So either ldap_int_tls_destroy() needs to be moved after ber_sockbuf_free() or > what's performed in the tls functions exported by tls_m.c need to be modified > it guarantees the right order of operations. I have just quickly scanned OpenSSL and GnuTLS backends, and it seems that this change would be possible without harming the other backends. As for OpenSSL, I found some references that closing the connection (SSL_Shutdown) should appear before cleaning up the resources (SSL_CTX_free). Which is the same case. I'm not very sure about GnuTLS. But the current order is illogical IMO.
I submitted the patch for this issue upstream: http://www.openldap.org/its/index.cgi?findid=7241
*** Bug 812974 has been marked as a duplicate of this bug. ***
Resolved in openldap-2.4.31-3.fc17
openldap-2.4.31-3.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/openldap-2.4.31-3.fc17
openldap-2.4.26-8.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/openldap-2.4.26-8.fc16
Package openldap-2.4.31-3.fc17: * should fix your issue, * was pushed to the Fedora 17 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing openldap-2.4.31-3.fc17' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-10000/openldap-2.4.31-3.fc17 then log in and leave karma (feedback).
openldap-2.4.31-3.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.
openldap-2.4.26-8.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.