File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1043,6 +1043,7 @@ config_sspi_auth(const char *pgdata)
10431043 * domainname ;
10441044 char username [128 ];
10451045 DWORD sz = sizeof (username ) - 1 ;
1046+ bool have_ipv6 ;
10461047 char fname [MAXPGPATH ];
10471048 int res ;
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+ struct addrinfo * gai_result ;
1072+ struct addrinfo hints ;
1073+ WSADATA wsaData ;
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#define CW (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 );
Original file line number Diff line number Diff 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();
You can’t perform that action at this time.
0 commit comments