Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2031 06/02/10 01:20:36 anozdrin@stripped +7 -0
Fix for BUG#16266: Definer is not fully qualified error during replication
The idea of the fix is to extend support of non-SUID triggers for backward
compatibility. Formerly non-SUID triggers were appeared when "new" server
is being started against "old" database. Now, they are also created when
"new" slave receives updates from "old" master.
mysql-test/std_data/bug16266.000001
1.1 06/02/10 01:20:31 anozdrin@stripped +13 -0
A new binlog file for testing a patch for BUG#16266.
sql/sql_yacc.yy
1.448 06/02/10 01:20:31 anozdrin@stripped +38 -18
Extended support of non-SUID triggers.
sql/sql_trigger.cc
1.42 06/02/10 01:20:31 anozdrin@stripped +65 -22
Extend support of non-SUID triggers.
sql/sql_parse.cc
1.524 06/02/10 01:20:31 anozdrin@stripped +29 -1
Add a utility operation to be used from sql_yacc.yy.
sql/mysql_priv.h
1.373 06/02/10 01:20:31 anozdrin@stripped +1 -0
Added an utility operation to be used from sql_yacc.yy.
mysql-test/t/rpl_trigger.test
1.5 06/02/10 01:20:31 anozdrin@stripped +71 -0
Added the test case for BUG#16266.
mysql-test/std_data/bug16266.000001
1.0 06/02/10 01:20:31 anozdrin@stripped +0 -0
BitKeeper file
/mnt/hda4/home/alik/MySQL/devel/5.0-bug16266/mysql-test/std_data/bug16266.000001
mysql-test/r/rpl_trigger.result
1.4 06/02/10 01:20:31 anozdrin@stripped +36 -0
Updated the result file with the results of the test for BUG#16266.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: anozdrin
# Host: booka.home
# Root: /mnt/hda4/home/alik/MySQL/devel/5.0-bug16266
--- 1.372/sql/mysql_priv.h 2005-12-27 12:30:49 +03:00
+++ 1.373/sql/mysql_priv.h 2006-02-10 01:20:31 +03:00
@@ -530,6 +530,7 @@
TABLE_LIST *create_table);
bool get_default_definer(THD *thd, LEX_USER *definer);
+LEX_USER *create_default_definer(THD *thd);
LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
enum enum_mysql_completiontype {
--- 1.523/sql/sql_parse.cc 2006-01-11 02:10:54 +03:00
+++ 1.524/sql/sql_parse.cc 2006-02-10 01:20:31 +03:00
@@ -7218,6 +7218,34 @@
/*
+ Create default definer for the specified THD. Also check that the current
+ user is conformed to the definers requirements.
+
+ SYNOPSIS
+ create_default_definer()
+ thd [in] thread handler
+
+ RETURN
+ On success, return a valid pointer to the created and initialized
+ LEX_STRING, which contains definer information.
+ On error, return 0.
+*/
+
+LEX_USER *create_default_definer(THD *thd)
+{
+ LEX_USER *definer;
+
+ if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER))))
+ return 0;
+
+ if (get_default_definer(thd, definer))
+ return 0;
+
+ return definer;
+}
+
+
+/*
Create definer with the given user and host names. Also check that the user
and host names satisfy definers requirements.
@@ -7229,7 +7257,7 @@
RETURN
On success, return a valid pointer to the created and initialized
- LEX_STRING, which contains definer information.
+ LEX_USER, which contains definer information.
On error, return 0.
*/
--- 1.447/sql/sql_yacc.yy 2006-01-13 14:30:19 +03:00
+++ 1.448/sql/sql_yacc.yy 2006-02-10 01:20:31 +03:00
@@ -8908,35 +8908,55 @@
{
THD *thd= YYTHD;
- if (! (thd->lex->definer= create_definer(thd, &$1->user,
&$1->host)))
- YYABORT;
+ if (!$1)
+ {
+ /* This is a non-SUID trigger. */
+
+ thd->lex->definer= 0;
+ }
+ else
+ {
+ thd->lex->definer= $1;
+ }
}
;
get_definer:
- opt_current_definer
+ /* empty */
{
THD *thd= YYTHD;
-
- if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- YYABORT;
- if (get_default_definer(thd, $$))
- YYABORT;
+ if (thd->slave_thread)
+ {
+ /*
+ Definer-clause is missing and we are in slave thread. This means
+ that we received CREATE TRIGGER from the master, that does not
+ support definer in triggers. So, we should mark this trigger as
+ non-SUID.
+
+ Note that this does not happen when we parse triggers'
+ definitions during opening .TRG file. LEX::definer is ignored in
+ that case.
+ */
+
+ $$= 0;
+ }
+ else
+ {
+ if (! ($$= create_default_definer(thd)))
+ YYABORT;
+ }
+ }
+ | DEFINER_SYM EQ CURRENT_USER optional_braces
+ {
+ if (! ($$= create_default_definer(YYTHD)))
+ YYABORT;
}
| DEFINER_SYM EQ ident_or_text '@' ident_or_text
{
- if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
- YYABORT;
-
- $$->user= $3;
- $$->host= $5;
+ if (!($$= create_definer(YYTHD, &$3, &$5)))
+ YYABORT;
}
- ;
-
-opt_current_definer:
- /* empty */
- | DEFINER_SYM EQ CURRENT_USER optional_braces
;
/**************************************************************************
--- New file ---
+++ mysql-test/std_data/bug16266.000001 06/02/10 01:20:31
þbin;iëC ^ b 5.0.16-debug-log ;iëC8
K HiëC U ·