Score:0

Why isn't ut_user field of logout record in wtmp file no longer zeroed

mh flag

I'm running Ubuntu 22.04. All documentation states that on logout, a utmp entry is appended to the wtmp file like the one for login, except that the username field is zeroed out with null bytes. This used to be true. Now when I dump the wtmp file, using utmpdump, and with a program I wrote to double-check it, the username field contains the actual username. Which version of logout.c is being used now? The glibc/login/logout.c function clearly zeroes that field on logout.

It matters because if I want to write a version of last(1) for example, the method of detecting logouts associated with the login depends on whether this field is empty.

hr flag
Are you referring to logout from a terminal session, or from a desktop session? In the latter case, it would be the display manager that handles the utmp/wtmp records I think. In the vanilla Ubuntu 22.04 desktop that would be gdm3 - specifically the `gdm-session-record-logout` code in `daemon/gdm-session-record.c`
stewart avatar
mh flag
Thank you. This is a start. In neither case -- whether I open and close a terminal session, or login and logout from the machine, is the ut_user field of the wtmp entry created zeroed. The gdm-session-record-logout in the Gitlab repo, https://gitlab.gnome.org/GNOME/gdm/-/blob/main/daemon/gdm-session-record.c, does not set ut_user to nulls. But where are terminal logouts handled?
stewart avatar
mh flag
I correct myself regarding gdm-session-record-logout -- sloppy reading last night -- it sets ut_user to null by not setting it at all.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.