From owner-freebsd-hackers Wed Sep 13 10:22:26 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id KAA18392 for hackers-outgoing; Wed, 13 Sep 1995 10:22:26 -0700 Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id KAA18384 for ; Wed, 13 Sep 1995 10:22:25 -0700 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA07690; Wed, 13 Sep 1995 10:21:26 -0700 From: Terry Lambert Message-Id: <199509131721.KAA07690@phaeton.artisoft.com> Subject: Re: Kernel & fixit diskette (fwd) To: freebsd-hackers@FreeBSD.ORG Date: Wed, 13 Sep 1995 10:21:25 -0700 (MST) Cc: steve@news.netdtw.com In-Reply-To: <199509131436.QAA04272@uriah.heep.sax.de> from "J Wunsch" at Sep 13, 95 04:36:15 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1613 Sender: hackers-owner@FreeBSD.ORG Precedence: bulk > > > 2. How do you establish your identify when you boot single user? > > > I ask this because rlogin (off the fixit) reports that it does > > > not know its user name, and, a rlogin -l xxx does not resolve > > > the issue. > > > > By logging in. > > > > I know, this is an odd answer. > > > > The problem is that the user is retrieved from information initialized by > > login, but you have not really used login when you boot into a shell in > > single user mode. > > You should better look into the code, Terry: > > if (!(pw = getpwuid(uid = getuid()))) { > (void)fprintf(stderr, "rlogin: unknown user id.\n"); > exit(1); > } > if (!user) > user = pw->pw_name; > > The problem is that the fixit floppy contains a dummy spwd.db file (an > empty one). Hence the above logic will fail. You have to bit the > bullet and bloat your fixit floppy by a 40 KB long real spwd.db. > (Even if you've got only "root" there, the db file will be 40 KB. :( ) > > Alternatively, you can hack the rlogin on the floppy to avoid this > check. Say, this is really broken. I just assumed that the rlogin code was good. Silly me. It should be getting the name from getlogin(), since uid's do not have to be unique between multiple user names. Someone want to fix rlogin? The fix should be #ifdef'ed for code compatability reasons. Ideally, /etc/utmp would be preferred to getpwuid(getuid()). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.