summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-06-17 16:20:07 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2003-06-17 16:20:07 +0300
commit231b0ff8dd13dc39a1ab94ed7c24b4a2d40e9c1c (patch)
treeca9c79a3f741e378a3b6085b4189b4cfa23f140d /sql/sql_acl.cc
parentc9505d8fc1d82d4af9240e394ee7a7c8105b426b (diff)
downloadmariadb-git-231b0ff8dd13dc39a1ab94ed7c24b4a2d40e9c1c.tar.gz
Two Sprint tasks and two behaviour changes.
sql/sql_acl.cc: Fix for a grant bug. If there is a table privilege, for which no column privileges are defined , and the same privilege is granted for a column, new code prevents that table privilege is reduced to a column privilege. To accomplish that, now a REVOKE command has to be used first. sql/sql_parse.cc: SCRUM TASK No 1. Adding support for INSERT .. SELECT with a table in the join that is to be inserted into. test case pending. sql/sql_union.cc: Changing behaviour for SQL_OPTION_FOUND_ROWS in unins. sql/sql_yacc.yy: SCRUM TASK no 2. Making CREATE and INSERT to work with any UNION>
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 12ea3a94464..e2946022ddf 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2038,7 +2038,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
check->column.c_ptr(), table_list->alias);
DBUG_RETURN(-1);
}
- column_priv |= check->rights | (rights & COL_ACLS);
+ column_priv |= check->rights & COL_ACLS;
}
close_thread_tables(thd);
}
@@ -2173,7 +2173,12 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
else
{
- column_priv|= grant_table->cols;
+ /*
+ This code makes sure that if there is X privilege on the entire table and
+ X can be also a column privilege, that granting column privilege does not
+ revoke a table privilege.
+ */
+ column_priv&= ~(grant_table->privs & ~grant_table->cols);
}
@@ -2186,13 +2191,13 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ // Crashend table ??
result= -1; /* purecov: deadcode */
}
- else if (tables[2].table)
+ else if (tables[2].table && (column_priv | revoke_grant))
{
if ((replace_column_table(grant_table,tables[2].table, *Str,
columns,
table_list->db,
table_list->real_name,
- rights, revoke_grant)))
+ (revoke_grant) ? rights : column_priv, revoke_grant)))
{
result= -1;
}