summaryrefslogtreecommitdiff
path: root/scripts/mysql_setpermission.sh
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2014-10-17 11:14:26 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2014-10-17 11:14:26 +0530
commit635f38a2c1bb0d4e2d382a04e03d7ab716915e45 (patch)
tree449beccfe935cce264f1077eeb053d7ebf001d22 /scripts/mysql_setpermission.sh
parent57eec7bc29734d55600260f93d191664b15ef7cf (diff)
downloadmariadb-git-635f38a2c1bb0d4e2d382a04e03d7ab716915e45.tar.gz
Bug #14486004 MYSQL_SETPERMISSION DOES NOT QUOTE USER NAMES
Description: Certain operations using the client tool 'mysql\_setpermisson' which uses username of the format "xxx-yyy" results in a syntax error. Analysis: The user name variable ( $user ) was not quoted properly in the 'mysql\_setpermission' script. As a result, while granting user privileges for a user with username of the format 'xxx-yyy', results in a syntax error. Fix: The escape sequence has been applied for the user variable in the script file. Note: Test case is not added for this fix. 'mysql\_setpermission' executable resides in different directories on pb2 machines and on local boxes. Hence the test case cannot be made generic.
Diffstat (limited to 'scripts/mysql_setpermission.sh')
-rw-r--r--scripts/mysql_setpermission.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index f23011a5ae6..48f0b09b566 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -264,13 +264,13 @@ sub addall {
foreach $host (@hosts) {
# user privileges: SELECT
if (($todo == 2) || ($todo == 3)) {
- $sth = $dbh->do("GRANT SELECT ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
+ $sth = $dbh->do("GRANT SELECT ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 4) {
# user privileges: SELECT,INSERT,UPDATE,DELETE
- $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
+ $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 5) {
# user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
- $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
+ $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 6) {
# all privileges
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;