From dd4996a83b84e1fe41d3dd4ed7f39a72fd5f8b01 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Tue, 20 May 2008 01:28:54 +0000 Subject: [PATCH] ITS#5507 --- CHANGES | 1 + libraries/libldap/os-ip.c | 6 ++++++ libraries/libldap/os-local.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/CHANGES b/CHANGES index 5df80a32e3..a26ede6dfb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ OpenLDAP 2.3 Change Log OpenLDAP 2.3.42 Release (2008/05/15) + Fixed libldap file descriptor leak with SELinux (ITS#5507) Fixed slapd abstract objectClass inheritance check (ITS#5474) Fixed slapd connection handling (ITS#5469) Fixed slapd delta-syncrepl refresh mode (ITS#5376) diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 42605204da..15dd4372dc 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -36,6 +36,9 @@ #ifdef HAVE_IO_H #include #endif /* HAVE_IO_H */ +#ifdef HAVE_FCNTL_H +#include +#endif #include "ldap-int.h" @@ -110,6 +113,9 @@ ldap_int_socket(LDAP *ld, int family, int type ) { ber_socket_t s = socket(family, type, 0); osip_debug(ld, "ldap_new_socket: %d\n",s,0,0); +#ifdef FD_CLOEXEC + fcntl(s, F_SETFD, FD_CLOEXEC); +#endif return ( s ); } diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 381220b5b6..9ed4984cf9 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -47,6 +47,9 @@ #ifdef HAVE_IO_H #include #endif /* HAVE_IO_H */ +#ifdef HAVE_FCNTL_H +#include +#endif #include "ldap-int.h" #include "ldap_defaults.h" @@ -89,6 +92,9 @@ ldap_pvt_socket(LDAP *ld) { ber_socket_t s = socket(PF_LOCAL, SOCK_STREAM, 0); oslocal_debug(ld, "ldap_new_socket: %d\n",s,0,0); +#ifdef FD_CLOEXEC + fcntl(s, F_SETFD, FD_CLOEXEC); +#endif return ( s ); } -- 2.47.2