dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0038-sssctl-sssctl-config-check-alternative-snippet-dir.patch

377657
From 72b8e02c77f0b0b7e36663fa3bd3fd6987ea1b80 Mon Sep 17 00:00:00 2001
377657
From: Tomas Halman <thalman@redhat.com>
377657
Date: Mon, 13 Jul 2020 18:11:40 +0200
377657
Subject: [PATCH] sssctl: sssctl config-check alternative snippet dir
377657
377657
The sssctl config-check now allows to specify not only alternative
377657
config file but also snippet dir.
377657
377657
    sssctl config-check -c ./sssd.conf -s /etc/sssd/conf.d
377657
377657
Configuration snippets are still looked up in the same place under
377657
conf.d directory by default. It would be in ./conf.d/ for the example
377657
above.
377657
377657
Resolves:
377657
https://github.com/SSSD/sssd/issues/5142
377657
377657
Reviewed-by: Pawel Polawski <ppolawsk@redhat.com>
377657
---
377657
 src/tools/sssctl/sssctl_config.c | 14 ++++++++++----
377657
 1 file changed, 10 insertions(+), 4 deletions(-)
377657
377657
diff --git a/src/tools/sssctl/sssctl_config.c b/src/tools/sssctl/sssctl_config.c
377657
index de9f3de6e..db4aeeae4 100644
377657
--- a/src/tools/sssctl/sssctl_config.c
377657
+++ b/src/tools/sssctl/sssctl_config.c
377657
@@ -75,6 +75,11 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
377657
     struct poptOption long_options[] = {
377657
         {"config", 'c', POPT_ARG_STRING, &config_path,
377657
             0, _("Specify a non-default config file"), NULL},
377657
+        {"snippet", 's', POPT_ARG_STRING, &config_snippet_path,
377657
+            0, _("Specify a non-default snippet dir (The default is to look in "
377657
+                 "the same place where the main config file is located. For "
377657
+                 "example if the config is set to \"/my/path/sssd.conf\", "
377657
+                 "the snippet dir \"/my/path/conf.d\" is used)"), NULL},
377657
         POPT_TABLEEND
377657
     };
377657
 
377657
@@ -92,16 +97,17 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
377657
         goto done;
377657
     }
377657
 
377657
-    if (config_path != NULL) {
377657
+    if (config_path == NULL) {
377657
+        config_path = SSSD_CONFIG_FILE;
377657
+    }
377657
+
377657
+    if (config_snippet_path == NULL) {
377657
         config_snippet_path = sssctl_config_snippet_path(tmp_ctx, config_path);
377657
         if (config_snippet_path == NULL) {
377657
             DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create snippet path\n");
377657
             ret = ENOMEM;
377657
             goto done;
377657
         }
377657
-    } else {
377657
-        config_path = SSSD_CONFIG_FILE;
377657
-        config_snippet_path = CONFDB_DEFAULT_CONFIG_DIR;
377657
     }
377657
 
377657
     ret = sss_ini_read_sssd_conf(init_data,
377657
-- 
377657
2.21.3
377657