Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25fd0228d2 | ||
|
|
adb5b25bb6 | ||
|
|
b6490057d1 |
4 changed files with 110 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -39,3 +39,5 @@
|
|||
/openldap-2.6.5.tgz
|
||||
/openldap-2.6.6.tgz
|
||||
/openldap-2.6.7.tgz
|
||||
/openldap-2.6.8.tgz
|
||||
/openldap-2.6.9.tgz
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
From 5f4569f0605a73eb1a282ee5251ead073ed3b26e Mon Sep 17 00:00:00 2001
|
||||
From: Simon Pichugin <spichugi@redhat.com>
|
||||
Date: Tue, 26 Nov 2024 12:32:07 -0800
|
||||
Subject: [PATCH] libldap: avoid SSL context cleanup during library destruction
|
||||
|
||||
Given that libldap can be pulled into random applications and applications
|
||||
are allowed to call OPENSSL_cleanup() before exiting, the only sane thing
|
||||
to do is to avoid trying to touch SSL context in ldap destructors, and just
|
||||
let them leak if the application does not explicitly free the ldap context.
|
||||
|
||||
Add ldap_int_tls_destroy_safe() which skips SSL context cleanup while
|
||||
maintaining all other cleanup operations, and use it in the library
|
||||
destructor path.
|
||||
|
||||
Fixes: https://bugs.openldap.org/show_bug.cgi?id=9952
|
||||
---
|
||||
libraries/libldap/init.c | 2 +-
|
||||
libraries/libldap/ldap-int.h | 1 +
|
||||
libraries/libldap/tls2.c | 25 +++++++++++++++++++++----
|
||||
3 files changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c
|
||||
index 213276b4b5..aa017f4128 100644
|
||||
--- a/libraries/libldap/init.c
|
||||
+++ b/libraries/libldap/init.c
|
||||
@@ -545,7 +545,7 @@ ldap_int_destroy_global_options(void)
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TLS
|
||||
- ldap_int_tls_destroy( gopts );
|
||||
+ ldap_int_tls_destroy_safe( gopts );
|
||||
#endif
|
||||
}
|
||||
|
||||
diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h
|
||||
index 7e754775e8..b73097ccc7 100644
|
||||
--- a/libraries/libldap/ldap-int.h
|
||||
+++ b/libraries/libldap/ldap-int.h
|
||||
@@ -914,6 +914,7 @@ LDAP_F (int) ldap_int_tls_start LDAP_P(( LDAP *ld,
|
||||
LDAPConn *conn, LDAPURLDesc *srv ));
|
||||
|
||||
LDAP_F (void) ldap_int_tls_destroy LDAP_P(( struct ldapoptions *lo ));
|
||||
+LDAP_F (void) ldap_int_tls_destroy_safe LDAP_P(( struct ldapoptions *lo ));
|
||||
|
||||
/*
|
||||
* in getvalues.c
|
||||
diff --git a/libraries/libldap/tls2.c b/libraries/libldap/tls2.c
|
||||
index 0841005a59..82f8573602 100644
|
||||
--- a/libraries/libldap/tls2.c
|
||||
+++ b/libraries/libldap/tls2.c
|
||||
@@ -97,10 +97,14 @@ tls_ctx_ref( tls_ctx *ctx )
|
||||
static ldap_pvt_thread_mutex_t tls_def_ctx_mutex;
|
||||
#endif
|
||||
|
||||
-void
|
||||
-ldap_int_tls_destroy( struct ldapoptions *lo )
|
||||
-{
|
||||
- if ( lo->ldo_tls_ctx ) {
|
||||
+/*
|
||||
+ * Implementation function that handles all cleanup.
|
||||
+ * skip_ctx_cleanup: 1 when called from destructor, 0 for normal operation
|
||||
+ */
|
||||
+static void
|
||||
+ldap_int_tls_destroy_impl( struct ldapoptions *lo, int skip_ctx_cleanup )
|
||||
+ {
|
||||
+ if ( lo->ldo_tls_ctx && !skip_ctx_cleanup ) {
|
||||
ldap_pvt_tls_ctx_free( lo->ldo_tls_ctx );
|
||||
lo->ldo_tls_ctx = NULL;
|
||||
}
|
||||
@@ -147,6 +151,19 @@ ldap_int_tls_destroy( struct ldapoptions *lo )
|
||||
BER_BVZERO( &lo->ldo_tls_pin );
|
||||
}
|
||||
|
||||
+
|
||||
+void
|
||||
+ldap_int_tls_destroy( struct ldapoptions *lo )
|
||||
+{
|
||||
+ ldap_int_tls_destroy_impl(lo, 0);
|
||||
+}
|
||||
+
|
||||
+/* Safe version for destructor use */
|
||||
+void ldap_int_tls_destroy_safe( struct ldapoptions *lo )
|
||||
+{
|
||||
+ ldap_int_tls_destroy_impl(lo, 1);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Tear down the TLS subsystem. Should only be called once.
|
||||
*/
|
||||
--
|
||||
2.47.0
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
%global __brp_remove_la_files %nil
|
||||
|
||||
Name: openldap
|
||||
Version: 2.6.7
|
||||
Version: 2.6.9
|
||||
Release: 1%{?dist}
|
||||
Summary: LDAP support libraries
|
||||
License: OLDAP-2.8
|
||||
|
|
@ -47,8 +47,7 @@ Patch6: openldap-switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.patch
|
|||
# System-wide default for CA certs
|
||||
Patch7: openldap-openssl-manpage-defaultCA.patch
|
||||
Patch8: openldap-add-export-symbols-LDAP_CONNECTIONLESS.patch
|
||||
Patch9: openldap-slapi-fix-plugin-plugin_pblock_new-usage.patch
|
||||
Patch10: openldap-explicitly-cast-private-values.patch
|
||||
Patch9: openldap-libldap-avoid-SSL-context-cleanup-during-library-des.patch
|
||||
|
||||
# check-password module specific patches
|
||||
Patch90: check-password-makefile.patch
|
||||
|
|
@ -160,7 +159,6 @@ pushd openldap-%{version}
|
|||
%patch -P7 -p1
|
||||
%patch -P8 -p1
|
||||
%patch -P9 -p1
|
||||
%patch -P10 -p1
|
||||
|
||||
# build smbk5pwd with other overlays
|
||||
ln -s ../../../contrib/slapd-modules/smbk5pwd/smbk5pwd.c servers/slapd/overlays
|
||||
|
|
@ -190,6 +188,8 @@ popd
|
|||
%set_build_flags
|
||||
# enable experimental support for LDAP over UDP (LDAP_CONNECTIONLESS)
|
||||
export CFLAGS="${CFLAGS} ${LDFLAGS} -Wl,--as-needed -DLDAP_CONNECTIONLESS"
|
||||
# disable legacy hash algorithm
|
||||
export CFLAGS="${CFLAGS} -DOPENSSL_NO_MD2"
|
||||
|
||||
pushd openldap-%{version}
|
||||
%configure \
|
||||
|
|
@ -469,6 +469,7 @@ exit 0
|
|||
%{_libdir}/openldap/home*
|
||||
%{_libdir}/openldap/lloadd*
|
||||
%{_libdir}/openldap/memberof*
|
||||
%{_libdir}/openldap/nestgroup*
|
||||
%{_libdir}/openldap/otp*
|
||||
%{_libdir}/openldap/pcache*
|
||||
%{_libdir}/openldap/ppolicy*
|
||||
|
|
@ -516,6 +517,16 @@ exit 0
|
|||
%{_libdir}/libslapi-2.4*.so.*
|
||||
|
||||
%changelog
|
||||
* Fri Mar 28 2025 Simon Pichugin <spichugi@redhat.com> - 2.6.9-1
|
||||
- Rebase to version 2.6.9 (rhbz#2355654)
|
||||
|
||||
* Thu Jan 16 2025 Simon Pichugin <spichugi@redhat.com> - 2.6.8-2
|
||||
- Disable MD2 hash algorithm (rhbz#2338563)
|
||||
|
||||
* Thu Dec 5 2024 Simon Pichugin <spichugi@redhat.com> - 2.6.8-1
|
||||
- Rebase to version 2.6.8 (rhbz#2330709)
|
||||
- Avoid SSL context cleanup during library destruction (rhbz#2330710)
|
||||
|
||||
* Fri Feb 9 2024 Simon Pichugin <spichugi@redhat.com> - 2.6.7-1
|
||||
- Rebase to version 2.6.7 (rhbz#2261163)
|
||||
- Use systemd-sysusers for ldap user and group (rhbz#2173965)
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1,2 +1,2 @@
|
|||
SHA512 (openldap-ppolicy-check-password-1.1.tar.gz) = a92854d7438cb95fac361da80a49d084d502155e8ce0ad2ea679db9529bbe0182aa4354e6139793c775e496349375d8f017678941d23315ff1c20fefc9573cdc
|
||||
SHA512 (openldap-2.6.7.tgz) = ea207b84fdb7bc6cdff2bc1201fcdde6a907f5766f9637589d956ca86ecf61d4e732ab7d80f33b18b691644e1f5fa39b00ff2c7f4084c9b85760ee693a7c451e
|
||||
SHA512 (openldap-2.6.9.tgz) = d3f839d3cf1030caa410e54f968e9c0caf3bc371c06ea0f64cf3a6ece6d31013c9dbfb08a3a63ea9137a2062aa6edc6e0bc542b365fe4ad66608df4cdbe94a4e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue