|
|
2fc102 |
From 08134dde5a6c8b23cf40ec8f0020cd553af2667e Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: Pavel Reichl <pavel.reichl@redhat.com>
|
|
|
2fc102 |
Date: Tue, 19 Nov 2013 11:24:31 +0000
|
|
|
2fc102 |
Subject: [PATCH 2/6] monitor: Specific error message for missing sssd.conf
|
|
|
2fc102 |
|
|
|
2fc102 |
Specific error message is logged for missing sssd.conf file. New sssd specific
|
|
|
2fc102 |
error value is introduced for this case.
|
|
|
2fc102 |
|
|
|
2fc102 |
Resolves:
|
|
|
2fc102 |
https://fedorahosted.org/sssd/ticket/2156
|
|
|
2fc102 |
---
|
|
|
2fc102 |
src/confdb/confdb_setup.c | 9 +++++++--
|
|
|
2fc102 |
src/monitor/monitor.c | 8 +++++++-
|
|
|
2fc102 |
src/util/util_errors.c | 1 +
|
|
|
2fc102 |
src/util/util_errors.h | 1 +
|
|
|
2fc102 |
4 files changed, 16 insertions(+), 3 deletions(-)
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c
|
|
|
2fc102 |
index b13553eaa560bb83ecf7a53b32ab116f38f7f480..2a34e4f7a3e5f9aa37760036520f5274e9289b70 100644
|
|
|
2fc102 |
--- a/src/confdb/confdb_setup.c
|
|
|
2fc102 |
+++ b/src/confdb/confdb_setup.c
|
|
|
2fc102 |
@@ -155,8 +155,13 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
|
|
|
2fc102 |
/* Open config file */
|
|
|
2fc102 |
ret = sss_ini_config_file_open(init_data, config_file);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
- DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to open configuration file.\n"));
|
|
|
2fc102 |
- ret = EIO;
|
|
|
2fc102 |
+ DEBUG(SSSDBG_TRACE_FUNC,
|
|
|
2fc102 |
+ ("sss_ini_config_file_open failed: %s [%d]\n", strerror(ret),
|
|
|
2fc102 |
+ ret));
|
|
|
2fc102 |
+ if (ret == ENOENT) {
|
|
|
2fc102 |
+ /* sss specific error denoting missing configuration file */
|
|
|
2fc102 |
+ ret = ERR_MISSING_CONF;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
goto done;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
|
|
|
2fc102 |
index 3d8ba26285b6a8fc60ccb695f8b10ae1714ac918..09f530d2643b45fc31fb4dbe3cb69f2abc5510af 100644
|
|
|
2fc102 |
--- a/src/monitor/monitor.c
|
|
|
2fc102 |
+++ b/src/monitor/monitor.c
|
|
|
2fc102 |
@@ -1614,7 +1614,7 @@ static errno_t load_configuration(TALLOC_CTX *mem_ctx,
|
|
|
2fc102 |
ret = confdb_init_db(config_file, ctx->cdb);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
DEBUG(0, ("ConfDB initialization has failed [%s]\n",
|
|
|
2fc102 |
- strerror(ret)));
|
|
|
2fc102 |
+ sss_strerror(ret)));
|
|
|
2fc102 |
goto done;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
@@ -2789,6 +2789,12 @@ int main(int argc, const char *argv[])
|
|
|
2fc102 |
ret = load_configuration(tmp_ctx, config_file, &monitor);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
switch (ret) {
|
|
|
2fc102 |
+ case ERR_MISSING_CONF:
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
2fc102 |
+ ("Configuration file: %s does not exist.\n", config_file));
|
|
|
2fc102 |
+ sss_log(SSS_LOG_ALERT,
|
|
|
2fc102 |
+ "Configuration file: %s does not exist.\n", config_file);
|
|
|
2fc102 |
+ break;
|
|
|
2fc102 |
case EPERM:
|
|
|
2fc102 |
case EACCES:
|
|
|
2fc102 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
2fc102 |
diff --git a/src/util/util_errors.c b/src/util/util_errors.c
|
|
|
2fc102 |
index b3d10f97b0567ca21ca08a3f2d326ea401c28aff..114c8b04fd354b166d14e526a3bab6a6c0c05951 100644
|
|
|
2fc102 |
--- a/src/util/util_errors.c
|
|
|
2fc102 |
+++ b/src/util/util_errors.c
|
|
|
2fc102 |
@@ -50,6 +50,7 @@ struct err_string error_to_str[] = {
|
|
|
2fc102 |
{ "Dynamic DNS update not possible while offline" }, /* ERR_DYNDNS_OFFLINE */
|
|
|
2fc102 |
{ "Entry not found" }, /* ERR_NOT_FOUND */
|
|
|
2fc102 |
{ "Domain not found" }, /* ERR_DOMAIN_NOT_FOUND */
|
|
|
2fc102 |
+ { "Missing configuration file" }, /* ERR_MISSING_CONF */
|
|
|
2fc102 |
};
|
|
|
2fc102 |
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/util/util_errors.h b/src/util/util_errors.h
|
|
|
2fc102 |
index 685607c5bb1b4e7c37152c876518a2b1c69c18d6..bca45f392b0357c3f1c848768358cb1d47514715 100644
|
|
|
2fc102 |
--- a/src/util/util_errors.h
|
|
|
2fc102 |
+++ b/src/util/util_errors.h
|
|
|
2fc102 |
@@ -72,6 +72,7 @@ enum sssd_errors {
|
|
|
2fc102 |
ERR_DYNDNS_OFFLINE,
|
|
|
2fc102 |
ERR_NOT_FOUND,
|
|
|
2fc102 |
ERR_DOMAIN_NOT_FOUND,
|
|
|
2fc102 |
+ ERR_MISSING_CONF,
|
|
|
2fc102 |
ERR_LAST /* ALWAYS LAST */
|
|
|
2fc102 |
};
|
|
|
2fc102 |
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.4.2
|
|
|
2fc102 |
|