Commit 512d1c7f authored by cmiller@zippy.(none)'s avatar cmiller@zippy.(none)

Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge

into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
parents 4163c91d 69820afc
show variables like 'collation_server';
Variable_name Value
collation_server ucs2_unicode_ci
show variables like "%character_set_ser%"; show variables like "%character_set_ser%";
Variable_name Value Variable_name Value
character_set_server ucs2 character_set_server ucs2
......
...@@ -386,11 +386,11 @@ show keys from v4; ...@@ -386,11 +386,11 @@ show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.views where TABLE_NAME like "v%"; select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v0 select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER NULL test v0 /* ALGORITHM=UNDEFINED */ select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER
NULL test v1 select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER NULL test v1 /* ALGORITHM=UNDEFINED */ select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER
NULL test v2 select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER NULL test v2 /* ALGORITHM=UNDEFINED */ select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER
NULL test v3 select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER NULL test v3 /* ALGORITHM=UNDEFINED */ select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
NULL test v4 select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER NULL test v4 /* ALGORITHM=UNDEFINED */ select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
drop view v0, v1, v2, v3, v4; drop view v0, v1, v2, v3, v4;
create table t1 (a int); create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost; grant select,update,insert on t1 to mysqltest_1@localhost;
...@@ -483,9 +483,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; ...@@ -483,9 +483,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views; select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER NULL test v1 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER NULL test v2 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER NULL test v3 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
grant select (a) on test.t1 to joe@localhost with grant option; grant select (a) on test.t1 to joe@localhost with grant option;
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES; select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
...@@ -1169,7 +1169,7 @@ select * from information_schema.views ...@@ -1169,7 +1169,7 @@ select * from information_schema.views
where table_name='v1' or table_name='v2'; where table_name='v1' or table_name='v2';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v1 NONE YES root@localhost DEFINER NULL test v1 NONE YES root@localhost DEFINER
NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER NULL test v2 /* ALGORITHM=UNDEFINED */ select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
......
...@@ -420,3 +420,34 @@ ERROR HY000: There is no 'mysqltest_1'@'localhost' registered ...@@ -420,3 +420,34 @@ ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
---> connection: root ---> connection: root
DROP USER mysqltest_2@localhost; DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
user19857@localhost;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
use test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END //
SHOW CREATE PROCEDURE test.sp19857;
Procedure sql_mode Create Procedure
sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END
DROP PROCEDURE IF EXISTS test.sp19857;
---> connection: root
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
...@@ -421,6 +421,28 @@ set tmp_table_size=100; ...@@ -421,6 +421,28 @@ set tmp_table_size=100;
set tx_isolation="READ-COMMITTED"; set tx_isolation="READ-COMMITTED";
set wait_timeout=100; set wait_timeout=100;
set log_warnings=1; set log_warnings=1;
select @@session.insert_id;
@@session.insert_id
1
set @save_insert_id=@@session.insert_id;
set session insert_id=20;
select @@session.insert_id;
@@session.insert_id
20
set session last_insert_id=100;
select @@session.insert_id;
@@session.insert_id
20
select @@session.last_insert_id;
@@session.last_insert_id
100
select @@session.insert_id;
@@session.insert_id
20
set @@session.insert_id=@save_insert_id;
select @@session.insert_id;
@@session.insert_id
1
create table t1 (a int not null auto_increment, primary key(a)); create table t1 (a int not null auto_increment, primary key(a));
create table t2 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a));
insert into t1 values(null),(null),(null); insert into t1 values(null),(null),(null);
......
--default-character-set=ucs2 --default-collation=ucs2_unicode_ci --default-collation=ucs2_unicode_ci --default-character-set=ucs2
#
# MySQL Bug#15276: MySQL ignores collation-server
#
show variables like 'collation_server';
# #
# Bug#18004 Connecting crashes server when default charset is UCS2 # Bug#18004 Connecting crashes server when default charset is UCS2
# #
......
...@@ -744,4 +744,50 @@ DROP USER mysqltest_2@localhost; ...@@ -744,4 +744,50 @@ DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
#
# Can't test with embedded server that doesn't support grants
GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
user19857@localhost;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--connect (mysqltest_2_con,localhost,user19857,meow,test)
--echo
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END //
DELIMITER ;//
SHOW CREATE PROCEDURE test.sp19857;
--disconnect mysqltest_2_con
--connect (mysqltest_2_con,localhost,user19857,meow,test)
--connection mysqltest_2_con
DROP PROCEDURE IF EXISTS test.sp19857;
--echo
--echo ---> connection: root
--connection con1root
--disconnect mysqltest_2_con
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
DROP USER user19857@localhost;
# End of 5.0 bugs. # End of 5.0 bugs.
...@@ -301,6 +301,22 @@ set tx_isolation="READ-COMMITTED"; ...@@ -301,6 +301,22 @@ set tx_isolation="READ-COMMITTED";
set wait_timeout=100; set wait_timeout=100;
set log_warnings=1; set log_warnings=1;
#
# Bugs: #20392: INSERT_ID session variable has weird value
#
select @@session.insert_id;
set @save_insert_id=@@session.insert_id;
set session insert_id=20;
select @@session.insert_id;
set session last_insert_id=100;
select @@session.insert_id;
select @@session.last_insert_id;
select @@session.insert_id;
set @@session.insert_id=@save_insert_id;
select @@session.insert_id;
# #
# key buffer # key buffer
# #
......
...@@ -1701,7 +1701,7 @@ int mysql_init_character_set(MYSQL *mysql) ...@@ -1701,7 +1701,7 @@ int mysql_init_character_set(MYSQL *mysql)
C_MODE_END C_MODE_END
MYSQL * MYSQL * STDCALL
CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db, const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag) uint port, const char *unix_socket,ulong client_flag)
......
...@@ -323,7 +323,9 @@ static char *opt_init_slave, *language_ptr, *opt_init_connect; ...@@ -323,7 +323,9 @@ static char *opt_init_slave, *language_ptr, *opt_init_connect;
static char *default_character_set_name; static char *default_character_set_name;
static char *character_set_filesystem_name; static char *character_set_filesystem_name;
static char *my_bind_addr_str; static char *my_bind_addr_str;
static char *default_collation_name, *default_storage_engine_str; static char *default_collation_name;
static char *default_storage_engine_str;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
static char mysql_data_home_buff[2]; static char mysql_data_home_buff[2];
static struct passwd *user_info; static struct passwd *user_info;
static I_List<THD> thread_cache; static I_List<THD> thread_cache;
...@@ -7047,7 +7049,7 @@ static void mysql_init_variables(void) ...@@ -7047,7 +7049,7 @@ static void mysql_init_variables(void)
/* Variables in libraries */ /* Variables in libraries */
charsets_dir= 0; charsets_dir= 0;
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME; default_collation_name= compiled_default_collation_name;
sys_charset_system.value= (char*) system_charset_info->csname; sys_charset_system.value= (char*) system_charset_info->csname;
character_set_filesystem_name= (char*) "binary"; character_set_filesystem_name= (char*) "binary";
...@@ -7181,7 +7183,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -7181,7 +7183,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmake(mysql_home,argument,sizeof(mysql_home)-1); strmake(mysql_home,argument,sizeof(mysql_home)-1);
break; break;
case 'C': case 'C':
default_collation_name= 0; if (default_collation_name == compiled_default_collation_name)
default_collation_name= 0;
break; break;
case 'l': case 'l':
opt_log=1; opt_log=1;
......
...@@ -2817,7 +2817,7 @@ bool sys_var_insert_id::update(THD *thd, set_var *var) ...@@ -2817,7 +2817,7 @@ bool sys_var_insert_id::update(THD *thd, set_var *var)
byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type, byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base) LEX_STRING *base)
{ {
return (byte*) &thd->current_insert_id; return (byte*) &thd->next_insert_id;
} }
......
...@@ -5749,25 +5749,30 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, ...@@ -5749,25 +5749,30 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
TABLE_LIST tables[1]; TABLE_LIST tables[1];
List<LEX_USER> user_list; List<LEX_USER> user_list;
bool result; bool result;
ACL_USER *au;
char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
DBUG_ENTER("sp_grant_privileges"); DBUG_ENTER("sp_grant_privileges");
if (!(combo=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) if (!(combo=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
combo->user.str= sctx->user; combo->user.str= sctx->user;
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
if (!find_acl_user(combo->host.str=(char*)sctx->host_or_ip, combo->user.str,
FALSE) && if ((au= find_acl_user(combo->host.str=(char*)sctx->host_or_ip,combo->user.str,FALSE)))
!find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str, goto found_acl;
FALSE) && if ((au= find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str,FALSE)))
!find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str, goto found_acl;
FALSE) && if ((au= find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str,FALSE)))
!find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE)) goto found_acl;
{ if((au= find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE)))
VOID(pthread_mutex_unlock(&acl_cache->lock)); goto found_acl;
DBUG_RETURN(TRUE);
} VOID(pthread_mutex_unlock(&acl_cache->lock));
DBUG_RETURN(TRUE);
found_acl:
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
bzero((char*)tables, sizeof(TABLE_LIST)); bzero((char*)tables, sizeof(TABLE_LIST));
...@@ -5775,13 +5780,37 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, ...@@ -5775,13 +5780,37 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
tables->db= (char*)sp_db; tables->db= (char*)sp_db;
tables->table_name= tables->alias= (char*)sp_name; tables->table_name= tables->alias= (char*)sp_name;
combo->host.length= strlen(combo->host.str); combo->host.length= strlen(combo->host.str);
combo->user.length= strlen(combo->user.str); combo->user.length= strlen(combo->user.str);
combo->host.str= thd->strmake(combo->host.str,combo->host.length); combo->host.str= thd->strmake(combo->host.str,combo->host.length);
combo->user.str= thd->strmake(combo->user.str,combo->user.length); combo->user.str= thd->strmake(combo->user.str,combo->user.length);
combo->password.str= (char*)"";
combo->password.length= 0;
if(au && au->salt_len)
{
if (au->salt_len == SCRAMBLE_LENGTH)
{
make_password_from_salt(passwd_buff, au->salt);
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
}
else if (au->salt_len == SCRAMBLE_LENGTH_323)
{
make_password_from_salt_323(passwd_buff, (ulong *) au->salt);
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
}
else
{
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
return -1;
}
combo->password.str= passwd_buff;
}
else
{
combo->password.str= (char*)"";
combo->password.length= 0;
}
if (user_list.push_back(combo)) if (user_list.push_back(combo))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -71,6 +71,10 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **), ...@@ -71,6 +71,10 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
static void store_key_options(THD *thd, String *packet, TABLE *table, static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info); KEY *key_info);
static void
append_algorithm(TABLE_LIST *table, String *buff);
/*************************************************************************** /***************************************************************************
** List all table types supported ** List all table types supported
***************************************************************************/ ***************************************************************************/
...@@ -1422,6 +1426,28 @@ static void store_key_options(THD *thd, String *packet, TABLE *table, ...@@ -1422,6 +1426,28 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
void void
view_store_options(THD *thd, TABLE_LIST *table, String *buff) view_store_options(THD *thd, TABLE_LIST *table, String *buff)
{
append_algorithm(table, buff);
append_definer(thd, buff, &table->definer.user, &table->definer.host);
if (table->view_suid)
buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
else
buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
}
/*
Append DEFINER clause to the given buffer.
SYNOPSIS
append_definer()
thd [in] thread handle
buffer [inout] buffer to hold DEFINER clause
definer_user [in] user name part of definer
definer_host [in] host name part of definer
*/
static void append_algorithm(TABLE_LIST *table, String *buff)
{ {
buff->append(STRING_WITH_LEN("ALGORITHM=")); buff->append(STRING_WITH_LEN("ALGORITHM="));
switch ((int8)table->algorithm) { switch ((int8)table->algorithm) {
...@@ -1437,11 +1463,6 @@ view_store_options(THD *thd, TABLE_LIST *table, String *buff) ...@@ -1437,11 +1463,6 @@ view_store_options(THD *thd, TABLE_LIST *table, String *buff)
default: default:
DBUG_ASSERT(0); // never should happen DBUG_ASSERT(0); // never should happen
} }
append_definer(thd, buff, &table->definer.user, &table->definer.host);
if (table->view_suid)
buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
else
buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
} }
/* /*
...@@ -3517,7 +3538,16 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, ...@@ -3517,7 +3538,16 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
table->field[1]->store(tables->view_db.str, tables->view_db.length, cs); table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
table->field[2]->store(tables->view_name.str, tables->view_name.length, cs); table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
if (grant & SHOW_VIEW_ACL) if (grant & SHOW_VIEW_ACL)
table->field[3]->store(tables->query.str, tables->query.length, cs); {
char buff[2048];
String qwe_str(buff, sizeof(buff), cs);
qwe_str.length(0);
qwe_str.append(STRING_WITH_LEN("/* "));
append_algorithm(tables, &qwe_str);
qwe_str.append(STRING_WITH_LEN("*/ "));
qwe_str.append(tables->query.str, tables->query.length);
table->field[3]->store(qwe_str.ptr(), qwe_str.length(), cs);
}
if (tables->with_check != VIEW_CHECK_NONE) if (tables->with_check != VIEW_CHECK_NONE)
{ {
......
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