[2839] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

pending/511: More on the BSD/OS setreuid()

daemon@ATHENA.MIT.EDU (Evan Champion)
Sat Dec 6 10:10:12 1997

Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: gnats-admin@rt-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, Evan Champion <evanc@synapse.net>
Date: Sat, 6 Dec 1997 10:09:51 -0500 (EST)
From: Evan Champion <evanc@synapse.net>
To: krb5-bugs@MIT.EDU


>Number:         511
>Category:       pending
>Synopsis:       More on the BSD/OS setreuid()
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Sat Dec 06 10:10:01 EST 1997
>Last-Modified:
>Originator:
>Organization:
>Release:
>Environment:
>Description:
>How-To-Repeat:
>Fix:
>Audit-Trail:
>Unformatted:
As an FYI, I was digging through the BSD/OS kernel source to find out what
setreuid() _really_ does, and found this...

        /*
         * Partially emulate old setreuid usage of exchanging ruid and euid.
         * We assume that the intent of setting ruid is to be able to get
         * back setuid privilege. So we make sure that we will be able to
         * do so, but do not actually set the ruid.
         */

setreuid() is actually implemented as seteuid().  The real uid is never
changed.

Now, this code is only included if you have COMPAT_43 or COMPAT_BSDI11
defined.  COMPAT_43 is not defined by default, and my kernels don't have
COMPAT_BSDI11 defined.

Even more interesting, in libc's compat-43 part, setruid() is implemented
as setreuid(ruid, -1), when setreuid() never sets the real id :-) 

Evan


home help back first fref pref prev next nref lref last post