diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-08-13 08:45:24 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-08-13 08:45:24 +0300 |
commit | 784c724ff46f564d4313c2a6d8197922959eb09d (patch) | |
tree | fdf177375bedfbe2f438c84d2fd46b32daed9491 /libmu_auth | |
parent | 3f63391c6ddb872bd6cb78662a24c5adade4a59c (diff) | |
download | mailutils-784c724ff46f564d4313c2a6d8197922959eb09d.tar.gz mailutils-784c724ff46f564d4313c2a6d8197922959eb09d.tar.bz2 |
Bugfix in LDAP code.
* libmu_auth/ldap.c (_mu_conn_setup): Set protocol version
number before trying to initialize TLS. Provide a detailed
diagnostics.
Diffstat (limited to 'libmu_auth')
-rw-r--r-- | libmu_auth/ldap.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libmu_auth/ldap.c b/libmu_auth/ldap.c index 2b7aff270..4b9f5d1f6 100644 --- a/libmu_auth/ldap.c +++ b/libmu_auth/ldap.c @@ -244,18 +244,28 @@ _mu_conn_setup (LDAP **pld) } free (ldapuri); + ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &protocol); + if (ldap_param.tls) { rc = ldap_start_tls_s (ld, NULL, NULL); if (rc != LDAP_SUCCESS) { + char *msg = NULL; + ldap_get_option (ld, + LDAP_OPT_DIAGNOSTIC_MESSAGE, + (void*)&msg); + mu_error (_("ldap_start_tls failed: %s"), ldap_err2string (rc)); + mu_error (_("TLS diagnostics: %s"), msg); + ldap_memfree (msg); + + ldap_unbind_ext (ld, NULL, NULL); + return 1; } } - ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &protocol); - /* FIXME: Timeouts, SASL, etc. */ *pld = ld; return 0; |