dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0046-DEBUG-fixes-program-identifier-as-seen-in-syslog.patch

32a074
From 647a130b501374c22b63937decdcf97da5c92505 Mon Sep 17 00:00:00 2001
32a074
From: Alexey Tikhonov <atikhono@redhat.com>
32a074
Date: Wed, 21 Oct 2020 19:20:03 +0200
32a074
Subject: [PATCH 46/46] DEBUG: fixes program identifier as seen in syslog
32a074
MIME-Version: 1.0
32a074
Content-Type: text/plain; charset=UTF-8
32a074
Content-Transfer-Encoding: 8bit
32a074
32a074
Commit 225fe9950f2807d5fb226f6b3be1ff4cefd731f0 changed `debug_prg_name`
32a074
to accomodate needs of own SSSD logs, but this affected journal/syslog
32a074
as well.
32a074
32a074
This patch amends situation:
32a074
 - journal messages gets "umbrella" identifier "sssd[]"
32a074
 - syslog uses default which is program name
32a074
32a074
Resolves: https://github.com/SSSD/sssd/issues/5384
32a074
32a074
Reviewed-by: Tomáš Halman <thalman@redhat.com>
32a074
(cherry picked from commit 18233532b72e62452eac6886652fa633ba055d8c)
32a074
---
32a074
 src/util/debug.c   |  2 +-
32a074
 src/util/sss_log.c | 12 +++---------
32a074
 2 files changed, 4 insertions(+), 10 deletions(-)
32a074
32a074
diff --git a/src/util/debug.c b/src/util/debug.c
32a074
index e9633fb8c..ee5fc12f9 100644
32a074
--- a/src/util/debug.c
32a074
+++ b/src/util/debug.c
32a074
@@ -250,7 +250,7 @@ static errno_t journal_send(const char *file,
32a074
             "MESSAGE=%s", message,
32a074
             "PRIORITY=%i", LOG_DEBUG,
32a074
             "SSSD_DOMAIN=%s", domain,
32a074
-            "SSSD_PRG_NAME=%s", debug_prg_name,
32a074
+            "SSSD_PRG_NAME=sssd[%s]", debug_prg_name,
32a074
             "SSSD_DEBUG_LEVEL=%x", level,
32a074
             NULL);
32a074
     ret = -res;
32a074
diff --git a/src/util/sss_log.c b/src/util/sss_log.c
32a074
index 48e73dbea..c6b7435c6 100644
32a074
--- a/src/util/sss_log.c
32a074
+++ b/src/util/sss_log.c
32a074
@@ -107,7 +107,7 @@ static void sss_log_internal(int priority, int facility, const char *format,
32a074
                     "SSSD_DOMAIN=%s", domain,
32a074
                     "PRIORITY=%i", syslog_priority,
32a074
                     "SYSLOG_FACILITY=%i", LOG_FAC(facility),
32a074
-                    "SYSLOG_IDENTIFIER=%s", debug_prg_name,
32a074
+                    "SYSLOG_IDENTIFIER=sssd[%s]", debug_prg_name,
32a074
                     NULL);
32a074
 
32a074
     free(message);
32a074
@@ -118,15 +118,9 @@ static void sss_log_internal(int priority, int facility, const char *format,
32a074
 static void sss_log_internal(int priority, int facility, const char *format,
32a074
                             va_list ap)
32a074
 {
32a074
-    int syslog_priority;
32a074
-
32a074
-    syslog_priority = sss_to_syslog(priority);
32a074
-
32a074
-    openlog(debug_prg_name, 0, facility);
32a074
-
32a074
-    vsyslog(syslog_priority, format, ap);
32a074
+    int syslog_priority = sss_to_syslog(priority);
32a074
 
32a074
-    closelog();
32a074
+    vsyslog(facility|syslog_priority, format, ap);
32a074
 }
32a074
 
32a074
 #endif /* WITH_JOURNALD */
32a074
-- 
32a074
2.21.3
32a074