Commit 257763a9 authored by unknown's avatar unknown

create/drop/rename user cleanup


dbug/user.r:
  help cralified
include/mysqld_error.h:
  new error message added
mysql-test/r/grant.result:
  results updated
mysql-test/r/grant2.result:
  results updated
mysql-test/t/grant.test:
  results updated
mysql-test/t/grant2.test:
  results updated
sql/share/czech/errmsg.txt:
  error message updated
sql/share/danish/errmsg.txt:
  error message updated
sql/share/dutch/errmsg.txt:
  error message updated
sql/share/english/errmsg.txt:
  error message updated
sql/share/estonian/errmsg.txt:
  error message updated
sql/share/french/errmsg.txt:
  error message updated
sql/sql_acl.cc:
  changed error reporting for create/drop/rename user to be consistent with drop table
sql/share/german/errmsg.txt:
  error message updated
sql/share/greek/errmsg.txt:
  error message updated
sql/share/hungarian/errmsg.txt:
  error message updated
sql/share/italian/errmsg.txt:
  error message updated
sql/share/japanese/errmsg.txt:
  error message updated
sql/share/korean/errmsg.txt:
  error message updated
sql/share/norwegian-ny/errmsg.txt:
  error message updated
sql/share/norwegian/errmsg.txt:
  error message updated
sql/share/polish/errmsg.txt:
  error message updated
sql/share/portuguese/errmsg.txt:
  error message updated
sql/share/romanian/errmsg.txt:
  error message updated
sql/share/russian/errmsg.txt:
  error message updated
sql/share/serbian/errmsg.txt:
  error message updated
sql/share/slovak/errmsg.txt:
  error message updated
sql/share/spanish/errmsg.txt:
  error message updated
sql/share/swedish/errmsg.txt:
  error message updated
sql/share/ukrainian/errmsg.txt:
  error message updated
