From 8fdb54b8c41c13f6a97aa9eaec00cd3e74c1f458 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Tue, 28 Nov 2017 12:41:13 +0100 Subject: [PATCH] TT#25061 add missing user/host quotes in sql * that is to allow user/host names with special characters Change-Id: I83005a433d1692f8f98deaf08b3fc5365250567a --- sbin/ngcp-sync-grants | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ngcp-sync-grants b/sbin/ngcp-sync-grants index 1ba12c1a..5ddbbcdc 100755 --- a/sbin/ngcp-sync-grants +++ b/sbin/ngcp-sync-grants @@ -348,7 +348,7 @@ sub grants_helper { my $host = $TEMP_GRANT_HOST; set_user_protected_password($user, $host); - $dbh->do("REVOKE ALL PRIVILEGES, GRANT OPTION FROM $user\@$host"); + $dbh->do("REVOKE ALL PRIVILEGES, GRANT OPTION FROM '$user'\@'$host'"); foreach my $grant (@$grants) { $grant = normalise_grant_str($grant); @@ -365,7 +365,7 @@ sub grants_helper { } my $temp_grants = $dbh->selectall_arrayref( - "SHOW GRANTS FOR ?\@?", undef, $user, $host); + "SHOW GRANTS FOR '$user'\@'$host'"); for (my $i=0;$i<=$#$temp_grants;$i++) { if ($temp_grants->[$i][0] =~ /grant usage/i) { @@ -421,7 +421,7 @@ sub check_grants { my ($grants, $user, $host) = @_; my $current_grants = $dbh->selectall_arrayref( - "SHOW GRANTS FOR ?\@?", undef, $user, $host); + "SHOW GRANTS FOR '$user'\@'$host'"); if ($DBI::errstr && ($DBI::errstr !~ /There is no such grant defined/ && $DBI::errstr !~ /fetch[()]+ without execute[()]+/)) {