diff options
author | Pavel Reichl <pavel.reichl@redhat.com> | 2013-11-19 11:24:31 +0000 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-11-27 10:46:14 +0100 |
commit | b5ee224324b0158641d9b110f81d2bc6eddddc13 (patch) | |
tree | 4d005ce00136288a5e266286ea186ff5af6ddeac /src | |
parent | 9f39fa303b328c4e82ffd6b3d8dfa9b6640222cd (diff) | |
download | sssd-b5ee224324b0158641d9b110f81d2bc6eddddc13.tar.gz sssd-b5ee224324b0158641d9b110f81d2bc6eddddc13.tar.xz sssd-b5ee224324b0158641d9b110f81d2bc6eddddc13.zip |
monitor: Specific error message for missing sssd.conf
Specific error message is logged for missing sssd.conf file. New sssd specific
error value is introduced for this case.
Resolves:
https://fedorahosted.org/sssd/ticket/2156
Diffstat (limited to 'src')
-rw-r--r-- | src/confdb/confdb_setup.c | 9 | ||||
-rw-r--r-- | src/monitor/monitor.c | 8 | ||||
-rw-r--r-- | src/util/util_errors.c | 1 | ||||
-rw-r--r-- | src/util/util_errors.h | 1 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c index b13553eaa..2a34e4f7a 100644 --- a/src/confdb/confdb_setup.c +++ b/src/confdb/confdb_setup.c @@ -155,8 +155,13 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb) /* Open config file */ ret = sss_ini_config_file_open(init_data, config_file); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to open configuration file.\n")); - ret = EIO; + DEBUG(SSSDBG_TRACE_FUNC, + ("sss_ini_config_file_open failed: %s [%d]\n", strerror(ret), + ret)); + if (ret == ENOENT) { + /* sss specific error denoting missing configuration file */ + ret = ERR_MISSING_CONF; + } goto done; } diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index f8a02b8b8..92bac422a 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -1614,7 +1614,7 @@ static errno_t load_configuration(TALLOC_CTX *mem_ctx, ret = confdb_init_db(config_file, ctx->cdb); if (ret != EOK) { DEBUG(0, ("ConfDB initialization has failed [%s]\n", - strerror(ret))); + sss_strerror(ret))); goto done; } @@ -2785,6 +2785,12 @@ int main(int argc, const char *argv[]) ret = load_configuration(tmp_ctx, config_file, &monitor); if (ret != EOK) { switch (ret) { + case ERR_MISSING_CONF: + DEBUG(SSSDBG_CRIT_FAILURE, + ("Configuration file: %s does not exist.\n", config_file)); + sss_log(SSS_LOG_ALERT, + "Configuration file: %s does not exist.\n", config_file); + break; case EPERM: case EACCES: DEBUG(SSSDBG_CRIT_FAILURE, diff --git a/src/util/util_errors.c b/src/util/util_errors.c index b3d10f97b..114c8b04f 100644 --- a/src/util/util_errors.c +++ b/src/util/util_errors.c @@ -50,6 +50,7 @@ struct err_string error_to_str[] = { { "Dynamic DNS update not possible while offline" }, /* ERR_DYNDNS_OFFLINE */ { "Entry not found" }, /* ERR_NOT_FOUND */ { "Domain not found" }, /* ERR_DOMAIN_NOT_FOUND */ + { "Missing configuration file" }, /* ERR_MISSING_CONF */ }; diff --git a/src/util/util_errors.h b/src/util/util_errors.h index 685607c5b..bca45f392 100644 --- a/src/util/util_errors.h +++ b/src/util/util_errors.h @@ -72,6 +72,7 @@ enum sssd_errors { ERR_DYNDNS_OFFLINE, ERR_NOT_FOUND, ERR_DOMAIN_NOT_FOUND, + ERR_MISSING_CONF, ERR_LAST /* ALWAYS LAST */ }; |