Problem 1:
column_priv_hash uses utf8_general_ci collation
for the key comparison. The key consists of user name,
db name and table name. Thus user with privileges on table t1
is able to perform the same operation on T1
(the similar situation with user name & db name, see acl_cache).
So collation which is used for column_priv_hash and acl_cache
should be case sensitive.
The fix:
replace system_charset_info with my_charset_utf8_bin for
column_priv_hash and acl_cache
Problem 2:
The same situation with proc_priv_hash, func_priv_hash,
the only difference is that Routine name is case insensitive.
So the fix is to use my_charset_utf8_bin for
proc_priv_hash & func_priv_hash and convert routine name into lower
case before writing the element into the hash and
before looking up the key.
Additional fix: mysql.procs_priv Routine_name field collation
is changed to utf8_general_ci.
It's necessary for REVOKE command
(to find a field by routine hash element values).
Note:
It's safe for lower-case-table-names mode too because
db name & table name are converted into lower case
(see GRANT_NAME::GRANT_NAME).
mysql-test/include/have_case_insensitive_fs.inc:
test case
mysql-test/r/case_insensitive_fs.require:
test case
mysql-test/r/grant_lowercase_fs.result:
test result
mysql-test/r/lowercase_fs_off.result:
test result
mysql-test/r/ps_grant.result:
test result
mysql-test/r/system_mysql_db.result:
changed Routine_name field collation to case insensitive
mysql-test/t/grant_lowercase_fs.test:
test case
mysql-test/t/lowercase_fs_off.test:
test case
scripts/mysql_system_tables.sql:
changed Routine_name field collation to case insensitive
scripts/mysql_system_tables_fix.sql:
changed Routine_name field collation to case insensitive
sql/sql_acl.cc:
Problem 1:
column_priv_hash uses utf8_general_ci collation
for the key comparison. The key consists of user name,
db name and table name. Thus user with privileges on table t1
is able to perform the same operation on T1
(the similar situation with user name & db name, see acl_cache).
So collation which is used for column_priv_hash and acl_cache
should be case sensitive.
The fix:
replace system_charset_info with my_charset_utf8_bin for
column_priv_hash and acl_cache
Problem 2:
The same situation with proc_priv_hash, func_priv_hash,
the only difference is that Routine name is case insensitive.
So the fix is to use my_charset_utf8_bin for
proc_priv_hash & func_priv_hash and convert routine name into lower
case before writing the element into the hash and
before looking up the key.
Additional fix: mysql.procs_priv Routine_name field collation
is changed to utf8_general_ci.
It's necessary for REVOKE command
(to find a field by routine hash element values).
Note:
It's safe for lower-case-table-names mode too because
db name & table name are converted into lower case
(see GRANT_NAME::GRANT_NAME).
should work in Prepared Statements. Post-review changeset.
Problem: There are some commands which are avaiable to be executed in SP
but cannot be prepared. This patch fixes this and makes it possible
prepare these statements.
Changes: The commands later are made available in PS. RESET has been forbidden
in SF/Trigger.
Solution: All current server commands where checked and those missing (see later)
we added. Tests for all of the commands with repeated executions were
added - testing with SP, SF and PS.
SHOW BINLOG EVENTS
SHOW (MASTER | SLAVE) STATUS
SHOW (MASTER | BINARY) LOGS
SHOW (PROCEDURE | FUNCTION) CODE (parsable only in debug builds)
SHOW CREATE (PROCEDURE | FUNCTION | EVENT | TABLE | VIEW)
SHOW (AUTHORS | CONTRIBUTORS | WARNINGS | ERRORS)
CHANGE MASTER
RESET (MASTER | SLAVE | QUERY CACHE)
SLAVE (START | STOP)
CHECKSUM (TABLE | TABLES)
INSTALL PLUGIN
UNINSTALL PLUGIN
CACHE INDEX
LOAD INDEX INTO CACHE
GRANT
REVOKE
KILL
(CREATE | RENAME | DROP) DATABASE
(CREATE | RENAME | DROP) USER
FLUSH (TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES |
LOGS | STATUS | MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES)
mysql-test/r/ps.result:
update result
mysql-test/r/ps_1general.result:
update result
mysql-test/r/ps_grant.result:
update result
mysql-test/r/sp-dynamic.result:
update result
mysql-test/t/ps.test:
Add more statements, probably all currently missing which are possible in
a SP but not preparable.
Every statement is tested in a SP, in a SF and attempted to prepare.
mysql-test/t/ps_1general.test:
- Enable some of the statements, which are already possible in SP.
- 1295 -> ER_UNSUPPORTED_PS
mysql-test/t/ps_grant.test:
Enable statements already possible in SP.
sql/sp_head.cc:
- Reorder to keep some alphabet order.
- Add missing SHOW_SCHEDULER_STATUS.
sql/sql_prepare.cc:
Add possibility to prepare statements, which are already allowed in SP.
mysql-test/r/func_group.result:
Update results after merge (things moved around when aligning 4.1 and 5.0 tests)
mysql-test/r/mysqldump.result:
Update results after merge (things moved around when aligning 4.1 and 5.0 tests)
mysql-test/r/ps_grant.result:
Update results after merge (test moved to another file)
mysql-test/t/mysqldump.test:
Align with other lines
sql/lock.cc:
Removed compiler warning
Fixed typo during merge
into mysql.com:/home/my/mysql-5.0
BitKeeper/etc/ignore:
auto-union
BitKeeper/deleted/.del-ctype_cp932.test:
Auto merged
BitKeeper/deleted/.del-isam.test~834fb0ee8196c445:
Auto merged
include/thr_lock.h:
Auto merged
mysql-test/t/alias.test:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/archive.test:
Auto merged
mysql-test/t/backup.test:
Auto merged
mysql-test/t/bool.test:
Auto merged
mysql-test/t/connect.test:
Auto merged
mysql-test/t/count_distinct2.test:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/ctype_many.test:
Auto merged
mysql-test/t/ctype_ucs_binlog.test:
Auto merged
mysql-test/t/date_formats.test:
Auto merged
mysql-test/t/delayed.test:
Auto merged
mysql-test/t/derived.test:
Auto merged
mysql-test/t/distinct.test:
Auto merged
mysql-test/t/drop.test:
Auto merged
mysql-test/t/endspace.test:
Auto merged
mysql-test/t/flush.test:
Auto merged
mysql-test/t/fulltext.test:
Auto merged
mysql-test/t/fulltext_order_by.test:
Auto merged
mysql-test/t/func_compress.test:
Auto merged
mysql-test/t/func_concat.test:
Auto merged
mysql-test/t/func_date_add.test:
Auto merged
mysql-test/t/func_equal.test:
Auto merged
mysql-test/t/func_if.test:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
mysql-test/t/func_set.test:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
mysql-test/t/gis.test:
Auto merged
mysql-test/t/grant.test:
Auto merged
mysql-test/t/grant2.test:
Auto merged
mysql-test/t/grant_cache.test:
Auto merged
mysql-test/t/heap.test:
Auto merged
mysql-test/t/heap_btree.test:
Auto merged
mysql-test/t/heap_hash.test:
Auto merged
mysql-test/t/init_connect.test:
Auto merged
mysql-test/t/insert_select.test:
Auto merged
mysql-test/t/insert_update.test:
Auto merged
mysql-test/t/key.test:
Auto merged
mysql-test/t/keywords.test:
Auto merged
mysql-test/t/limit.test:
Auto merged
mysql-test/t/lock.test:
Auto merged
mysql-test/t/lowercase_table.test:
Auto merged
mysql-test/t/lowercase_table3.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/mix_innodb_myisam_binlog.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
mysql-test/t/mysqlbinlog2.test:
Auto merged
mysql-test/t/ndb_alter_table.test:
Auto merged
mysql-test/t/ndb_autodiscover.test:
Auto merged
mysql-test/t/ndb_charset.test:
Auto merged
mysql-test/t/ndb_grant.later:
Auto merged
mysql-test/t/ndb_index_ordered.test:
Auto merged
mysql-test/t/ndb_index_unique.test:
Auto merged
mysql-test/t/ndb_restore.test:
Auto merged
mysql-test/t/ndb_types.test:
Auto merged
mysql-test/t/ndb_update.test:
Auto merged
mysql-test/t/null.test:
Auto merged
mysql-test/t/null_key.test:
Auto merged
mysql-test/t/olap.test:
Auto merged
mysql-test/t/openssl_1.test:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysql-test/t/ps_1general.test:
Auto merged
mysql-test/t/ps_4heap.test:
Auto merged
mysql-test/t/ps_5merge.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysql-test/t/replace.test:
Auto merged
mysql-test/t/row.test:
Auto merged
mysql-test/t/rpl000001.test:
Auto merged
mysql-test/t/rpl000015.test:
Auto merged
mysql-test/t/rpl000017.test:
Auto merged
mysql-test/t/rpl000018.test:
Auto merged
mysql-test/t/rpl_EE_error.test:
Auto merged
mysql-test/t/rpl_change_master.test:
Auto merged
mysql-test/t/rpl_charset.test:
Auto merged
mysql-test/t/rpl_create_database.test:
Auto merged
mysql-test/t/rpl_ddl.test:
Auto merged
mysql-test/t/rpl_deadlock.test:
Auto merged
mysql-test/t/rpl_empty_master_crash.test:
Auto merged
mysql-test/t/rpl_error_ignored_table.test:
Auto merged
mysql-test/t/rpl_flush_log_loop.test:
Auto merged
mysql-test/t/rpl_flush_tables.test:
Auto merged
mysql-test/t/rpl_get_lock.test:
Auto merged
mysql-test/t/rpl_heap.test:
Auto merged
mysql-test/t/rpl_loaddata.test:
Auto merged
mysql-test/t/rpl_loaddata_rule_m.test:
Auto merged
mysql-test/t/rpl_log.test:
Auto merged
mysql-test/t/rpl_log_pos.test:
Auto merged
mysql-test/t/rpl_max_relay_size.test:
Auto merged
mysql-test/t/rpl_multi_query.test:
Auto merged
mysql-test/t/rpl_openssl.test:
Auto merged
mysql-test/t/rpl_redirect.test:
Auto merged
mysql-test/t/rpl_relayrotate.test:
Auto merged
mysql-test/t/rpl_replicate_do.test:
Auto merged
mysql-test/t/rpl_reset_slave.test:
Auto merged
mysql-test/t/rpl_server_id2.test:
Auto merged
mysql-test/t/rpl_temporary.test:
Auto merged
mysql-test/t/rpl_timezone.test:
Auto merged
mysql-test/t/rpl_user_variables.test:
Auto merged
mysql-test/t/show_check.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/symlink.test:
Auto merged
mysql-test/t/synchronization.test:
Auto merged
mysql-test/t/system_mysql_db.test:
Auto merged
mysql-test/t/system_mysql_db_fix.test:
Auto merged
mysql-test/t/temp_table.test:
Auto merged
mysql-test/t/timezone2.test:
Auto merged
mysql-test/t/timezone_grant.test:
Auto merged
mysql-test/t/type_float.test:
Auto merged
mysql-test/t/type_ranges.test:
Auto merged
mysql-test/t/type_timestamp.test:
Auto merged
mysql-test/t/union.test:
Auto merged
mysql-test/t/update.test:
Auto merged
mysql-test/t/user_var-binlog.test:
Auto merged
mysql-test/t/warnings.test:
Auto merged
mysys/thr_lock.c:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_select.cc:
Auto merged
support-files/mysql.spec.sh:
Auto merged
BitKeeper/deleted/.del-rpl_trunc_binlog.test~961b1f6ac73d37c8:
Simple merge
mysql-test/r/ps_grant.result:
Simple merge
mysql-test/t/analyse.test:
Simple merge
mysql-test/t/auto_increment.test:
Simple merge
mysql-test/t/bdb.test:
Simple merge
mysql-test/t/bigint.test:
Simple merge
mysql-test/t/case.test:
Simple merge
mysql-test/t/cast.test:
Simple merge
mysql-test/t/check.test:
Simple merge
mysql-test/t/count_distinct.test:
Simple merge
mysql-test/t/ctype_latin1_de.test:
Simple merge
mysql-test/t/ctype_uca.test:
Simple merge
mysql-test/t/ctype_ucs.test:
Simple merge
mysql-test/t/ctype_utf8.test:
Simple merge
mysql-test/t/delete.test:
Simple merge
mysql-test/t/flush_block_commit.test:
Simple merge
mysql-test/t/func_default.test:
Simple merge
mysql-test/t/func_gconcat.test:
Simple merge
mysql-test/t/func_group.test:
Aligned code with 4.1
mysql-test/t/func_in.test:
Simple merge
mysql-test/t/func_math.test:
Simple merge
mysql-test/t/func_misc.test:
Simple merge
mysql-test/t/func_test.test:
Simple merge
mysql-test/t/func_time.test:
Simple merge
mysql-test/t/group_by.test:
Simple merge
mysql-test/t/having.test:
Simple merge
mysql-test/t/innodb.test:
Simple merge
mysql-test/t/insert.test:
Simple merge
mysql-test/t/join_outer.test:
Simple merge
mysql-test/t/kill.test:
Simple merge
mysql-test/t/loaddata.test:
Simple merge
mysql-test/t/lock_multi.test:
Simple merge
mysql-test/t/multi_update.test:
Simple merge
mysql-test/t/mysqlbinlog.test:
Simple merge
mysql-test/t/mysqldump.test:
Aligned code with 4.1
mysql-test/t/mysqltest.test:
Simple merge
mysql-test/t/ndb_basic.test:
Simple merge
mysql-test/t/ndb_cache.test:
Simple merge
mysql-test/t/ndb_subquery.test:
Simple merge
mysql-test/t/ps_grant.test:
Simple merge
mysql-test/t/range.test:
Simple merge
mysql-test/t/rpl_drop_temp.test:
Simple merge
mysql-test/t/rpl_loaddata_rule_s.test:
Simple merge
mysql-test/t/rpl_loaddatalocal.test:
Simple merge
mysql-test/t/rpl_rotate_logs.test:
Simple merge
mysql-test/t/rpl_until.test:
Simple merge
mysql-test/t/rpl_variables.test:
Simple merge
mysql-test/t/select.test:
Simple merge
mysql-test/t/sql_mode.test:
Simple merge
mysql-test/t/type_blob.test:
Simple merge
mysql-test/t/type_decimal.test:
Simple merge
mysql-test/t/user_var.test:
Simple merge
mysql-test/t/variables.test:
Simple merge
sql/lock.cc:
Simple optimization
sql/mysql_priv.h:
Simple merge
sql/sql_table.cc:
Simple merge
sql/table.cc:
Simple merge
sql/unireg.cc:
Simple merge
mysql-test/r/ps_grant.result:
Deallocate prepare statements
Moved test for 'show full processlist' to not_embedded_server.test becasue it's shouldn't be here and it could fail on a slow computer where previous connections has not yet disconnected
mysql-test/t/ps_grant.test:
Deallocate prepare statements
Moved test for 'show full processlist' to not_embedded_server.test becasue it's shouldn't be here and it could fail on a slow computer where previous connections has not yet disconnected
sql/sql_lex.cc:
Fixed typo
mysql-test/r/not_embedded_server.result:
New BitKeeper file ``mysql-test/r/not_embedded_server.result''
mysql-test/t/not_embedded_server.test:
New BitKeeper file ``mysql-test/t/not_embedded_server.test''
BitKeeper/etc/ignore:
added ndb/tools/ndb_config
Bug#8367 "low log doesn't gives complete information about prepared
statements"
Implement status variables for prepared statements commands (a port of
the patch by Andrey Hristov).
See details in comments to the changed files.
No test case as there is no way to test slow log/general log in
mysqltest.
mysql-test/r/ps_grant.result:
Now execute is logged with tag 'Execute' (changed result file).
sql/mysql_priv.h:
- remove obsolete macro.
- add declarations for new status variables.
- export function log_slow_statement, which now is used in sql_prepare.cc
sql/mysqld.cc:
Add status variables for prepared statements API: now we record
mysql_stmt_close, mysql_stmt_reset, mysql_stmt_prepare, mysql_stmt_execute
mysql_stmt_send_long_data, PREPARE, EXECUTE, DEALLOCATE.
sql/sql_parse.cc:
- account DEALLOCATE prepare as a Com_stmt_close command (close of a
prepared statement).
sql/sql_prepare.cc:
- fix a bug in SQL syntax for prepared statements + logging:
if we use --log and EXECUTE stmt USING @no_such_variable;, the
server crashed because the old code assumed that the variable
returned by get_var_with_binlog is never NULL.
- account statistics for
mysql_stmt_{prepare,execute,close,reset,send_long_data} in
Com_stmt_{prepare,execute,close,reset,send_long_data} correspondingly.
- log slow statements into the slow log early, when thd->query
points to a valid (with expanded placeholder values) query.
The previous version was logging it in sql_parse, when thd->query
is empty. Prevent the server from logging the statement twice by
setting thd->enable_slow_log= FALSE.
- now in case of EXECUTE stmt in SQL syntax for prepared statements the
general log gets two queries, e.g.
Query EXECUTE stmt USING @a, @b, @c
Execute INSERT INTO t1 VALUES (1, 2, 3)
This makes the behavior consistent with PREPARE command, which
also logs the statement twice.
process of the predecessing test case instead of the current test case.
Shifting the command to the end of the current test case should avoid this problem.
mysql-test/r/ps_grant.result:
Updated result
mysql-test/t/ps_grant.test:
Shift ' show full processlist ' to the end of the test script
server testing cleanups.
mysql-test/r/innodb.result:
Update results
mysql-test/r/insert_select-binlog.result:
Update results
mysql-test/r/mix_innodb_myisam_binlog.result:
Update results
mysql-test/r/ps_1general.result:
Update results
mysql-test/r/ps_grant.result:
Update results
mysql-test/r/view.result:
Update results
mysql-test/t/client_xml.test:
Skip test with embedded server
mysql-test/t/flush_read_lock_kill.test:
Skip test with embedded server
mysql-test/t/grant3.test:
Skip test with embedded server
mysql-test/t/information_schema.test:
Skip test with embedded server
mysql-test/t/innodb.test:
Fix up filenames
mysql-test/t/multi_update.test:
Skip test with embedded server
mysql-test/t/mysqlshow.test:
Skip test with embedded server
mysql-test/t/ps_1general.test:
Move grant-related tests to ps_grant, and fix cleanup of filename
mysql-test/t/ps_grant.test:
Add additional tests
mysql-test/t/sp-security.test:
Skip test with embedded server
mysql-test/t/user_limits.test:
Skip test with embedded server
mysql-test/t/view.test:
Split grant-related tests to new test file view_grant
by adding check for embedded server within tests and splitting some
tests into multiple test files.
mysql-test/mysql-test-run.sh:
Remove most of hardcoded list of tests to skip
mysql-test/r/ps_1general.result:
Update results
mysql-test/r/timezone2.result:
Update results
mysql-test/r/user_var.result:
Update results
mysql-test/r/variables.result:
Update results
mysql-test/t/mix_innodb_myisam_binlog.test:
Disable test with embedded server
mysql-test/t/mysql_protocols.test:
Disable test with embedded server
mysql-test/t/mysqlbinlog.test:
Disable test with embedded server
mysql-test/t/mysqlbinlog2.test:
Disable test with embedded server
mysql-test/t/mysqldump.test:
Disable test with embedded server
mysql-test/t/packet.test:
Disable test with embedded server
mysql-test/t/ps_1general.test:
Move parts of test to new ps_grant
mysql-test/t/rename.test:
Disable test with embedded server
mysql-test/t/show_check.test:
Disable test with embedded server
mysql-test/t/system_mysql_db_fix.test:
Disable test with embedded server
mysql-test/t/timezone2.test:
Move part of test to timezone_grant
mysql-test/t/user_var.test:
Move part of test to new user_var-binlog
mysql-test/t/variables.test:
Move part of test to rpl_variables