Skip to content

Commit e755e70

Browse files
committed
Proposed fix for issue 133: no commas in pgpass field
1 parent d0bba94 commit e755e70

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

check_postgres.pl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,6 +3426,17 @@ sub setup_target_databases {
34263426
my %group;
34273427
my $found_new_var = 0;
34283428

3429+
## Do we have any using multiple values for non-passwords?
3430+
my $got_multiple = 0;
3431+
for my $v (keys %$conn) {
3432+
next if $v eq 'dbpass' or ! defined $opt{$v}[0];
3433+
my $num = $opt{$v}->@*;
3434+
if ($num > 1 or $opt{$v}[0] =~ /,/) {
3435+
$got_multiple = 1;
3436+
last;
3437+
}
3438+
}
3439+
34293440
for my $v (keys %$conn) { ## For each connection var such as port, host...
34303441
my $vname = $v;
34313442

@@ -3438,7 +3449,7 @@ sub setup_target_databases {
34383449
$new =~ s/\s+//g unless $vname eq 'dbservice' or $vname eq 'host';
34393450

34403451
## Set this as the new default for this connection var moving forward
3441-
$conn->{$vname} = [split /,/ => $new, -1];
3452+
$conn->{$vname} = $got_multiple ? [split /,/ => $new, -1] : [$new];
34423453

34433454
## Make a note that we found something new this round
34443455
$found_new_var = 1;
@@ -11364,6 +11375,11 @@ =head1 HISTORY
1136411375
1136511376
=over 4
1136611377
11378+
=item B<Version 2.26.1> not yet released
11379+
11380+
Allow commas in passwords via --dbpass for one-connection queries (Greg Sabino Mullane) [Github issue #133]
11381+
11382+
1136711383
=item B<Version 2.26.0> Released April 3, 2023
1136811384
1136911385
Add new action "pgbouncer_maxwait" (Ruslan Kabalin) [Github pull #59]

0 commit comments

Comments
 (0)