From: Volker Lendecke Date: Mon, 10 May 2010 10:05:01 +0000 (+0200) Subject: libwbclient: Fix a fd-leak at dlclose-time X-Git-Tag: samba-3.6.0pre1~2130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8d91ae8e6b4b813c0479f09be9e090aff047a9;p=thirdparty%2Fsamba.git libwbclient: Fix a fd-leak at dlclose-time __attribute__((destructor)) makes winbind_close_sock() being called at dlclose() time. Found while testing apache on Linux with mod_auth_pam. Other platforms will have to find a different fix. One possibility would be to always close the socket after each operation, but this badly sucks performance-wise. --- diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c index fbb550f139a..9a3788a0722 100644 --- a/nsswitch/wb_common.c +++ b/nsswitch/wb_common.c @@ -62,6 +62,9 @@ static void init_response(struct winbindd_response *response) /* Close established socket */ +#if HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR +__attribute__((destructor)) +#endif static void winbind_close_sock(void) { if (winbindd_fd != -1) {