summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-05-26 11:49:39 +0300
committerunknown <gkodinov@mysql.com>2006-05-26 11:49:39 +0300
commit419ae6cbf8ce04430673174e4a0063eda4e90254 (patch)
treea6e1e57b9c8be0e4046fd68ea9fcac02e357f0fb /sql
parent48fe5a2d8feef07b50d8cda323bff706e90ce1c0 (diff)
downloadmariadb-git-419ae6cbf8ce04430673174e4a0063eda4e90254.tar.gz
Bug #14875: Bad view DEFINER makes SHOW CREATE VIEW fail
When reading a view definition from a .frm file it was throwing a SQL error if the DEFINER user is not defined. Changed it to a warning to match the (documented) case when a view with undefined DEFINER user is created. mysql-test/r/view_grant.result: test case for the bug mysql-test/t/view_grant.test: test case for the bug sql/sql_acl.cc: Initialized the members to no privileges so even if the subsequent checks fail it will still initialize the security context. sql/table.cc: Turned the error of undefined DEFINER user in reading a view definition to a warning.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc2
-rw-r--r--sql/table.cc14
2 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 02b2f88676f..197c703ece3 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -959,6 +959,8 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
sctx->master_access= 0;
sctx->db_access= 0;
+ sctx->priv_user= (char *) "";
+ *sctx->priv_host= 0;
/*
Find acl entry in user database.
diff --git a/sql/table.cc b/sql/table.cc
index 8e23bea2540..4390c67c77d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2428,8 +2428,18 @@ bool st_table_list::prepare_view_securety_context(THD *thd)
definer.host.str,
thd->db))
{
- my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
- DBUG_RETURN(TRUE);
+ if (thd->lex->sql_command == SQLCOM_SHOW_CREATE)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_NO_SUCH_USER,
+ ER(ER_NO_SUCH_USER),
+ definer.user.str, definer.host.str);
+ }
+ else
+ {
+ my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
+ DBUG_RETURN(TRUE);
+ }
}
}
DBUG_RETURN(FALSE);