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

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