Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgCOL-00GawO-LF for pgsql-docs@arkaria.postgresql.org; Tue, 20 Aug 2024 00:06:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sgCOJ-004ljQ-Fy for pgsql-docs@arkaria.postgresql.org; Tue, 20 Aug 2024 00:06:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgCOJ-004ljI-89 for pgsql-docs@lists.postgresql.org; Tue, 20 Aug 2024 00:06:27 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgCOH-000Tw7-5v for pgsql-docs@lists.postgresql.org; Tue, 20 Aug 2024 00:06:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2024011501; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description; bh=57GfIUkAjNS04pWlVX/QfgSshdbOejYIxOad2rX5s/Q=; b=XSTei I+blWpZcgXBPcc+JD7mcPFPh1I9zyekH78IhNuJv09PjdZ2mDK2lIoO68p5dZqDw730e4HRH2LKIU DG6L98aL20g0n3BmSAc/21hJBPpalD9F0/OAmko8c61gX8hgo9w/N/5RuSJQNFT/R8TuUgioDq61o 7zD/yhiyPqTjVuHZDhCE1k3uw4eAxhhsz2TR6Hs0NZbMTrKNuB5tUh45lke+pXVC6mQuWxdkwd44a kLrS0QKsTWprmv6omDnNoEpryyNBblAkdbVtQjuMAKPlAnJtF7ZMJtE/JkWB66qud/o4p6furg5E9 th7khRk2BEmeRmOhWv5bSG5AUFqjQ==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1sgCOF-00FCAu-2c; Mon, 19 Aug 2024 20:06:23 -0400 Date: Mon, 19 Aug 2024 20:06:23 -0400 From: Bruce Momjian To: marc@msys.ch, pgsql-docs@lists.postgresql.org Subject: Re: Documentation of .pgpass for Unix is incomplete Message-ID: References: <172311029184.915368.14898011794686876553@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <172311029184.915368.14898011794686876553@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Aug 8, 2024 at 09:44:51AM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/16/libpq-pgpass.html > Description: > > The documentation of the .pgpass password file is incomplete in the Unix > case (https://www.postgresql.org/docs/16/libpq-pgpass.html): > > It does not mention how the .pgpass File is actually found. One would > assume it uses the getpwent() function to find the current users > homedirectory and locate the .pgpass file there, but this is not the case. > It only looks at the HOME environment variable. > > If you change the user using setuid() and do not change HOME as well, the > file not be found. Or assume you start a DB client as root by using su to > change the user id, things will not work: > > # /bin/su -c "startx -- " - xpos > > This starts X11 and changes to the user xpos, but it does only change the > user id, not $HOME. Well, it is more complicated than checking just HOME because it calls getpwuid_r() if HOME is not set: https://doxygen.postgresql.org/fe-connect_8c.html#a3f49cbb20595c1765bd0db5ff434c9c3 Is it worth going into that detail in the docs? -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.