From 96d8b77ae6e7d1dd72b9add553935fc4aa6ab2c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= <allopez@redhat.com>
Date: Mon, 9 Oct 2023 10:56:08 +0200
Subject: [PATCH] KCM: Display in the log the limit as set by the user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

max_uid_ccaches is unconditionally incremented by 2 in ccdb_secdb_init()
to create space for some internal entries. We cannot just show this
value as it is not what the user configured.

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>

Reference: https://github.com/SSSD/sssd/commit/96d8b77ae6e7d1dd72b9add553935fc4aa6ab2c5 
Conflict: NA
---
 src/responder/kcm/secrets/secrets.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/responder/kcm/secrets/secrets.c b/src/responder/kcm/secrets/secrets.c
index 4dc748c3b..8f32c63e9 100644
--- a/src/responder/kcm/secrets/secrets.c
+++ b/src/responder/kcm/secrets/secrets.c
@@ -381,11 +381,12 @@ static int local_db_check_peruid_number_of_secrets(TALLOC_CTX *mem_ctx,
         ret = local_db_remove_oldest_expired_secret(res, req);
         if (ret != EOK) {
             if (ret == ERR_NO_MATCHING_CREDS) {
+                /* max_uid_secrets is incremented by 2 for internal entries. */
                 DEBUG(SSSDBG_OP_FAILURE,
                       "Cannot store any more secrets for this client (basedn %s) "
                       "as the maximum allowed limit (%d) has been reached\n",
                       ldb_dn_get_linearized(cli_basedn),
-                      req->quota->max_uid_secrets);
+                      req->quota->max_uid_secrets - 2);
                 ret = ERR_SEC_INVALID_TOO_MANY_SECRETS;
             }
             goto done;
-- 
2.33.0

