Re: Bug#15859: libc5 in stable is horribly broken (fwd)
>>>>> Scott Ellis writes:
Scott> On Fri, 12 Dec 1997, Turbo Fredriksson wrote:
>> On Fri, 12 Dec 1997, Scott Ellis wrote:
>> How do I know which type of utmp/wtmp I'm currently using, my package
>> 'TCPQuota' is using utmp to find out the users online... That is, when
>> (exactly) did the utmp/wtmp file changed?
Scott> The change in utmp was made when libc6 was released. If your program is
Scott> libc6, the libc6 utmp/wtmp functions should be used at all times.
Just use the libc functions setutent/getutent. They're available in
both libc5 and glibc2. If you're never writing/reading the files
directly (opening them), you don't have problems. Even with
glibc2/libc6 you shouldn't access the files directly and use the
library functions always.
I've appended below an extract from glibc2.
>From login/README.utmpd in the development version of glibc 2.1:
In order for the `utmpd' approach to work it is essential that NO
program EVER accesses the UTMP and WTMP files directly. Instead, a
program should use ONLY the available library functions:
* utmpname() Select the database used (UTMP, WTMP, ...).
* setutent() Open the database.
* getutent() Read the next entry from the database.
* getutid() Search for the next entry with a specific ID.
* getutline() Search for the next entry for a specific line.
* pututline() Write an entry to the database.
* endutent() Close the database.
* updwtmp() Add an entry to a database (WTMP, ...).
For details, please refer to `The GNU C Library Reference Manual',
which also contains information about some additional functions
derived from BSD and XPG that may be of interest. The command
info libc "User Accounting Database"
should point you at the right location.
If you encounter a program that reads from or, even worse, writes to
the UTMP and WTMP files directly, please report this as a bug to the
author of that program. Note that the files referred to by the macros
`_PATH_UTMP' and `_PATH_WTMP' might even disappear in the future, so
please do not use these, except in a call to `utmpname()' or
`updwtmp()', not even to check their existence.
Andreas Jaeger email@example.com firstname.lastname@example.org
for pgp-key finger email@example.com
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to firstname.lastname@example.org .