summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_id.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-10-10 19:21:07 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-25 19:55:07 +0200
commit64f615974a57e50124a7186ee8e8d14a78d3304d (patch)
treeeafe1912cbd6903696d0839320e4d9568c23bcd0 /src/providers/ldap/ldap_id.c
parent8b64ca35eb73667a589067788a6f9fb1f7d281c1 (diff)
downloadsssd-64f615974a57e50124a7186ee8e8d14a78d3304d.tar.gz
sssd-64f615974a57e50124a7186ee8e8d14a78d3304d.tar.xz
sssd-64f615974a57e50124a7186ee8e8d14a78d3304d.zip
LDAP: Delete entry by SID if not found
In case the entry was deleted from the server, the search didn't notice and kept returning the cached data.
Diffstat (limited to 'src/providers/ldap/ldap_id.c')
-rw-r--r--src/providers/ldap/ldap_id.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index 9fd95ce79..624533301 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -1553,12 +1553,28 @@ static void get_user_and_group_users_done(struct tevent_req *subreq)
ret = users_get_recv(subreq, &state->dp_error, &state->sdap_ret);
talloc_zfree(subreq);
- if (ret == EOK) { /* Matching user found */
- tevent_req_done(req);
- } else {
+ if (ret != EOK) {
tevent_req_error(req, ret);
+ return;
}
+ if (state->sdap_ret == ENOENT) {
+ /* The search ran to completion, but nothing was found.
+ * Delete the existing entry, if any. */
+ ret = sysdb_delete_by_sid(state->sysdb, state->domain,
+ state->filter_val);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, ("Could not delete entry by SID!\n"));
+ tevent_req_error(req, ret);
+ return;
+ }
+ } else if (state->sdap_ret != EOK) {
+ tevent_req_error(req, EIO);
+ return;
+ }
+
+ /* Both ret and sdap->ret are EOK. Matching user found */
+ tevent_req_done(req);
return;
}