Skip to content

Commit

Permalink
INI: add verbose error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tikhonov committed Oct 31, 2024
1 parent 19ca7f5 commit 99d1ee0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,9 @@ int main(int argc, const char *argv[])
ERROR("Can't read config: '%s'\n", sss_strerror(ret));
sss_log(SSS_LOG_ALERT,
"Failed to read configuration: '%s'", sss_strerror(ret));
sss_log(SSS_LOG_ALERT,
"Make sure configuration is readable by the user used to run service"
" and doesn't have public rwx bits set.");
ret = 3;
goto out;
}
Expand Down
25 changes: 12 additions & 13 deletions src/util/sss_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ static int sss_ini_add_snippets(struct sss_ini *self,
&self->ra_success_list);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to augment configuration: Error %d",
ret);
"Failed to augment configuration [%d]: %s\n",
ret, sss_strerror(ret));
}

while (ref_array_get(self->ra_error_list, i, &msg) != NULL) {
Expand Down Expand Up @@ -613,14 +613,14 @@ static int sss_ini_call_validators_errobj(struct sss_ini *data,
ret = ini_rules_read_from_file(rules_path, &rules_cfgobj);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
"Failed to read sssd.conf schema %d [%s]\n", ret, strerror(ret));
"Failed to read sssd.conf schema [%d]: %s\n", ret, strerror(ret));
goto done;
}

ret = ini_rules_check(rules_cfgobj, data->sssd_config, sss_validators, errobj);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
"ini_rules_check failed %d [%s]\n", ret, strerror(ret));
"ini_rules_check failed [%d]: %s\n", ret, strerror(ret));
goto done;
}

Expand Down Expand Up @@ -761,14 +761,14 @@ int sss_ini_open(struct sss_ini *self,
strlen(fallback_cfg));
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
"sss_ini_config_file_from_mem failed. Error %d\n",
ret);
"sss_ini_config_file_from_mem() failed [%d]: %s\n",
ret, sss_strerror(ret));
}
break;
default:
DEBUG(SSSDBG_CONF_SETTINGS,
"sss_ini_config_file_open failed: Error %d\n",
ret);
"sss_ini_config_file_open() failed [%d]: %s\n",
ret, sss_strerror(ret));
sss_ini_config_print_errors(self->error_list);
break;
}
Expand Down Expand Up @@ -860,9 +860,8 @@ int sss_ini_read_sssd_conf(struct sss_ini *self,
ret = sss_ini_open(self, config_file, "[sssd]\n");
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
"sss_ini_open on %s failed: %d\n",
config_file,
ret);
"sss_ini_open() on '%s' failed [%d]: %s\n",
config_file, ret, sss_strerror(ret));
return ERR_INI_OPEN_FAILED;
}

Expand All @@ -882,8 +881,8 @@ int sss_ini_read_sssd_conf(struct sss_ini *self,
ret = sss_ini_add_snippets(self, config_dir);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
"Error while reading configuration directory %s: %d\n",
config_dir, ret);
"Error while reading configuration directory '%s' [%d]: %s\n",
config_dir, ret, sss_strerror(ret));
return ERR_INI_ADD_SNIPPETS_FAILED;
}

Expand Down

0 comments on commit 99d1ee0

Please sign in to comment.