From eb85a718f4fd69ea1734b502f3d5f91758bd2020 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 28 Jan 2015 11:21:40 +0100 Subject: LDAP: Add better DEBUG messages to the cleanup task Some failures would shortcut to the done handler without telling us anything about why it failed. This commit decorates the cleanup task with more DEBUG statements. Reviewed-by: Pavel Reichl --- src/providers/ldap/ldap_id_cleanup.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c index f78d4b40..dd1e2d7d 100644 --- a/src/providers/ldap/ldap_id_cleanup.c +++ b/src/providers/ldap/ldap_id_cleanup.c @@ -236,6 +236,7 @@ static int cleanup_users(struct sdap_options *opts, * the cleanup in that case */ if (ret != EOK && ret != ENOSYS) { + DEBUG(SSSDBG_CRIT_FAILURE, "get_uid_table failed: %d\n", ret); goto done; } @@ -247,6 +248,7 @@ static int cleanup_users(struct sdap_options *opts, ret = EFAULT; goto done; } + DEBUG(SSSDBG_TRACE_ALL, "Processing user %s\n", name); if (uid_table) { ret = cleanup_users_logged_in(uid_table, msgs[i]); @@ -257,6 +259,8 @@ static int cleanup_users(struct sdap_options *opts, "keeping data\n", name); continue; } else if (ret != ENOENT) { + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot check if user is logged in: %d\n", ret); goto done; } } @@ -265,6 +269,7 @@ static int cleanup_users(struct sdap_options *opts, DEBUG(SSSDBG_TRACE_ALL, "About to delete user %s\n", name); ret = sysdb_delete_user(dom, name, 0); if (ret) { + DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_delete_user failed: %d\n", ret); goto done; } } @@ -300,6 +305,7 @@ static int cleanup_users_logged_in(hash_table_t *table, return ENOENT; } + DEBUG(SSSDBG_OP_FAILURE, "hash_lookup failed: %d\n", ret); return EIO; } @@ -356,6 +362,7 @@ static int cleanup_groups(TALLOC_CTX *memctx, for (i = 0; i < count; i++) { dn = ldb_dn_get_linearized(msgs[i]->dn); if (!dn) { + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot linearize DN!\n"); ret = EFAULT; goto done; } @@ -387,6 +394,8 @@ static int cleanup_groups(TALLOC_CTX *memctx, goto done; } + DEBUG(SSSDBG_TRACE_LIBS, "Searching with: %s\n", subfilter); + ret = sysdb_search_entry(tmpctx, sysdb, base_dn, LDB_SCOPE_SUBTREE, subfilter, NULL, &u_count, &u_msgs); @@ -410,6 +419,8 @@ static int cleanup_groups(TALLOC_CTX *memctx, } } if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to search sysdb using %s: %d\n", subfilter, ret); goto done; } talloc_zfree(u_msgs); -- cgit