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.
This commit is contained in:
Petar Kapris 2020-11-24 23:29:01 +01:00 committed by kappa
parent 24e4896584
commit 261b0c5084

View file

@ -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;
}