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-125661
  • Loading branch information
Evan-Adam committed Jul 10, 2024
1 parent dc52bbe commit c61bb22
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 c61bb22

Please sign in to comment.