Blob Blame History Raw
From 24a6888e38fb9d11bf173eb06e400678388bce49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Tue, 3 Nov 2020 13:35:33 +0100
Subject: [PATCH 16/19] secrets: fix may_payload_size exceeded debug message

The unit is bytes (B) not bits (b) and the conversion of the input
payload size to KiB was wrong (multiplying bytes * 1024).
---
 src/util/secrets/secrets.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/util/secrets/secrets.c b/src/util/secrets/secrets.c
index 6fd9e0af5bd9986052efdb8e244ddeb9e4fa50ff..1000757228bea75bb2d5c48aceb717c9bfe35ffb 100644
--- a/src/util/secrets/secrets.c
+++ b/src/util/secrets/secrets.c
@@ -399,14 +399,14 @@ static int local_check_max_payload_size(struct sss_sec_req *req,
         return EOK;
     }
 
-    max_payload_size = req->quota->max_payload_size * 1024; /* kb */
+    max_payload_size = req->quota->max_payload_size * 1024; /* KiB */
     if (payload_size > max_payload_size) {
         DEBUG(SSSDBG_OP_FAILURE,
-              "Secrets' payload size [%d kb (%d)] exceeds the maximum allowed "
-              "payload size [%d kb (%d)]\n",
-              payload_size * 1024, /* kb */
+              "Secrets' payload size [%d KiB (%d B)] exceeds the maximum "
+              "allowed payload size [%d KiB (%d B)]\n",
+              payload_size / 1024, /* KiB */
               payload_size,
-              req->quota->max_payload_size, /* kb */
+              req->quota->max_payload_size, /* KiB */
               max_payload_size);
 
         return ERR_SEC_PAYLOAD_SIZE_IS_TOO_LARGE;
-- 
2.25.4