List:Commits« Previous MessageNext Message »
From:Luis Soares Date:November 23 2011 11:48am
Subject:bzr push into mysql-trunk branch (luis.soares:3658 to 3660) Bug#13410464
View as plain text  
 3660 Luis Soares	2011-11-23
      BUG#13410464
      
      Addressing review comments.

    modified:
      sql/sql_rewrite.cc
 3659 Luis Soares	2011-11-23 [merge]
      BUG#13410464
      
      Automerging with latest mysql-trunk.

    modified:
      mysql-test/suite/rpl/r/rpl_master_connection.result
      mysql-test/suite/rpl/t/rpl_master_connection.test
      sql/sql_rewrite.cc
 3658 Tor Didriksen	2011-11-23
      Fix pushbuild complaints:
      WARNING: GPL not restricted to version 2: sql/sql_get_diagnostics.h

    modified:
      sql/sql_get_diagnostics.cc
      sql/sql_get_diagnostics.h
      unittest/gunit/get_diagnostics-t.cc
      unittest/gunit/stdcxx-t.cc
=== modified file 'mysql-test/suite/rpl/r/rpl_master_connection.result'
--- a/mysql-test/suite/rpl/r/rpl_master_connection.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_master_connection.result	2011-11-20 22:17:18 +0000
@@ -223,6 +223,42 @@ include/stop_slave.inc
 START SLAVE USER= 'root' PASSWORD= '';
 include/wait_for_slave_to_start.inc
 include/check_slave_is_running.inc
+SET @old_log_output= @@log_output;
+SET GLOBAL log_output= 'TABLE,FILE';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE PASSWORD='secret';
+include/stop_slave.inc
+START SLAVE PASSWORD = '<secret>';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE USER='root' PASSWORD='secret';
+include/stop_slave.inc
+START SLAVE USER = 'root' PASSWORD = '<secret>';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE IO_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+START SLAVE IO_THREAD USER = 'root' PASSWORD = '<secret>' DEFAULT_AUTH = 'auth_test_plugin' PLUGIN_DIR = 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE IO_THREAD, SQL_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+START SLAVE IO_THREAD, SQL_THREAD USER = 'root' PASSWORD = '<secret>' DEFAULT_AUTH = 'auth_test_plugin' PLUGIN_DIR = 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE IO_THREAD, SQL_THREAD UNTIL MASTER_LOG_FILE='dummy-log.000001', MASTER_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+START SLAVE IO_THREAD, SQL_THREAD UNTIL MASTER_LOG_FILE = 'dummy-log.000001', MASTER_LOG_POS = 116 USER = 'root' PASSWORD = '<secret>' DEFAULT_AUTH = 'auth_test_plugin' PLUGIN_DIR = 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE IO_THREAD, SQL_THREAD UNTIL RELAY_LOG_FILE='dummy-log.000001', RELAY_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+START SLAVE IO_THREAD, SQL_THREAD UNTIL RELAY_LOG_FILE = 'dummy-log.000001', RELAY_LOG_POS = 116 USER = 'root' PASSWORD = '<secret>' DEFAULT_AUTH = 'auth_test_plugin' PLUGIN_DIR = 'PLUGIN_AUTH_DIR';
+include/stop_slave.inc
+SET GLOBAL log_output= @old_log_output;
+TRUNCATE mysql.general_log;
+include/start_slave.inc
 SET SQL_LOG_BIN=0;
 DROP USER plug_user_p, plug_user_wp, regular_user_p, regular_user_wp, proxy_user_p, proxy_user_wp;
 SET SQL_LOG_BIN=1;

=== modified file 'mysql-test/suite/rpl/t/rpl_master_connection.test'
--- a/mysql-test/suite/rpl/t/rpl_master_connection.test	2011-11-11 17:37:44 +0000
+++ b/mysql-test/suite/rpl/t/rpl_master_connection.test	2011-11-20 22:17:18 +0000
@@ -267,6 +267,79 @@ CHANGE MASTER TO MASTER_USER= 'root', MA
 --source include/wait_for_slave_to_start.inc
 --source include/check_slave_is_running.inc
 
+# 
+# Bug#13410464: FOR START SLAVE .. PASSWORD=<PASSWORD>, THE PASSWORD IS LOGGED IN PLAIN TEXT  
+#
+
+SET @old_log_output= @@log_output;
+SET GLOBAL log_output= 'TABLE,FILE';
+
+--disable_warnings
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE PASSWORD='secret';
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--eval $rewritten
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+START SLAVE USER='root' PASSWORD='secret';
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--eval $rewritten
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval START SLAVE IO_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval $rewritten
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval START SLAVE IO_THREAD, SQL_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval $rewritten
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval START SLAVE IO_THREAD, SQL_THREAD UNTIL MASTER_LOG_FILE='dummy-log.000001', MASTER_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval $rewritten
+
+--source include/stop_slave.inc
+TRUNCATE mysql.general_log;
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval START SLAVE IO_THREAD, SQL_THREAD UNTIL RELAY_LOG_FILE='dummy-log.000001', RELAY_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
+--let $rewritten= `SELECT argument FROM mysql.general_log WHERE argument LIKE "%PASSWORD = '<secret>'%"`
+# execute it to see if the rewrite generated a (syntatically) valid command 
+--source include/stop_slave.inc
+--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
+--eval $rewritten
+
+--source include/stop_slave.inc
+
+--enable_warnings
+
+SET GLOBAL log_output= @old_log_output;
+TRUNCATE mysql.general_log;
+--source include/start_slave.inc
+
 ################################################################################
 # 3. Clean the environment
 ################################################################################

