forked from jengelh/sssd
cd5612d3e6
- Add patches to fix an fd leak in sssd_pam OBS-URL: https://build.opensuse.org/request/show/77463 OBS-URL: https://build.opensuse.org/package/show/network:ldap/sssd?expand=0&rev=55
56 lines
2.1 KiB
Diff
56 lines
2.1 KiB
Diff
>From b28d5e5f7eddf504cbe36cff1ddba5b240822668 Mon Sep 17 00:00:00 2001
|
|
From: Simo Sorce <ssorce@redhat.com>
|
|
Date: Thu, 28 Jul 2011 15:15:26 -0400
|
|
Subject: [PATCH] sss_client: avoid leaking file descriptors
|
|
|
|
If a pam or nss module is dlcolse()d and unloaded we were leaking
|
|
the file descriptor used to communicate to sssd in the process.
|
|
|
|
Make sure the fucntion used to close the socket file descriptor is
|
|
called on dlclose()
|
|
---
|
|
configure.ac | 12 ++++++++++++
|
|
src/sss_client/common.c | 3 +++
|
|
2 files changed, 15 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 0e2e6d44a0cc4b33fda39b3eaf3dcd383d1e09dc..ec29cb71a2153d29f73231e92646ea46eacd68a2 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -176,6 +176,18 @@ AC_CHECK_HEADERS([sys/inotify.h])
|
|
|
|
AC_CHECK_HEADERS([sasl/sasl.h],,AC_MSG_ERROR([Could not find SASL headers]))
|
|
|
|
+AC_CACHE_CHECK([whether compiler supports __attribute__((destructor))],
|
|
+ sss_client_attribute_destructor,
|
|
+ [AC_COMPILE_IFELSE(
|
|
+ [__attribute__((destructor)) static void cleanup(void) { }],
|
|
+ sss_client_attribute_destructor=yes)
|
|
+ ])
|
|
+
|
|
+if test x"$sss_client_attribute_destructor" = xyes ; then
|
|
+ AC_DEFINE(HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR, 1,
|
|
+ [whether compiler supports __attribute__((destructor))])
|
|
+fi
|
|
+
|
|
PKG_CHECK_MODULES([CHECK], [check >= 0.9.5], [have_check=1], [have_check=])
|
|
if test x$have_check = x; then
|
|
AC_MSG_WARN([Without the 'CHECK' libraries, you will be unable to run all tests in the 'make check' suite])
|
|
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
|
|
index b603305596a3ed3fd653930388ff633daa187db2..55e393e57a1fc759dd7972a611a0d5e4e88abda7 100644
|
|
--- a/src/sss_client/common.c
|
|
+++ b/src/sss_client/common.c
|
|
@@ -53,6 +53,9 @@
|
|
int sss_cli_sd = -1; /* the sss client socket descriptor */
|
|
struct stat sss_cli_sb; /* the sss client stat buffer */
|
|
|
|
+#if HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR
|
|
+__attribute__((destructor))
|
|
+#endif
|
|
static void sss_cli_close_socket(void)
|
|
{
|
|
if (sss_cli_sd != -1) {
|
|
--
|
|
1.7.6
|
|
|