From: Nirbhay Choubey Date: July 13 2012 2:30pm Subject: bzr push into mysql-5.6 branch (nirbhay.choubey:4025 to 4026) WL#5603 List-Archive: http://lists.mysql.com/commits/144447 Message-Id: <20120713143051.30460.89063.4026@Nirbhay-lenovo> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4026 Nirbhay Choubey 2012-07-13 Minor modifications related to WL#5603. modified: client/mysql_config_editor.cc mysql-test/r/mysql_config_editor.result mysql-test/t/mysql_config_editor.test 4025 Nirbhay Choubey 2012-07-13 Fix for a compiler warning. modified: client/mysqldump.c === modified file 'client/mysql_config_editor.cc' --- a/client/mysql_config_editor.cc 2012-06-09 13:16:21 +0000 +++ b/client/mysql_config_editor.cc 2012-07-13 14:28:34 +0000 @@ -19,7 +19,7 @@ @file @brief - MySQL Configuration Tool + MySQL Configuration Utility */ /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ @@ -54,7 +54,8 @@ static char *opt_user= NULL, *opt_passwo static char my_login_file[FN_REFLEN]; static char my_key[LOGIN_KEY_LEN]; -static my_bool opt_verbose, opt_all, tty_password= 0, opt_warn; +static my_bool opt_verbose, opt_all, tty_password= 0, opt_warn, + login_path_specified= TRUE; int execute_commands(int argc, char **argv); static void print_login_path(DYNAMIC_STRING *file_buf, const char *path_name); @@ -116,11 +117,11 @@ static struct my_option my_long_options[ NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Host name to be entered into the login file.", &opt_host, &opt_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"login-path", 'G', "Login file path.", &opt_login_path, &opt_login_path, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"password", 'p', "Password to be entered into the login file. It has to " - "be specified in the next line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, - 0, 0, 0}, + {"login-path", 'G', "Name of the login path to use in the login file.", + &opt_login_path, &opt_login_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"password", 'p', "Prompt for password to be entered into the login file.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User name to be entered into the login file.", &opt_user, &opt_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Write more information.", &opt_verbose, @@ -181,7 +182,10 @@ int main(int argc, char *argv[]) /* if not, set it to 'client' (default) */ if (!opt_login_path) + { + login_path_specified= FALSE; opt_login_path= my_strdup("client", MYF(MY_WME)); + } error= execute_commands(argc, argv); exit(error ? 1 : 0); @@ -273,6 +277,22 @@ int execute_commands(int argc, char **ar else break; /* Nothing to remove, skip.. */ + /* Warn if no login path is specified. */ + if (opt_warn && + ((locate_login_path (&file_buf, opt_login_path)) != NULL) && + (login_path_specified == FALSE) + ) + { + int choice; + printf ("WARNING : No login path specified, so default login path " + "will be removed. \n Continue? (Press y|Y for Yes, any " + "other key for No) : "); + choice= getchar(); + + if (choice != (int) 'y' && choice != (int) 'Y') + break; /* skip */ + } + remove_login_path(&file_buf, opt_login_path); encrypt_and_write_file(&file_buf); @@ -411,6 +431,10 @@ static my_bool check_and_create_login_fi else { verbose_msg("File does not have the required permission.\n"); + if (opt_warn) + printf ("WARNING : Login file does not have the required" + " file permissions.\nPlease set the mode to 600 &" + " run the command again.\n"); goto error; } } @@ -974,18 +998,18 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2012")); - puts("MySQL Configuration Tool."); - printf("Usage: %s [OPTIONS] command \n", my_progname); + puts("MySQL Configuration Utility."); + printf("Usage: %s command [options] \n", my_progname); my_print_help(my_long_options); my_print_variables(my_long_options); puts("\nWhere command can be any one of the following :\n\ - set [options] Sets username/password/hostname for a\n\ + set [options] Sets user name/password/host name for a\n\ given login path (section).\n\ - remove [options] Removes options from the specified path.\n\ - print [options] Prints all the options for a specified\n\ + remove [options] Remove a login path from the login file.\n\ + print [options] Print all the options for a specified\n\ login path.\n\ - reset Clean-up the login file.\n\ - help Print this usage/help information.\n"); + reset Deletes the contents of the login file.\n\ + help Display this usage/help information.\n"); } === modified file 'mysql-test/r/mysql_config_editor.result' --- a/mysql-test/r/mysql_config_editor.result 2012-06-09 13:16:21 +0000 +++ b/mysql-test/r/mysql_config_editor.result 2012-07-13 14:28:34 +0000 @@ -89,14 +89,13 @@ Oracle is a registered trademark of Orac affiliates. Other names may be trademarks of their respective owners. -MySQL Configuration Tool. +MySQL Configuration Utility. --all Used with print command to print all login paths. -?, --help Display this help and exit. -h, --host=name Host name to be entered into the login file. -G, --login-path=name - Login file path. - -p, --password Password to be entered into the login file. It has to be - specified in the next line. + Name of the login path to use in the login file. + -p, --password Prompt for password to be entered into the login file. -u, --user=name User name to be entered into the login file. -v, --verbose Write more information. -V, --version Output version information and exit. @@ -115,13 +114,13 @@ verbose FALSE warn TRUE Where command can be any one of the following : - set [options] Sets username/password/hostname for a + set [options] Sets user name/password/host name for a given login path (section). - remove [options] Removes options from the specified path. - print [options] Prints all the options for a specified + remove [options] Remove a login path from the login file. + print [options] Print all the options for a specified login path. - reset Clean-up the login file. - help Print this usage/help information. + reset Deletes the contents of the login file. + help Display this usage/help information. # done.. @@ -240,7 +239,7 @@ mysqld is alive ################################# # Testing with login file removed ################################# -# Even if login file does not exit, the +# Even if login file does not exist, the # tools should be able to continue # normally. mysqld is alive === modified file 'mysql-test/t/mysql_config_editor.test' --- a/mysql-test/t/mysql_config_editor.test 2012-06-09 13:16:21 +0000 +++ b/mysql-test/t/mysql_config_editor.test 2012-07-13 14:28:34 +0000 @@ -57,7 +57,7 @@ --echo ################################################ --echo # --echo # Default path ---exec $MYSQL_CONFIG_EDITOR remove +--exec $MYSQL_CONFIG_EDITOR remove --skip-warn --echo # done.. --echo # test-login-path1 --exec $MYSQL_CONFIG_EDITOR remove --login-path=test-login-path1 @@ -188,7 +188,7 @@ DROP USER test_user1, test_user2; --echo ################################# --echo # Testing with login file removed --echo ################################# ---echo # Even if login file does not exit, the +--echo # Even if login file does not exist, the --echo # tools should be able to continue --echo # normally. --exec $MYSQLADMIN -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2>&1 No bundle (reason: useless for push emails).