-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH 1/2] Fix config file error message
EIO was used for pretty much any error related to loading configuration.
This patch changes the return value when permission check on the config
file fails to EPERM making it easy to print error message.

Fixes: 427

[PATCH 2/2] Add generic error message
This patch also adds a generic error message when confdb cannot be
loaded. Because it's past string-freeze, this is a separate patch that
should only go into the master branch.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkujeu4ACgkQHsardTLnvCXL/gCgoEyEi5f60N9LAUaxPJ9etP67
gkoAni/qbj05hV0Q1Cze6NWHY74/HYVX
=ZLBD
-----END PGP SIGNATURE-----
From b7c0e501e851f1de0e5d0782a25278f67bbab7fa Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Fri, 19 Mar 2010 14:17:40 +0100
Subject: [PATCH 1/2] Fix config file error message

---
 src/confdb/confdb_setup.c |    2 +-
 src/monitor/monitor.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c
index 77cd5f9..1e9200e 100644
--- a/src/confdb/confdb_setup.c
+++ b/src/confdb/confdb_setup.c
@@ -290,7 +290,7 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
     if (ret != EOK) {
         DEBUG(1, ("Permission check on config file failed.\n"));
         talloc_zfree(tmp_ctx);
-        return EIO;
+        return EPERM;
     }
 
     /* Determine if the conf file has changed since we last updated
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 0ba3354..53feda8 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2240,7 +2240,7 @@ int main(int argc, const char *argv[])
     /* Parse config file, fail if cannot be done */
     ret = load_configuration(tmp_ctx, config_file, &monitor);
     if (ret != EOK) {
-        if (ret == EIO) {
+        if (ret == EPERM) {
             DEBUG(1, ("Cannot read configuration file %s\n", config_file));
             ERROR("Cannot read config file %s, please check if permissions "
                   "are 0600 and the file is owned by root.root\n", config_file);
-- 
1.6.6.1

From 98229a80a5104c309f2a8633e401f44d1e19d616 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Fri, 19 Mar 2010 14:19:54 +0100
Subject: [PATCH 2/2] Add generic error message

---
 src/monitor/monitor.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 53feda8..6ef1883 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2244,6 +2244,10 @@ int main(int argc, const char *argv[])
             DEBUG(1, ("Cannot read configuration file %s\n", config_file));
             ERROR("Cannot read config file %s, please check if permissions "
                   "are 0600 and the file is owned by root.root\n", config_file);
+        } else {
+            DEBUG(1, ("Error loading configuration database: [%d]: %s",
+                      ret, strerror(ret)));
+            ERROR("Cannot load configuration database\n");
         }
         return 4;
     }
-- 
1.6.6.1

Attachment: 0001-Fix-config-file-error-message.patch.sig
Description: PGP signature

Attachment: 0002-Add-generic-error-message.patch.sig
Description: PGP signature

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to