Skip to content

Commit

Permalink
fix(gorgone-mbi): escape db password when connecting using mysql cli
Browse files Browse the repository at this point in the history
Refs:MON-144577
  • Loading branch information
Evan-Adam committed Aug 14, 2024
1 parent 99d0ea1 commit 7e4dbfa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gorgone/gorgone/modules/centreon/mbi/libs/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ sub checkBasicOptions {

sub buildCliMysqlArgs {
my ($self, $con) = @_;

my $args = '-u "' . $con->{user} . '" ' .
'-p"' . $con->{password} . '" ' .
'-h "' . $con->{host} . '" ' .
'-P ' . $con->{port};
my $password = $con->{password};
# as we will use a bash command we need to use single quote to protect against every characters, and escape single quote)
$password =~ s/'/'"'"'/;
my $args = "-u'" . $con->{user} . "' " .
"-p'" . $password . "' " .
"-h '" . $con->{host} . "' " .
"-P " . $con->{port};
return $args;
}

sub getYesterdayTodayDate {
my ($self) = @_;

Expand Down

0 comments on commit 7e4dbfa

Please sign in to comment.