]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su, agetty: don't use program_invocation_short_name for openlog()
authorKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2024 12:30:10 +0000 (13:30 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2024 12:30:10 +0000 (13:30 +0100)
Make sure the program name is hardcoded when write to the log.

Reported-by: "Serge E. Hallyn" <serge@hallyn.com>
Reported-by: "Skyler Ferrante (RIT Student)" <sjf5462@rit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/su-common.c
term-utils/agetty.c

index 4cc24e34c148868dd19823c9bf4287929a23898d..242b6ce4ea78e82d742cf4ddab19711bc65687dc 100644 (file)
@@ -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 ",
index 6059b01d014b1dc3c3e984570e86a6a9078a38a1..0fc6f151443e5ec122b4b8b991ec7654b4300961 100644 (file)
@@ -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