summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-08-02 23:46:26 +0200
committerunknown <guilhem@mysql.com>2003-08-02 23:46:26 +0200
commit3b013646e1550d22dff01dd02c8d12118a563fe2 (patch)
tree19e36a2975c086bb3eebb76ab47fbad1ca9d400e /sql/sql_acl.cc
parentb1c56d68e9c56abd335515dcc6cad3026f39a2ad (diff)
downloadmariadb-git-3b013646e1550d22dff01dd02c8d12118a563fe2.tar.gz
Fix so that SET PASSWORD is not replicated by the slave if running with
replicate-*-table rules which exclude 'mysql' tables (e.g. replicate-wild-ignore-table=mysql.%). This was already the behaviour for GRANT/REVOKE, I'm extending it to SET PASSWORD because it seems very logical (the contrary seems illogical). 2 new tests: - one to test if GRANT and SET PASSWORD are replicated - one to test if they are not replicated if replicate-wild-ignore-table=mysql.% The 2nd is also a testcase for BUG#980. sql/sql_acl.cc: Fix so that SET PASSWORD is not replicated by the slave if running with replicate-*-table rules which exclude 'mysql' tables (e.g. replicate-wild-ignore-table=mysql.%). This was already the behaviour for GRANT/REVOKE, I'm extending it to SET PASSWORD because it seems very logical (the contrary seems illogical).
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index fd7ea5aac51..3a3de2abf10 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1233,6 +1233,25 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
bzero((char*) &tables,sizeof(tables));
tables.alias=tables.real_name=(char*) "user";
tables.db=(char*) "mysql";
+#ifdef HAVE_REPLICATION
+ /*
+ GRANT and REVOKE are applied the slave in/exclusion rules as they are
+ some kind of updates to the mysql.% tables.
+ */
+ if (thd->slave_thread && table_rules_on)
+ {
+ /*
+ The tables must be marked "updating" so that tables_ok() takes them into
+ account in tests.
+ */
+ tables.updating=1;
+ /* Thanks to bzero, tables.next==0 */
+ if (!tables_ok(0, &tables))
+ DBUG_RETURN(0);
+ tables.updating=0;
+ }
+#endif
+
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,(uint) strlen(host));