Bug 4116 - [patch] [kerberos] Kerberized login as <user>.root fails to become root
Summary: [patch] [kerberos] Kerberized login as <user>.root fails to become root
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1997-07-18 19:40 UTC by Joe Traister
Modified: 2017-12-31 22:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Traister 1997-07-18 19:40:03 UTC
	When logging in as <user>.root principle, the login is subjected
	to the same tty tests as root, allowed to login when /etc/nologin
	exists, the kerberos ticket file is created as /tmp/tkt_root_<uid>,
	and a root login is syslog'ed, but you don't become root.  This
	is a problem only when LOGIN_CAP is defined during compile.  The
	non-LOGIN_CAP code does everything as the user and then does the
	final setuid() to 0 if it's a root login, but the LOGIN_CAP code
	simply does a setusercontext() to the user.  This is fixed very
	simply by including a check for rootlogin and passing setuserconext
	a 0 uid instead of the user's uid.

Fix: 

change

	if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETALL) != 0 {

	to

	if (setusercontext(lc, pwd, rootlogin ? 0 : pwd->pw_uid, LOGIN_SETALL) != 0 {

	in login.c in the main() function.
How-To-Repeat: 
	login as a <user>.root principle on a kerberized box.
Comment 1 davidn freebsd_committer 1997-07-21 06:48:32 UTC
Responsible Changed
From-To: freebsd-bugs->davidn

I broke this, so I'll look into a fix. 
However, I'm not certain that the suggested fix is correct. 
After all, instances other than 'root' may be used, and if the root 
instance login is broken, then they all will be. 

Comment 2 firsttv 2002-12-21 18:17:23 UTC
Try this patch:

if(rootlogin){
    pwd->pw-uid=0;
}
right before the call to setusercontext() in login.c.

Lucas
Comment 3 firsttv 2002-12-21 18:19:00 UTC
Try this fix:
if(rootlogin)
    pwd->pw_uid=0;
right before the call to setusercontext() in login.c.
Lucas
Comment 4 Doug Barton freebsd_committer 2003-03-15 05:43:28 UTC
Responsible Changed
From-To: davidn->freebsd-bugs


davidn is no longer with us
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:53 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped