[MDEV-11584] GRANT inside an SP does not work well on 2nd execution Created: 2016-12-16  Updated: 2016-12-28  Resolved: 2016-12-28

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System, Prepared Statements, Stored routines
Affects Version/s: 10.1.20, 10.2
Fix Version/s: 10.1.21, 10.2.4

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.2.4-5

 Description   

I run this script:

DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
  GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass';
CALL sp1();

It seems to work fine.
However, if I call sp1() for the second time, it returns a strange warning:

CALL sp1();
SHOW WARNINGS;

+---------+------+--------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                              |
+---------+------+--------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect string value: '\xA5\xA5\xA5\xA5\xA5\xA5...' for column 'Password' at row 1 |
+---------+------+--------------------------------------------------------------------------------------+



 Comments   
Comment by Elena Stepanova [ 2016-12-17 ]

Same with prepared statements.

MySQL 5.5-5.7 and MariaDB 5.5, 10.0 are not affected.

Comment by Oleksandr Byelkin [ 2016-12-21 ]

CREATE PROCEDURE sp1()
  GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass';
CALL sp1();
CALL sp1();
drop user 'foo'@'%';
drop procedure sp1;

Comment by Oleksandr Byelkin [ 2016-12-21 ]

Buffer for password hash was allocated in wrong memory.

Comment by Oleksandr Byelkin [ 2016-12-21 ]

revision-id: b730003a34661cbd3dc2beea73130cb67cebd30c (mariadb-10.2.2-257-gb730003a346)
parent(s): 27f20d192c118c3c8ae03d8e29759f343e46ad78
committer: Oleksandr Byelkin
timestamp: 2016-12-21 17:41:48 +0100
message:

MDEV-11584: GRANT inside an SP does not work well on 2nd execution

Allocate password hash in statment memory

Comment by Oleksandr Byelkin [ 2016-12-21 ]

10.1 version:
revision-id: 33b01257190cef414a4b0f00bf36ee6a3ceda0a7 (mariadb-10.1.20-6-g33b01257190)
parent(s): 9e032d6150b39cf36a22e7c1503e06fae9c4016d
committer: Oleksandr Byelkin
timestamp: 2016-12-21 20:11:14 +0100
message:

MDEV-11584: GRANT inside an SP does not work well on 2nd execution

Allocate password hash in statment memory

Generated at Thu Feb 08 07:51:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.