From 261b0c508436b0ae608a8a970a0ee9c6e9209dc8 Mon Sep 17 00:00:00 2001 From: Petar Kapris Date: Tue, 24 Nov 2020 23:29:01 +0100 Subject: [PATCH] Fix "no * expansion for USERS field in config" bug There were two lines in the check_idle() function, which were meant to test if a given user has been found in a given line of the configuration file. Rather than using the chkmatch function, to test for a match, and any potential expansions, these two lines, comprising an if statement, simply checked if the USER pattern matched the given username as a string, or if it was simply a *. This means that if a function was checking the user kappa, it would match him for the USERS field "kappa" or "*", but not "ka*", this is not the behaviour documented in the timeouts(5) manpage, which explicitly states the expansion for the USERS field in the config, will be done in the exact same way as the TTYS field. --- timeoutd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/timeoutd.c b/timeoutd.c index 10603a3..6927908 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -1003,9 +1003,8 @@ void check_idle() if (!config[0]) return; /* no entries in config */ while (config[++aktconfigline] && aktconfigline >= 0) - if (strcmp(config[aktconfigline]->users, user) == 0 - || config[aktconfigline]->users[0] == '*') { - aktconfigline = -2; /* we found user or * in config, so he/they has/have restrictions */ + if (chkmatch(user, config[aktconfigline]->users)) { + aktconfigline = -2; /* we found user in config, so he/they has/have restrictions */ break; }