|
|
bb7cd1 |
From 85b74b966ec1d417ce76b05cbf3351b20c0981b2 Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
bb7cd1 |
Date: Wed, 17 May 2017 15:43:25 +0200
|
|
|
bb7cd1 |
Subject: [PATCH 164/166] ldap: handle certmap errors gracefully
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Currently the LDAP user lookup request errors out if e.g. there is no
|
|
|
bb7cd1 |
matching rule for a certificate. This might cause the related domain to
|
|
|
bb7cd1 |
go offline.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
With this patch the request returns that no user was found for the given
|
|
|
bb7cd1 |
certificate but overall result is that the request finishes
|
|
|
bb7cd1 |
successfully.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Resolves:
|
|
|
bb7cd1 |
https://pagure.io/SSSD/sssd/issue/3405
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/providers/ldap/ldap_id.c | 21 +++++++++++++++++++++
|
|
|
bb7cd1 |
1 file changed, 21 insertions(+)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
|
|
|
bb7cd1 |
index 7400dc1f57e30cc6ae5f939ffa628a1e9dd47e06..557712e8dc2b2bde664b4054fa2f8eb39df84d73 100644
|
|
|
bb7cd1 |
--- a/src/providers/ldap/ldap_id.c
|
|
|
bb7cd1 |
+++ b/src/providers/ldap/ldap_id.c
|
|
|
bb7cd1 |
@@ -258,6 +258,27 @@ struct tevent_req *users_get_send(TALLOC_CTX *memctx,
|
|
|
bb7cd1 |
if (ret != EOK) {
|
|
|
bb7cd1 |
DEBUG(SSSDBG_OP_FAILURE,
|
|
|
bb7cd1 |
"sss_cert_derb64_to_ldap_filter failed.\n");
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ /* Typically sss_cert_derb64_to_ldap_filter() will fail if there
|
|
|
bb7cd1 |
+ * is no mapping rule matching the current certificate. But this
|
|
|
bb7cd1 |
+ * just means that no matching user can be found so we can finish
|
|
|
bb7cd1 |
+ * the request with this result. Even if
|
|
|
bb7cd1 |
+ * sss_cert_derb64_to_ldap_filter() would fail for other reason
|
|
|
bb7cd1 |
+ * there is no need to return an error which might cause the
|
|
|
bb7cd1 |
+ * domain go offline. */
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ if (noexist_delete) {
|
|
|
bb7cd1 |
+ ret = sysdb_remove_cert(state->domain, filter_value);
|
|
|
bb7cd1 |
+ if (ret != EOK) {
|
|
|
bb7cd1 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
bb7cd1 |
+ "Ignoring error while removing user certificate "
|
|
|
bb7cd1 |
+ "[%d]: %s\n", ret, sss_strerror(ret));
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ ret = EOK;
|
|
|
bb7cd1 |
+ state->sdap_ret = ENOENT;
|
|
|
bb7cd1 |
+ state->dp_error = DP_ERR_OK;
|
|
|
bb7cd1 |
goto done;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.4
|
|
|
bb7cd1 |
|