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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6625fad8
Commit
6625fad8
authored
Jun 07, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4564 ALTER on a temporary table generates an audit event
parent
3bc814be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
mysql-test/suite/plugins/r/audit_null.result
mysql-test/suite/plugins/r/audit_null.result
+3
-1
mysql-test/suite/plugins/t/audit_null.test
mysql-test/suite/plugins/t/audit_null.test
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+10
-4
No files found.
mysql-test/suite/plugins/r/audit_null.result
View file @
6625fad8
...
@@ -44,6 +44,7 @@ insert t2 values ('2020-10-09');
...
@@ -44,6 +44,7 @@ insert t2 values ('2020-10-09');
select * from t2;
select * from t2;
a
a
2020-10-09
2020-10-09
alter table t2 add column b int;
drop table t2;
drop table t2;
explain select distinct * from t2;
explain select distinct * from t2;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
...
@@ -77,8 +78,8 @@ root[root] @ localhost [] test.t1 : read
...
@@ -77,8 +78,8 @@ root[root] @ localhost [] test.t1 : read
root[root] @ localhost [] >> rename table t1 to t2
root[root] @ localhost [] >> rename table t1 to t2
root[root] @ localhost [] test.t1 : rename to test.t2
root[root] @ localhost [] test.t1 : rename to test.t2
root[root] @ localhost [] >> alter table t2 add column b int
root[root] @ localhost [] >> alter table t2 add column b int
root[root] @ localhost [] test.t2 : alter
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : alter
root[root] @ localhost [] >> create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy
root[root] @ localhost [] >> create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
...
@@ -89,6 +90,7 @@ root[root] @ localhost [] >> drop view v1
...
@@ -89,6 +90,7 @@ root[root] @ localhost [] >> drop view v1
root[root] @ localhost [] >> create temporary table t2 (a date)
root[root] @ localhost [] >> create temporary table t2 (a date)
root[root] @ localhost [] >> insert t2 values ('2020-10-09')
root[root] @ localhost [] >> insert t2 values ('2020-10-09')
root[root] @ localhost [] >> select * from t2
root[root] @ localhost [] >> select * from t2
root[root] @ localhost [] >> alter table t2 add column b int
root[root] @ localhost [] >> drop table t2
root[root] @ localhost [] >> drop table t2
root[root] @ localhost [] >> explain select distinct * from t2
root[root] @ localhost [] >> explain select distinct * from t2
root[root] @ localhost [] test.t2 : read
root[root] @ localhost [] test.t2 : read
...
...
mysql-test/suite/plugins/t/audit_null.test
View file @
6625fad8
...
@@ -38,6 +38,7 @@ drop view v1;
...
@@ -38,6 +38,7 @@ drop view v1;
create
temporary
table
t2
(
a
date
);
create
temporary
table
t2
(
a
date
);
insert
t2
values
(
'2020-10-09'
);
insert
t2
values
(
'2020-10-09'
);
select
*
from
t2
;
select
*
from
t2
;
alter
table
t2
add
column
b
int
;
# MDEV-4565 ALTER on a temporary table generates an audit event
drop
table
t2
;
drop
table
t2
;
# internal temp table generates no audit events
# internal temp table generates no audit events
...
...
sql/sql_table.cc
View file @
6625fad8
...
@@ -6064,13 +6064,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -6064,13 +6064,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
mysql_ha_rm_tables
(
thd
,
table_list
);
mysql_ha_rm_tables
(
thd
,
table_list
);
mysql_audit_alter_table
(
thd
,
table_list
);
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
if
(
alter_info
->
tablespace_op
!=
NO_TABLESPACE_OP
)
if
(
alter_info
->
tablespace_op
!=
NO_TABLESPACE_OP
)
{
mysql_audit_alter_table
(
thd
,
table_list
);
/* Conditionally writes to binlog. */
/* Conditionally writes to binlog. */
DBUG_RETURN
(
mysql_discard_or_import_tablespace
(
thd
,
table_list
,
bool
ret
=
mysql_discard_or_import_tablespace
(
thd
,
table_list
,
alter_info
->
tablespace_op
));
alter_info
->
tablespace_op
);
DBUG_RETURN
(
ret
);
}
/*
/*
Code below can handle only base tables so ensure that we won't open a view.
Code below can handle only base tables so ensure that we won't open a view.
...
@@ -6262,6 +6265,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -6262,6 +6265,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_error
(
ER_ILLEGAL_HA
,
MYF
(
0
),
table_name
);
my_error
(
ER_ILLEGAL_HA
,
MYF
(
0
),
table_name
);
goto
err
;
goto
err
;
}
}
if
(
table
->
s
->
tmp_table
==
NO_TMP_TABLE
)
mysql_audit_alter_table
(
thd
,
table_list
);
thd_proc_info
(
thd
,
"setup"
);
thd_proc_info
(
thd
,
"setup"
);
if
(
!
(
alter_info
->
flags
&
~
(
ALTER_RENAME
|
ALTER_KEYS_ONOFF
))
&&
if
(
!
(
alter_info
->
flags
&
~
(
ALTER_RENAME
|
ALTER_KEYS_ONOFF
))
&&
...
...
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