Skip to content

Commit bb14cc0

Browse files
author
Arun Kuruvila
committed
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.
1 parent 8b64f82 commit bb14cc0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/mysql_setpermission.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,13 @@ sub addall {
264264
foreach $host (@hosts) {
265265
# user privileges: SELECT
266266
if (($todo == 2) || ($todo == 3)) {
267-
$sth = $dbh->do("GRANT SELECT ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
267+
$sth = $dbh->do("GRANT SELECT ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
268268
} elsif ($todo == 4) {
269269
# user privileges: SELECT,INSERT,UPDATE,DELETE
270-
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
270+
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
271271
} elsif ($todo == 5) {
272272
# user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
273-
$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;
273+
$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;
274274
} elsif ($todo == 6) {
275275
# all privileges
276276
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;

0 commit comments

Comments
 (0)