mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Add tests for various connection string issues
Add tests for consistent support of connection strings in frontend programs as well as proper handling of unusual characters in database and user names. These tests were developed for the issues of CVE-2016-5424. To allow testing of names with spaces, change the pg_regress command-line options --create-role and --dbname to split their arguments by comma only, not space or comma as before. Only commas were actually used in existing uses. Noah Misch, Michael Paquier, Peter Eisentraut
This commit is contained in:
@ -20,6 +20,7 @@ use SimpleTee;
|
||||
use Test::More;
|
||||
|
||||
our @EXPORT = qw(
|
||||
generate_ascii_string
|
||||
slurp_dir
|
||||
slurp_file
|
||||
append_to_file
|
||||
@ -166,6 +167,19 @@ sub run_log
|
||||
return IPC::Run::run(@_);
|
||||
}
|
||||
|
||||
# Generate a string made of the given range of ASCII characters
|
||||
sub generate_ascii_string
|
||||
{
|
||||
my ($from_char, $to_char) = @_;
|
||||
my $res;
|
||||
|
||||
for my $i ($from_char .. $to_char)
|
||||
{
|
||||
$res .= sprintf("%c", $i);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub slurp_dir
|
||||
{
|
||||
my ($dir) = @_;
|
||||
|
Reference in New Issue
Block a user