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

Commit8d9cb0b

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 parent740a4ec commit8d9cb0b

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
@@ -1035,6 +1035,7 @@ config_sspi_auth(const char *pgdata)
10351035
*domainname;
10361036
constchar*username;
10371037
char*errstr;
1038+
boolhave_ipv6;
10381039
charfname[MAXPGPATH];
10391040
intres;
10401041
FILE*hba,
@@ -1054,6 +1055,28 @@ config_sspi_auth(const char *pgdata)
10541055
exit(2);
10551056
}
10561057

1058+
/*
1059+
* Like initdb.c:setup_config(), determine whether the platform recognizes
1060+
* ::1 (IPv6 loopback) as a numeric host address string.
1061+
*/
1062+
{
1063+
structaddrinfo*gai_result;
1064+
structaddrinfohints;
1065+
WSADATAwsaData;
1066+
1067+
hints.ai_flags=AI_NUMERICHOST;
1068+
hints.ai_family=AF_UNSPEC;
1069+
hints.ai_socktype=0;
1070+
hints.ai_protocol=0;
1071+
hints.ai_addrlen=0;
1072+
hints.ai_canonname=NULL;
1073+
hints.ai_addr=NULL;
1074+
hints.ai_next=NULL;
1075+
1076+
have_ipv6= (WSAStartup(MAKEWORD(2,2),&wsaData)==0&&
1077+
getaddrinfo("::1",NULL,&hints,&gai_result)==0);
1078+
}
1079+
10571080
/* Check a Write outcome and report any error. */
10581081
#defineCW(cond)\
10591082
do { \
@@ -1085,6 +1108,9 @@ config_sspi_auth(const char *pgdata)
10851108
CW(fputs("# Configuration written by config_sspi_auth()\n",hba) >=0);
10861109
CW(fputs("host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
10871110
hba) >=0);
1111+
if (have_ipv6)
1112+
CW(fputs("host all all ::1/128 sspi include_realm=1 map=regress\n",
1113+
hba) >=0);
10881114
CW(fclose(hba)==0);
10891115

10901116
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
@@ -345,6 +345,7 @@ sub mkvcbuild
345345
$pgregress_ecpg->AddIncludeDir('src\test\regress');
346346
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
347347
$pgregress_ecpg->AddDefine('FRONTEND');
348+
$pgregress_ecpg->AddLibrary('ws2_32.lib');
348349
$pgregress_ecpg->AddDirResourceFile('src\interfaces\ecpg\test');
349350
$pgregress_ecpg->AddReference($libpgcommon,$libpgport);
350351

@@ -372,6 +373,7 @@ sub mkvcbuild
372373
$pgregress_isolation->AddIncludeDir('src\test\regress');
373374
$pgregress_isolation->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
374375
$pgregress_isolation->AddDefine('FRONTEND');
376+
$pgregress_isolation->AddLibrary('ws2_32.lib');
375377
$pgregress_isolation->AddDirResourceFile('src\test\isolation');
376378
$pgregress_isolation->AddReference($libpgcommon,$libpgport);
377379

@@ -605,6 +607,8 @@ sub mkvcbuild
605607
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
606608
$pgregress->AddIncludeDir('src\port');
607609
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
610+
$pgregress->AddDefine('FRONTEND');
611+
$pgregress->AddLibrary('ws2_32.lib');
608612
$pgregress->AddDirResourceFile('src\test\regress');
609613
$pgregress->AddReference($libpgcommon,$libpgport);
610614

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp