File 0015-SSSCTL-config-check-do-not-return-an-error-if-snippe.patch of Package sssd.42075
From a4f007427674787d622385db156b2cd0c32f0a22 Mon Sep 17 00:00:00 2001
From: Samuel Cabrero <scabrero@suse.com>
Date: Tue, 16 Dec 2025 15:14:13 +0100
Subject: [PATCH] SSSCTL: config-check: do not return an error if snippets
directory does not exists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is a discrepancy between sssd and sssctl config-check regarding
the absence of the snippets directory.
The sssctl config-check command exits with code 1, but sssd does not
consider it a hard error, it just logs a warning and then runs fine.
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 698f992029642c5e3382b0b3ba23bf871d49306c)
---
src/tools/sssctl/sssctl_config.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/tools/sssctl/sssctl_config.c b/src/tools/sssctl/sssctl_config.c
index f00915125..39e3084cc 100644
--- a/src/tools/sssctl/sssctl_config.c
+++ b/src/tools/sssctl/sssctl_config.c
@@ -188,6 +188,18 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
i++;
}
+ /* Match SSSD behavior and do not return an error when the directory
+ * does not exist. */
+ if (num_ra_success == 0 && num_ra_error == 1 &&
+ ref_array_get(ra_error, 0, &msg) != NULL) {
+ char *emsg = talloc_asprintf(tmp_ctx, "Directory %s does not exist.",
+ config_snippet_path);
+ if (strcmp(emsg, msg) == 0) {
+ ret = EOK;
+ goto done;
+ }
+ }
+
if (num_errors != 0 || num_ra_error != 0) {
ret = EINVAL;
} else {
--
2.52.0