Again:bug in login: wrong pid in utmprecord.
Stef Bon <[email protected]> Sun, 30 Oct 2005 22:04:33 +0100
| Newsgroups | gmane.linux.pld.shadow.general |
|---|---|
| Message-ID | <[email protected]> |
Hello again, i've posted earlier about what I think is a bug. I think that in the utmpdatabase the wrong pid is stored by 'login' and 'su'. Maybe it was a little bit complicated to understand. I'll try again: First I'm in my kdm-session. From konsole I get: :> who -u sbon :0 Oct 30 21:18 ? 3117 :> ps aux ..... root 2951 0.0 0.6 3692 1692 ? S 21:17 0:00 -:0 sbon 3117 0.0 0.5 4880 1344 ? Ss 21:18 0:00 /bin/sh /opt/kde-3.5/bin/startkde ..... So far no problem. In the utmpdatabase the pid of the process of user sbon is stored:3117. When I open a root console, and then do from the first konsole: :>who -u sbon :0 Oct 30 21:18 ? 3117 :>ps aux ..... root 2951 0.0 0.6 3692 1692 ? S 21:17 0:00 -:0 sbon 3117 0.0 0.5 4880 1344 ? Ss 21:18 0:00 /bin/sh /opt/kde-3.5/bin/startkde ..... sbon 3425 0.2 5.1 29608 13112 ? S 21:35 0:00 konsole [kdeinit] --type su root 3428 0.0 0.6 5468 1752 pts/1 Ss 21:35 0:00 su - root 3429 0.0 0.6 4672 1576 pts/1 S+ 21:35 0:00 -bash ..... I can't understand! In the utmpdatabase the pid of the process su is not stored. The user root is logged in right! I go futher: In the su-konsole, I do root@localhost:> login After entering my credebtials as user sbon, I do again on my konsole: :> who -u sbon :0 Oct 30 21:18 ? 3117 sbon pts/1 Oct 30 21:39 . 3445 :> ps aux sbon 3425 0.1 5.1 29608 13116 ? S 21:35 0:00 konsole [kdeinit] --type su root 3428 0.0 0.6 5456 1736 pts/1 Ss 21:35 0:00 su - root 3429 0.0 0.6 4672 1584 pts/1 S 21:35 0:00 -bash root 3445 0.0 0.7 5576 1884 pts/1 S 21:39 0:00 login sbon 3490 0.0 0.7 5396 1960 pts/1 S+ 21:39 0:00 -bash Again I do not understand: The pid of the parent process, login, is stored in the new record in the utmpdatabase, 3445. I think it should be: 3490, and that's the pid of the process of what the new user(sbon) is doing: bash. When I exit the loginsession I started at the su-konsole, I get: :> who -u sbon :0 Oct 30 21:18 ? 3117 sbon pts/1 Oct 30 21:39 . 3445 This is wrong! I've closed the loginsession but the record is still in the utmpdatabase! :> last -f /var/run/utmp sbon pts/1 Sun Oct 30 21:39 gone - no logout sbon :0 Sun Oct 30 21:18 still logged in reboot system boot Sun Oct 30 20:38 (01:20) utmp begins Sun Oct 30 20:38:13 2005 So this looks like some bugs to me in the handling of the utmp records: - su does not store any utmprecord - login does create a utmprecord, but with a wrong pid. That's the reason this record remains in the utmpdatabase and commands like who give wrong information about who is logged in. I could use the command 'w', but that's not my point. Any comments? Is this normal behaviour for handling utmprecords? Does not looks like it to me. Stef Bon