Bug #37198 user without any right on schema sees NDB table
Submitted: 4 Jun 2008 15:43 Modified: 4 Jun 2008 15:47
Reporter: Matthias Leich Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:5.0 OS:Any
Assigned to: CPU Architecture:Any

[4 Jun 2008 15:43] Matthias Leich
Description:
Snip from my protocol slightly edited:
--------------------------------------
...
CREATE DATABASE mydb;
CREATE TABLE mydb.t_ndb (f1 VARCHAR(20)) 
ENGINE = ndb;
CREATE TABLE mydb.t_myisam (f1 VARCHAR(20)) 
ENGINE = myisam;

CREATE DATABASE db_datadict;
SELECT table_schema, table_name, engine
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'mydb' ORDER BY table_name;
table_schema    table_name      engine
mydb    t_myisam        MyISAM
mydb    t_ndb   ndbcluster

CREATE USER testuser@localhost;
GRANT SELECT ON db_datadict.* TO testuser@localhost;
# Establish connection testuser (user=testuser)
connect(localhost,testuser,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
SELECT USER();
USER()
testuser@localhost
SELECT table_schema, table_name, engine
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'mydb' ORDER BY table_name;
table_schema    table_name      engine
mydb    t_ndb   ndbcluster   
     <--- Why is this row presented?
          The behaviour in case of the MyISAM
          table is correct.
SHOW TABLES FROM mydb;
ERROR 42000: Access denied for user 
      'testuser'@'localhost' to database 'mydb'
SELECT * FROM mydb.t_ndb;
ERROR 42000: SELECT command denied to user 
      'testuser'@'localhost' for table 't_ndb'
SELECT * FROM mydb.t_myisam;
ERROR 42000: SELECT command denied to user 
      'testuser'@'localhost' for table 't_myisam'

The MySQL versions 5.1 and 6.0 do not show
this bug.

My environment:
- Intel Core2Duo (64Bit)
- OpenSuSE 10.3 (64 Bit)
- mysql compiled from source (bugteam trees)

How to repeat:
Please run the attached testscript via
mysql-test-run.pl.
[4 Jun 2008 15:46] Matthias Leich
testscript

Attachment: ml003.test (application/octet-stream, text), 1.59 KiB.