Mercurial > dovecot > core-2.2
changeset 18354:fe05443b3cd6
auth ldap: Include LDAP config path in all fatal errors.
Also moved all such error checks to db_ldap_init().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 16 Mar 2015 22:46:16 +0200 |
parents | 3d8a054a93a9 |
children | 8c77d80e014c |
files | src/auth/db-ldap.c |
diffstat | 1 files changed, 17 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/db-ldap.c Mon Mar 16 13:54:50 2015 +0200 +++ b/src/auth/db-ldap.c Mon Mar 16 22:46:16 2015 +0200 @@ -1139,8 +1139,7 @@ if (ldap_initialize(&conn->ld, conn->set.uris) != LDAP_SUCCESS) conn->ld = NULL; #else - i_fatal("LDAP: Your LDAP library doesn't support " - "'uris' setting, use 'hosts' instead."); + i_unreached(); /* already checked at init */ #endif } else conn->ld = ldap_init(conn->set.hosts, LDAP_PORT); @@ -1167,8 +1166,7 @@ return -1; } #else - i_error("LDAP: Your LDAP library doesn't support TLS"); - return -1; + i_unreached(); /* already checked at init */ #endif } @@ -1191,7 +1189,7 @@ if (db_ldap_connect_finish(conn, ret) < 0) return -1; #else - i_fatal("LDAP: sasl_bind=yes but no SASL support compiled in"); + i_unreached(); /* already checked at init */ #endif conn->conn_state = LDAP_CONN_STATE_BOUND_DEFAULT; } else { @@ -1777,23 +1775,31 @@ i_fatal("ldap %s: %s", config_path, error); if (conn->set.base == NULL) - i_fatal("LDAP: No base given"); + i_fatal("LDAP %s: No base given", config_path); if (conn->set.uris == NULL && conn->set.hosts == NULL) - i_fatal("LDAP: No uris or hosts set"); + i_fatal("LDAP %s: No uris or hosts set", config_path); #ifndef LDAP_HAVE_INITIALIZE if (conn->set.uris != NULL) { - i_fatal("LDAP: Dovecot compiled without support for LDAP uris " - "(ldap_initialize not found)"); + i_fatal("LDAP %s: uris set, but Dovecot compiled without support for LDAP uris " + "(ldap_initialize() not supported by LDAP library)", config_path); } #endif +#ifndef LDAP_HAVE_START_TLS_S + if (conn->set.tls) + i_fatal("LDAP %s: tls=yes, but your LDAP library doesn't support TLS", config_path); +#endif +#ifndef HAVE_LDAP_SASL + if (conn->set.sasl_bind) + i_fatal("LDAP: sasl_bind=yes but no SASL support compiled in"); +#endif if (*conn->set.ldaprc_path != '\0') { str = getenv("LDAPRC"); if (str != NULL && strcmp(str, conn->set.ldaprc_path) != 0) { - i_fatal("LDAP: Multiple different ldaprc_path " + i_fatal("LDAP %s: Multiple different ldaprc_path " "settings not allowed (%s and %s)", - str, conn->set.ldaprc_path); + config_path, str, conn->set.ldaprc_path); } env_put(t_strconcat("LDAPRC=", conn->set.ldaprc_path, NULL)); }