Blame SOURCES/0093-RESPONDER-fixed-condition-in-responder_idle_handler.patch

5ddef6
From f37e15e9134ff22d03c4997fd1c76754b67d3539 Mon Sep 17 00:00:00 2001
5ddef6
From: Alexey Tikhonov <atikhono@redhat.com>
5ddef6
Date: Tue, 19 Jul 2022 14:28:35 +0200
5ddef6
Subject: [PATCH] RESPONDER: fixed condition in responder_idle_handler()
5ddef6
MIME-Version: 1.0
5ddef6
Content-Type: text/plain; charset=UTF-8
5ddef6
Content-Transfer-Encoding: 8bit
5ddef6
5ddef6
Man page says about `responder_idle_timeout` the following:
5ddef6
```
5ddef6
number of seconds that an SSSD responder process can be up without being used.
5ddef6
```
5ddef6
Idle timer fires every responder_idle_timeout/2 seconds and checks if
5ddef6
current_time > (last_request_time + timeout).
5ddef6
In a trivial case - no additional requests after initial one / startup -
5ddef6
condition will became 'true' only when timer fires for a 3rd time, i.e.
5ddef6
after 3*(timeout/2) seconds. This contradicts man page statement.
5ddef6
5ddef6
This patch changes condition to '>=' so that responder would be terminated
5ddef6
in 2*(timeout/2) seconds.
5ddef6
5ddef6
Reviewed-by: Alejandro Lopez <allopez@redhat.com>
5ddef6
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
5ddef6
(cherry picked from commit 473752e261d8d166b16f95fe4ddc8d320ae0faf4)
5ddef6
---
5ddef6
 src/responder/common/responder_common.c | 2 +-
5ddef6
 1 file changed, 1 insertion(+), 1 deletion(-)
5ddef6
5ddef6
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
5ddef6
index fb2a31bb0..4c6445311 100644
5ddef6
--- a/src/responder/common/responder_common.c
5ddef6
+++ b/src/responder/common/responder_common.c
5ddef6
@@ -374,7 +374,7 @@ static void responder_idle_handler(struct tevent_context *ev,
5ddef6
         goto end;
5ddef6
     }
5ddef6
 
5ddef6
-    if ((now - rctx->last_request_time) > rctx->idle_timeout) {
5ddef6
+    if ((now - rctx->last_request_time) >= rctx->idle_timeout) {
5ddef6
         /* This responder is idle. Terminate it */
5ddef6
         DEBUG(SSSDBG_TRACE_INTERNAL,
5ddef6
               "Terminating idle responder [%p]\n", rctx);
5ddef6
-- 
5ddef6
2.37.3
5ddef6