summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-04 13:24:41 -0800
committerJeremy Allison <jra@samba.org>2008-01-04 13:24:41 -0800
commitfadf9cc1ca1735471e2b3fdc111dbcb8de9fdcbe (patch)
treee240aa29b0ed17773ac0f6f8a12e3826173d5a9d
parent68b296510827c4d40a06ab16c6cfee883bc6bc1d (diff)
parentb54310cbaa9584a46decfa2a5bc4bb2a72381a98 (diff)
downloadsamba-fadf9cc1ca1735471e2b3fdc111dbcb8de9fdcbe.tar.gz
samba-fadf9cc1ca1735471e2b3fdc111dbcb8de9fdcbe.tar.bz2
samba-fadf9cc1ca1735471e2b3fdc111dbcb8de9fdcbe.zip
Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
(This used to be commit 3a62a177ba758b325ab98e9d77d302bc382e0df8)
-rw-r--r--source3/libads/ldap.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 843d57988c..44560c852d 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -52,10 +52,14 @@ static void gotalarm_sig(void)
gotalarm = 1;
}
- LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to)
+LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to)
{
LDAP *ldp = NULL;
+
+ DEBUG(10, ("Opening connection to LDAP server '%s:%d', timeout "
+ "%u seconds\n", server, port, to));
+
/* Setup timeout */
gotalarm = 0;
CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
@@ -65,8 +69,10 @@ static void gotalarm_sig(void)
ldp = ldap_open(server, port);
if (ldp == NULL) {
- DEBUG(2,("Could not open LDAP connection to %s:%d: %s\n",
+ DEBUG(2,("Could not open connection to LDAP server %s:%d: %s\n",
server, port, strerror(errno)));
+ } else {
+ DEBUG(10, ("Connected to LDAP server '%s:%d'\n", server, port));
}
/* Teardown timeout. */
@@ -400,7 +406,7 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
got_connection:
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
- DEBUG(3,("Connected to LDAP server %s\n", addr));
+ DEBUG(3,("Successfully contacted LDAP server %s\n", addr));
if (!ads->auth.user_name) {
/* Must use the userPrincipalName value here or sAMAccountName
@@ -442,11 +448,12 @@ got_connection:
/* Otherwise setup the TCP LDAP session */
- if ( (ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name,
- LDAP_PORT, lp_ldap_timeout())) == NULL )
- {
+ ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name,
+ LDAP_PORT, lp_ldap_timeout());
+ if (ads->ldap.ld == NULL) {
return ADS_ERROR(LDAP_OPERATIONS_ERROR);
}
+ DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name));
/* cache the successful connection for workgroup and realm */
if (ads_closest_dc(ads)) {