[SSSD] [PATCH] Specific error message for missing sssd.conf

Pavel Reichl preichl at redhat.com
Wed Nov 20 12:52:42 UTC 2013


On Tue, 2013-11-19 at 15:41 +0100, Lukas Slebodnik wrote:
> On (19/11/13 13:10), Pavel Reichl wrote:
> >More specific error message is logged using sss_log.
> 
> >From 623eb7f163ac3f28a06aed6965ffa4ecc9f47e5d Mon Sep 17 00:00:00 2001
> >From: Pavel Reichl <pavel.reichl at redhat.com>
> >Date: Tue, 19 Nov 2013 11:24:31 +0000
> >Subject: [PATCH] monitor: Specific error message for missing sssd.conf
> >
> >Specific error message is logged for missing sssd.conf file using sss_log function.
> >
> >Resolves:
> >https://fedorahosted.org/sssd/ticket/2156
> >---
> > src/confdb/confdb_setup.c | 3 +--
> > src/monitor/monitor.c     | 6 ++++++
> > 2 files changed, 7 insertions(+), 2 deletions(-)
> >
> >diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c
> >index b13553eaa560bb83ecf7a53b32ab116f38f7f480..0bb13d229987d42c14b81113f8898ad7522f4622 100644
> >--- a/src/confdb/confdb_setup.c
> >+++ b/src/confdb/confdb_setup.c
> >@@ -155,8 +155,7 @@ 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"));
> It would be better to print debug message with higher level (SSSDBG_TRACE_FUNC)
> instead of removing debug message.
> Something like: "sss_ini_config_file_open failed: %s [%d], strerror(ret), ret
> 
> >-        ret = EIO;
> >+        ret = ENOENT;
> sss_ini_config_file_open will return ENOENT if config_file does not exist.
> It is not needed to overwrite error code. This is a reason why current error
> message was confusing.
> 
> >         goto done;
> >     }
> > 
> >diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
> >index f8a02b8b8be083860a4ae342a27b1297613af996..e8d18fad3e16c9b111f85707180993019cc1399a 100644
> >--- a/src/monitor/monitor.c
> >+++ b/src/monitor/monitor.c
> >@@ -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 ENOENT:
> >+            DEBUG(SSSDBG_CRIT_FAILURE,
> >+                  ("Failed to open configuration file: %s.\n", config_file));
> >+            sss_log(SSS_LOG_ALERT,
> >+                    "Failed to open configuration file.\n");
> ENOENT means "No such file or directory", Please add more specific error
> message and syslog message (sss_log) should also contain information about path
> to config_file
> 
> >+            break;
> >         case EPERM:
> >         case EACCES:
> >             DEBUG(SSSDBG_CRIT_FAILURE,
> >-- 
> >1.8.3.1
> >
> 
> LS
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

New patch hopefully addressing all mentioned issues is attached.

PR

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-monitor-Specific-error-message-for-missing-sssd.conf.patch
Type: text/x-patch
Size: 3341 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20131120/0089b46f/attachment.bin>


More information about the sssd-devel mailing list