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

Commit7bb78b2

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 parent5c86658 commit7bb78b2

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
@@ -1039,6 +1039,7 @@ config_sspi_auth(const char *pgdata)
10391039
*domainname;
10401040
charusername[128];
10411041
DWORDsz=sizeof(username)-1;
1042+
boolhave_ipv6;
10421043
charfname[MAXPGPATH];
10431044
intres;
10441045
FILE*hba,
@@ -1058,6 +1059,28 @@ config_sspi_auth(const char *pgdata)
10581059
exit(2);
10591060
}
10601061

1062+
/*
1063+
* Like initdb.c:setup_config(), determine whether the platform recognizes
1064+
* ::1 (IPv6 loopback) as a numeric host address string.
1065+
*/
1066+
{
1067+
structaddrinfo*gai_result;
1068+
structaddrinfohints;
1069+
WSADATAwsaData;
1070+
1071+
hints.ai_flags=AI_NUMERICHOST;
1072+
hints.ai_family=AF_UNSPEC;
1073+
hints.ai_socktype=0;
1074+
hints.ai_protocol=0;
1075+
hints.ai_addrlen=0;
1076+
hints.ai_canonname=NULL;
1077+
hints.ai_addr=NULL;
1078+
hints.ai_next=NULL;
1079+
1080+
have_ipv6= (WSAStartup(MAKEWORD(2,2),&wsaData)==0&&
1081+
getaddrinfo("::1",NULL,&hints,&gai_result)==0);
1082+
}
1083+
10611084
/* Check a Write outcome and report any error. */
10621085
#defineCW(cond)\
10631086
do { \
@@ -1089,6 +1112,9 @@ config_sspi_auth(const char *pgdata)
10891112
CW(fputs("# Configuration written by config_sspi_auth()\n",hba) >=0);
10901113
CW(fputs("host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
10911114
hba) >=0);
1115+
if (have_ipv6)
1116+
CW(fputs("host all all ::1/128 sspi include_realm=1 map=regress\n",
1117+
hba) >=0);
10921118
CW(fclose(hba)==0);
10931119

10941120
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
@@ -307,6 +307,7 @@ sub mkvcbuild
307307
$pgregress_ecpg->AddIncludeDir('src\test\regress');
308308
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
309309
$pgregress_ecpg->AddDefine('FRONTEND');
310+
$pgregress_ecpg->AddLibrary('ws2_32.lib');
310311
$pgregress_ecpg->AddReference($libpgport);
311312

312313
my$isolation_tester =
@@ -332,6 +333,7 @@ sub mkvcbuild
332333
$pgregress_isolation->AddIncludeDir('src\test\regress');
333334
$pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
334335
$pgregress_isolation->AddDefine('FRONTEND');
336+
$pgregress_isolation->AddLibrary('ws2_32.lib');
335337
$pgregress_isolation->AddReference($libpgport);
336338

337339
# src/bin
@@ -561,6 +563,8 @@ sub mkvcbuild
561563
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
562564
$pgregress->AddIncludeDir('src\port');
563565
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
566+
$pgregress->AddDefine('FRONTEND');
567+
$pgregress->AddLibrary('ws2_32.lib');
564568
$pgregress->AddReference($libpgport);
565569

566570
$solution->Save();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp