diff options
author | Ray Strode <rstrode@redhat.com> | 2022-10-19 14:50:33 -0400 |
---|---|---|
committer | Ray Strode <halfline@gmail.com> | 2022-10-27 16:21:52 +0000 |
commit | 151dd072b37babc2e909a9a6a46631cb47e50b8f (patch) | |
tree | f9f63d2fb6940137b9321c081cec13517ca65666 /daemon/gdm-session-record.c | |
parent | 002b39bf345b1327159bab0fca053f69e8eb0f95 (diff) | |
download | gdm-151dd072b37babc2e909a9a6a46631cb47e50b8f.tar.gz |
manager: Fix btmp record accounting
Before a user logs in they don't have a display.
btmp records currently need a display though, and they
get written when the user can't log in.
Furthermore, the display from X11 point of view is
somewhat archaic. We use wayland by default now.
In lieu of a display, this commit gives the btmp record
the seat id instead.
Diffstat (limited to 'daemon/gdm-session-record.c')
-rw-r--r-- | daemon/gdm-session-record.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c index 3b41f9c1..ca2fc2bc 100644 --- a/daemon/gdm-session-record.c +++ b/daemon/gdm-session-record.c @@ -149,15 +149,21 @@ record_set_line (UTMP *u, { /* * Set ut_line to the device name associated with this display - * but remove the "/dev/" prefix. If no device, then use the - * $DISPLAY value. + * but remove the "/dev/" prefix if there is one. Otherwise, if it + * seems like the display device is a seat id, just use it wholesale. + * If there's no device at all, but $DISPLAY is set, just fall back to + * using that. */ - if (display_device != NULL - && g_str_has_prefix (display_device, "/dev/")) { + if (display_device != NULL && g_str_has_prefix (display_device, "/dev/")) { memccpy (u->ut_line, display_device + strlen ("/dev/"), '\0', sizeof (u->ut_line)); + } else if (display_device != NULL && g_str_has_prefix (display_device, "seat")) { + memccpy (u->ut_line, + display_device, + '\0', + sizeof (u->ut_line)); } else if (x11_display_name != NULL) { memccpy (u->ut_line, x11_display_name, |