=== modified file 'sql/sql_rewrite.cc'
--- a/sql/sql_rewrite.cc	2011-08-18 15:27:05 +0000
+++ b/sql/sql_rewrite.cc	2011-11-23 10:51:10 +0000
@@ -20,7 +20,7 @@
 #include "sql_parse.h"  // get_current_user
 #include "sql_show.h"   // append_identifier
 #include "sp_head.h"    // TYPE_ENUM_(FUNCTION|PROCEDURE)
-
+#include "rpl_slave.h"  // SLAVE_SQL, SLAVE_IO
 
 
 static void mysql_rewrite_grant(THD *thd, String *rlb)
@@ -352,6 +352,75 @@ static void mysql_rewrite_change_master(
   }
 }
 
+static void mysql_rewrite_start_slave(THD *thd, String *rlb)
+{
+  LEX *lex= thd->lex;
+
+  if (!lex->slave_connection.password)
+    return;
+
+  rlb->append(STRING_WITH_LEN("START SLAVE"));
+
+  if (lex->slave_thd_opt & SLAVE_IO)
+    rlb->append(STRING_WITH_LEN(" IO_THREAD"));
+
+  /* we have printed the IO THREAD related options */
+  if (lex->slave_thd_opt & SLAVE_IO && 
+      lex->slave_thd_opt & SLAVE_SQL)
+    rlb->append(STRING_WITH_LEN(","));
+
+  if (lex->slave_thd_opt & SLAVE_SQL)
+    rlb->append(STRING_WITH_LEN(" SQL_THREAD"));
+
+  /* until options */
+  if (lex->mi.log_file_name || lex->mi.relay_log_name)
+  {
+    rlb->append(STRING_WITH_LEN(" UNTIL"));
+    if (lex->mi.log_file_name)
+    {
+      rlb->append(STRING_WITH_LEN(" MASTER_LOG_FILE = '"));
+      rlb->append(lex->mi.log_file_name);
+      rlb->append(STRING_WITH_LEN("', "));
+      rlb->append(STRING_WITH_LEN("MASTER_LOG_POS = "));
+      rlb->append_ulonglong(lex->mi.pos);
+    }
+
+    if (lex->mi.relay_log_name)
+    {
+      rlb->append(STRING_WITH_LEN(" RELAY_LOG_FILE = '"));
+      rlb->append(lex->mi.relay_log_name);
+      rlb->append(STRING_WITH_LEN("', "));
+      rlb->append(STRING_WITH_LEN("RELAY_LOG_POS = "));
+      rlb->append_ulonglong(lex->mi.relay_log_pos);
+    }
+  }
+
+  /* connection options */
+  if (lex->slave_connection.user)
+  {
+    rlb->append(STRING_WITH_LEN(" USER = '"));
+    rlb->append(lex->slave_connection.user);
+    rlb->append(STRING_WITH_LEN("'"));
+  }
+
+  if (lex->slave_connection.password)
+    rlb->append(STRING_WITH_LEN(" PASSWORD = '<secret>'"));
+
+  if (lex->slave_connection.plugin_auth)
+  {
+    rlb->append(STRING_WITH_LEN(" DEFAULT_AUTH = '"));
+    rlb->append(lex->slave_connection.plugin_auth);
+    rlb->append(STRING_WITH_LEN("'"));
+  }
+
+  if (lex->slave_connection.plugin_dir)
+  {
+    rlb->append(STRING_WITH_LEN(" PLUGIN_DIR = '"));
+    rlb->append(lex->slave_connection.plugin_dir);
+    rlb->append(STRING_WITH_LEN("'"));
+  }
+}
+
 
 /**
 Rewrite a query (to obfuscate passwords etc.)
@@ -370,6 +439,7 @@ void mysql_rewrite_query(THD *thd)
   case SQLCOM_SET_OPTION:    mysql_rewrite_set(thd, rlb);           break;
   case SQLCOM_CREATE_USER:   mysql_rewrite_create_user(thd, rlb);   break;
   case SQLCOM_CHANGE_MASTER: mysql_rewrite_change_master(thd, rlb); break;
+  case SQLCOM_SLAVE_START:   mysql_rewrite_start_slave(thd, rlb);   break;
   default:                   /* unhandled query types are legal. */ break;
   }
 }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (luis.soares:3658 to 3660) Bug#13410464Luis Soares29 Nov