Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
65e26bc1
Commit
65e26bc1
authored
Oct 28, 2020
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.1' into 10.2
parents
cc5f4428
d03ea827
Changes
23
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
510 additions
and
76 deletions
+510
-76
client/mysql_upgrade.c
client/mysql_upgrade.c
+1
-1
mysql-test/include/have_not_innodb_plugin.inc
mysql-test/include/have_not_innodb_plugin.inc
+0
-4
mysql-test/include/have_static_innodb.inc
mysql-test/include/have_static_innodb.inc
+7
-0
mysql-test/r/blackhole.result
mysql-test/r/blackhole.result
+6
-0
mysql-test/r/bootstrap_innodb.result
mysql-test/r/bootstrap_innodb.result
+7
-0
mysql-test/r/lock_view.result
mysql-test/r/lock_view.result
+231
-0
mysql-test/r/not_true.require
mysql-test/r/not_true.require
+0
-2
mysql-test/r/processlist_notembedded.result
mysql-test/r/processlist_notembedded.result
+13
-0
mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
+4
-0
mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
+5
-11
mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
+3
-0
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
+17
-15
mysql-test/t/blackhole.test
mysql-test/t/blackhole.test
+16
-0
mysql-test/t/bootstrap_innodb.test
mysql-test/t/bootstrap_innodb.test
+27
-0
mysql-test/t/lock_view.test
mysql-test/t/lock_view.test
+76
-0
mysql-test/t/plugin_innodb.test
mysql-test/t/plugin_innodb.test
+1
-8
mysql-test/t/processlist_notembedded.test
mysql-test/t/processlist_notembedded.test
+18
-0
mysys/my_addr_resolve.c
mysys/my_addr_resolve.c
+18
-9
sql/item_func.cc
sql/item_func.cc
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+46
-18
sql/sys_vars.ic
sql/sys_vars.ic
+5
-1
storage/blackhole/ha_blackhole.h
storage/blackhole/ha_blackhole.h
+3
-2
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+4
-5
No files found.
client/mysql_upgrade.c
View file @
65e26bc1
...
...
@@ -18,7 +18,7 @@
#include "client_priv.h"
#include <sslopt-vars.h>
#include
"../scripts/mysql_fix_privilege_tables_sql.c"
#include
<../scripts/mysql_fix_privilege_tables_sql.c>
#include <welcome_copyright_notice.h>
/* ORACLE_WELCOME_COPYRIGHT_NOTICE */
...
...
mysql-test/include/have_not_innodb_plugin.inc
deleted
100644 → 0
View file @
cc5f4428
disable_query_log
;
--
require
r
/
not_true
.
require
select
(
PLUGIN_LIBRARY
LIKE
'ha_innodb_plugin%'
OR
PLUGIN_DESCRIPTION
LIKE
'%xtradb%'
)
as
`TRUE`
from
information_schema
.
plugins
where
PLUGIN_NAME
=
'InnoDB'
;
enable_query_log
;
mysql-test/include/have_static_innodb.inc
0 → 100644
View file @
65e26bc1
source
include
/
have_innodb
.
inc
;
if
(
!
`select count(*) from information_schema.plugins
where plugin_name = 'innodb' and plugin_status = 'active' and
plugin_library is null`
)
{
skip
Need
compiled
-
in
InnoDB
;
}
mysql-test/r/blackhole.result
View file @
65e26bc1
...
...
@@ -24,3 +24,9 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
0
DROP TABLE t1;
End of 5.6 tests
CREATE TABLE `t` (
`a` varchar(3000) NOT NULL default '',
PRIMARY KEY (`a`)
) ENGINE=BLACKHOLE;
DROP TABLE `t`;
End of 10.1 tests
mysql-test/r/bootstrap_innodb.result
0 → 100644
View file @
65e26bc1
create table t1(a int) engine=innodb;
select * from t1;
a
1
2
5
drop table t1;
mysql-test/r/lock_view.result
0 → 100644
View file @
65e26bc1
This diff is collapsed.
Click to expand it.
mysql-test/r/not_true.require
deleted
100644 → 0
View file @
cc5f4428
TRUE
NULL
mysql-test/r/processlist_notembedded.result
View file @
65e26bc1
...
...
@@ -14,3 +14,16 @@ disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
#
# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
#
connect con1,localhost,root,,;
select sleep(100000);;
connection default;
SHOW EXPLAIN FOR con_id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sleep(100000)
KILL QUERY con_id;
# End of 10.2 tests
mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
View file @
65e26bc1
...
...
@@ -37,5 +37,9 @@ SET @@GLOBAL.replicate_do_db=null;
SELECT @@GLOBAL.replicate_do_db;
@@GLOBAL.replicate_do_db
SET @@GLOBAL.replicate_do_db=DEFAULT;
SELECT @@GLOBAL.replicate_do_db;
@@GLOBAL.replicate_do_db
# Cleanup.
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
View file @
65e26bc1
include/master-slave.inc
[connection master]
connection slave;
include/sync_slave_sql_with_master.inc
SET @start_max_connections= @@global.max_connections;
SET @start_init_slave= @@global.init_slave;
SET NAMES utf8;
...
...
@@ -19,18 +19,12 @@ SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connec
1
Expect 1
include/assert.inc [@@global.max_connections = @start_max_connections]
STOP SLAVE;
RESET MASTER;
RESET SLAVE;
START SLAVE;
include/wait_for_slave_to_start.inc
include/restart_slave.inc
connection master;
include/sync_slave_sql_with_master.inc
include/assert.inc [@@global.max_connections = @start_max_connections + 1]
SET @@global.init_slave = "SET @a=5";
STOP SLAVE;
RESET MASTER;
RESET SLAVE;
START SLAVE;
include/wait_for_slave_to_start.inc
include/restart_slave.inc
SHOW VARIABLES LIKE 'init_slave';
Variable_name Value
init_slave SET @a=5
...
...
mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
View file @
65e26bc1
...
...
@@ -38,5 +38,8 @@ SELECT @@GLOBAL.replicate_do_db;
SET
@@
GLOBAL
.
replicate_do_db
=
null
;
SELECT
@@
GLOBAL
.
replicate_do_db
;
SET
@@
GLOBAL
.
replicate_do_db
=
DEFAULT
;
SELECT
@@
GLOBAL
.
replicate_do_db
;
--
echo
# Cleanup.
SET
@@
GLOBAL
.
replicate_do_db
=
@
save_replicate_do_db
;
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
View file @
65e26bc1
...
...
@@ -29,7 +29,13 @@
###############################################################################
source
include
/
master
-
slave
.
inc
;
connection
slave
;
# Since a part of slave SQL thread initialisation happens after Slave_SQL_Running
# has been set to Yes, there is a race condition between initialisation above and
# init_slave setting given below. Synchronise slave applier with master to ensure
# init_slave is complete and applier had processed few events like FD.
--
source
include
/
sync_slave_sql_with_master
.
inc
--
disable_query_log
call
mtr
.
add_suppression
(
"Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"
);
--
enable_query_log
...
...
@@ -66,14 +72,15 @@ let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
--
let
$assert_text
=
@@
global
.
max_connections
=
@
start_max_connections
--
let
$assert_cond
=
@@
global
.
max_connections
=
@
start_max_connections
--
source
include
/
assert
.
inc
#
# reset of the server
STOP
SLAVE
;
--
wait_for_slave_to_stop
RESET
MASTER
;
RESET
SLAVE
;
START
SLAVE
;
source
include
/
wait_for_slave_to_start
.
inc
;
--
source
include
/
restart_slave_sql
.
inc
# Upon slave start, sync the applier with master, to ensure slave has
# completed init_slave command execution and processed FD event from the
# master.
--
connection
master
--
source
include
/
sync_slave_sql_with_master
.
inc
#
# wait for the slave threads have set the global variable.
let
$wait_timeout
=
90
;
...
...
@@ -87,12 +94,7 @@ let $wait_condition= SELECT @@global.max_connections = @start_max_connections +
# Setting a variable(which is local to a session) and must not be visible
SET
@@
global
.
init_slave
=
"SET @a=5"
;
#
STOP
SLAVE
;
--
wait_for_slave_to_stop
RESET
MASTER
;
RESET
SLAVE
;
START
SLAVE
;
source
include
/
wait_for_slave_to_start
.
inc
;
--
source
include
/
restart_slave_sql
.
inc
#
SHOW
VARIABLES
LIKE
'init_slave'
;
# expect NULL
...
...
mysql-test/t/blackhole.test
View file @
65e26bc1
...
...
@@ -38,3 +38,19 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
DROP
TABLE
t1
;
--
echo
End
of
5.6
tests
#
# MDEV-24017 / bug 53588 test case.
#
# Create long enough index (between 1000 and 3500). 1000 is the old value,
# 3500 is innodb value (see ha_innobase::max_supported_key_length()). Without
# the fix the test will fail with "Specified key was too long" error.
#
CREATE
TABLE
`t`
(
`a`
varchar
(
3000
)
NOT
NULL
default
''
,
PRIMARY
KEY
(
`a`
)
)
ENGINE
=
BLACKHOLE
;
DROP
TABLE
`t`
;
--
echo
End
of
10.1
tests
mysql-test/t/bootstrap_innodb.test
0 → 100644
View file @
65e26bc1
source
include
/
have_static_innodb
.
inc
;
source
include
/
not_embedded
.
inc
;
let
$datadir
=
`select @@datadir`
;
create
table
t1
(
a
int
)
engine
=
innodb
;
source
include
/
shutdown_mysqld
.
inc
;
write_file
$MYSQLTEST_VARDIR
/
tmp
/
bootstrap_test
.
sql
;
use
test
;
insert
t1
values
(
1
);
start
transaction
;
insert
t1
values
(
2
);
savepoint
s1
;
insert
t1
values
(
3
);
savepoint
s2
;
insert
t1
values
(
4
);
rollback
to
savepoint
s1
;
insert
t1
values
(
5
);
commit
;
EOF
exec
$MYSQLD_BOOTSTRAP_CMD
--
datadir
=
$datadir
--
innodb
<
$MYSQLTEST_VARDIR
/
tmp
/
bootstrap_test
.
sql
>>
$MYSQLTEST_VARDIR
/
tmp
/
bootstrap
.
log
2
>&
1
;
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bootstrap_test
.
sql
;
source
include
/
start_mysqld
.
inc
;
select
*
from
t1
;
drop
table
t1
;
mysql-test/t/lock_view.test
0 → 100644
View file @
65e26bc1
source
include
/
not_embedded
.
inc
;
#
# LOCK TABLES and privileges on views
#
create
database
mysqltest1
;
create
database
mysqltest2
;
create
database
mysqltest3
;
create
user
invoker
@
localhost
;
create
user
definer
@
localhost
;
grant
select
,
show
view
on
mysqltest1
.*
to
invoker
@
localhost
;
grant
select
,
show
view
on
mysqltest1
.*
to
definer
@
localhost
;
grant
select
,
show
view
on
mysqltest2
.*
to
invoker
@
localhost
;
grant
select
,
show
view
on
mysqltest2
.*
to
definer
@
localhost
;
grant
select
,
show
view
on
mysqltest3
.*
to
invoker
@
localhost
;
grant
select
on
performance_schema
.*
to
definer
@
localhost
;
create
table
mysqltest1
.
t1
(
a
int
);
create
definer
=
definer
@
localhost
view
mysqltest2
.
v2
as
select
*
from
mysqltest1
.
t1
;
create
definer
=
definer
@
localhost
view
mysqltest3
.
v3
as
select
*
from
mysqltest2
.
v2
;
create
definer
=
definer
@
localhost
view
mysqltest3
.
v3is
as
select
schema_name
from
information_schema
.
schemata
order
by
schema_name
;
create
definer
=
definer
@
localhost
view
mysqltest3
.
v3ps
as
select
user
from
performance_schema
.
users
where
current_connections
>
0
order
by
user
;
create
definer
=
definer
@
localhost
view
mysqltest3
.
v3nt
as
select
1
;
create
definer
=
definer
@
localhost
sql
security
invoker
view
mysqltest3
.
v3i
as
select
*
from
mysqltest1
.
t1
;
exec
$MYSQL_DUMP
--
compact
-
B
mysqltest1
mysqltest2
mysqltest3
;
connect
inv
,
localhost
,
invoker
;
error
ER_DBACCESS_DENIED_ERROR
;
lock
table
mysqltest3
.
v3
write
;
disconnect
inv
;
connection
default
;
grant
lock
tables
on
mysqltest3
.*
to
invoker
@
localhost
;
connect
inv
,
localhost
,
invoker
;
show
create
view
mysqltest3
.
v3
;
show
create
view
mysqltest3
.
v3is
;
show
create
view
mysqltest3
.
v3ps
;
show
create
view
mysqltest3
.
v3nt
;
show
create
view
mysqltest3
.
v3i
;
error
ER_VIEW_INVALID
;
lock
table
mysqltest3
.
v3
write
;
error
ER_VIEW_INVALID
;
lock
table
mysqltest3
.
v3i
write
;
lock
table
mysqltest3
.
v3is
write
;
select
*
from
mysqltest3
.
v3is
;
lock
table
mysqltest3
.
v3ps
write
;
select
*
from
mysqltest3
.
v3ps
;
lock
table
mysqltest3
.
v3nt
write
;
select
*
from
mysqltest3
.
v3nt
;
disconnect
inv
;
connection
default
;
grant
lock
tables
on
mysqltest2
.*
to
invoker
@
localhost
;
connect
inv
,
localhost
,
invoker
;
error
ER_VIEW_INVALID
;
lock
table
mysqltest3
.
v3
write
;
error
ER_VIEW_INVALID
;
lock
table
mysqltest3
.
v3i
write
;
disconnect
inv
;
connection
default
;
grant
lock
tables
on
mysqltest1
.*
to
definer
@
localhost
;
connect
inv
,
localhost
,
invoker
;
lock
table
mysqltest3
.
v3
write
;
select
*
from
mysqltest3
.
v3
;
error
ER_VIEW_INVALID
;
lock
table
mysqltest3
.
v3i
write
;
disconnect
inv
;
connection
default
;
grant
lock
tables
on
mysqltest1
.*
to
invoker
@
localhost
;
connect
inv
,
localhost
,
invoker
;
lock
table
mysqltest3
.
v3i
write
;
select
*
from
mysqltest3
.
v3i
;
disconnect
inv
;
connection
default
;
drop
user
invoker
@
localhost
;
drop
user
definer
@
localhost
;
drop
database
mysqltest1
;
drop
database
mysqltest2
;
drop
database
mysqltest3
;
mysql-test/t/plugin_innodb.test
View file @
65e26bc1
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_example_plugin
.
inc
--
source
include
/
have_innodb
.
inc
if
(
!
`select count(*) from information_schema.plugins
where plugin_name = 'innodb' and plugin_status = 'active' and
plugin_library is null`
)
{
skip
Need
compiled
-
in
InnoDB
;
}
--
source
include
/
have_static_innodb
.
inc
--
replace_regex
/
\
.
dll
/.
so
/
eval
install
plugin
example
soname
'$HA_EXAMPLE_SO'
;
...
...
mysql-test/t/processlist_notembedded.test
View file @
65e26bc1
...
...
@@ -40,3 +40,21 @@ SET DEBUG_SYNC = 'RESET';
source
include
/
wait_until_count_sessions
.
inc
;
--
echo
End
of
5.5
tests
--
echo
#
--
echo
# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
--
echo
#
--
connect
(
con1
,
localhost
,
root
,,)
--
let
$con_id
=
`SELECT CONNECTION_ID()`
--
send
select
sleep
(
100000
);
--
connection
default
--
replace_result
$con_id
con_id
eval
SHOW
EXPLAIN
FOR
$con_id
;
--
replace_result
$con_id
con_id
eval
KILL
QUERY
$con_id
;
--
echo
# End of 10.2 tests
mysys/my_addr_resolve.c
View file @
65e26bc1
...
...
@@ -159,10 +159,18 @@ const char *my_addr_resolve_init()
#include <ctype.h>
#include <sys/wait.h>
#if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#endif
/* defined(HAVE_POLL_H) */
static
int
in
[
2
],
out
[
2
];
static
pid_t
pid
;
static
char
addr2line_binary
[
1024
];
static
char
output
[
1024
];
static
struct
pollfd
poll_fds
;
Dl_info
info
;
int
start_addr2line_fork
(
const
char
*
binary_path
)
{
...
...
@@ -212,15 +220,16 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
ssize_t
extra_bytes_read
=
0
;
ssize_t
parsed
=
0
;
fd_set
set
;
struct
timeval
timeout
;
int
ret
;
int
filename_start
=
-
1
;
int
line_number_start
=
-
1
;
Dl_info
info
;
void
*
offset
;
poll_fds
.
fd
=
out
[
0
];
poll_fds
.
events
=
POLLIN
|
POLLRDBAND
;
if
(
!
dladdr
(
ptr
,
&
info
))
return
1
;
...
...
@@ -242,16 +251,16 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
if
(
write
(
in
[
1
],
input
,
len
)
<=
0
)
return
3
;
FD_ZERO
(
&
set
);
FD_SET
(
out
[
0
],
&
set
);
/* 100 ms should be plenty of time for addr2line to issue a response. */
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
100000
;
/* 500 ms should be plenty of time for addr2line to issue a response. */
/* Read in a loop till all the output from addr2line is complete. */
while
(
parsed
==
total_bytes_read
&&
select
(
out
[
0
]
+
1
,
&
set
,
NULL
,
NULL
,
&
timeout
)
>
0
)
(
ret
=
poll
(
&
poll_fds
,
1
,
500
))
)
{
/* error during poll */
if
(
ret
<
0
)
return
1
;
extra_bytes_read
=
read
(
out
[
0
],
output
+
total_bytes_read
,
sizeof
(
output
)
-
total_bytes_read
);
if
(
extra_bytes_read
<
0
)
...
...
sql/item_func.cc
View file @
65e26bc1
...
...
@@ -4055,6 +4055,8 @@ int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex)
timeout
=
m_abs_timeout
;
error
=
mysql_cond_timedwait
(
cond
,
mutex
,
&
timeout
);
if
(
m_thd
->
check_killed
())
break
;
if
(
error
==
ETIMEDOUT
||
error
==
ETIME
)
{
/* Return error if timed out or connection is broken. */
...
...
sql/sql_parse.cc
View file @
65e26bc1
...
...
@@ -104,6 +104,8 @@
#include "my_json_writer.h"
#define PRIV_LOCK_TABLES (SELECT_ACL | LOCK_TABLES_ACL)
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
#ifdef WITH_ARIA_STORAGE_ENGINE
...
...
@@ -1056,7 +1058,6 @@ static void handle_bootstrap_impl(THD *thd)
thd
->
reset_kill_query
();
/* Ensure that killed_errmsg is released */
free_root
(
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
free_root
(
&
thd
->
transaction
.
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
thd
->
lex
->
restore_set_statement_var
();
}
...
...
@@ -2880,6 +2881,36 @@ static bool lock_tables_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
goto
err
;
}
}
/*
Check privileges of view tables here, after views were opened.
Either definer or invoker has to have PRIV_LOCK_TABLES to be able
to lock view and its tables. For mysqldump (that locks views
before dumping their structures) compatibility we allow locking
views that select from I_S or P_S tables, but downrade the lock
to TL_READ
*/
if
(
table
->
belong_to_view
&&
check_single_table_access
(
thd
,
PRIV_LOCK_TABLES
,
table
,
1
))
{
if
(
table
->
grant
.
m_internal
.
m_schema_access
)
table
->
lock_type
=
TL_READ
;
else
{
bool
error
=
true
;
if
(
Security_context
*
sctx
=
table
->
security_ctx
)
{
table
->
security_ctx
=
0
;
error
=
check_single_table_access
(
thd
,
PRIV_LOCK_TABLES
,
table
,
1
);
table
->
security_ctx
=
sctx
;
}
if
(
error
)
{
my_error
(
ER_VIEW_INVALID
,
MYF
(
0
),
table
->
belong_to_view
->
view_db
.
str
,
table
->
belong_to_view
->
view_name
.
str
);
goto
err
;
}
}
}
}
if
(
lock_tables
(
thd
,
tables
,
counter
,
0
)
||
...
...
@@ -5084,7 +5115,7 @@ mysql_execute_command(THD *thd)
if
(
first_table
&&
lex
->
type
&
(
REFRESH_READ_LOCK
|
REFRESH_FOR_EXPORT
))
{
/* Check table-level privileges. */
if
(
check_table_access
(
thd
,
LOCK_TABLES_ACL
|
SELECT_ACL
,
all_tables
,
if
(
check_table_access
(
thd
,
PRIV_LOCK_TABLES
,
all_tables
,
FALSE
,
UINT_MAX
,
FALSE
))
goto
error
;
...
...
@@ -6597,7 +6628,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
@param thd Thread handler
@param privilege requested privilege
@param
all_tables
global table list of query
@param
tables
global table list of query
@param no_errors FALSE/TRUE - report/don't report error to
the client (using my_error() call).
...
...
@@ -6607,28 +6638,25 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
1 access denied, error is sent to client
*/
bool
check_single_table_access
(
THD
*
thd
,
ulong
privilege
,
TABLE_LIST
*
all_tables
,
bool
no_errors
)
bool
check_single_table_access
(
THD
*
thd
,
ulong
privilege
,
TABLE_LIST
*
tables
,
bool
no_errors
)
{
Switch_to_definer_security_ctx
backup_sctx
(
thd
,
all_
tables
);
Switch_to_definer_security_ctx
backup_sctx
(
thd
,
tables
);
const
char
*
db_name
;
if
((
all_tables
->
view
||
all_tables
->
field_translation
)
&&
!
all_tables
->
schema_table
)
db_name
=
all_tables
->
view_db
.
str
;
if
((
tables
->
view
||
tables
->
field_translation
)
&&
!
tables
->
schema_table
)
db_name
=
tables
->
view_db
.
str
;
else
db_name
=
all_
tables
->
db
;
db_name
=
tables
->
db
;
if
(
check_access
(
thd
,
privilege
,
db_name
,
&
all_tables
->
grant
.
privilege
,
&
all_tables
->
grant
.
m_internal
,
0
,
no_errors
))
if
(
check_access
(
thd
,
privilege
,
db_name
,
&
tables
->
grant
.
privilege
,
&
tables
->
grant
.
m_internal
,
0
,
no_errors
))
return
1
;
/* Show only 1 table for check_grant */
if
(
!
(
all_
tables
->
belong_to_view
&&
if
(
!
(
tables
->
belong_to_view
&&
(
thd
->
lex
->
sql_command
==
SQLCOM_SHOW_FIELDS
))
&&
check_grant
(
thd
,
privilege
,
all_
tables
,
FALSE
,
1
,
no_errors
))
check_grant
(
thd
,
privilege
,
tables
,
FALSE
,
1
,
no_errors
))
return
1
;
return
0
;
...
...
@@ -9640,7 +9668,7 @@ static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables)
if
(
is_temporary_table
(
table
))
continue
;
if
(
check_table_access
(
thd
,
LOCK_TABLES_ACL
|
SELECT_ACL
,
table
,
if
(
check_table_access
(
thd
,
PRIV_LOCK_TABLES
,
table
,
FALSE
,
1
,
FALSE
))
return
TRUE
;
}
...
...
sql/sys_vars.ic
View file @
65e26bc1
...
...
@@ -731,7 +731,11 @@ public:
{ DBUG_ASSERT(FALSE); }
void global_save_default(THD *thd, set_var *var)
{ DBUG_ASSERT(FALSE); }
{
char *ptr= (char*)(intptr)option.def_value;
var->save_result.string_value.str= ptr;
var->save_result.string_value.length= ptr ? strlen(ptr) : 0;
}
bool session_update(THD *thd, set_var *var)
{
...
...
storage/blackhole/ha_blackhole.h
View file @
65e26bc1
...
...
@@ -20,6 +20,7 @@
#include "thr_lock.h"
/* THR_LOCK */
#include "handler.h"
/* handler */
#include "table.h"
/* TABLE_SHARE */
#include "sql_const.h"
/* MAX_KEY */
/*
Shared structure for correct LOCK operation
...
...
@@ -65,9 +66,9 @@ class ha_blackhole: public handler
HA_READ_ORDER
|
HA_KEYREAD_ONLY
);
}
/* The following defines can be increased if necessary */
#define BLACKHOLE_MAX_KEY
64
/* Max allowed keys */
#define BLACKHOLE_MAX_KEY
MAX_KEY
/* Max allowed keys */
#define BLACKHOLE_MAX_KEY_SEG 16
/* Max segments for key */
#define BLACKHOLE_MAX_KEY_LENGTH
1000
#define BLACKHOLE_MAX_KEY_LENGTH
3500
/* Like in InnoDB */
uint
max_supported_keys
()
const
{
return
BLACKHOLE_MAX_KEY
;
}
uint
max_supported_key_length
()
const
{
return
BLACKHOLE_MAX_KEY_LENGTH
;
}
uint
max_supported_key_part_length
()
const
{
return
BLACKHOLE_MAX_KEY_LENGTH
;
}
...
...
storage/connect/ha_connect.cc
View file @
65e26bc1
...
...
@@ -4538,14 +4538,13 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
case
TAB_DIR
:
case
TAB_ZIP
:
case
TAB_OEM
:
if
(
table
&&
table
->
pos_in_table_list
)
// if SELECT
{
if
(
table
&&
table
->
pos_in_table_list
)
{
// if SELECT
#if MYSQL_VERSION_ID > 100200
Switch_to_definer_security_ctx
backup_ctx
(
thd
,
table
->
pos_in_table_list
);
#endif // VERSION_ID > 100200
return
check_global_access
(
thd
,
FILE_ACL
);
}
else
}
else
return
check_global_access
(
thd
,
FILE_ACL
);
case
TAB_ODBC
:
case
TAB_JDBC
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment