From owner-freebsd-hackers Sun Sep 14 15:17:26 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA05313 for hackers-outgoing; Sun, 14 Sep 1997 15:17:26 -0700 (PDT) Received: from usr09.primenet.com (tlambert@usr09.primenet.com [206.165.6.209]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA05301 for ; Sun, 14 Sep 1997 15:17:22 -0700 (PDT) Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id PAA25420; Sun, 14 Sep 1997 15:17:17 -0700 (MST) From: Terry Lambert Message-Id: <199709142217.PAA25420@usr09.primenet.com> Subject: Re: Here's an interesting bug in our utmp handling. To: jkh@time.cdrom.com (Jordan K. Hubbard) Date: Sun, 14 Sep 1997 22:17:16 +0000 (GMT) Cc: hackers@FreeBSD.ORG In-Reply-To: <10396.874268145@time.cdrom.com> from "Jordan K. Hubbard" at Sep 14, 97 01:15:45 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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." :) Read the login man page. Login is supposed to be exec'ed by the shells: The standard shells, csh(1) and sh(1), do not fork before executing the login utility. So it is supposed to be impossible to do the "Now log out and do another who(1)." part of repeating the "problem". If you want to become another user and return to yourself afterwards, use the "su" command. Since it keeps running, it can change things like the utmp entry, and put it back afterwards (though it doesn't fiddle utmp, even when you specify "-l"; that's probably a bug, too). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.