summaryrefslogtreecommitdiff
path: root/sql/tztime.h
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-10-21 22:18:00 +0400
committerunknown <dlenev@brandersnatch.localdomain>2004-10-21 22:18:00 +0400
commit8537cf2f4ba91b7e08975842aba910d4debefc13 (patch)
treeb557681e179a7a27aa8225e52e5623edc88c4db6 /sql/tztime.h
parent8f8236008193394ea2785c0095adf02839cde83a (diff)
downloadmariadb-git-8537cf2f4ba91b7e08975842aba910d4debefc13.tar.gz
Fix for bug #6116 "SET time_zone := ... requires access to
mysql.time_zone* tables". We are excluding implicitly used time zone tables from privilege checking. mysql-test/r/timezone2.result: Added test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone tables" mysql-test/t/timezone2.test: Added test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone tables" sql/sql_parse.cc: check_table_access(): we should avoid privilege checking for implicitly used time zone tables. sql/tztime.cc: Indicated dependancy between my_tz_get_table_list() function and my_tz_check_n_skip_implicit_tables() function. sql/tztime.h: Added my_tz_check_n_skip_implicit_tables() function which allows easily determine whenever we have found beggining of the list of implicitly used time zone tables and fast-forward to its end.
Diffstat (limited to 'sql/tztime.h')
-rw-r--r--sql/tztime.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/tztime.h b/sql/tztime.h
index aabec260ec7..9f969639bd0 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -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)