diff options
author | holyfoot/hf@hfmain.(none) <> | 2007-03-23 00:09:12 +0400 |
---|---|---|
committer | holyfoot/hf@hfmain.(none) <> | 2007-03-23 00:09:12 +0400 |
commit | a7f5f07b6f0ba21e631ffab467885def890ecae6 (patch) | |
tree | 76cf679fd607f9683c09454e81480f5c0930410d /sql/sql_view.cc | |
parent | 81b59fb3ccd1390283861a7ce4239aab85ae6226 (diff) | |
parent | fc23f3356e60dd01c881d9d4dfedb6b19c9eb146 (diff) | |
download | mariadb-git-a7f5f07b6f0ba21e631ffab467885def890ecae6.tar.gz |
Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index b619e451b22..193ee5d1f0c 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -224,6 +224,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, { LEX *lex= thd->lex; bool link_to_local; + bool definer_check_is_needed= mode != VIEW_ALTER || lex->definer; /* first table in list is target VIEW name => cut off it */ TABLE_LIST *view= lex->unlink_first_table(&link_to_local); TABLE_LIST *tables= lex->query_tables; @@ -256,8 +257,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, /* DEFINER-clause is missing; we have to create default definer in persistent arena to be PS/SP friendly. + If this is an ALTER VIEW then the current user should be set as + the definer. */ - Query_arena original_arena; Query_arena *ps_arena = thd->activate_stmt_arena_if_needed(&original_arena); @@ -277,11 +279,11 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, - same as current user - current user has SUPER_ACL */ - if (strcmp(lex->definer->user.str, - thd->security_ctx->priv_user) != 0 || - my_strcasecmp(system_charset_info, - lex->definer->host.str, - thd->security_ctx->priv_host) != 0) + if (definer_check_is_needed && + (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 || + my_strcasecmp(system_charset_info, + lex->definer->host.str, + thd->security_ctx->priv_host) != 0)) { if (!(thd->security_ctx->master_access & SUPER_ACL)) { |