From cd5612d3e6e9018830a589846aea4105a53dae3290b02e6752173e7e5568db1e Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 2 Aug 2011 07:04:28 +0000 Subject: [PATCH] Accepting request 77463 from home:jengelh:dev - 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 --- 0001-Silence-autoconf-2.28-warnings.patch | 34 ++++++++++++ ...lient-avoid-leaking-file-descriptors.patch | 55 +++++++++++++++++++ sssd.changes | 5 ++ sssd.spec | 3 + 4 files changed, 97 insertions(+) create mode 100644 0001-Silence-autoconf-2.28-warnings.patch create mode 100644 0001-sss_client-avoid-leaking-file-descriptors.patch diff --git a/0001-Silence-autoconf-2.28-warnings.patch b/0001-Silence-autoconf-2.28-warnings.patch new file mode 100644 index 0000000..ae9a899 --- /dev/null +++ b/0001-Silence-autoconf-2.28-warnings.patch @@ -0,0 +1,34 @@ +From 90fc734631c26c762cc87bd0cd90a8e6b3ee9e95 Mon Sep 17 00:00:00 2001 +From: Jakub Hrozek +Date: Fri, 29 Jul 2011 09:51:23 +0200 +Subject: [PATCH] Silence autoconf 2.28 warnings + +--- + configure.ac | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index ec29cb7..d79ccfd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -177,13 +177,13 @@ 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, ++ sss_client_cv_attribute_destructor, + [AC_COMPILE_IFELSE( +- [__attribute__((destructor)) static void cleanup(void) { }], +- sss_client_attribute_destructor=yes) ++ [AC_LANG_SOURCE([__attribute__((destructor)) static void cleanup(void) { }])], ++ sss_client_cv_attribute_destructor=yes) + ]) + +-if test x"$sss_client_attribute_destructor" = xyes ; then ++if test x"$sss_client_cv_attribute_destructor" = xyes ; then + AC_DEFINE(HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR, 1, + [whether compiler supports __attribute__((destructor))]) + fi +-- +1.7.6 + diff --git a/0001-sss_client-avoid-leaking-file-descriptors.patch b/0001-sss_client-avoid-leaking-file-descriptors.patch new file mode 100644 index 0000000..5ae260a --- /dev/null +++ b/0001-sss_client-avoid-leaking-file-descriptors.patch @@ -0,0 +1,55 @@ +>From b28d5e5f7eddf504cbe36cff1ddba5b240822668 Mon Sep 17 00:00:00 2001 +From: Simo Sorce +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 + diff --git a/sssd.changes b/sssd.changes index c18bd02..f02f6fa 100644 --- a/sssd.changes +++ b/sssd.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jul 29 10:39:51 UTC 2011 - jengelh@medozas.de + +- Add patches to fix an fd leak in sssd_pam + ------------------------------------------------------------------- Thu Jul 28 10:03:32 UTC 2011 - jengelh@medozas.de diff --git a/sssd.spec b/sssd.spec index e5b0d6c..aa356a2 100644 --- a/sssd.spec +++ b/sssd.spec @@ -26,6 +26,8 @@ License: GPLv3+ and LGPLv3+ Url: https://fedorahosted.org/sssd/ Source0: %{name}-%{version}.tar.bz2 Source1: baselibs.conf +Patch1: 0001-sss_client-avoid-leaking-file-descriptors.patch +Patch2: 0001-Silence-autoconf-2.28-warnings.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define servicename sssd @@ -109,6 +111,7 @@ Security Services Daemon (sssd). %prep %setup -q +%patch -P 1 -P 2 -p1 %build autoreconf