[MDEV-30085] ER_DBACCESS_DENIED_ERROR for Spider and Federated tables on test db Created: 2022-11-24  Updated: 2023-05-20  Resolved: 2022-11-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Federated, Storage Engine - Spider
Affects Version/s: 10.11
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Roel Van de Paar Assignee: Roel Van de Paar
Resolution: Not a Bug Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-5215 Granted to PUBLIC Closed
Relates

 Description   

The following testcase will pass before MDEV-5215:

--let $SOCKET=`SELECT @@global.socket`
--source include/have_innodb.inc
INSTALL PLUGIN Spider SONAME 'ha_spider.so';
CREATE USER u@localhost IDENTIFIED BY 'a';
eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$SOCKET",DATABASE 'test',user 'u',PASSWORD 'a');
CREATE TABLE ti (c INT) ENGINE=InnoDB;
CREATE TABLE ts ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv", TABLE "ti"';

But not afterwards, yielding:

10.11.1 b4e7803a6f4c734fc5f06a0b0d78285510ae0f48

mysqltest: At line 7: query 'CREATE TABLE ts ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv", TABLE "ti"'' failed: ER_DBACCESS_DENIED_ERROR (1044): Access denied for user 'u'@'localhost' to database 'test'

Adding:

GRANT ALL ON test.* TO u@localhost;

Directly after the user creation fixes the test on 10.11.

The same happens for Federated. Testcase (with GRANT present for convenience but commented):

--let $SOCKET= `SELECT @@global.socket`
--source include/have_innodb.inc
INSTALL SONAME 'ha_federatedx.so';
CREATE USER u@localhost IDENTIFIED BY 'a';
#GRANT ALL ON test.* TO u@localhost;
eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$SOCKET",DATABASE 'test',user 'u',PASSWORD 'a');
CREATE TABLE ti (c INT) ENGINE=InnoDB;
CREATE TABLE tf CONNECTION='srv/ti' ENGINE=FEDERATED;



 Comments   
Comment by Roel Van de Paar [ 2022-11-26 ]

This is only applicable to the test database, to which users no longers get access-by-default. When using any other DB, the issue is the same, even prior to MDEV-5215. The only difference is that from now on, testcases using the test database will need the additional GRANT.

Generated at Thu Feb 08 10:13:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.