Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions src/tools/sssctl/sssctl_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,6 @@
#include "confdb/confdb.h"



static char *sssctl_config_snippet_path(TALLOC_CTX *ctx, const char *path)
{
char *tmp = NULL;
const char delimiter = '/';
char *dpos = NULL;

tmp = talloc_strdup(ctx, path);
if (!tmp) {
return NULL;
}

dpos = strrchr(tmp, delimiter);
if (dpos != NULL) {
++dpos;
*dpos = '\0';
} else {
*tmp = '\0';
}

return talloc_strdup_append(tmp, CONFDB_DEFAULT_CONFIG_DIR_NAME);
}

errno_t sssctl_config_check(struct sss_cmdline *cmdline,
struct sss_tool_ctx *tool_ctx)
{
Expand Down Expand Up @@ -97,12 +74,7 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
}

if (config_snippet_path == NULL) {
config_snippet_path = sssctl_config_snippet_path(tmp_ctx, config_path);
if (config_snippet_path == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create snippet path\n");
ret = ENOMEM;
goto done;
}
config_snippet_path = CONFDB_DEFAULT_CONFIG_DIR;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. The tools can be given a different config file path (-c /path/to/my/sssd.conf) and the idea here was to have snippet folder /path/to/my/sssd.conf.d. This change, while elegant, breaks this.

While I like it, I'm not sure if we can break it out of a sudden. And if do this, the snippet path should be empty if a non-default config file is provided (otherwise the snippets from default directory would be loaded, which may be unexpected).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SSSD/developers opinions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see the use case now. Someone might want to check a config file + snippets out of the standard directories. I will wait for the feedback before reverting this change.

}

ret = sss_ini_read_sssd_conf(init_data,
Expand All @@ -126,7 +98,7 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
SSSDDATADIR"/cfg_rules.ini",
&strs, &num_errors);
if (ret) {
PRINT("Failed to run validators");
PRINT("Failed to run validators\n");
goto done;
}

Expand Down