summaryrefslogtreecommitdiff
path: root/src/providers/ldap/ldap_id_services.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-06-04 15:15:24 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-07 00:14:13 +0200
commitca344fdecdf127c80ad1074047aeba21e1165313 (patch)
tree635f018041a1efca22dd16c5b5cf7c86c5002b70 /src/providers/ldap/ldap_id_services.c
parent749cfb5d3270b5daf389d51a0dbd3fd2aec6e05d (diff)
downloadsssd-ca344fdecdf127c80ad1074047aeba21e1165313.tar.gz
sssd-ca344fdecdf127c80ad1074047aeba21e1165313.tar.bz2
sssd-ca344fdecdf127c80ad1074047aeba21e1165313.zip
LDAP: return sdap search return code to ID
By default, the LDAP searches delete the entry from cache if it wasn't found during a search. But if a search wants to try both Global Catalog and LDAP, for example, it might be beneficial to have an option to only delete the entry from cache after the last operation fails to prevent unnecessary memberof operations for example.
Diffstat (limited to 'src/providers/ldap/ldap_id_services.c')
-rw-r--r--src/providers/ldap/ldap_id_services.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/providers/ldap/ldap_id_services.c b/src/providers/ldap/ldap_id_services.c
index 8b331cac..1f3fd804 100644
--- a/src/providers/ldap/ldap_id_services.c
+++ b/src/providers/ldap/ldap_id_services.c
@@ -48,6 +48,8 @@ struct sdap_services_get_state {
int filter_type;
int dp_error;
+ int sdap_ret;
+ bool noexist_delete;
};
static errno_t
@@ -65,7 +67,8 @@ services_get_send(TALLOC_CTX *mem_ctx,
struct sdap_id_conn_ctx *conn,
const char *name,
const char *protocol,
- int filter_type)
+ int filter_type,
+ bool noexist_delete)
{
errno_t ret;
struct tevent_req *req;
@@ -87,6 +90,7 @@ services_get_send(TALLOC_CTX *mem_ctx,
state->name = name;
state->protocol = protocol;
state->filter_type = filter_type;
+ state->noexist_delete = noexist_delete;
state->op = sdap_id_op_create(state, state->conn->conn_cache);
if (!state->op) {
@@ -237,6 +241,7 @@ services_get_done(struct tevent_req *subreq)
/* Return to the mainloop to retry */
return;
}
+ state->sdap_ret = ret;
/* An error occurred. */
if (ret && ret != ENOENT) {
@@ -245,7 +250,7 @@ services_get_done(struct tevent_req *subreq)
return;
}
- if (ret == ENOENT) {
+ if (ret == ENOENT && state->noexist_delete == true) {
/* Ensure that this entry is removed from the sysdb */
switch(state->filter_type) {
case BE_FILTER_NAME:
@@ -283,7 +288,7 @@ services_get_done(struct tevent_req *subreq)
}
errno_t
-services_get_recv(struct tevent_req *req, int *dp_error_out)
+services_get_recv(struct tevent_req *req, int *dp_error_out, int *sdap_ret)
{
struct sdap_services_get_state *state =
tevent_req_data(req, struct sdap_services_get_state);
@@ -292,6 +297,10 @@ services_get_recv(struct tevent_req *req, int *dp_error_out)
*dp_error_out = state->dp_error;
}
+ if (sdap_ret) {
+ *sdap_ret = state->sdap_ret;
+ }
+
TEVENT_REQ_RETURN_ON_ERROR(req);
return EOK;