[pgpool-hackers: 4169] Re: bug: localhost entry in .pcppass does not match Unix domain socket connections

KAWAMOTO Masaya kawamoto at sraoss.co.jp
Thu Jun 9 11:23:29 JST 2022


Hi,

I checked the behavior of psql when using the .pgpass file.
The behavior of psql using pgpass is the same as the pcp commands
using the pcppass, but the difference is that the psql documentation
expressly explain that the localhost entry matches the socket directory
determined when build. The default socket directory
(DEFAULT_PGSOCKET_DIR) is defined as "/tmp" in pg_config_manual.h.

[libpq - C Library - The Password File]
   The host name localhost is also searched for when the connection
   is a Unix-domain socket connection and the host parameter matches
   libpq's default socket directory path.

[libpq - C Library - Database Connection Control Functions - Parameter Key Words - host]
   The default behavior when host is not specified, or is empty, is to
   connect to a Unix-domain socket in /tmp (or whatever socket directory
   was specified when PostgreSQL was built).

Instead of modifying the behavior of the pcp commands, should we
modify the documentation to be the same as PostgreSQL?

Regards.

On Wed, 1 Jun 2022 15:15:22 +0900
KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp> wrote:

> Hi,
> 
> The document of PCP password file says that a hostname of localhost
> matches Unix domain socket connections coming from the local  machie.
> But, actually localhost only matches UNIX_DOMAIN_PATH defined in
> src/include/pcp/pcp_stream.h.
> 
> The reproduction is as follows.
> I built pgpool with UNIX_DOMAIN_PATH defined '/tmp'.
> $ sudo mkdir /var/run/pgpool_pcp
> $ sudo chown kawamoto:kawamoto /var/run/pgpool_pcp
> $ pgpool_setup
> $ vi etc/pgpool.conf
> pcp_sochet_dir = '/var/run/pgpool_pcp'
> $ ./startall
> $ cat ~/.pcppass
> localhost:11001:kawamoto:kawamoto
> $ /usr/pcp_bug/bin/pcp_node_info -p 11001 -U kawamoto -w
> ERROR: connection to socket "/tmp/.s.PGSQL.11001" failed with error "No such file or directory"
> $ /usr/pcp_bug/bin/pcp_node_info -h /var/run/pgpool_pcp -p 11001 -U kawamoto -w
> FATAL:  authentication failed for user "kawamoto"
> DETAIL:  username and/or password does not match
> 
> 
> I attach a patch.
> 
> Best regards.
> 
> -- 
> KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp>
> SRA OSS, Inc. Japan


-- 
KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp>
SRA OSS, Inc. Japan


More information about the pgpool-hackers mailing list