summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_id_cleanup.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-01-28 11:22:49 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-02-17 16:04:58 +0100
commit5a56c7c6ee79ab6d9706be333a64c2c29b90e668 (patch)
tree8bbe20c499e07faa99bf86749b1ce434500ee427 /src/providers/ldap/ldap_id_cleanup.c
parenteb85a718f4fd69ea1734b502f3d5f91758bd2020 (diff)
downloadsssd-5a56c7c6ee79ab6d9706be333a64c2c29b90e668.tar.gz
sssd-5a56c7c6ee79ab6d9706be333a64c2c29b90e668.tar.xz
sssd-5a56c7c6ee79ab6d9706be333a64c2c29b90e668.zip
LDAP: Handle ENOENT better in the cleanup task
The cleanup task handled both count=0 and ret=ENOENT separately which makes no sense, the count=0 handler was dead code previously. Set count=0 on ENOENT instead to just bubble through the DEBUG message gracefully as well. Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/providers/ldap/ldap_id_cleanup.c')
-rw-r--r--src/providers/ldap/ldap_id_cleanup.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index dd1e2d7db..171c9b0ae 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -217,13 +217,12 @@ static int cleanup_users(struct sdap_options *opts,
}
ret = sysdb_search_users(tmpctx, dom, subfilter, attrs, &count, &msgs);
- if (ret) {
- if (ret == ENOENT) {
- ret = EOK;
- }
+ if (ret == ENOENT) {
+ count = 0;
+ } else if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_search_users failed: %d\n", ret);
goto done;
}
-
DEBUG(SSSDBG_FUNC_DATA, "Found %zu expired user entries!\n", count);
if (count == 0) {
@@ -345,10 +344,10 @@ static int cleanup_groups(TALLOC_CTX *memctx,
}
ret = sysdb_search_groups(tmpctx, domain, subfilter, attrs, &count, &msgs);
- if (ret) {
- if (ret == ENOENT) {
- ret = EOK;
- }
+ if (ret == ENOENT) {
+ count = 0;
+ } else if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_search_groups failed: %d\n", ret);
goto done;
}