[313] in NetBSD-Development
login
daemon@ATHENA.MIT.EDU (yoav@MIT.EDU)
Fri Dec 23 11:05:32 1994
From: yoav@MIT.EDU
Date: Fri, 23 Dec 1994 11:04:44 -0500
To: netbsd-dev@MIT.EDU
Well, I've managed to compile login and make it act somewhat happy,
only due to the following bug, a lot of the performance of login is lost
(i.e., it loses it's root id halfway through, and doesn't complete all the
logging).
Basically, the program uses setreuid, which "is depracated". Anyway, I've been
trying to figure out what they're REALLY(tm) trying to do, and to no avail.
It seems the program is trying to figure out whether the person can actually cd
and read from their homedir.. I guess that makes sense, but how do I do that
(do I need to leave the saved-id-bit and somehow lose effective and real? and if
so, how do I do that? - with the ability to rever back....)
anyway, this is the code.. tell me what setreuid should be changed to
(in both cases)
yoav
/*
The effective uid is used under AFS for access.
NFS uses euid and uid for access checking
*/
setreuid(geteuid(),pwd->pw_uid);
if (!invalid && chdir(pwd->pw_dir) < 0) {
if (chdir("/") < 0) {
printf("No directory!\n");
invalid = TRUE;
} else {
puts("No directory! Logging in with home=/\n");
pwd->pw_dir = "/";
}
}
setreuid(getuid(), getuid());
/*
* Remote login invalid must have been because
* of a restriction of some sort, no extra chances.
*/
if (!usererr && invalid)
exit(1);