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

Commit86b561f

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 parent310597e commit86b561f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎src/test/regress/pg_regress.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,7 @@ config_sspi_auth(const char *pgdata)
10481048
*domainname;
10491049
charusername[128];
10501050
DWORDsz=sizeof(username)-1;
1051+
boolhave_ipv6;
10511052
charfname[MAXPGPATH];
10521053
intres;
10531054
FILE*hba,
@@ -1067,6 +1068,28 @@ config_sspi_auth(const char *pgdata)
10671068
exit(2);
10681069
}
10691070

1071+
/*
1072+
* Like initdb.c:setup_config(), determine whether the platform recognizes
1073+
* ::1 (IPv6 loopback) as a numeric host address string.
1074+
*/
1075+
{
1076+
structaddrinfo*gai_result;
1077+
structaddrinfohints;
1078+
WSADATAwsaData;
1079+
1080+
hints.ai_flags=AI_NUMERICHOST;
1081+
hints.ai_family=AF_UNSPEC;
1082+
hints.ai_socktype=0;
1083+
hints.ai_protocol=0;
1084+
hints.ai_addrlen=0;
1085+
hints.ai_canonname=NULL;
1086+
hints.ai_addr=NULL;
1087+
hints.ai_next=NULL;
1088+
1089+
have_ipv6= (WSAStartup(MAKEWORD(2,2),&wsaData)==0&&
1090+
getaddrinfo("::1",NULL,&hints,&gai_result)==0);
1091+
}
1092+
10701093
/* Check a Write outcome and report any error. */
10711094
#defineCW(cond)\
10721095
do { \
@@ -1098,6 +1121,9 @@ config_sspi_auth(const char *pgdata)
10981121
CW(fputs("# Configuration written by config_sspi_auth()\n",hba) >=0);
10991122
CW(fputs("host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
11001123
hba) >=0);
1124+
if (have_ipv6)
1125+
CW(fputs("host all all ::1/128 sspi include_realm=1 map=regress\n",
1126+
hba) >=0);
11011127
CW(fclose(hba)==0);
11021128

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

‎src/tools/msvc/Mkvcbuild.pm‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ sub mkvcbuild
272272
$pgregress_ecpg->AddIncludeDir('src\test\regress');
273273
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
274274
$pgregress_ecpg->AddDefine('FRONTEND');
275+
$pgregress_ecpg->AddLibrary('ws2_32.lib');
275276
$pgregress_ecpg->AddReference($libpgport);
276277

277278
my$isolation_tester =$solution->AddProject('isolationtester','exe','misc');
@@ -294,6 +295,7 @@ sub mkvcbuild
294295
$pgregress_isolation->AddIncludeDir('src\test\regress');
295296
$pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
296297
$pgregress_isolation->AddDefine('FRONTEND');
298+
$pgregress_isolation->AddLibrary('ws2_32.lib');
297299
$pgregress_isolation->AddReference($libpgport);
298300

299301
# src/bin
@@ -486,6 +488,8 @@ sub mkvcbuild
486488
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
487489
$pgregress->AddIncludeDir('src\port');
488490
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
491+
$pgregress->AddDefine('FRONTEND');
492+
$pgregress->AddLibrary('ws2_32.lib');
489493
$pgregress->AddReference($libpgport);
490494

491495
$solution->Save();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp