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
b60d59b9
Commit
b60d59b9
authored
Jan 19, 2010
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
5ba1dd04
81391bd0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
41 deletions
+49
-41
sql/event_data_objects.cc
sql/event_data_objects.cc
+1
-1
sql/events.cc
sql/events.cc
+9
-6
sql/mysql_priv.h
sql/mysql_priv.h
+6
-2
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+1
-1
sql/sql_db.cc
sql/sql_db.cc
+2
-3
sql/sql_parse.cc
sql/sql_parse.cc
+23
-17
sql/sql_show.cc
sql/sql_show.cc
+4
-5
sql/sql_view.cc
sql/sql_view.cc
+2
-2
sql/table.cc
sql/table.cc
+1
-4
No files found.
sql/event_data_objects.cc
View file @
b60d59b9
...
...
@@ -1401,7 +1401,7 @@ Event_job_data::execute(THD *thd, bool drop)
#endif
if
(
check_access
(
thd
,
EVENT_ACL
,
dbname
.
str
,
0
,
0
,
0
,
is_schema_db
(
dbname
.
str
)))
0
,
0
,
0
,
is_schema_db
(
dbname
.
str
,
dbname
.
length
)))
{
/*
This aspect of behavior is defined in the worklog,
...
...
sql/events.cc
View file @
b60d59b9
...
...
@@ -415,7 +415,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
DBUG_ASSERT
(
parse_data
->
expression
||
parse_data
->
execute_at
);
if
(
check_access
(
thd
,
EVENT_ACL
,
parse_data
->
dbname
.
str
,
0
,
0
,
0
,
is_schema_db
(
parse_data
->
dbname
.
str
)))
is_schema_db
(
parse_data
->
dbname
.
str
,
parse_data
->
dbname
.
length
)))
DBUG_RETURN
(
TRUE
);
if
(
check_db_dir_existence
(
parse_data
->
dbname
.
str
))
...
...
@@ -526,7 +527,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
DBUG_RETURN
(
TRUE
);
if
(
check_access
(
thd
,
EVENT_ACL
,
parse_data
->
dbname
.
str
,
0
,
0
,
0
,
is_schema_db
(
parse_data
->
dbname
.
str
)))
is_schema_db
(
parse_data
->
dbname
.
str
,
parse_data
->
dbname
.
length
)))
DBUG_RETURN
(
TRUE
);
if
(
new_dbname
)
/* It's a rename */
...
...
@@ -548,7 +550,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
access it.
*/
if
(
check_access
(
thd
,
EVENT_ACL
,
new_dbname
->
str
,
0
,
0
,
0
,
is_schema_db
(
new_dbname
->
str
)))
is_schema_db
(
new_dbname
->
str
,
new_dbname
->
length
)))
DBUG_RETURN
(
TRUE
);
/* Check that the target database exists */
...
...
@@ -653,7 +655,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
DBUG_RETURN
(
TRUE
);
if
(
check_access
(
thd
,
EVENT_ACL
,
dbname
.
str
,
0
,
0
,
0
,
is_schema_db
(
dbname
.
str
)))
is_schema_db
(
dbname
.
str
,
dbname
.
length
)))
DBUG_RETURN
(
TRUE
);
/*
...
...
@@ -811,7 +813,7 @@ Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
DBUG_RETURN
(
TRUE
);
if
(
check_access
(
thd
,
EVENT_ACL
,
dbname
.
str
,
0
,
0
,
0
,
is_schema_db
(
dbname
.
str
)))
is_schema_db
(
dbname
.
str
,
dbname
.
length
)))
DBUG_RETURN
(
TRUE
);
/*
...
...
@@ -869,7 +871,8 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
if
(
thd
->
lex
->
sql_command
==
SQLCOM_SHOW_EVENTS
)
{
DBUG_ASSERT
(
thd
->
lex
->
select_lex
.
db
);
if
(
!
is_schema_db
(
thd
->
lex
->
select_lex
.
db
)
&&
// There is no events in I_S
if
(
!
is_schema_db
(
thd
->
lex
->
select_lex
.
db
,
// There is no events in I_S
strlen
(
thd
->
lex
->
select_lex
.
db
))
&&
check_access
(
thd
,
EVENT_ACL
,
thd
->
lex
->
select_lex
.
db
,
0
,
0
,
0
,
0
))
DBUG_RETURN
(
1
);
db
=
thd
->
lex
->
select_lex
.
db
;
...
...
sql/mysql_priv.h
View file @
b60d59b9
...
...
@@ -1415,8 +1415,12 @@ bool get_schema_tables_result(JOIN *join,
enum
enum_schema_table_state
executed_place
);
enum
enum_schema_tables
get_schema_table_idx
(
ST_SCHEMA_TABLE
*
schema_table
);
#define is_schema_db(X) \
!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
inline
bool
is_schema_db
(
const
char
*
name
,
size_t
len
)
{
return
(
INFORMATION_SCHEMA_NAME
.
length
==
len
&&
!
my_strcasecmp
(
system_charset_info
,
INFORMATION_SCHEMA_NAME
.
str
,
name
));
}
/* sql_prepare.cc */
...
...
sql/repl_failsafe.cc
View file @
b60d59b9
...
...
@@ -905,7 +905,7 @@ bool load_master_data(THD* thd)
if
(
!
rpl_filter
->
db_ok
(
db
)
||
!
rpl_filter
->
db_ok_with_wild_table
(
db
)
||
!
strcmp
(
db
,
"mysql"
)
||
is_schema_db
(
db
))
is_schema_db
(
db
,
strlen
(
db
)
))
{
*
cur_table_res
=
0
;
continue
;
...
...
sql/sql_db.cc
View file @
b60d59b9
...
...
@@ -618,7 +618,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_ENTER
(
"mysql_create_db"
);
/* do not create 'information_schema' db */
if
(
!
my_strcasecmp
(
system_charset_info
,
db
,
INFORMATION_SCHEMA_NAME
.
str
))
if
(
is_schema_db
(
db
,
strlen
(
db
)
))
{
my_error
(
ER_DB_CREATE_EXISTS
,
MYF
(
0
),
db
);
DBUG_RETURN
(
-
1
);
...
...
@@ -1557,8 +1557,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
}
}
if
(
my_strcasecmp
(
system_charset_info
,
new_db_name
->
str
,
INFORMATION_SCHEMA_NAME
.
str
)
==
0
)
if
(
is_schema_db
(
new_db_name
->
str
,
new_db_name
->
length
))
{
/* Switch the current database to INFORMATION_SCHEMA. */
...
...
sql/sql_parse.cc
View file @
b60d59b9
...
...
@@ -1305,8 +1305,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list
.
alias
=
table_list
.
table_name
=
conv_name
.
str
;
packet
=
arg_end
+
1
;
if
(
!
my_strcasecmp
(
system_charset_info
,
table_list
.
db
,
INFORMATION_SCHEMA_NAME
.
str
))
if
(
is_schema_db
(
table_list
.
db
,
table_list
.
db_length
))
{
ST_SCHEMA_TABLE
*
schema_table
=
find_schema_table
(
thd
,
table_list
.
alias
);
if
(
schema_table
)
...
...
@@ -1368,7 +1367,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
}
if
(
check_access
(
thd
,
CREATE_ACL
,
db
.
str
,
0
,
1
,
0
,
is_schema_db
(
db
.
str
)))
is_schema_db
(
db
.
str
,
db
.
length
)))
break
;
general_log_print
(
thd
,
command
,
"%.*s"
,
db
.
length
,
db
.
str
);
bzero
(
&
create_info
,
sizeof
(
create_info
));
...
...
@@ -1387,7 +1386,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_error
(
ER_WRONG_DB_NAME
,
MYF
(
0
),
db
.
str
?
db
.
str
:
"NULL"
);
break
;
}
if
(
check_access
(
thd
,
DROP_ACL
,
db
.
str
,
0
,
1
,
0
,
is_schema_db
(
db
.
str
)))
if
(
check_access
(
thd
,
DROP_ACL
,
db
.
str
,
0
,
1
,
0
,
is_schema_db
(
db
.
str
,
db
.
length
)))
break
;
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
{
...
...
@@ -2852,7 +2852,7 @@ mysql_execute_command(THD *thd)
&
first_table
->
grant
.
privilege
,
0
,
0
,
test
(
first_table
->
schema_table
))
||
check_access
(
thd
,
INSERT_ACL
|
CREATE_ACL
,
select_lex
->
db
,
&
priv
,
0
,
0
,
is_schema_db
(
select_lex
->
db
))
||
is_schema_db
(
select_lex
->
db
,
strlen
(
select_lex
->
db
)
))
||
check_merge_table_access
(
thd
,
first_table
->
db
,
(
TABLE_LIST
*
)
create_info
.
merge_list
.
first
))
...
...
@@ -3590,7 +3590,7 @@ mysql_execute_command(THD *thd)
}
#endif
if
(
check_access
(
thd
,
CREATE_ACL
,
lex
->
name
.
str
,
0
,
1
,
0
,
is_schema_db
(
lex
->
name
.
str
)))
is_schema_db
(
lex
->
name
.
str
,
lex
->
name
.
length
)))
break
;
res
=
mysql_create_db
(
thd
,(
lower_case_table_names
==
2
?
alias
:
lex
->
name
.
str
),
&
create_info
,
0
);
...
...
@@ -3625,7 +3625,7 @@ mysql_execute_command(THD *thd)
}
#endif
if
(
check_access
(
thd
,
DROP_ACL
,
lex
->
name
.
str
,
0
,
1
,
0
,
is_schema_db
(
lex
->
name
.
str
)))
is_schema_db
(
lex
->
name
.
str
,
lex
->
name
.
length
)))
break
;
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
{
...
...
@@ -3659,9 +3659,12 @@ mysql_execute_command(THD *thd)
my_error
(
ER_WRONG_DB_NAME
,
MYF
(
0
),
db
->
str
);
break
;
}
if
(
check_access
(
thd
,
ALTER_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
))
||
check_access
(
thd
,
DROP_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
))
||
check_access
(
thd
,
CREATE_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
)))
if
(
check_access
(
thd
,
ALTER_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
,
db
->
length
))
||
check_access
(
thd
,
DROP_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
,
db
->
length
))
||
check_access
(
thd
,
CREATE_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
,
db
->
length
)))
{
res
=
1
;
break
;
...
...
@@ -3704,7 +3707,8 @@ mysql_execute_command(THD *thd)
break
;
}
#endif
if
(
check_access
(
thd
,
ALTER_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
)))
if
(
check_access
(
thd
,
ALTER_ACL
,
db
->
str
,
0
,
1
,
0
,
is_schema_db
(
db
->
str
,
db
->
length
)))
break
;
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
{
...
...
@@ -3860,7 +3864,8 @@ mysql_execute_command(THD *thd)
first_table
?
&
first_table
->
grant
.
privilege
:
0
,
first_table
?
0
:
1
,
0
,
first_table
?
(
bool
)
first_table
->
schema_table
:
select_lex
->
db
?
is_schema_db
(
select_lex
->
db
)
:
0
))
select_lex
->
db
?
is_schema_db
(
select_lex
->
db
,
strlen
(
select_lex
->
db
))
:
0
))
goto
error
;
if
(
thd
->
security_ctx
->
user
)
// If not replication
...
...
@@ -4203,7 +4208,8 @@ mysql_execute_command(THD *thd)
}
if
(
check_access
(
thd
,
CREATE_PROC_ACL
,
lex
->
sphead
->
m_db
.
str
,
0
,
0
,
0
,
is_schema_db
(
lex
->
sphead
->
m_db
.
str
)))
is_schema_db
(
lex
->
sphead
->
m_db
.
str
,
lex
->
sphead
->
m_db
.
length
)))
goto
create_sp_error
;
if
(
end_active_trans
(
thd
))
...
...
@@ -4858,7 +4864,8 @@ mysql_execute_command(THD *thd)
res
=
mysql_xa_recover
(
thd
);
break
;
case
SQLCOM_ALTER_TABLESPACE
:
if
(
check_access
(
thd
,
ALTER_ACL
,
thd
->
db
,
0
,
1
,
0
,
thd
->
db
?
is_schema_db
(
thd
->
db
)
:
0
))
if
(
check_access
(
thd
,
ALTER_ACL
,
thd
->
db
,
0
,
1
,
0
,
thd
->
db
?
is_schema_db
(
thd
->
db
,
thd
->
db_length
)
:
0
))
break
;
if
(
!
(
res
=
mysql_alter_tablespace
(
thd
,
lex
->
alter_tablespace_info
)))
my_ok
(
thd
);
...
...
@@ -5297,7 +5304,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
if
(
check_access
(
thd
,
SELECT_ACL
,
dst_db_name
,
&
thd
->
col_access
,
FALSE
,
FALSE
,
is_schema_db
(
dst_db_name
)))
is_schema_db
(
dst_db_name
,
strlen
(
dst_db_name
)
)))
return
TRUE
;
if
(
!
thd
->
col_access
&&
check_grant_db
(
thd
,
dst_db_name
))
...
...
@@ -6262,8 +6269,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr
->
force_index
=
test
(
table_options
&
TL_OPTION_FORCE_INDEX
);
ptr
->
ignore_leaves
=
test
(
table_options
&
TL_OPTION_IGNORE_LEAVES
);
ptr
->
derived
=
table
->
sel
;
if
(
!
ptr
->
derived
&&
!
my_strcasecmp
(
system_charset_info
,
ptr
->
db
,
INFORMATION_SCHEMA_NAME
.
str
))
if
(
!
ptr
->
derived
&&
is_schema_db
(
ptr
->
db
,
ptr
->
db_length
))
{
ST_SCHEMA_TABLE
*
schema_table
=
find_schema_table
(
thd
,
ptr
->
table_name
);
if
(
!
schema_table
||
...
...
sql/sql_show.cc
View file @
b60d59b9
...
...
@@ -826,8 +826,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN
(
TRUE
);
}
#endif
if
(
!
my_strcasecmp
(
system_charset_info
,
dbname
,
INFORMATION_SCHEMA_NAME
.
str
))
if
(
is_schema_db
(
dbname
,
strlen
(
dbname
)))
{
dbname
=
INFORMATION_SCHEMA_NAME
.
str
;
create
.
default_table_charset
=
system_charset_info
;
...
...
@@ -2780,8 +2779,8 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
*/
if
(
lookup_field_vals
->
db_value
.
str
)
{
if
(
!
my_strcasecmp
(
system_charset_info
,
INFORMATION_SCHEMA_NAME
.
str
,
lookup_field_vals
->
db_value
.
str
))
if
(
is_schema_db
(
lookup_field_vals
->
db_value
.
str
,
lookup_field_vals
->
db_value
.
length
))
{
*
with_i_schema
=
1
;
if
(
files
->
push_back
(
i_s_name_copy
))
...
...
@@ -5228,7 +5227,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
*/
if
(
thd
->
lex
->
sql_command
!=
SQLCOM_SHOW_EVENTS
&&
check_access
(
thd
,
EVENT_ACL
,
et
.
dbname
.
str
,
0
,
0
,
1
,
is_schema_db
(
et
.
dbname
.
str
)))
is_schema_db
(
et
.
dbname
.
str
,
et
.
dbname
.
length
)))
DBUG_RETURN
(
0
);
/* ->field[0] is EVENT_CATALOG and is by default NULL */
...
...
sql/sql_view.cc
View file @
b60d59b9
...
...
@@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
table (i.e. user will not get some privileges by view creation)
*/
if
((
check_access
(
thd
,
CREATE_VIEW_ACL
,
view
->
db
,
&
view
->
grant
.
privilege
,
0
,
0
,
is_schema_db
(
view
->
db
))
||
0
,
0
,
is_schema_db
(
view
->
db
,
view
->
db_length
))
||
check_grant
(
thd
,
CREATE_VIEW_ACL
,
view
,
0
,
1
,
0
))
||
(
mode
!=
VIEW_CREATE_NEW
&&
(
check_access
(
thd
,
DROP_ACL
,
view
->
db
,
&
view
->
grant
.
privilege
,
0
,
0
,
is_schema_db
(
view
->
db
))
||
0
,
0
,
is_schema_db
(
view
->
db
,
view
->
db_length
))
||
check_grant
(
thd
,
DROP_ACL
,
view
,
0
,
1
,
0
))))
goto
err
;
...
...
sql/table.cc
View file @
b60d59b9
...
...
@@ -212,10 +212,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
DBUG_ASSERT
(
db
!=
NULL
);
DBUG_ASSERT
(
name
!=
NULL
);
if
((
db
->
length
==
INFORMATION_SCHEMA_NAME
.
length
)
&&
(
my_strcasecmp
(
system_charset_info
,
INFORMATION_SCHEMA_NAME
.
str
,
db
->
str
)
==
0
))
if
(
is_schema_db
(
db
->
str
,
db
->
length
))
{
return
TABLE_CATEGORY_INFORMATION
;
}
...
...
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