show web sessions in who output

Resolves: rhbz#2307847
This commit is contained in:
Lukáš Zaoral 2024-08-27 12:58:15 +02:00
commit 968cac099d
No known key found for this signature in database
GPG key ID: 39157506DD67752D
2 changed files with 47 additions and 1 deletions

View file

@ -0,0 +1,39 @@
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

View file

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 9.5
Release: 8%{?dist}
Release: 9%{?dist}
# some used parts of gnulib are under various variants of LGPL
License: GPL-3.0-or-later AND GFDL-1.3-no-invariants-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later
Url: https://www.gnu.org/software/coreutils/
@ -32,6 +32,10 @@ Patch103: coreutils-python3.patch
# df --direct
Patch104: coreutils-df-direct.patch
# coreutils no longer lists Cockpit logins in `who` (rhbz#2307847)
# https://git.savannah.gnu.org/cgit/gnulib.git/patch/?id=43f7f428a1665950233557bd97611bd5e996b5cb
Patch105: coreutils-9.5-readutmp-web-session.patch
# (sb) lin18nux/lsb compliance - multibyte functionality patch
Patch800: coreutils-i18n.patch
@ -274,6 +278,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Tue Aug 27 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-9
- show web sessions in who output (rhbz#2307847)
* Wed Aug 21 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-8
- add missing systemd-devel buildrequires