From c8fd2a4d6d5a9ad504e4eff71efa040ca5bb459b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 4 Mar 2024 13:30:10 +0100 Subject: [PATCH] su, agetty: don't use program_invocation_short_name for openlog() Make sure the program name is hardcoded when write to the log. Reported-by: "Serge E. Hallyn" Reported-by: "Skyler Ferrante (RIT Student)" Signed-off-by: Karel Zak (cherry picked from commit 677a3168b261f3289e282a02dfd85d7f37de0447) --- login-utils/su-common.c | 2 +- term-utils/agetty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/login-utils/su-common.c b/login-utils/su-common.c index 4cc24e34c1..242b6ce4ea 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -290,7 +290,7 @@ static void log_syslog(struct su_context *su, bool successful) { DBG(LOG, ul_debug("syslog logging")); - openlog(program_invocation_short_name, LOG_PID, LOG_AUTH); + openlog(su->runuser ? "runuser" : "su", LOG_PID, LOG_AUTH); syslog(LOG_NOTICE, "%s(to %s) %s on %s", successful ? "" : su->runuser ? "FAILED RUNUSER " : "FAILED SU ", diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 6059b01d01..0fc6f15144 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -2519,7 +2519,7 @@ static void dolog(int priority * automatically prepended to the message. If we write directly to * /dev/console, we must prepend the process name ourselves. */ - openlog(program_invocation_short_name, LOG_PID, LOG_AUTHPRIV); + openlog("agetty", LOG_PID, LOG_AUTHPRIV); vsyslog(priority, fmt, ap); closelog(); #else -- 2.47.3