Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3472529

Browse files
committed
Don't connect() to a wildcard address in test_postmaster_connection().
At least OpenBSD, NetBSD, and Windows don't support it. This repairspg_ctl for listen_addresses='0.0.0.0' and listen_addresses='::'. Sincepg_ctl prefers to test a Unix-domain socket, Windows users are mostlikely to need this change. Back-patch to 9.1 (all supported versions).This could change pg_ctl interaction with loopback-interface firewallrules. Therefore, in 9.4 and earlier (released branches), activate thechange only on known-affected platforms.Reported (bug #13611) and designed by Kondo Yuta.
1 parent8db6523 commit3472529

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,22 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint)
601601
returnPQPING_NO_ATTEMPT;
602602
}
603603

604-
/* If postmaster is listening on "*", use localhost */
604+
/*
605+
* Map listen-only addresses to counterparts usable
606+
* for establishing a connection. connect() to "::"
607+
* or "0.0.0.0" is not portable to OpenBSD 5.0 or to
608+
* Windows Server 2008, and connect() to "::" is
609+
* additionally not portable to NetBSD 6.0. (Cygwin
610+
* does handle both addresses, though.)
611+
*/
605612
if (strcmp(host_str,"*")==0)
606613
strcpy(host_str,"localhost");
614+
#if defined(__NetBSD__)|| defined(__OpenBSD__)|| defined(WIN32)
615+
elseif (strcmp(host_str, "0.0.0.0")==0)
616+
strcpy(host_str, "127.0.0.1");
617+
elseif (strcmp(host_str, "::")==0)
618+
strcpy(host_str, "::1");
619+
#endif
607620

608621
/*
609622
* We need to set connect_timeout otherwise on Windows

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp