summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-11-25 21:55:49 +0100
committerunknown <ingo@mysql.com>2004-11-25 21:55:49 +0100
commit5e26cd43b18f5c9c5da88d0f717b9616397bd896 (patch)
treefb57792268eee09ca036d97f725d13e2067dc42d /sql/sql_parse.cc
parente24375fd33c6a81b42056d3168167a1c8f19f6e0 (diff)
downloadmariadb-git-5e26cd43b18f5c9c5da88d0f717b9616397bd896.tar.gz
WL#2050 - CREATE USER and DROP USER and RENAME USER
Added new commands CREATE USER and RENAME USER. Changed behaviour of DROP USER. Changed an error messages for the new commands. Docs/mysqld_error.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. include/mysqld_error.h: WL#2050 - CREATE USER and DROP USER and RENAME USER Changed an error code for more general use. mysql-test/r/grant.result: WL#2050 - CREATE USER and DROP USER and RENAME USER Changed test results. mysql-test/r/grant2.result: WL#2050 - CREATE USER and DROP USER and RENAME USER New test results. mysql-test/r/ps_1general.result: WL#2050 - CREATE USER and DROP USER and RENAME USER Changed test results. mysql-test/t/grant.test: WL#2050 - CREATE USER and DROP USER and RENAME USER Updated old tests for new behaviour of DROP USER. It does now implicitly remove all privileges and does not fail when privileges are still in place. Fixed a typo, which left an user in the database, whereby other tests could be confused. Added a DROP USER for another test user. mysql-test/t/grant2.test: WL#2050 - CREATE USER and DROP USER and RENAME USER Added new tests for the new features. sql/share/czech/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/danish/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/dutch/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/english/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/estonian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/french/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/german/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/greek/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/hungarian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/italian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/japanese/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/korean/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/norwegian-ny/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/norwegian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/polish/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/portuguese/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/romanian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/russian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/serbian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/slovak/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/spanish/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/swedish/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/share/ukrainian/errmsg.txt: WL#2050 - CREATE USER and DROP USER and RENAME USER Modified an error message for more general use. sql/sql_acl.cc: WL#2050 - CREATE USER and DROP USER and RENAME USER Added a destructor for the GRANT_TABLE object to get rid of a hash_column in cases where a nonsense row was read from the privilege tables. Added code to delete such an object when it is not entered into the column_priv_hash due to a nonsense row. Added function comments to two unmodified functions. Replaced mysql_drop_user() by the implementation of all of the functions as specified in the Low Level Design. sql/sql_acl.h: WL#2050 - CREATE USER and DROP USER and RENAME USER Added prototypes for new functions. sql/sql_lex.h: WL#2050 - CREATE USER and DROP USER and RENAME USER Added new command codes for CREATE USER and RENAME USER. sql/sql_parse.cc: WL#2050 - CREATE USER and DROP USER and RENAME USER Added case clauses for the new commands CREATE USER and RENAME USER. sql/sql_yacc.yy: WL#2050 - CREATE USER and DROP USER and RENAME USER Added syntax for the new commands CREATE USER and RENAME USER, reworked DROP USER, introduced a new 'user_list' and 'rename_list', renamed the old 'user_list' to 'grant_list'. The difference is that 'grant_list' contains 'grant_user' (with optional IDENTIFIED BY), while 'user_list' contains 'user'. Concentrated privilege initializazions into a new section 'clear_privileges'.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fce8d294456..2dba134f54e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3370,6 +3370,21 @@ create_error:
break;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ case SQLCOM_CREATE_USER:
+ {
+ if (check_access(thd, GRANT_ACL,"mysql",0,1,0))
+ break;
+ if (!(res= mysql_create_user(thd, lex->users_list)))
+ {
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
+ mysql_bin_log.write(&qinfo);
+ }
+ send_ok(thd);
+ }
+ break;
+ }
case SQLCOM_DROP_USER:
{
if (check_access(thd, GRANT_ACL,"mysql",0,1,0))
@@ -3378,8 +3393,23 @@ create_error:
{
if (mysql_bin_log.is_open())
{
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
- mysql_bin_log.write(&qinfo);
+ Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
+ mysql_bin_log.write(&qinfo);
+ }
+ send_ok(thd);
+ }
+ break;
+ }
+ case SQLCOM_RENAME_USER:
+ {
+ if (check_access(thd, GRANT_ACL,"mysql",0,1,0))
+ break;
+ if (!(res= mysql_rename_user(thd, lex->users_list)))
+ {
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
+ mysql_bin_log.write(&qinfo);
}
send_ok(thd);
}