summaryrefslogtreecommitdiffstats
path: root/source/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-07-01 16:35:43 +0000
committerJeremy Allison <jra@samba.org>2004-07-01 16:35:43 +0000
commit4d46b4a2c6f58a29ece71c06877c10b827ed6e95 (patch)
tree954486eb1b0fcfa321ace123426f3cbdf2c7ef8b /source/nsswitch
parentc34e695c2a261f2d3348591e977f95dc369a95be (diff)
downloadsamba-4d46b4a2c6f58a29ece71c06877c10b827ed6e95.tar.gz
samba-4d46b4a2c6f58a29ece71c06877c10b827ed6e95.tar.xz
samba-4d46b4a2c6f58a29ece71c06877c10b827ed6e95.zip
r1317: Patch from Joe Meadows "Joe Meadows" <jameadows@webopolis.com> to
add a timeout to the ldap open calls. New parameter, ldap timeout added. Jeremy.
Diffstat (limited to 'source/nsswitch')
-rw-r--r--source/nsswitch/winbindd_rpc.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/source/nsswitch/winbindd_rpc.c b/source/nsswitch/winbindd_rpc.c
index 76688449209..ba24749fbef 100644
--- a/source/nsswitch/winbindd_rpc.c
+++ b/source/nsswitch/winbindd_rpc.c
@@ -707,36 +707,6 @@ done:
#include <ldap.h>
-static SIG_ATOMIC_T gotalarm;
-
-/***************************************************************
- Signal function to tell us we timed out.
-****************************************************************/
-
-static void gotalarm_sig(void)
-{
- gotalarm = 1;
-}
-
-static LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to)
-{
- LDAP *ldp = NULL;
-
- /* Setup timeout */
- gotalarm = 0;
- CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
- alarm(to);
- /* End setup timeout. */
-
- ldp = ldap_open(server, port);
-
- /* Teardown timeout. */
- CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
- alarm(0);
-
- return ldp;
-}
-
static int get_ldap_seq(const char *server, int port, uint32 *seq)
{
int ret = -1;
@@ -749,11 +719,11 @@ static int get_ldap_seq(const char *server, int port, uint32 *seq)
*seq = DOM_SEQUENCE_NONE;
/*
- * 10 second timeout on open. This is needed as the search timeout
+ * Parameterised (5) second timeout on open. This is needed as the search timeout
* doesn't seem to apply to doing an open as well. JRA.
*/
- if ((ldp = ldap_open_with_timeout(server, port, 10)) == NULL)
+ if ((ldp = ldap_open_with_timeout(server, port, lp_ldap_timeout())) == NULL)
return -1;
/* Timeout if no response within 20 seconds. */