summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-07-02 08:14:58 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-07-09 15:00:57 -0400
commit2ee34809cb2d580ac7a3e1fd666b005543e3aa8d (patch)
tree93a09887d8589a1582e3c6f624ca8f4dcc241ae0
parent8571644422d36fac63d2e351936433f1fb8856c7 (diff)
downloadsssd-2ee34809cb2d580ac7a3e1fd666b005543e3aa8d.tar.gz
sssd-2ee34809cb2d580ac7a3e1fd666b005543e3aa8d.tar.bz2
sssd-2ee34809cb2d580ac7a3e1fd666b005543e3aa8d.zip
Log TLS errors to syslog
Also adds support for detecting LDAPS errors by adding a check for SDAP_DIAGNOSTIC_MESSAGE after ldap_search_ext()
-rw-r--r--src/providers/ldap/sdap_async.c18
-rw-r--r--src/providers/ldap/sdap_async_connection.c6
2 files changed, 23 insertions, 1 deletions
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index 77b7b5e1..0f260242 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -764,7 +764,9 @@ struct tevent_req *sdap_get_generic_send(TALLOC_CTX *memctx,
{
struct tevent_req *req = NULL;
struct sdap_get_generic_state *state = NULL;
+ char *errmsg;
int lret;
+ int optret;
int ret;
int msgid;
@@ -805,7 +807,21 @@ struct tevent_req *sdap_get_generic_send(TALLOC_CTX *memctx,
DEBUG(3, ("ldap_search_ext failed: %s\n", ldap_err2string(lret)));
if (lret == LDAP_SERVER_DOWN) {
ret = ETIMEDOUT;
- } else {
+ optret = ldap_get_option(state->sh->ldap,
+ SDAP_DIAGNOSTIC_MESSAGE,
+ (void*)&errmsg);
+ if (optret == LDAP_SUCCESS) {
+ DEBUG(3, ("Connection error: %s\n", errmsg));
+ sss_log(SSS_LOG_ERR, "LDAP connection error: %s", errmsg);
+ ldap_memfree(errmsg);
+ }
+ else {
+ sss_log(SSS_LOG_ERR, "LDAP connection error, %s",
+ ldap_err2string(lret));
+ }
+ }
+
+ else {
ret = EIO;
}
goto fail;
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index 3770fea0..806bd5fe 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -154,11 +154,14 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx,
DEBUG(3, ("ldap_start_tls failed: [%s] [%s]\n",
ldap_err2string(lret),
errmsg));
+ sss_log(SSS_LOG_ERR, "Could not start TLS. %s", errmsg);
ldap_memfree(errmsg);
}
else {
DEBUG(3, ("ldap_start_tls failed: [%s]\n",
ldap_err2string(lret)));
+ sss_log(SSS_LOG_ERR, "Could not start TLS. "
+ "Check for certificate issues.");
}
goto fail;
}
@@ -237,11 +240,14 @@ static void sdap_connect_done(struct sdap_op *op,
DEBUG(3, ("ldap_install_tls failed: [%s] [%s]\n",
ldap_err2string(ret),
tlserr));
+ sss_log(SSS_LOG_ERR, "Could not start TLS encryption. %s", tlserr);
ldap_memfree(tlserr);
}
else {
DEBUG(3, ("ldap_install_tls failed: [%s]\n",
ldap_err2string(ret)));
+ sss_log(SSS_LOG_ERR, "Could not start TLS encryption. "
+ "Check for certificate issues.");
}
state->result = ret;