>From 257db8f79dcfdf0e4085fcb77e47503f7c38eae8 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 28 Jan 2015 11:22:49 +0100 Subject: [PATCH 2/2] 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. fix --- 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 dd1e2d7dbe562b422eb83cb328a8e3e48524a41d..171c9b0aecd35f3ddabb00e5c260b66981a1d0f4 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; } -- 2.1.0