Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2017 16:23:25 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Chris Sinjakli <chris@sinjakli.co.uk>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: A historical curiosity in su(1)
Message-ID:  <CAG6CVpW=Eq3htNS%2BHB83jRRBCrGUZViivz0RcS2%2Bz20-f5udog@mail.gmail.com>
In-Reply-To: <CAG6CVpUM05yoZa=dQLp1R2D6sbcBHDo2ggkX8MM0p%2BN6EaySmA@mail.gmail.com>
References:  <CAN-H%2BybmipbPq59HGVsfouS_8v-ezDbU%2B4PKtiTwj3tv-LjOyw@mail.gmail.com> <CAG6CVpUM05yoZa=dQLp1R2D6sbcBHDo2ggkX8MM0p%2BN6EaySmA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 21, 2017 at 4:14 PM, Conrad Meyer <cem@freebsd.org> wrote:
> Hi Chris,
>
> You might be interested in FreeBSD's copy of the CSRG repository.[0]
> Some of this logic was changed by karels@ in "r45520"[1] (of course it
> wasn't Subversion at the time).  The previous change[2] message
> includes "use new getlogin()."  Prior to that change, su did not use
> getlogin/getpwnam.
>
> The "BUGS" section of the getlogin(2) manual page says:
>
>      In earlier versions of the system, getlogin() failed unless the process
>      was associated with a login terminal.  The current implementation (using
>      setlogin()) allows getlogin to succeed even when the process has no con-
>      trolling terminal. In earlier versions of the system, the value returned
>      by getlogin() could not be trusted without checking the user ID.  Porta-
>      ble programs should probably still make this check.
>
> That might explain it?
>
> Best,
> Conrad
>
> [0]: https://svnweb.freebsd.org/csrg/usr.bin/su/su.c?view=annotate
> [1]: https://svnweb.freebsd.org/csrg?view=revision&revision=45520
> [2]: https://svnweb.freebsd.org/csrg?view=revision&revision=45127


Additionally, that getlogin(2) BUGS blurb dates to karels in 1990 as
well.[3]  The commit message was "good enough for now."  A different
time :-).

[3]: https://svnweb.freebsd.org/csrg?view=revision&revision=43655



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpW=Eq3htNS%2BHB83jRRBCrGUZViivz0RcS2%2Bz20-f5udog>