summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2003-04-01 22:49:40 +0200
committerguilhem@mysql.com <>2003-04-01 22:49:40 +0200
commit4824d6c66c62e0803df5d0dc00c4d8b9c76cdf02 (patch)
tree02dad4338cbed9769c9cabd6f9857a00b15678c0 /sql/sql_acl.cc
parent64413474351bf0807b7e183df2760729f1a8e425 (diff)
downloadmariadb-git-4824d6c66c62e0803df5d0dc00c4d8b9c76cdf02.tar.gz
Sprint task #856 : make table exclusion rules (in replication)
apply to GRANT and REVOKE too. For example if replicate-wild-ignore-table=mysql.%, GRANT and REVOKE will not be replicated on the slave.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ee9d3f1c1ea..e8cbba8aefa 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -28,6 +28,9 @@
#include "mysql_priv.h"
#include "sql_acl.h"
#include "hash_filo.h"
+#ifdef HAVE_REPLICATION
+#include "sql_repl.h" //for tables_ok()
+#endif
#include <m_ctype.h>
#include <assert.h>
#include <stdarg.h>
@@ -2052,6 +2055,15 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
tables[0].db=tables[1].db=tables[2].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 && !tables_ok(0, tables))
+ DBUG_RETURN(0);
+#endif
+
if (open_and_lock_tables(thd,tables))
{ // Should never happen
close_thread_tables(thd); /* purecov: deadcode */
@@ -2214,6 +2226,16 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
tables[0].db=tables[1].db=(char*) "mysql";
tables[0].table=tables[1].table=0;
+
+#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 && !tables_ok(0, tables))
+ DBUG_RETURN(0);
+#endif
+
if (open_and_lock_tables(thd,tables))
{ // This should never happen
close_thread_tables(thd); /* purecov: deadcode */