From ff672756820f240305aed0a21cb81ef1a338ece5 Mon Sep 17 00:00:00 2001
From: Samuel Cabrero <scabrero@suse.com>
Date: Thu, 12 Mar 2026 11:54:59 +0100
Subject: [PATCH] TOOLS: noisy debug messages when config.ldb does not exist

If sss_tool_confdb_init() fails because config.ldb does not exist yet, it
will print at level 0:

  [sss_cache] [sss_tool_confdb_init] (0x0010): Can't access '/var/lib/sss/db/config.ldb', probably SSSD isn't configured
  Can't find configuration db, was SSSD configured and run?

This is too noisy. For example, if shadow is built with sssd support, adding
a new user will output these messages because useradd will call
sss_cache to invalidate the user cache.

Log with SSSDBG_OP_FAILURE instead of SSSDBG_CRIT_FAILURE.

Signed-off-by: Samuel Cabrero <scabrero@suse.com>
---
 src/tools/common/sss_tools.c | 2 +-
 src/tools/sss_cache.c        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/tools/common/sss_tools.c b/src/tools/common/sss_tools.c
index 236a7498a..c043c5e44 100644
--- a/src/tools/common/sss_tools.c
+++ b/src/tools/common/sss_tools.c
@@ -96,7 +96,7 @@ errno_t sss_tool_confdb_init(TALLOC_CTX *mem_ctx, struct confdb_ctx **_confdb)
     ret = stat(path, &statbuf);
     if (ret != 0) {
         ret = errno;
-        DEBUG(SSSDBG_FATAL_FAILURE,
+        DEBUG(SSSDBG_OP_FAILURE,
               "Can't access '%s', probably SSSD isn't configured\n", path);
         return ret;
     }
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 94af3c3cf..d8e872135 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -650,7 +650,8 @@ static errno_t init_domains(struct cache_tool_ctx *ctx,
 
     ret = sss_tool_confdb_init(ctx, &ctx->confdb);
     if (ret != EOK) {
-        ERROR("Can't find configuration db, was SSSD configured and run?\n");
+        DEBUG(SSSDBG_OP_FAILURE,
+              "Can't find configuration db, was SSSD configured and run?\n");
         return ERR_NO_DOMAIN_ENABLED;
     }
 
-- 
2.53.0

