return left % USEC_PER_HOUR;
}
-bool logind_wall_tty_filter(const char *tty, void *userdata) {
+bool logind_wall_tty_filter(const char *tty, bool is_local, void *userdata) {
Manager *m = userdata;
const char *p;
CONFIG_PARSER_PROTOTYPE(config_parse_tmpfs_size);
int manager_setup_wall_message_timer(Manager *m);
-bool logind_wall_tty_filter(const char *tty, void *userdata);
+bool logind_wall_tty_filter(const char *tty, bool is_local, void *userdata);
int manager_read_efi_boot_loader_entries(Manager *m);
const char *message,
const char *username,
const char *origin_tty,
- bool (*match_tty)(const char *tty, void *userdata),
+ bool (*match_tty)(const char *tty, bool is_local, void *userdata),
void *userdata) {
_unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
if (u->ut_type != USER_PROCESS || u->ut_user[0] == 0)
continue;
- /* this access is fine, because STRLEN("/dev/") << 32 (UT_LINESIZE) */
+ /* This access is fine, because strlen("/dev/") < 32 (UT_LINESIZE) */
if (path_startswith(u->ut_line, "/dev/"))
path = u->ut_line;
else {
if (asprintf(&buf, "/dev/%.*s", (int) sizeof(u->ut_line), u->ut_line) < 0)
return -ENOMEM;
-
path = buf;
}
- if (!match_tty || match_tty(path, userdata)) {
+ /* It seems that the address field is always set for remote logins.
+ * For local logins and other local entries, we get [0,0,0,0]. */
+ bool is_local = memeqzero(u->ut_addr_v6, sizeof(u->ut_addr_v6));
+
+ if (!match_tty || match_tty(path, is_local, userdata)) {
q = write_to_terminal(path, text);
if (q < 0)
r = q;
const char *message,
const char *username,
const char *origin_tty,
- bool (*match_tty)(const char *tty, void *userdata),
+ bool (*match_tty)(const char *tty, bool is_local, void *userdata),
void *userdata);
static inline bool utxent_start(void) {
return (int) n;
}
-static bool wall_tty_match(const char *path, void *userdata) {
+static bool wall_tty_match(const char *path, bool is_local, void *userdata) {
_cleanup_free_ char *p = NULL;
_cleanup_close_ int fd = -1;
struct stat st;