List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:November 19 2012 5:58pm
Subject:bzr push into mysql-trunk branch (magnus.blaudd:5041 to 5042)
View as plain text  
 5042 magnus.blaudd@stripped	2012-11-19 [merge]
      Merge

    modified:
      sql/handler.h
      sql/sql_acl.cc
 5041 Vamsikrishna Bhagi	2012-11-19 [merge]
      Bazaar merge for Bug#14463669 from mysql-5.6.

    modified:
      client/mysqldump.c
      mysql-test/r/mysqldump.result
=== modified file 'sql/handler.h'
--- a/sql/handler.h	2012-11-07 12:05:17 +0000
+++ b/sql/handler.h	2012-11-19 15:00:50 +0000
@@ -421,7 +421,8 @@ enum enum_binlog_command {
   LOGCOM_DROP_TABLE,
   LOGCOM_CREATE_DB,
   LOGCOM_ALTER_DB,
-  LOGCOM_DROP_DB
+  LOGCOM_DROP_DB,
+  LOGCOM_ACL_NOTIFY
 };
 
 /* struct to hold information about the table that should be created */

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2012-11-16 16:37:45 +0000
+++ b/sql/sql_acl.cc	2012-11-19 17:52:50 +0000
@@ -1488,6 +1488,30 @@ static bool acl_trans_commit_and_close_t
 }
 
 
+/**
+  Notify handlerton(s) that privileges have changed
+
+  Interested handlertons may use this notification to update
+  its own privilege structures as well as propagating
+  the changing query to other destinations.
+
+*/
+
+static inline void
+acl_notify_htons(THD* thd,
+                const char* query, uint query_length)
+{
+  DBUG_ENTER("acl_notify_htons");
+  DBUG_PRINT("enter", ("db: %s", thd->db));
+  DBUG_PRINT("enter", ("query: '%s', length: %u", query, query_length));
+
+  ha_binlog_log_query(thd, NULL, LOGCOM_ACL_NOTIFY,
+                      query, query_length,
+                      thd->db, "");
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Forget current user/db-level privileges and read new privileges
   from the privilege tables.
@@ -2405,6 +2429,9 @@ bool change_password(THD *thd, const cha
 end:
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (!result)
+    acl_notify_htons(thd, buff, query_length);
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
@@ -4451,7 +4478,10 @@ int mysql_table_grant(THD *thd, TABLE_LI
   result|= acl_trans_commit_and_close_tables(thd);
 
   if (!result) /* success */
+  {
+    acl_notify_htons(thd, thd->query(), thd->query_length());
     my_ok(thd);
+  }
 
   thd->lex->restore_backup_query_tables_list(&backup);
   /* Restore the state of binlog format */
@@ -4659,6 +4689,9 @@ bool mysql_routine_grant(THD *thd, TABLE
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (write_to_binlog && !result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
@@ -4908,7 +4941,10 @@ bool mysql_grant(THD *thd, const char *d
   result|= acl_trans_commit_and_close_tables(thd);
   
   if (!result)
+  {
+    acl_notify_htons(thd, thd->query(), thd->query_length());
     my_ok(thd);
+  }
 
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -7456,6 +7492,9 @@ bool mysql_create_user(THD *thd, List <L
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (some_users_created && !result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
@@ -7545,6 +7584,9 @@ bool mysql_drop_user(THD *thd, List <LEX
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (some_users_deleted && !result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   thd->variables.sql_mode= old_sql_mode;
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -7646,6 +7688,9 @@ bool mysql_rename_user(THD *thd, List <L
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (some_users_renamed && !result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
@@ -7763,6 +7808,9 @@ bool mysql_user_password_expire(THD *thd
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (some_passwords_expired && !result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
@@ -7970,6 +8018,9 @@ bool mysql_revoke_all(THD *thd,  List <L
 
   result|= acl_trans_commit_and_close_tables(thd);
 
+  if (!result)
+    acl_notify_htons(thd, thd->query(), thd->query_length());
+
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (magnus.blaudd:5041 to 5042) magnus.blaudd19 Nov