[gdm] manager: don't record wtmp entries when user unknown
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] manager: don't record wtmp entries when user unknown
- Date: Tue, 10 Oct 2017 16:56:35 +0000 (UTC)
commit b5fb83e5d1cc70685ddcf88a66b3f29a9857d7b9
Author: Ray Strode <rstrode redhat com>
Date: Tue Oct 10 12:49:10 2017 -0400
manager: don't record wtmp entries when user unknown
Right now we end up writing wtmp entries for the login screen
user into /var/log/wtmp, but with a funky username of "(unknown)".
The login screen session shouldn't get a wtmp entry, and we
shouldn't ever add wtmp entries for sessions we don't know the username
for.
This commit fixes that.
https://bugzilla.gnome.org/show_bug.cgi?id=788784
daemon/gdm-manager.c | 5 +++++
daemon/gdm-session-record.c | 15 +--------------
2 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 256b644..c3293d9 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -677,6 +677,11 @@ add_session_record (GdmManager *manager,
display_device = NULL;
username = gdm_session_get_username (session);
+
+ if (username == NULL) {
+ goto out;
+ }
+
g_object_get (G_OBJECT (session),
"display-name", &display_name,
"display-hostname", &hostname,
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c
index 32933ef..487f100 100644
--- a/daemon/gdm-session-record.c
+++ b/daemon/gdm-session-record.c
@@ -61,21 +61,8 @@
static void
record_set_username (UTMP *u,
- const char *user_name)
+ const char *username)
{
- const char *username;
-
- /*
- * It is possible that PAM failed before it mapped the user
- * input into a valid username, so we fallback to try using
- * "(unknown)"
- */
- if (user_name != NULL) {
- username = user_name;
- } else {
- username = "(unknown)";
- }
-
#if defined(HAVE_UT_UT_USER)
strncpy (u->ut_user,
username,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]