Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: andersk(at)mit(dot)edu, alvherre(at)alvh(dot)no-ip(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Date: 2021-10-20 11:55:46
Message-ID: 07CA67A0-A46C-4ED5-99C6-24D41BDDC8CA@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 20 Oct 2021, at 07:40, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> At Tue, 19 Oct 2021 02:44:03 -0700, Anders Kaseorg <andersk(at)mit(dot)edu> wrote in
>> On 10/19/21 01:34, Kyotaro Horiguchi wrote:
>>> I tend to agree to this, but seeing ssh ignoring $HOME, I'm not sure
>>> it's safe that we follow the variable at least when accessing
>>> confidentiality(?) files. Since I don't understand the exact
>>> reasoning for the ssh's behavior so it's just my humbole opinion.
>>
>> According to https://bugzilla.mindrot.org/show_bug.cgi?id=3048#c1, it
>> used to be supported to install the ssh binary as setuid. A
>> setuid/setgid binary needs to treat all environment variables with
>> suspicion: if it can be convinced to write a file to $HOME with root
>> privileges, then a user who modifies $HOME before invoking the binary
>> could cause it to write to a file that the user normally couldn’t.
>>
>> There’s no such concern for a binary that isn’t setuid/setgid. Anyone
>> with the ability to modify $HOME can be assumed to already have full
>> control of the user account.
>
> Thansk for the link. Still I'm not sure it's the fact but it sounds
> reasonable enough. If that's the case, I vote +1 for psql or other
> commands honoring $HOME.

Is the proposed change portable across all linux/unix systems we support?
Reading aobut indicates that it's likely to be, but neither NetBSD nor FreeBSD
have the upthread referenced wording in their manpages.

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-20 12:19:51 Re: [PATCH] Fix memory corruption in pg_shdepend.c
Previous Message Dmitry Dolgov 2021-10-20 11:48:33 Re: lastOverflowedXid does not handle transaction ID wraparound