Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 1995 10:21:25 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        freebsd-hackers@FreeBSD.ORG
Cc:        steve@news.netdtw.com
Subject:   Re: Kernel & fixit diskette (fwd)
Message-ID:  <199509131721.KAA07690@phaeton.artisoft.com>
In-Reply-To: <199509131436.QAA04272@uriah.heep.sax.de> from "J Wunsch" at Sep 13, 95 04:36:15 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > > 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509131721.KAA07690>