|
From: | Allison Karlitskaya |
Subject: | Re: tty heuristics in lib/readutmp.c exclude "web" sessions |
Date: | Tue, 27 Aug 2024 15:34:11 +0200 |
Allison Karlitskaya wrote:
> I can confirm that with this patch, the output of `who` shows Cockpit
> again. Specifically:
>
> admin cockpit 2024-08-27 08:21 (::ffff:172.27.0.2)
Thanks, that's perfect. I'm committing the patch:
2024-08-27 Bruno Haible <bruno@clisp.org>
readutmp: In systemd mode, show sessions of type "web".
Reported by Allison Karlitskaya <allison.karlitskaya@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00160.html>.
* lib/readutmp.c (read_utmp_from_systemd): For a systemd session of type
"web", add a single USER_PROCESS entry.
diff --git a/lib/readutmp.c b/lib/readutmp.c
index 10d79d1d81..3c4f97b146 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -867,6 +867,14 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
else if (pty != NULL)
tty = pty;
}
+ else if (strcmp (type, "web") == 0)
+ {
+ char *service;
+ if (sd_session_get_service (session, &service) < 0)
+ service = NULL;
+
+ tty = service;
+ }
}
/* Create up to two USER_PROCESS entries: one for the seat,
[Prev in Thread] | Current Thread | [Next in Thread] |