summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@oracle.com>2010-12-16 10:37:05 +0100
committerMartin Hansson <martin.hansson@oracle.com>2010-12-16 10:37:05 +0100
commitd74e8c5d8beab1c48b3d8a2dd953c77771517e0a (patch)
tree8d196b7555a9ee23cd5314177b38c6f4986d8179 /sql
parentffdeb062727361fb52c1baa38a184a214ec91ea3 (diff)
parent1bd81f6b817cc9b8e0b61d126b7ad159117e1b29 (diff)
downloadmariadb-git-d74e8c5d8beab1c48b3d8a2dd953c77771517e0a.tar.gz
Merge.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 88d1e8879d1..669229a8404 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3657,6 +3657,8 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
/*
Find field by name in a base table or a view with temp table algorithm.
+ The caller is expected to check column-level privileges.
+
SYNOPSIS
find_field_in_table()
thd thread handler
@@ -3753,6 +3755,8 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
This procedure detects the type of the table reference 'table_list'
and calls the corresponding search routine.
+ The routine checks column-level privieleges for the found field.
+
RETURN
0 field is not found
view_ref_found found value in VIEW (real result is in *ref)
@@ -3944,8 +3948,16 @@ find_field_in_tables(THD *thd, Item_ident *item,
when table_ref->field_translation != NULL.
*/
if (table_ref->table && !table_ref->view)
+ {
found= find_field_in_table(thd, table_ref->table, name, length,
TRUE, &(item->cached_field_index));
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ /* Check if there are sufficient access rights to the found field. */
+ if (found && check_privileges &&
+ check_column_grant_in_table_ref(thd, table_ref, name, length))
+ found= WRONG_GRANT;
+#endif
+ }
else
found= find_field_in_table_ref(thd, table_ref, name, length, item->name,
NULL, NULL, ref, check_privileges,