From a540f914c8de598ef03e388389b613cc0d6e9cfc Mon Sep 17 00:00:00 2001 From: Alexey Tikhonov Date: Thu, 20 Jul 2023 15:16:54 +0200 Subject: [PATCH] TOOLS: get rid of strings duplications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Alejandro López Reviewed-by: Pavel Březina --- .../alltests/test_config_validation.py | 3 +-- src/tools/sssctl/sssctl_config.c | 21 ++----------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/tests/multihost/alltests/test_config_validation.py b/src/tests/multihost/alltests/test_config_validation.py index 95f2ea99bb8..f30ee27a00e 100644 --- a/src/tests/multihost/alltests/test_config_validation.py +++ b/src/tests/multihost/alltests/test_config_validation.py @@ -555,8 +555,7 @@ def test_0028_bz1723273(self, multihost, backupsssdconf): result = sssctl_check.stdout_text.strip() rm_dir = 'rm -rf /tmp/test' multihost.client[0].run_command(rm_dir, raiseonerr=False) - assert 'File ownership and permissions check failed. Expected ' \ - 'root:root and 0600' in result and \ + assert 'File ownership and permissions check failed' in result and \ sssctl_check.returncode == 1 @pytest.mark.tier1 diff --git a/src/tools/sssctl/sssctl_config.c b/src/tools/sssctl/sssctl_config.c index f00915125fd..8f6e139875f 100644 --- a/src/tools/sssctl/sssctl_config.c +++ b/src/tools/sssctl/sssctl_config.c @@ -114,8 +114,8 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline, config_path, config_snippet_path); - if (ret == ERR_INI_OPEN_FAILED) { - PRINT("Failed to open %s\n", config_path); + if (ret != EOK) { + PRINT("Failed to read '%s': %s\n", config_path, sss_strerror(ret)); goto done; } @@ -123,23 +123,6 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline, PRINT("File %1$s does not exist.\n", config_path); } - if (ret == ERR_INI_INVALID_PERMISSION) { - PRINT("File ownership and permissions check failed. " - "Expected root:root and 0600.\n"); - goto done; - } - - if (ret == ERR_INI_PARSE_FAILED) { - PRINT("Failed to load configuration from %s.\n", - config_path); - goto done; - } - - if (ret == ERR_INI_ADD_SNIPPETS_FAILED) { - PRINT("Error while reading configuration directory.\n"); - goto done; - } - /* Used snippet files */ ra_success = sss_ini_get_ra_success_list(init_data); num_ra_success = ref_array_len(ra_success);