parent cf1de7d9
......@@ -907,8 +907,10 @@ Double the colon, if you want it in the path
.SP 1
EX: \fCa,C::\\tmp\\log\fR
.LI A[,file]
Like 'a[,file]' but close and reopen file after each write. It helps to get
a complete log file in case of crashes.
Like 'a[,file]' but ensure that data are written after each write
(this typically implies flush or close/reopen). It helps to get
a complete log file in case of crashes. This mode is implied in
multi-threaded environment.
.LI d[,keywords]
Enable output from macros with specified keywords.
A null list of keywords implies that all keywords are selected.
......
......@@ -284,7 +284,7 @@
#define ER_WARN_DATA_TRUNCATED 1265
#define ER_WARN_USING_OTHER_HANDLER 1266
#define ER_CANT_AGGREGATE_2COLLATIONS 1267
#define ER_HANDLE_USER 1268
#define ER_DROP_USER 1268
#define ER_REVOKE_GRANTS 1269
#define ER_CANT_AGGREGATE_3COLLATIONS 1270
#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
......@@ -412,4 +412,5 @@
#define ER_VIEW_MULTIUPDATE 1393
#define ER_VIEW_NO_INSERT_FIELD_LIST 1394
#define ER_VIEW_DELETE_MERGE_VIEW 1395
#define ER_ERROR_MESSAGES 396
#define ER_CANNOT_USER 1396
#define ER_ERROR_MESSAGES 397
......@@ -223,7 +223,7 @@ drop_user3@localhost, drop_user4@localhost;
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
ERROR HY000: Operation DROP USER failed for 4 of the requested users
ERROR HY000: Operation DROP USER failed for 'drop_user1'@'localhost','drop_user2'@'localhost','drop_user3'@'localhost','drop_user4'@'localhost'
drop table t1;
grant usage on *.* to mysqltest_1@localhost identified by "password";
grant select, update, insert on test.* to mysqltest_1@localhost;
......
......@@ -66,7 +66,7 @@ create table t1(c1 int);
create table t2(c1 int, c2 int);
create user 'mysqltest_1';
create user 'mysqltest_1';
ERROR HY000: Operation CREATE USER failed for 1 of the requested users
ERROR HY000: Operation CREATE USER failed for 'mysqltest_1'@'%'
create user 'mysqltest_2' identified by 'Mysqltest-2';
create user 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
grant select on *.* to 'mysqltest_2';
......@@ -139,7 +139,7 @@ drop user 'mysqltest_1', 'mysqltest_3';
grant all on test.t1 to 'mysqltest_1';
ERROR 42000: 'root'@'localhost' is not allowed to create new users
drop user 'mysqltest_1';
ERROR HY000: Operation DROP USER failed for 1 of the requested users
ERROR HY000: Operation DROP USER failed for 'mysqltest_1'@'%'
drop table t1, t2;
insert into mysql.db set user='mysqltest_1', db='%', host='%';
flush privileges;
......@@ -169,16 +169,16 @@ drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
create user 'mysqltest_1', 'mysqltest_2' identified by 'Mysqltest-2', 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
rename user 'mysqltest_1' to 'mysqltest_1a', 'mysqltest_2' TO 'mysqltest_2a', 'mysqltest_3' TO 'mysqltest_3a';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
ERROR HY000: Operation DROP USER failed for 3 of the requested users
ERROR HY000: Operation DROP USER failed for 'mysqltest_1'@'%','mysqltest_2'@'%','mysqltest_3'@'%'
drop user 'mysqltest_1a', 'mysqltest_2a', 'mysqltest_3a';
create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
create user 'mysqltest_1a', 'mysqltest_2', 'mysqltest_3a';
ERROR HY000: Operation CREATE USER failed for 1 of the requested users
ERROR HY000: Operation CREATE USER failed for 'mysqltest_2'@'%'
rename user 'mysqltest_1a' to 'mysqltest_1b', 'mysqltest_2a' TO 'mysqltest_2b', 'mysqltest_3a' TO 'mysqltest_3b';
ERROR HY000: Operation RENAME USER failed for 1 of the requested users
ERROR HY000: Operation RENAME USER failed for 'mysqltest_2a'@'%'
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1b', 'mysqltest_2b', 'mysqltest_3b';
ERROR HY000: Operation DROP USER failed for 1 of the requested users
ERROR HY000: Operation DROP USER failed for 'mysqltest_2b'@'%'
create user 'mysqltest_2' identified by 'Mysqltest-2';
drop user 'mysqltest_2' identified by 'Mysqltest-2';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'Mysqltest-2'' at line 1
......
......@@ -168,7 +168,7 @@ drop_user4@localhost;
--error 1269
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
--error 1268
--error 1396
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
drop table t1;
......
......@@ -91,7 +91,7 @@ create table t2(c1 int, c2 int);
#
# Three forms of CREATE USER
create user 'mysqltest_1';
--error 1268
--error 1396
create user 'mysqltest_1';
create user 'mysqltest_2' identified by 'Mysqltest-2';
create user 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
......@@ -127,7 +127,7 @@ drop user 'mysqltest_1', 'mysqltest_3';
# Grant must not create user
--error 1211
grant all on test.t1 to 'mysqltest_1';
--error 1268
--error 1396
drop user 'mysqltest_1';
#
# Cleanup
......@@ -164,18 +164,18 @@ create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
create user 'mysqltest_1', 'mysqltest_2' identified by 'Mysqltest-2', 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
rename user 'mysqltest_1' to 'mysqltest_1a', 'mysqltest_2' TO 'mysqltest_2a', 'mysqltest_3' TO 'mysqltest_3a';
--error 1268
--error 1396
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1a', 'mysqltest_2a', 'mysqltest_3a';
#
# Let one of multiple users fail
create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1268
--error 1396
create user 'mysqltest_1a', 'mysqltest_2', 'mysqltest_3a';
--error 1268
--error 1396
rename user 'mysqltest_1a' to 'mysqltest_1b', 'mysqltest_2a' TO 'mysqltest_2b', 'mysqltest_3a' TO 'mysqltest_3b';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1268
--error 1396
drop user 'mysqltest_1b', 'mysqltest_2b', 'mysqltest_3b';
#
# Obsolete syntax has been dropped
......
......@@ -296,7 +296,7 @@ character-set=latin2
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -424,3 +424,4 @@ character-set=latin2
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -287,7 +287,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -415,3 +415,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -296,7 +296,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -424,3 +424,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -284,7 +284,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for %.256s",
......@@ -289,7 +289,7 @@ character-set=latin7
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -417,3 +417,4 @@ character-set=latin7
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -284,7 +284,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -297,7 +297,7 @@ character-set=latin1
"Daten abgeschnitten für Spalte '%s' in Zeile %ld",
"Für Tabelle '%s' wird Speicher-Engine %s benutzt",
"Unerlaubte Vermischung der Kollationen (%s,%s) und (%s,%s) für die Operation '%s'",
"Das Kommando %s scheiterte für %d von den betroffenen Benutzern",
"Kann einen oder mehrere der angegebenen Benutzer nicht löschen",
"Kann nicht alle Berechtigungen widerrufen, grant for one or more of the requested users",
"Unerlaubte Vermischung der Kollationen (%s,%s), (%s,%s), (%s,%s) für die Operation '%s'",
"Unerlaubte Vermischung der Kollationen für die Operation '%s'",
......@@ -425,3 +425,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Das Kommando %s scheiterte für %.256s",
......@@ -284,7 +284,7 @@ character-set=greek
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=greek
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -289,7 +289,7 @@ character-set=latin2
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -417,3 +417,4 @@ character-set=latin2
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -284,7 +284,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -288,7 +288,7 @@ character-set=ujis
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -416,3 +416,4 @@ character-set=ujis
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -284,7 +284,7 @@ character-set=euckr
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=euckr
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -286,7 +286,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -414,3 +414,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -286,7 +286,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -414,3 +414,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -289,7 +289,7 @@ character-set=latin2
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -417,3 +417,4 @@ character-set=latin2
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -286,7 +286,7 @@ character-set=latin1
"Dado truncado para coluna '%s' na linha %ld",
"Usando engine de armazenamento %s para tabela '%s'",
"Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Não pode revocar todos os privilégios, grant para um ou mais dos usuários pedidos",
"Ilegal combinação de collations (%s,%s), (%s,%s), (%s,%s) para operação '%s'",
"Ilegal combinação de collations para operação '%s'",
......@@ -414,3 +414,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -289,7 +289,7 @@ character-set=latin2
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -417,3 +417,4 @@ character-set=latin2
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -289,7 +289,7 @@ character-set=koi8r
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -417,3 +417,4 @@ character-set=koi8r
" VIEW '%-.64s.%-.64s'"
" VIEW '%-.64s.%-.64s' "
" VIEW '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -277,7 +277,7 @@ character-set=cp1250
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -405,3 +405,4 @@ character-set=cp1250
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -292,7 +292,7 @@ character-set=latin2
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -420,3 +420,4 @@ character-set=latin2
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -288,7 +288,7 @@ character-set=latin1
"Datos truncados para columna '%s' en la línea %ld",
"Usando motor de almacenamiento %s para tabla '%s'",
"Ilegal mezcla de collations (%s,%s) y (%s,%s) para operación '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"No puede revocar todos los privilegios, derecho para uno o mas de los usuarios solicitados",
"Ilegal mezcla de collations (%s,%s), (%s,%s), (%s,%s) para operación '%s'",
"Ilegal mezcla de collations para operación '%s'",
......@@ -416,3 +416,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -284,7 +284,7 @@ character-set=latin1
"Data truncated for column '%s' at row %ld",
"Använder handler %s för tabell '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -412,3 +412,4 @@ character-set=latin1
"Can not modify more than one base table through a join view '%-.64s.%-.64s'"
"Can not insert into join view '%-.64s.%-.64s' without fields list"
"Can not delete from join view '%-.64s.%-.64s'"
"Operation %s failed for '%.256s'",
......@@ -290,7 +290,7 @@ character-set=koi8u
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Operation %s failed for %d of the requested users",
"Cannot drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'",
......@@ -418,3 +418,4 @@ character-set=koi8u
" ¦ VIEW '%-.64s.%-.64s', ͦԦ ˦ "
" VIEW '%-.64s.%-.64s', ͦ ˦ , æ"
" VIEW '%-.64s.%-.64s', ͦ ˦ "
"Operation %s failed for '%.256s'",
......@@ -3770,7 +3770,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop,
const char *user;
DBUG_ENTER("handle_grant_table");
if (! table_no)
if (! table_no) // mysql.user table
{
/*
The 'user' table has an unique index on (host, user).
......@@ -4119,6 +4119,16 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
DBUG_RETURN(result);
}
static void append_user(String *str, LEX_USER *user)
{
if (str->length())
str->append(',');
str->append('\'');
str->append(user->user.str);
str->append("'@'");
str->append(user->host.str);
str->append('\'');
}
/*
Create a list of users.
......@@ -4137,7 +4147,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
{
int result;
int found;
uint failures;
String wrong_users;
ulong sql_mode;
LEX_USER *user_name;
List_iterator <LEX_USER> user_list(list);
......@@ -4151,7 +4161,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
failures= 0;
while ((user_name= user_list++))
{
/*
......@@ -4160,20 +4169,16 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
*/
if ((found= handle_grant_data(tables, 0, user_name, NULL)))
{
if (found > 0)
sql_print_error("CREATE USER: Cannot create user: '%s'@'%s': "
"User exists",
user_name->user.str,
user_name->host.str);
failures++;
append_user(&wrong_users, user_name);
result= TRUE;
continue;
}
sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~MODE_NO_AUTO_CREATE_USER;
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1))
{
failures++;
append_user(&wrong_users, user_name);
result= TRUE;
}
thd->variables.sql_mode= sql_mode;
......@@ -4183,7 +4188,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
if (result)
my_error(ER_HANDLE_USER, MYF(0), "CREATE USER" , failures );
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr());
DBUG_RETURN(result);
}
......@@ -4205,34 +4210,24 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
{
int result;
int found;
uint failures;
String wrong_users;
LEX_USER *user_name;
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[4];
DBUG_ENTER("mysql_drop_user");
/* CREATE USER may be skipped on replication client. */
/* DROP USER may be skipped on replication client. */
if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
failures= 0;
while ((user_name= user_list++))
{
if ((found= handle_grant_data(tables, 1, user_name, NULL)) < 0)
if ((found= handle_grant_data(tables, 1, user_name, NULL)) <= 0)
{
failures++;
result= TRUE;
}
else if (! found)
{
sql_print_error("DROP USER: Cannot drop user '%s'@'%s': "
"No such user",
user_name->user.str,
user_name->host.str);
failures++;
append_user(&wrong_users, user_name);
result= TRUE;
}
}
......@@ -4241,7 +4236,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
if (result)
my_error(ER_HANDLE_USER, MYF(0), "DROP USER" , failures );
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr());
DBUG_RETURN(result);
}
......@@ -4263,63 +4258,42 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
{
int result= 0;
int found;
uint failures;
String wrong_users;
LEX_USER *user_from;
LEX_USER *user_to;
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[4];
DBUG_ENTER("mysql_rename_user");
/* CREATE USER may be skipped on replication client. */
/* RENAME USER may be skipped on replication client. */
if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
failures= 0;
while ((user_from= user_list++))
{
user_to= user_list++;
DBUG_ASSERT((user_to)); /* Syntax enforces pairs of users. */
DBUG_ASSERT(user_to); /* Syntax enforces pairs of users. */
/*
Search all in-memory structures and grant tables
for a mention of the new user name.
*/
if ((found= handle_grant_data(tables, 0, user_to, NULL)))
if (handle_grant_data(tables, 0, user_to, NULL) ||
handle_grant_data(tables, 0, user_from, user_to) <= 0)
{
if (found > 0)
sql_print_error("RENAME USER: Cannot rename to: '%s'@'%s': User exists",
user_to->user.str,
user_to->host.str);
failures++;
append_user(&wrong_users, user_from);
result= TRUE;
}
else
{
if ((found= handle_grant_data(tables, 0, user_from, user_to)) < 0)
{
failures++;
result= TRUE;
}
else if (! found)
{
sql_print_error("RENAME USER: Cannot rename user: '%s'@'%s': "
"No such user",
user_from->user.str,
user_from->host.str);
failures++;
result= TRUE;
}
}
}
VOID(pthread_mutex_unlock(&acl_cache->lock));
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
if (result)
my_error(ER_HANDLE_USER, MYF(0), "RENAME USER", failures);
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr());
DBUG_RETURN(result);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment