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
0ea8f291
Commit
0ea8f291
authored
Oct 22, 2004
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-tzfix
parents
af7ecf4c
e6a44b71
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
1 deletion
+85
-1
mysql-test/r/timezone2.result
mysql-test/r/timezone2.result
+20
-0
mysql-test/t/timezone2.test
mysql-test/t/timezone2.test
+28
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-1
sql/tztime.cc
sql/tztime.cc
+4
-0
sql/tztime.h
sql/tztime.h
+29
-0
No files found.
mysql-test/r/timezone2.result
View file @
0ea8f291
...
...
@@ -251,3 +251,23 @@ select convert_tz(ts, @@time_zone, 'Japan') from t1;
convert_tz(ts, @@time_zone, 'Japan')
2001-09-09 10:46:40
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant usage on mysqltest.* to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
2004-10-21 15:00:00
select * from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
delete from mysql.user where user like 'mysqltest\_%';
flush privileges;
mysql-test/t/timezone2.test
View file @
0ea8f291
...
...
@@ -199,3 +199,31 @@ insert into t1 (ts) values (now());
select
convert_tz
(
ts
,
@@
time_zone
,
'Japan'
)
from
t1
;
drop
table
t1
;
#
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
# tables". We should allow implicit access to time zone description tables
# even for unprivileged users.
#
delete
from
mysql
.
user
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
db
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
tables_priv
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
columns_priv
where
user
like
'mysqltest\_%'
;
flush
privileges
;
grant
usage
on
mysqltest
.*
to
mysqltest_1
@
localhost
;
connect
(
tzuser
,
localhost
,
mysqltest_1
,,);
connection
tzuser
;
show
grants
for
current_user
();
set
time_zone
=
'+00:00'
;
set
time_zone
=
'Europe/Moscow'
;
select
convert_tz
(
'2004-10-21 19:00:00'
,
'Europe/Moscow'
,
'UTC'
);
# But still these two statements should not work:
--
error
1044
select
*
from
mysql
.
time_zone_name
;
--
error
1044
select
Name
,
convert_tz
(
'2004-10-21 19:00:00'
,
Name
,
'UTC'
)
from
mysql
.
time_zone_name
;
connection
default
;
delete
from
mysql
.
user
where
user
like
'mysqltest\_%'
;
flush
privileges
;
sql/sql_parse.cc
View file @
0ea8f291
...
...
@@ -3730,7 +3730,10 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
TABLE_LIST
*
org_tables
=
tables
;
for
(;
tables
;
tables
=
tables
->
next
)
{
if
(
tables
->
derived
||
(
tables
->
table
&&
(
int
)
tables
->
table
->
tmp_table
))
if
(
tables
->
derived
||
(
tables
->
table
&&
(
int
)
tables
->
table
->
tmp_table
)
||
my_tz_check_n_skip_implicit_tables
(
&
tables
,
thd
->
lex
->
time_zone_tables_used
))
continue
;
if
((
thd
->
master_access
&
want_access
)
==
(
want_access
&
~
EXTRA_ACL
)
&&
thd
->
db
)
...
...
sql/tztime.cc
View file @
0ea8f291
...
...
@@ -1434,6 +1434,10 @@ tz_init_table_list(TABLE_LIST *tz_tabs)
This function creates list of TABLE_LIST objects allocated in thd's
memroot, which can be used for opening of time zone tables.
NOTE
my_tz_check_n_skip_implicit_tables() function depends on fact that
elements of list created are allocated as TABLE_LIST[4] array.
RETURN VALUES
Returns pointer to first TABLE_LIST object, (could be 0 if time zone
tables don't exist) and &fake_time_zone_tables_list in case of error.
...
...
sql/tztime.h
View file @
0ea8f291
...
...
@@ -64,6 +64,35 @@ extern Time_zone * my_tz_find(const String *name, TABLE_LIST *tz_tables);
extern
my_bool
my_tz_init
(
THD
*
org_thd
,
const
char
*
default_tzname
,
my_bool
bootstrap
);
extern
void
my_tz_free
();
/*
Check if we have pointer to the beggining of list of implictly used
time zone tables and fast-forward to its end.
SYNOPSIS
my_tz_check_n_skip_implicit_tables()
table - (in/out) pointer to element of table list to check
tz_tables - list of implicitly used time zone tables received
from my_tz_get_table_list() function.
NOTE
This function relies on my_tz_get_table_list() implementation.
RETURN VALUE
TRUE - if table points to the beggining of tz_tables list
FALSE - otherwise.
*/
inline
bool
my_tz_check_n_skip_implicit_tables
(
TABLE_LIST
**
table
,
TABLE_LIST
*
tz_tables
)
{
if
(
*
table
==
tz_tables
)
{
(
*
table
)
+=
3
;
return
TRUE
;
}
return
FALSE
;
}
/*
Maximum length of time zone name that we support
(Time zone name is char(64) in db)
...
...
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