summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-01-31 01:50:49 +0100
committerGünther Deschner <gd@samba.org>2008-01-31 11:05:25 +0100
commit6c764172e541decc0fa4b0314f4d26ea859c0dfe (patch)
treee5ece7605fc442767c20475b9d73674277c46812 /source3/libads
parent43ac44e3cff5ee7a7542214a678ddcb80a3195ca (diff)
downloadsamba-6c764172e541decc0fa4b0314f4d26ea859c0dfe.tar.gz
samba-6c764172e541decc0fa4b0314f4d26ea859c0dfe.tar.bz2
samba-6c764172e541decc0fa4b0314f4d26ea859c0dfe.zip
When running with debug level > 10, dump ads_struct in ads_connect().
Guenther (This used to be commit 2dd7c64fa8845fe502789068b877f5eaf060afc7)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ldap.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 28bc7793d7..7b0adc2fc3 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -391,6 +391,13 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
/* try with a user specified server */
+ if (DEBUGLEVEL >= 11) {
+ char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads);
+ DEBUG(11,("ads_connect: entering\n"));
+ DEBUGADD(11,("%s\n", s));
+ TALLOC_FREE(s);
+ }
+
if (ads->server.ldap_server &&
ads_try_connect(ads, ads->server.ldap_server)) {
goto got_connection;
@@ -401,7 +408,8 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
goto got_connection;
}
- return ADS_ERROR_NT(ntstatus);
+ status = ADS_ERROR_NT(ntstatus);
+ goto out;
got_connection:
@@ -438,12 +446,14 @@ got_connection:
/* If the caller() requested no LDAP bind, then we are done */
if (ads->auth.flags & ADS_AUTH_NO_BIND) {
- return ADS_SUCCESS;
+ status = ADS_SUCCESS;
+ goto out;
}
ads->ldap.mem_ctx = talloc_init("ads LDAP connection memory");
if (!ads->ldap.mem_ctx) {
- return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+ status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+ goto out;
}
/* Otherwise setup the TCP LDAP session */
@@ -451,7 +461,8 @@ got_connection:
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);
+ status = ADS_ERROR(LDAP_OPERATIONS_ERROR);
+ goto out;
}
DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name));
@@ -466,27 +477,40 @@ got_connection:
status = ADS_ERROR(smb_ldap_start_tls(ads->ldap.ld, version));
if (!ADS_ERR_OK(status)) {
- return status;
+ goto out;
}
/* fill in the current time and offsets */
status = ads_current_time( ads );
if ( !ADS_ERR_OK(status) ) {
- return status;
+ goto out;
}
/* Now do the bind */
if (ads->auth.flags & ADS_AUTH_ANON_BIND) {
- return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, NULL, NULL));
+ status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, NULL, NULL));
+ goto out;
}
if (ads->auth.flags & ADS_AUTH_SIMPLE_BIND) {
- return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, ads->auth.user_name, ads->auth.password));
+ status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, ads->auth.user_name, ads->auth.password));
+ goto out;
+ }
+
+ status = ads_sasl_bind(ads);
+
+ out:
+ if (DEBUGLEVEL >= 11) {
+ char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads);
+ DEBUG(11,("ads_connect: leaving with: %s\n",
+ ads_errstr(status)));
+ DEBUGADD(11,("%s\n", s));
+ TALLOC_FREE(s);
}
- return ads_sasl_bind(ads);
+ return status;
}
/**