|
|
9d84b2 |
From 9b5dc4cb8d5d82c31c0cda898832998c21afc303 Mon Sep 17 00:00:00 2001
|
|
|
9d84b2 |
From: Karel Zak <kzak@redhat.com>
|
|
|
9d84b2 |
Date: Mon, 9 Sep 2013 12:24:01 +0200
|
|
|
9d84b2 |
Subject: [PATCH] su: fix lastlog and btmp logging
|
|
|
9d84b2 |
|
|
|
9d84b2 |
The su(1) logging code mix ups "old" and "new" passwd structs. The
|
|
|
9d84b2 |
result is things like
|
|
|
9d84b2 |
|
|
|
9d84b2 |
Sep 9 11:50:45 x2 su: (to kzak) kzak on none
|
|
|
9d84b2 |
|
|
|
9d84b2 |
in /var/log/messages. The right log entry is
|
|
|
9d84b2 |
|
|
|
9d84b2 |
Sep 9 11:50:45 x2 su: (to root) kzak on pts/3
|
|
|
9d84b2 |
|
|
|
9d84b2 |
The bug has been introduced by commit c74a7af17c7a176c358dfaa8e1814786c89ebc14.
|
|
|
9d84b2 |
|
|
|
9d84b2 |
References: https://bugzilla.redhat.com/show_bug.cgi?id=1005194
|
|
|
9d84b2 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
9d84b2 |
---
|
|
|
9d84b2 |
login-utils/su-common.c | 5 +----
|
|
|
9d84b2 |
1 file changed, 1 insertion(+), 4 deletions(-)
|
|
|
9d84b2 |
|
|
|
9d84b2 |
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
|
|
|
9d84b2 |
index ade5c92..858af01 100644
|
|
|
9d84b2 |
--- a/login-utils/su-common.c
|
|
|
9d84b2 |
+++ b/login-utils/su-common.c
|
|
|
9d84b2 |
@@ -161,7 +161,7 @@ log_syslog(struct passwd const *pw, bool successful)
|
|
|
9d84b2 |
old_user = pwd ? pwd->pw_name : "";
|
|
|
9d84b2 |
}
|
|
|
9d84b2 |
|
|
|
9d84b2 |
- if (get_terminal_name(STDERR_FILENO, NULL, &tty, NULL) == 0 && tty)
|
|
|
9d84b2 |
+ if (get_terminal_name(STDERR_FILENO, NULL, &tty, NULL) != 0 || !tty)
|
|
|
9d84b2 |
tty = "none";
|
|
|
9d84b2 |
|
|
|
9d84b2 |
openlog (program_invocation_short_name, 0 , LOG_AUTH);
|
|
|
9d84b2 |
@@ -483,9 +483,6 @@ authenticate (const struct passwd *pw)
|
|
|
9d84b2 |
|
|
|
9d84b2 |
done:
|
|
|
9d84b2 |
|
|
|
9d84b2 |
- if (lpw && lpw->pw_name)
|
|
|
9d84b2 |
- pw = lpw;
|
|
|
9d84b2 |
-
|
|
|
9d84b2 |
log_syslog(pw, !is_pam_failure(retval));
|
|
|
9d84b2 |
|
|
|
9d84b2 |
if (is_pam_failure(retval))
|
|
|
9d84b2 |
--
|
|
|
9d84b2 |
1.8.1.4
|
|
|
9d84b2 |
|