Keeps counting time when user has logged out
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
timekpr |
New
|
Undecided
|
Unassigned |
Bug Description
Actually not sure where/how to report bugs since development here seems dead and I am using the version from https:/
To reproduce...
* Setup a limit for a user.
* Login as that user and then log back out before the limit is reached, making a note of the time remaining.
* Wait some time and then try to log back in. If the limit has not already been reached, again make a note of the time remaining.
This bug has to do with systemd and loginctl. It seems that when a user logs out, systemd is continuing to think the user is still active. When loginctl is called to get a list of active users it is incorrectly returning all users who have logged in sometime since the machine was booted.
You can reinstate the desired behavior by editing the /usr/bin/ users.timekpr script. It's as simple as commenting out lines so the old non-loginctl behavior is used. See example below.
------- ------- ------- ---EXAMPLE- ------- ------- ----
!/bin/sh
# check if loginctl is available
#which loginctl > /dev/null
# if not - fallback to old method (unique)
TKPR_USERS= `users | sed 's/ /\n/g' | tr "\\n" " "\ | sed 's/$/\n/'` `loginctl list-users | grep " \+[0-9]\+ .\+" | awk '{print $2}' | tr "\\n" " " | sed 's/$/\n/'`
#if [ $? -ne 0 ];
#then
#else
# TKPR_USERS=
#fi
# now filter out DM's
TKPR_USERS=`echo $TKPR_USERS | sed 's/ /\n/g' | grep -v -e '^gdm$' -e '^kdm$' -e '^lxdm$' -e '^lightdm$' | sort -u | tr "\\n" " "\ | sed 's/$/\n/'`
# output final user list
echo $TKPR_USERS
~