summaryrefslogtreecommitdiffstats
path: root/source/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
commit2dd7c64fa8845fe502789068b877f5eaf060afc7 (patch)
treea7e02aaf22bccfcd04652d6040db39c2ed01445d /source/libads
parent9ca1505d44e2c4459487c8e2f943a861e2dffb1e (diff)
downloadsamba-2dd7c64fa8845fe502789068b877f5eaf060afc7.tar.gz
samba-2dd7c64fa8845fe502789068b877f5eaf060afc7.tar.xz
samba-2dd7c64fa8845fe502789068b877f5eaf060afc7.zip
When running with debug level > 10, dump ads_struct in ads_connect().
Guenther
Diffstat (limited to 'source/libads')
-rw-r--r--source/libads/ldap.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 28bc7793d72..7b0adc2fc33 100644
--- a/source/libads/ldap.c
+++ b/source/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;
}
/**