Blame SOURCES/openldap-nss-unregister-on-unload.patch

d198f9
fix: OpenLDAP crash in NSS shutdown handling
d198f9
d198f9
Resolves: #1158005
d198f9
Related: #1231228 #1249977
d198f9
Author: Jan Synacek <jsynacek@redhat.com>
d198f9
Modified-By: Matus Honek <mhonek@redhat.com>
d198f9
d198f9
--- a/libraries/libldap/init.c
d198f9
+++ b/libraries/libldap/init.c
d198f9
@@ -473,7 +473,7 @@ static void openldap_ldap_init_w_env(
d198f9
  * Sorry, don't know how to handle this for non-GCC environments.
d198f9
  */
d198f9
 static void ldap_int_destroy_global_options(void)
d198f9
-	__attribute__ ((destructor));
d198f9
+	__attribute__ ((destructor (2)));
d198f9
 #endif
d198f9
 
d198f9
 static void
d198f9
--- a/libraries/libldap/tls_m.c
d198f9
+++ b/libraries/libldap/tls_m.c
d198f9
@@ -1931,6 +1931,18 @@ tlsm_clientauth_init( tlsm_ctx *ctx )
d198f9
 	return ( status == SECSuccess ? 0 : -1 );
d198f9
 }
d198f9
 
d198f9
+#if defined(__GNUC__)
d198f9
+static void
d198f9
+tlsm_destroy_on_unload(void) __attribute__ ((destructor (1)));
d198f9
+
d198f9
+static void
d198f9
+tlsm_destroy_on_unload(void)
d198f9
+{
d198f9
+	if (NSS_IsInitialized())
d198f9
+		NSS_UnregisterShutdown(tlsm_nss_shutdown_cb, NULL);
d198f9
+}
d198f9
+#endif
d198f9
+
d198f9
 /*
d198f9
  * Tear down the TLS subsystem. Should only be called once.
d198f9
  */