summaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2014-12-17 22:48:40 -0500
committerNoah Misch <noah@leadboat.com>2014-12-17 22:48:45 -0500
commit6b87d423dc6188a0fed4331bc5c8e4c9c88263d1 (patch)
tree8ee38eae7f83f513f5234d2c64a03775fdb7f2f3 /src/test/perl/TestLib.pm
parent3f63b38fb252c54a2c40910dee47c2dc46cc7097 (diff)
Lock down regression testing temporary clusters on Windows.
Use SSPI authentication to allow connections exclusively from the OS user that launched the test suite. This closes on Windows the vulnerability that commit be76a6d39e2832d4b88c0e1cc381aa44a7f86881 closed on other platforms. Users of "make installcheck" or custom test harnesses can run "pg_regress --config-auth=DATADIR" to activate the same authentication configuration that "make check" would use. Back-patch to 9.0 (all supported versions). Security: CVE-2014-0067
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r--src/test/perl/TestLib.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 46a8bece1e5..57abdb92bf4 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -7,6 +7,7 @@ use Exporter 'import';
our @EXPORT = qw(
tempdir
tempdir_short
+ standard_initdb
start_test_server
restart_test_server
psql
@@ -69,6 +70,14 @@ sub tempdir_short
return File::Temp::tempdir(CLEANUP => 1);
}
+sub standard_initdb
+{
+ my $pgdata = shift;
+ system_or_bail("initdb -D '$pgdata' -A trust -N >/dev/null");
+ system_or_bail("$ENV{top_srcdir}/src/test/regress/pg_regress",
+ '--config-auth', $pgdata);
+}
+
my ($test_server_datadir, $test_server_logfile);
sub start_test_server
@@ -78,7 +87,7 @@ sub start_test_server
my $tempdir_short = tempdir_short;
- system "initdb -D '$tempdir'/pgdata -A trust -N >/dev/null";
+ standard_initdb "$tempdir/pgdata";
$ret = system 'pg_ctl', '-D', "$tempdir/pgdata", '-s', '-w', '-l',
"$tempdir/logfile", '-o',
"--fsync=off -k $tempdir_short --listen-addresses='' --log-statement=all",