From 43f7f428a1665950233557bd97611bd5e996b5cb Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Tue, 27 Aug 2024 11:46:33 +0200
Subject: 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.
Upstream-commit: 43f7f428a1665950233557bd97611bd5e996b5cb
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
---
lib/readutmp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/readutmp.c b/lib/readutmp.c
index 10d79d1..3c4f97b 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,
--
cgit v1.1