mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-26 10:03:40 +03:00
logind: do not print wall messages to local pseudoterminals
Fixes #23520. Replaces #23555. The problem started with cdf370626f08ed509a5dde9d5618eed29d625032 and 90b1ec03b2ce939f589239133a32f4429f2ad6a6 which together started printing the wall message in more cases. The motivation for those change was reasonable, but this clearly causes problems described in #23520: users are getting unexpected wall messages. Xterm, urxvt, (anything using libutempter?), and tmux (in some configurations), register local pty sessions in utmp. So let's try to suppress the message for local pseudo-terminal logins. This patch based on #23538, but instead of filtering just on /dev/pts, it uses the .ut_addr_v6 to only filter out local entries. (cherry picked from commit 51a2b575d751c257f2603f12fe9bb883014c37c1)
This commit is contained in:
parent
865b5fb04e
commit
befd8769c2
@ -43,19 +43,17 @@ _const_ static usec_t when_wall(usec_t n, usec_t elapse) {
|
||||
}
|
||||
|
||||
bool logind_wall_tty_filter(const char *tty, bool is_local, void *userdata) {
|
||||
Manager *m = userdata;
|
||||
const char *p;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
|
||||
assert(m);
|
||||
|
||||
if (!m->scheduled_shutdown_tty)
|
||||
return true;
|
||||
|
||||
p = path_startswith(tty, "/dev/");
|
||||
const char *p = path_startswith(tty, "/dev/");
|
||||
if (!p)
|
||||
return true;
|
||||
|
||||
return !streq(p, m->scheduled_shutdown_tty);
|
||||
/* Do not write to local pseudo-terminals */
|
||||
if (startswith(p, "pts/") && is_local)
|
||||
return false;
|
||||
|
||||
return !streq_ptr(p, m->scheduled_shutdown_tty);
|
||||
}
|
||||
|
||||
static int warn_wall(Manager *m, usec_t n) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user