On 09/11/2015 11:02 AM, Lukas Slebodnik wrote:
I do not understand how is the function chown_debug_file related to journald.
sssd can be compiled with journald support and in the same time can log to the
files. This is a default for fedora and rehl7.

If someone want to enable logging all messages to journald then it is required
manula change to the file /etc/systemd/system/sssd.service.d/journal.conf


LS

Right, thanks, it wasn't good way how to fix it. There is another fixing patch attached.

I used variable debug_file which inform us if we use logfiles.
And I hope that I can ignore variable debug_to_stderr.

Petr
>From 8cb0a4a6b59259e9096ae6f5926595b7b10d6b27 Mon Sep 17 00:00:00 2001
From: Petr Cech <pc...@redhat.com>
Date: Thu, 10 Sep 2015 10:05:59 -0400
Subject: [PATCH] DEBUG: Preventing chown_debug_file if journald on

There is function chown_debug_file() which didn't check
if the SSSD is compiled with journald support.

This patch add simple checking of this state.

Resolves:
https://fedorahosted.org/sssd/ticket/2493
---
 src/util/debug.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/util/debug.c b/src/util/debug.c
index 69df54386101973548108c3194a1bfd111f046f0..b6ab368db824bbd297dcb410c3e669d911ff0d33 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -316,24 +316,27 @@ int chown_debug_file(const char *filename,
     const char *log_file;
     errno_t ret;
 
-    if (filename == NULL) {
-        log_file = debug_log_file;
-    } else {
-        log_file = filename;
-    }
+    if (debug_file) {
 
-    ret = asprintf(&logpath, "%s/%s.log", LOG_PATH, log_file);
-    if (ret == -1) {
-        return ENOMEM;
-    }
+        if (filename == NULL) {
+            log_file = debug_log_file;
+        } else {
+            log_file = filename;
+        }
 
-    ret = chown(logpath, uid, gid);
-    free(logpath);
-    if (ret != 0) {
-        ret = errno;
-        DEBUG(SSSDBG_FATAL_FAILURE, "chown failed for [%s]: [%d]\n",
-              log_file, ret);
-        return ret;
+        ret = asprintf(&logpath, "%s/%s.log", LOG_PATH, log_file);
+        if (ret == -1) {
+            return ENOMEM;
+        }
+
+        ret = chown(logpath, uid, gid);
+        free(logpath);
+        if (ret != 0) {
+            ret = errno;
+            DEBUG(SSSDBG_FATAL_FAILURE, "chown failed for [%s]: [%d]\n",
+                  log_file, ret);
+            return ret;
+        }
     }
 
     return EOK;
-- 
2.4.3

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

Reply via email to