From 37e7cf118e33725c00c4fb6bc685bd348a032177 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 May 2012 16:34:31 +1000 Subject: [PATCH] libads: Do not use alarm() to attempt to time out LDAP calls A properly implemented socket-using library will not terminate the ldap search simply because the process got a signal. Just use the timeout parameter instead. Andrew Bartlett --- source3/libads/ldap.c | 20 -------------------- 1 files changed, 0 insertions(+), 20 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 70dad2f..9849542 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -143,37 +143,17 @@ static int ldap_search_with_timeout(LDAP *ld, int result; /* Setup timeout for the ldap_search_ext_s call - local and remote. */ - gotalarm = 0; if (to) { timeout.tv_sec = to; timeout.tv_usec = 0; timeout_ptr = &timeout; - - /* Setup alarm timeout. */ - CatchSignal(SIGALRM, gotalarm_sig); - /* Make the alarm time one second beyond - the timout we're setting for the - remote search timeout, to allow that - to fire in preference. */ - alarm(to+1); - /* End setup timeout. */ } - result = ldap_search_ext_s(ld, base, scope, filter, attrs, attrsonly, sctrls, cctrls, timeout_ptr, sizelimit, res); - if (to) { - /* Teardown alarm timeout. */ - CatchSignal(SIGALRM, SIG_IGN); - alarm(0); - } - - if (gotalarm != 0) - return LDAP_TIMELIMIT_EXCEEDED; - /* * A bug in OpenLDAP means ldap_search_ext_s can return * LDAP_SUCCESS but with a NULL res pointer. Cope with -- 1.7.7.6