Commit e942adb2 authored by Kristofer Pettersson's avatar Kristofer Pettersson

Automerge

parents c310a5c9 f6048130
...@@ -992,13 +992,11 @@ static struct my_option my_long_options[] = ...@@ -992,13 +992,11 @@ static struct my_option my_long_options[] =
/* 'unspec' is not mentioned because it is just a placeholder. */ /* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG " "Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without " "statements: 'never' disables it and works only for binlogs without "
"row-based events; 'auto' is the default and prints base64 only when " "row-based events; 'auto' prints base64 only when necessary (i.e., "
"necessary (i.e., for row-based events and format description events); " "for row-based events and format description events); 'always' prints "
"'decode-rows' suppresses BINLOG statements for row events, but does " "base64 whenever possible. 'always' is for debugging only and should "
"not exit as an error if a row event is found, unlike 'never'; " "not be used in a production system. If this argument is not given, "
"'always' prints base64 whenever possible. 'always' is for debugging " "the default is 'auto'; if it is given with no argument, 'always' is used."
"only and should not be used in a production system. The default is "
"'auto'. --base64-output is a short form for --base64-output=always."
,(uchar**) &opt_base64_output_mode_str, ,(uchar**) &opt_base64_output_mode_str,
(uchar**) &opt_base64_output_mode_str, (uchar**) &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
......
...@@ -41,6 +41,14 @@ efgh efgh ...@@ -41,6 +41,14 @@ efgh efgh
ijkl ijkl ijkl ijkl
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#45645 Mysql server close all connection and restart using lower function
#
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
INSERT INTO t1 (a) VALUES ('hello!');
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
a
DROP TABLE t1;
#
# Bug#43827 Server closes connections and restarts # Bug#43827 Server closes connections and restarts
# #
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci); CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
......
...@@ -154,4 +154,42 @@ SELECT * FROM mysqltest_1.t1; ...@@ -154,4 +154,42 @@ SELECT * FROM mysqltest_1.t1;
a a
DROP USER 'mysqltest1'@'%'; DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
#
# Bug#41597 - After rename of user, there are additional grants
# when grants are reapplied.
#
CREATE DATABASE temp;
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
INSERT INTO temp.t1 VALUES(1, 'name1');
INSERT INTO temp.t1 VALUES(2, 'name2');
INSERT INTO temp.t1 VALUES(3, 'name3');
CREATE USER 'user1'@'%';
RENAME USER 'user1'@'%' TO 'user2'@'%';
# Show privileges after rename and BEFORE grant
SHOW GRANTS FOR 'user2'@'%';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
# Show privileges after rename and grant
SHOW GRANTS FOR 'user2'@'%';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
# Connect as the renamed user
SHOW GRANTS;
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
SELECT a FROM temp.t1;
a
1
2
3
# Check for additional privileges by accessing a
# non privileged column. We shouldn't be able to
# access this column.
SELECT b FROM temp.t1;
ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
DROP USER 'user2'@'%';
DROP DATABASE temp;
End of 5.0 tests End of 5.0 tests
...@@ -15,31 +15,13 @@ SET SESSION debug="d,crash_before_flush_keys"; ...@@ -15,31 +15,13 @@ SET SESSION debug="d,crash_before_flush_keys";
# Run the crashing query # Run the crashing query
FLUSH TABLE t1; FLUSH TABLE t1;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# Run MYISAMCHK tool to check the table t1 and repair
myisamchk: MyISAM file MYSQLD_DATADIR/test/t1
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: error: Size of indexfile is: 1024 Should be: 3072
MYISAMCHK: Unknown error 126
myisamchk: error: Can't read indexpage from filepos: 1024
MyISAM-table 'MYSQLD_DATADIR/test/t1' is corrupted
Fix it using switch "-r" or "-o"
# Write file to make mysql-test-run.pl start the server # Write file to make mysql-test-run.pl start the server
# Turn on reconnect # Turn on reconnect
# Call script that will poll the server waiting for # Call script that will poll the server waiting for
# it to be back online again # it to be back online again
SHOW CREATE TABLE t1; CHECK TABLE t1;
Table Create Table Table Op Msg_type Msg_text
t1 CREATE TABLE `t1` ( test.t1 check warning 1 client is using or hasn't closed the table properly
`a` int(11) NOT NULL DEFAULT '0', test.t1 check error Size of indexfile is: 1024 Should be: 3072
`b` int(11) NOT NULL DEFAULT '0', test.t1 check error Corrupt
PRIMARY KEY (`a`,`b`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
SELECT * FROM t1 FORCE INDEX (PRIMARY);
a b
1 2
2 3
3 4
4 5
5 6
DROP TABLE t1; DROP TABLE t1;
...@@ -37,6 +37,14 @@ UPDATE t1 SET col2=col1; ...@@ -37,6 +37,14 @@ UPDATE t1 SET col2=col1;
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1; SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#45645 Mysql server close all connection and restart using lower function
--echo #
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
INSERT INTO t1 (a) VALUES ('hello!');
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
DROP TABLE t1;
--echo # --echo #
--echo # Bug#43827 Server closes connections and restarts --echo # Bug#43827 Server closes connections and restarts
--echo # --echo #
......
...@@ -163,6 +163,41 @@ connection default; ...@@ -163,6 +163,41 @@ connection default;
DROP USER 'mysqltest1'@'%'; DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
--echo #
--echo # Bug#41597 - After rename of user, there are additional grants
--echo # when grants are reapplied.
--echo #
CREATE DATABASE temp;
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
INSERT INTO temp.t1 VALUES(1, 'name1');
INSERT INTO temp.t1 VALUES(2, 'name2');
INSERT INTO temp.t1 VALUES(3, 'name3');
CREATE USER 'user1'@'%';
RENAME USER 'user1'@'%' TO 'user2'@'%';
--echo # Show privileges after rename and BEFORE grant
SHOW GRANTS FOR 'user2'@'%';
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
--echo # Show privileges after rename and grant
SHOW GRANTS FOR 'user2'@'%';
--echo # Connect as the renamed user
connect (conn1, localhost, user2,,);
connection conn1;
SHOW GRANTS;
SELECT a FROM temp.t1;
--echo # Check for additional privileges by accessing a
--echo # non privileged column. We shouldn't be able to
--echo # access this column.
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT b FROM temp.t1;
disconnect conn1;
connection default;
DROP USER 'user2'@'%';
DROP DATABASE temp;
--echo End of 5.0 tests --echo End of 5.0 tests
......
...@@ -26,12 +26,6 @@ SET SESSION debug="d,crash_before_flush_keys"; ...@@ -26,12 +26,6 @@ SET SESSION debug="d,crash_before_flush_keys";
--error 2013 --error 2013
FLUSH TABLE t1; FLUSH TABLE t1;
--echo # Run MYISAMCHK tool to check the table t1 and repair
--replace_result $MYISAMCHK MYISAMCHK $MYSQLD_DATADIR MYSQLD_DATADIR
--error 255
--exec $MYISAMCHK -cs $MYSQLD_DATADIR/test/t1 2>&1
--exec $MYISAMCHK -rs $MYSQLD_DATADIR/test/t1
--echo # Write file to make mysql-test-run.pl start the server --echo # Write file to make mysql-test-run.pl start the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
...@@ -42,8 +36,6 @@ FLUSH TABLE t1; ...@@ -42,8 +36,6 @@ FLUSH TABLE t1;
--echo # it to be back online again --echo # it to be back online again
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
SHOW CREATE TABLE t1; # Must report that the table wasn't closed properly
CHECK TABLE t1;
SELECT * FROM t1 FORCE INDEX (PRIMARY);
DROP TABLE t1; DROP TABLE t1;
...@@ -2255,6 +2255,8 @@ public: ...@@ -2255,6 +2255,8 @@ public:
GRANT_NAME (TABLE *form); GRANT_NAME (TABLE *form);
virtual ~GRANT_NAME() {}; virtual ~GRANT_NAME() {};
virtual bool ok() { return privs != 0; } virtual bool ok() { return privs != 0; }
void set_user_details(const char *h, const char *d,
const char *u, const char *t);
}; };
...@@ -2272,20 +2274,23 @@ public: ...@@ -2272,20 +2274,23 @@ public:
}; };
void GRANT_NAME::set_user_details(const char *h, const char *d,
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u, const char *u, const char *t)
const char *t, ulong p)
:privs(p)
{ {
/* Host given by user */ /* Host given by user */
update_hostname(&host, strdup_root(&memex, h)); update_hostname(&host, strdup_root(&memex, h));
db = strdup_root(&memex,d); if (db != d)
{
db= strdup_root(&memex, d);
if (lower_case_table_names)
my_casedn_str(files_charset_info, db);
}
user = strdup_root(&memex,u); user = strdup_root(&memex,u);
sort= get_sort(3,host.hostname,db,user); sort= get_sort(3,host.hostname,db,user);
tname= strdup_root(&memex,t); if (tname != t)
if (lower_case_table_names)
{ {
my_casedn_str(files_charset_info, db); tname= strdup_root(&memex, t);
if (lower_case_table_names)
my_casedn_str(files_charset_info, tname); my_casedn_str(files_charset_info, tname);
} }
key_length= strlen(d) + strlen(u)+ strlen(t)+3; key_length= strlen(d) + strlen(u)+ strlen(t)+3;
...@@ -2293,6 +2298,12 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u, ...@@ -2293,6 +2298,12 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
} }
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
const char *t, ulong p)
:db(0), tname(0), privs(p)
{
set_user_details(h, d, u, t);
}
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u, GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
const char *t, ulong p, ulong c) const char *t, ulong p, ulong c)
...@@ -5436,9 +5447,20 @@ static int handle_grant_struct(uint struct_no, bool drop, ...@@ -5436,9 +5447,20 @@ static int handle_grant_struct(uint struct_no, bool drop,
case 2: case 2:
case 3: case 3:
grant_name->user= strdup_root(&mem, user_to->user.str); /*
update_hostname(&grant_name->host, Update the grant structure with the new user name and
strdup_root(&mem, user_to->host.str)); host name
*/
grant_name->set_user_details(user_to->host.str, grant_name->db,
user_to->user.str, grant_name->tname);
/*
Since username is part of the hash key, when the user name
is renamed, the hash key is changed. Update the hash to
ensure that the position matches the new hash key value
*/
hash_update(&column_priv_hash, (uchar*) grant_name,
(uchar*) grant_name->hash_key, grant_name->key_length);
break; break;
} }
} }
......
...@@ -7858,6 +7858,8 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) ...@@ -7858,6 +7858,8 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t))
return 1; return 1;
} }
cs->caseinfo= my_unicase_default;
if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*)))) if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*))))
return 1; return 1;
bzero(newweights, 256*sizeof(uint16*)); bzero(newweights, 256*sizeof(uint16*));
......
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