Date: Mon, 15 Sep 1997 00:05:53 +0100 From: Brian Somers <brian@awfulhak.org> To: "Jordan K. Hubbard" <jkh@time.cdrom.com> Cc: hackers@FreeBSD.ORG Subject: Re: Here's an interesting bug in our utmp handling. Message-ID: <199709142305.AAA24723@awfulhak.demon.co.uk> In-Reply-To: Your message of "Sun, 14 Sep 1997 13:15:45 PDT." <10396.874268145@time.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> Reported today by one Eddie Wieder..
>
> Log in somehow (real login, xterm -ls, whatever) and verify your
> user/[pt]ty combo by doing who(1) and tty(1) commands. Now use
> login(1) to log in as some other user and do the who/tty thing again.
> You'll have a new utmp entry for the user you just logged in as. Now
> log out and do another who(1). You'll have had your utmp entry
> smashed and still show up as the user you logged in and out again as.
>
> Not sure how to fix this one - it's "interesting." :)
This whole thing is a mess in every version of anything that rhymes
with unix that I've ever come across.
How about removing logwtmp() and having the whole thing dealt with
by kern_exit.c (is that the right place ?) and tcsetpgrp(3).
The idea is that calling tcsetpgrp() will call tcgetpgrp(). If
tcgetpgrp() returns an invalid pid, we create a new entry in utmp()
and tweak a "utmp'd" flag. Exit of a process would
move the utmp entry to wtmp if it has the "utmp'd" flag.
Would this work ? Would it make sense ?
The result AFACT would be that someone doing a "login" themselves would
not get a new utmp entry whereas anyone associating with a terminal
for the first time (via getty or allocating a new pty) will get one -
as they should. The only problem I forsee is that the UID of the
process may not be correct at tcsetpgrp() time....
> Jordan
--
Brian <brian@awfulhak.org>, <brian@freebsd.org>
<http://www.awfulhak.org>
Don't _EVER_ lose your sense of humour....
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709142305.AAA24723>
