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.
There are three string literals in the code where rather than having the
usual \a escape sequence to represent an alert character, the literal
character was inserted, this makes it impractical to edit the lines in
most text editors. So they have been replaced with the more typical
escape sequence.
The entire source code of timeoutd.c has been passed through GNU indent,
in order to amend the inconsistencies, it uses the K&R C style, but
modified, so that tabs are replaced with 4 spaces, close to what a lot
of the code was already using. (Blasphemy, i know) Also the maximum line
length is 100 chars, apart from long strings, which don't get cut as a
result.
Several lines in the code either have whitespace where tabs are
expected, the converse, or trailing whitespace before a newline. All
of these have been removed or replaced.
The file dump_wtmp.c is not a part of the timeoutd program itself, but a
seperate diagnostic tool, which, if it must be used at all, belongs in a
seperate package. I've decided to simply remove it from this repository.
It's name is also a misnomer, as it's programed to actually dump the
utmp file, not the wtmp file. It also only dumps records written on the
current date, and only some of the fields. It seemed that fixing the
program would require more effort that it's worth, as I'm currently not
using the program for any diagnostic purpose, and there are now better
replacements for it, such as the Linux package utmpdump. Therefore, I
decided to remove it and cease working on it.
The VERSION file didn't seem to be too useful, as the version of the
program is stated elsewhere, the VERSION file is actually out of date
with the version in the timeoutd.c file, and the particular version of
the software doesn't even matter currently.
Therefore, both files have been deleted.
There are several lines in the code which cause GCC to warn the user
about undefined behaviour. Most of these are potential buffer overflow
problems. Which come from either overwriting a buffer which may be too
small for a given input, or writing to, or from, a string not guaranteed
to be null-terminated, such as any of the char[] fields in a utmp
struct. Almost all come from an improper usage of strcmp or strncmp or
similar.
The README file mentions the wrong pathnames in its installation,
instructing the user to install the binary in "/usr/etc", rather than
the "/usr/sbin" directory, for example. It also has a typo at the very
end. These errors have been fixed.
The Makefile for the project was unable to properly build. It didn't
call an X11 library which was needed for the program to link, but called
various libraries which weren't necessary. It also didn't install the
/etc/timeouts config file, didn't have an uninstall option, and it's
install would fail, due to the fact that it used non-existent
directories as install destinations, and broken user and group settings
for the files.
All of the afformentioned problems have been mended in this commit. It's
likely that all of the problems which actually broke the program were
due to a difference in Unix systems of the early 90s compared to 2020.
It's likely the X11 libraries were reorganised, and the users and groups
in the install command have been obsoleted.