mariadb/mysql-test/suite
Daniel Black 8bbe3a3cd2 MDEV-21194: mariadb-install-db doesn't properly grant proxy privileges to all created user accounts
mariadb-install-db --auth-root-authentication-method=normal created 4
root accounts by default, but only two of these had PROXY privilege
granted.

mariadb-install-db (default option
--auth-root-authentication-method=socket) as non-root user also didn't
grant PROXY priv to the created nonroot@localhost user.

To fix this, in mysql_system_tables_data.sql, we re-use tmp_user_nopasswd
as this contains the list of all root users.

REPLACE INTO tmp_proxies_priv SELECT @current_hostname, IFNULL(@auth_root_socket, 'root')
creates the $user@$current_host but will not error if @auth_root_socket
is null. Note @current_hostname lines are filtered out with
--cross-bootstrap in mariadb-install-db so it was needed to include this
expression for consistency.

Like the existing mysql_system_tables.sql is used to create teh
$user@localhost proxies_priv.

Test cases roles.acl_statistics, perfschema,privilege_table_io depends on the number of proxy users.

After:

--auth-root-authentication-method=normal:

MariaDB [mysql]> select * from global_priv;
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------+
| Host      | User        | Priv                                                                                                                     |
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------+
| localhost | mariadb.sys | {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0} |
| localhost | root        | {"access":18446744073709551615}                                                                                          |
| bark      | root        | {"access":18446744073709551615}                                                                                          |
| 127.0.0.1 | root        | {"access":18446744073709551615}                                                                                          |
| ::1       | root        | {"access":18446744073709551615}                                                                                          |
| localhost |             | {}                                                                                                                       |
| bark      |             | {}                                                                                                                       |
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------+
7 rows in set (0.001 sec)

MariaDB [mysql]> select * from proxies_priv;
+-----------+------+--------------+--------------+------------+---------+---------------------+
| Host      | User | Proxied_host | Proxied_user | With_grant | Grantor | Timestamp           |
+-----------+------+--------------+--------------+------------+---------+---------------------+
| localhost | root |              |              |          1 |         | 2023-07-10 12:12:24 |
| 127.0.0.1 | root |              |              |          1 |         | 2023-07-10 12:12:24 |
| ::1       | root |              |              |          1 |         | 2023-07-10 12:12:24 |
| bark      | root |              |              |          1 |         | 2023-07-10 12:12:24 |
+-----------+------+--------------+--------------+------------+---------+---------------------+

--auth-root-authentication-method=socket:

MariaDB [mysql]> select * from proxies_priv;
+-----------+------+--------------+--------------+------------+---------+---------------------+
| Host      | User | Proxied_host | Proxied_user | With_grant | Grantor | Timestamp           |
+-----------+------+--------------+--------------+------------+---------+---------------------+
| localhost | root |              |              |          1 |         | 2023-07-10 12:11:55 |
| localhost | dan  |              |              |          1 |         | 2023-07-10 12:11:55 |
| bark      | dan  |              |              |          1 |         | 2023-07-10 12:11:55 |
+-----------+------+--------------+--------------+------------+---------+---------------------+
3 rows in set (0.017 sec)

MariaDB [mysql]> select * from global_priv;
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Host      | User        | Priv                                                                                                                                       |
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| localhost | mariadb.sys | {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0}                   |
| localhost | root        | {"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]} |
| localhost | dan         | {"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]} |
| localhost |             | {}                                                                                                                                         |
| bark      |             | {}                                                                                                                                         |
+-----------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------+
5 rows in set (0.000 sec)

MariaDB [mysql]> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for dan@localhost                                                                                                               |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `dan`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'dan'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+
2023-09-19 08:07:07 +10:00
..
archive MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
binlog MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
binlog_encryption MDEV-31655: Parallel replication deadlock victim preference code errorneously removed 2023-08-15 16:35:30 +02:00
compat MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
csv
encryption MDEV-21664 Add opt files for have_innodb_Xk.inc 2023-09-11 09:09:02 +03:00
engines MDEV-30421 more tests cleaned up 2023-03-23 21:07:32 +03:00
federated MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
funcs_1 MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
funcs_2 MDEV-30233 DROP DATABASE test fails: Directory not empty 2022-12-15 11:14:23 +02:00
galera MDEV-31988 : galera_partition test: assertion due to unallowed state transition 2023-09-12 00:31:54 +02:00
galera_3nodes MDEV-25045 : Assertion `client_state_.mode() != wsrep::client_state::m_toi' failed in int wsrep::transaction::before_commit() 2023-03-31 12:48:13 +02:00
galera_3nodes_sr MDEV-27912 Fixing inconsistency w.r.t. expect files in tests. 2023-03-22 11:55:57 +11:00
galera_sr MDEV-32051 Failed to insert streaming client 2023-09-12 00:37:12 +02:00
gcol MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
handler MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
heap Merge 10.3 into 10.4 2022-09-13 16:36:38 +03:00
innodb MDEV-23841: Memory leak in innodb_monitor_validate() 2023-09-11 10:27:21 +03:00
innodb_fts Revert "MDEV-30528 Assertion in dtype_get_at_most_n_mbchars" 2023-07-31 16:57:18 +03:00
innodb_gis MDEV-21678 innodb_gis.gis_split_nan fails with ER_CANT_CREATE_GEOMETRY_OBJECT 2023-09-11 08:12:58 +03:00
innodb_zip MDEV-21664 Add opt files for have_innodb_Xk.inc 2023-09-11 09:09:02 +03:00
jp MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-12 22:10:39 +04:00
json
large_tests MDEV-18187 Aria engine: Redo phase failed with "error 192 when executing record redo_index_new_page" upon startup on a restored datadir 2021-12-15 16:28:01 +02:00
maria Updated some test result for 32 bit systems 2023-05-24 19:22:08 +03:00
mariabackup MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
mtr/t
mtr2
multi_source
optimizer_unfixed_bugs
parts MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
perfschema MDEV-21194: mariadb-install-db doesn't properly grant proxy privileges to all created user accounts 2023-09-19 08:07:07 +10:00
perfschema_stress
period reformat the test 2022-11-27 05:11:39 +10:00
plugins "un-skip" more skipped tests 2023-09-11 11:23:26 +02:00
roles MDEV-21194: mariadb-install-db doesn't properly grant proxy privileges to all created user accounts 2023-09-19 08:07:07 +10:00
rpl Remove duplicated default client include from replication my.cnf 2023-09-14 12:56:41 +02:00
sql_sequence MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
storage_engine
stress MDEV-29710: Skip some more tests on Valgrind 2022-10-05 20:37:54 +03:00
sys_vars MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT 2023-07-30 22:00:43 +02:00
unit Merge 10.2 into 10.3 2021-10-21 17:39:34 +03:00
vcol MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
versioning MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
wsrep Merge branch '10.3' into 10.4 2022-05-08 23:03:08 +02:00