64-bit time_t and __WORDSIZE_TIME64_COMPAT32
Florian Weimer
fweimer@redhat.com
Tue Feb 14 08:59:59 GMT 2023
* Thorsten Kukuk via Libc-alpha:
> I think we don't lose anything if btmp and lastlog don't exist anymore.
> Querying utmp for the runlevel in systemd times is also obsolete.
> Statistical data how many users are logged in if you login or if you
> call uptime is also only nice to have, nothing more.
This is something that systemd could do, in a far more reliable fashion
(or the kernel audit subsystem, I assume).
> So the main consumer of utmp is glibc itself: getlogin()/getlogin_r()
> Is there any idea how to replace that, if utmp/wtmp gets deprecated?
We use /proc/self/loginuid already, and try to resolve that UID using
NSS. We still have fallback to __getutline_r. I think it would be
really helpful if you could discover why that fallback is used. I would
have thought it's dead code.
Is it because /proc/self/loginuid is missing, or because NSS fails for
some reason? If it's about /proc/self/loginuid, maybe we can look at
the owner of /dev/tty instead.
> That's the only use case for which I don't see an alternate currently.
> The musl libc way to use an environment variable is really not safe...
The manual page has strong guidance that getlogin is not to be trusted.
/proc/self/loginuid is probably quite hard to fool, though, but the
fallback code is another matter.
> Another real usecase is to find the TTYs for wall and wall alike
> messages by tools like shutdown, systemd and similar.
Again, this seems to be more in the realm of the init service.
> Functions like login()/logout() are only used by openssh. So should be
> solveable, too.
Also FTP servers. But we have seen quite a few problems due to account
database updates because the data structure isn't great, and isn't
really suitable to handling PTYs.
Thanks,
Florian
More information about the Libc-alpha
mailing list