Skip to content

Commit

Permalink
CONF: there is no use for CONFDB_FALLBACK_CONFIG
Browse files Browse the repository at this point in the history
since implicit files provider can't be enabled by default anymore.

Resolves: #5022
  • Loading branch information
alexey-tikhonov committed Aug 16, 2023
1 parent 481f6b0 commit b1b755f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 0 additions & 4 deletions src/confdb/confdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
#define CONFDB_DEFAULT_CONFIG_DIR SSSD_CONF_DIR"/"CONFDB_DEFAULT_CONFIG_DIR_NAME
#define SSSD_MIN_ID 1
#define CONFDB_DEFAULT_SHELL_FALLBACK "/bin/sh"
#define CONFDB_FALLBACK_CONFIG \
"[sssd]\n" \
"services = nss\n"


/* Configuration options */

Expand Down
19 changes: 7 additions & 12 deletions src/tools/sssctl/sssctl_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,16 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
config_path,
config_snippet_path);

if (ret != EOK) {
PRINT("Failed to read '%s': %s\n", config_path, sss_strerror(ret));
goto done;
}

if (!sss_ini_exists(init_data)) {
if (ret == ERR_INI_EMPTY_CONFIG) {
PRINT("File %1$s does not exist.\n", config_path);
}

/* Used snippet files */
ra_success = sss_ini_get_ra_success_list(init_data);
num_ra_success = ref_array_len(ra_success);
if ((sss_ini_exists(init_data) == false) && (num_ra_success == 0)) {
PRINT("There is no configuration.\n");
ret = ERR_INI_OPEN_FAILED;
goto done;
}
else if (ret != EOK) {
PRINT("Failed to read '%s': %s\n", config_path, sss_strerror(ret));
goto done;
}

/* Run validators */
ret = sss_ini_call_validators_strs(tmp_ctx, init_data,
Expand Down Expand Up @@ -163,6 +156,8 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
printf("\n");

/* Used snippets */
ra_success = sss_ini_get_ra_success_list(init_data);
num_ra_success = ref_array_len(ra_success);
PRINT("Used configuration snippet files: %zu\n", num_ra_success);

i = 0;
Expand Down
5 changes: 3 additions & 2 deletions src/tools/sssd_check_socket_activated_responders.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ static errno_t check_socket_activated_responder(const char *responder)
SSSD_CONFIG_FILE,
CONFDB_DEFAULT_CONFIG_DIR);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to read configuration: [%d] [%s]",
DEBUG(SSSDBG_DEFAULT,
"Failed to read configuration: [%d] [%s]. No reason to run "
"a responder if SSSD isn't configured.",
ret,
sss_strerror(ret));
goto done;
Expand Down
7 changes: 6 additions & 1 deletion src/util/sss_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ int sss_ini_read_sssd_conf(struct sss_ini *self,
return EINVAL;
}

ret = sss_ini_open(self, config_file, CONFDB_FALLBACK_CONFIG);
ret = sss_ini_open(self, config_file, "[sssd]\n");
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
"The sss_ini_open failed %s: %d\n",
Expand Down Expand Up @@ -986,5 +986,10 @@ int sss_ini_read_sssd_conf(struct sss_ini *self,
return ERR_INI_ADD_SNIPPETS_FAILED;
}

if (!sss_ini_exists(self) &&
(ref_array_len(sss_ini_get_ra_success_list(self)) == 0)) {
return ERR_INI_EMPTY_CONFIG;
}

return ret;
}
1 change: 1 addition & 0 deletions src/util/sss_ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct sss_ini* sss_ini_new(TALLOC_CTX *tmp_ctx);
* - ERR_INI_INVALID_PERMISSION - access check failed
* - ERR_INI_PARSE_FAILED - failed to parse configuration file
* - ERR_INI_ADD_SNIPPETS_FAILED - failed to add configuration snippets
* - ERR_INI_EMPTY_CONFIG - neither main config nor config snippets exist
*/
int sss_ini_read_sssd_conf(struct sss_ini *self,
const char *config_file,
Expand Down
3 changes: 2 additions & 1 deletion src/util/util_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ struct err_string error_to_str[] = {
{ "No reply was received" }, /* ERR_SBUS_NO_REPLY */

/* ini parsing errors */
{ "Failed to open configuration" }, /* ERR_INI_OPEN_FAILED */
{ "Failed to open main config file" }, /* ERR_INI_OPEN_FAILED */
{ "File ownership and permissions check failed" }, /* ERR_INI_INVALID_PERMISSION */
{ "Error while parsing configuration file" }, /* ERR_INI_PARSE_FAILED */
{ "Failed to add configuration snippets" }, /* ERR_INI_ADD_SNIPPETS_FAILED */
{ "Neither main config nor config snippets exist" }, /* ERR_INI_EMPTY_CONFIG */

{ "TLS handshake was interrupted"}, /* ERR_TLS_HANDSHAKE_INTERRUPTED */

Expand Down
1 change: 1 addition & 0 deletions src/util/util_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ enum sssd_errors {
ERR_INI_INVALID_PERMISSION,
ERR_INI_PARSE_FAILED,
ERR_INI_ADD_SNIPPETS_FAILED,
ERR_INI_EMPTY_CONFIG,

ERR_TLS_HANDSHAKE_INTERRUPTED,

Expand Down

0 comments on commit b1b755f

Please sign in to comment.