Bug #96787 | mysqldbcopy uses incorrect DDL to clone stored procedure call permission | ||
---|---|---|---|
Submitted: | 7 Sep 2019 19:55 | Modified: | 9 Sep 2019 6:41 |
Reporter: | Pavel Yazev | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Utilities | Severity: | S3 (Non-critical) |
Version: | 1.6.4, 1.6.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | DDL, grant, mysqldbcopy, permission |
[7 Sep 2019 19:55]
Pavel Yazev
[7 Sep 2019 21:16]
Pavel Yazev
I have also checked the latest version of the tool (1.6.5) and see that the problem persists here as well. The below code is erroneous: [./mysql/utilities/common/database.py] 391 # Tables are not supported 392 if obj_type == _TABLE and self.cloning: 393 return None 394 # Grants are a different animal! 395 if obj_type == _GRANT: 396 if obj[3]: 397 create_str = "GRANT %s ON %s.%s TO %s" % \ 398 (obj[1], self.q_new_db, obj[3], obj[0]) 399 else: 400 create_str = "GRANT %s ON %s.* TO %s" % \ 401 (obj[1], self.q_new_db, obj[0]) It could be fixed as shown below (lines w/o numbers are added by me): 391 # Tables are not supported 392 if obj_type == _TABLE and self.cloning: 393 return None 394 # Grants are a different animal! 395 if obj_type == _GRANT: 396 if obj[3]: + if obj[5] in ['PROCEDURE', 'FUNCTION']: + create_str = "GRANT %s ON %s %s.%s TO %s" % \ + (obj[1], obj[5], self.q_new_db, obj[3], obj[0]) + else: 397 create_str = "GRANT %s ON %s.%s TO %s" % \ 398 (obj[1], self.q_new_db, obj[3], obj[0]) 399 else: 400 create_str = "GRANT %s ON %s.* TO %s" % \ 401 (obj[1], self.q_new_db, obj[0]) Thus the PROCEDURE/FUNCTION keyword is added into the statement.
[9 Sep 2019 6:41]
MySQL Verification Team
Hello Pavel Yazev, Thank you for the report and feedback. regards, Umesh