From 5a56c7c6ee79ab6d9706be333a64c2c29b90e668 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 28 Jan 2015 11:22:49 +0100 Subject: 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 --- src/providers/ldap/ldap_id_cleanup.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c index dd1e2d7d..171c9b0a 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; } -- cgit