From owner-freebsd-hackers@freebsd.org Tue Mar 21 23:30:14 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 606F2D16B71 for ; Tue, 21 Mar 2017 23:30:14 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E601411B3 for ; Tue, 21 Mar 2017 23:30:13 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wm0-f51.google.com with SMTP id n11so22936449wma.1 for ; Tue, 21 Mar 2017 16:30:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=46lrGVbx8o6TTkjexp5mO9/HJJ9tD8y/2jS+Q9XH4Uk=; b=slCK1kvVhqepVax32qDMNRjhtvHvcu9MNoc/LBUkbrR4vHC50Ic5zyuft8VWoylWBL Dg9qpRlXY/enKdcO8whAjs2YwJ3lynn/X2Owt7g4UirsaWyFqCmyJv1c7k5bXDQnh3nF 8BicOpkHDWo2LUBHO0UotBWgyvqh/t2AoNZCWdc/vsyUjTu2hPbNvwa+xFabr07WB4Vi JtW4NkAj/fs2NcMNMrZ1INFWbM8T/FiUSrh78f93w6wIw0bGYqhBq8qyJONPrGq9C7xk MMwe2lAaTtpdm9oEQvtOSnl/yGhISfTCNNmRRuBSe0PidsVxTFT0NFrZL+QjP0LzVI4R CNCQ== X-Gm-Message-State: AFeK/H1wopFVyAYA0fNINETBGAMK8QSsi/03DRTnxYduAWR/1SThFN9o8MBfiR9RB9Bx7w== X-Received: by 10.28.47.15 with SMTP id v15mr4960746wmv.116.1490138606529; Tue, 21 Mar 2017 16:23:26 -0700 (PDT) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com. [209.85.128.175]) by smtp.gmail.com with ESMTPSA id y4sm16409791wra.16.2017.03.21.16.23.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 16:23:26 -0700 (PDT) Received: by mail-wr0-f175.google.com with SMTP id g10so120936545wrg.2 for ; Tue, 21 Mar 2017 16:23:26 -0700 (PDT) X-Received: by 10.223.145.97 with SMTP id j88mr32169737wrj.178.1490138606284; Tue, 21 Mar 2017 16:23:26 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.80.169.4 with HTTP; Tue, 21 Mar 2017 16:23:25 -0700 (PDT) In-Reply-To: References: From: Conrad Meyer Date: Tue, 21 Mar 2017 16:23:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A historical curiosity in su(1) To: Chris Sinjakli Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 23:30:14 -0000 On Tue, Mar 21, 2017 at 4:14 PM, Conrad Meyer 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