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

Commita99ec2b

Browse files
committed
Have config_sspi_auth() permit IPv6 localhost connections.
Windows versions later than Windows Server 2003 map "localhost" to ::1.Account for that in the generated pg_hba.conf, fixing another oversightin commitf6dc6dd. Back-patch to 9.0,like that commit.David Rowley and Noah Misch
1 parent8b70023 commita99ec2b

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

‎src/test/regress/pg_regress.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ config_sspi_auth(const char *pgdata)
10431043
*domainname;
10441044
charusername[128];
10451045
DWORDsz=sizeof(username)-1;
1046+
boolhave_ipv6;
10461047
charfname[MAXPGPATH];
10471048
intres;
10481049
FILE*hba,
@@ -1062,6 +1063,28 @@ config_sspi_auth(const char *pgdata)
10621063
exit(2);
10631064
}
10641065

1066+
/*
1067+
* Like initdb.c:setup_config(), determine whether the platform recognizes
1068+
* ::1 (IPv6 loopback) as a numeric host address string.
1069+
*/
1070+
{
1071+
structaddrinfo*gai_result;
1072+
structaddrinfohints;
1073+
WSADATAwsaData;
1074+
1075+
hints.ai_flags=AI_NUMERICHOST;
1076+
hints.ai_family=AF_UNSPEC;
1077+
hints.ai_socktype=0;
1078+
hints.ai_protocol=0;
1079+
hints.ai_addrlen=0;
1080+
hints.ai_canonname=NULL;
1081+
hints.ai_addr=NULL;
1082+
hints.ai_next=NULL;
1083+
1084+
have_ipv6= (WSAStartup(MAKEWORD(2,2),&wsaData)==0&&
1085+
getaddrinfo("::1",NULL,&hints,&gai_result)==0);
1086+
}
1087+
10651088
/* Check a Write outcome and report any error. */
10661089
#defineCW(cond)\
10671090
do { \
@@ -1093,6 +1116,9 @@ config_sspi_auth(const char *pgdata)
10931116
CW(fputs("# Configuration written by config_sspi_auth()\n",hba) >=0);
10941117
CW(fputs("host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
10951118
hba) >=0);
1119+
if (have_ipv6)
1120+
CW(fputs("host all all ::1/128 sspi include_realm=1 map=regress\n",
1121+
hba) >=0);
10961122
CW(fclose(hba)==0);
10971123

10981124
snprintf(fname,sizeof(fname),"%s/pg_ident.conf",pgdata);

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ sub mkvcbuild
264264
$pgregress_ecpg->AddIncludeDir('src\test\regress');
265265
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
266266
$pgregress_ecpg->AddDefine('FRONTEND');
267+
$pgregress_ecpg->AddLibrary('ws2_32.lib');
267268
$pgregress_ecpg->AddReference($libpgport);
268269

269270
# src/bin
@@ -454,6 +455,8 @@ sub mkvcbuild
454455
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
455456
$pgregress->AddIncludeDir('src\port');
456457
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
458+
$pgregress->AddDefine('FRONTEND');
459+
$pgregress->AddLibrary('ws2_32.lib');
457460
$pgregress->AddReference($libpgport);
458461

459462
$solution->Save();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp