MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:December 3 2008 8:51pm
Subject:bzr commit into mysql-5.1-bugteam branch (chad:2725) Bug#30261
View as plain text  
#At file:///home/cmiller/work/mysqlbzr/mysql-5.1-bugteam--bug30261/

 2725 Chad MILLER	2008-12-03
      Bug#30261: "mysqld --help" no longer possible for root
      
      Previoiusly, we quit before printing help if there was an error, and
      running as root is an error.
      
      Now, print help if we were asked to, but explicitly avoid plugin code
      if we are also running as root.  Also, emit a warning about avoiding it.
modified:
  sql/mysqld.cc
  sql/sql_plugin.cc

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-11-28 15:27:12 +0000
+++ b/sql/mysqld.cc	2008-12-03 20:47:11 +0000
@@ -1176,10 +1176,10 @@ extern "C" void unireg_abort(int exit_co
 {
   DBUG_ENTER("unireg_abort");
 
+  if (opt_help)
+    usage();
   if (exit_code)
     sql_print_error("Aborting\n");
-  else if (opt_help)
-    usage();
   clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
   DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
   wait_for_signal_thread_to_end();
@@ -7378,7 +7378,8 @@ static void usage(void)
     default_collation_name= (char*) default_charset_info->name;
   print_version();
   puts("\
-Copyright (C) 2000 MySQL AB, by Monty and others\n\
+Copyright (C) 2000-2008 MySQL AB, by Monty and others\n\
+Copyright (C) 2008 Sun Microsystems, Inc.\n\
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
 and you are welcome to modify and redistribute it under the GPL license\n\n\
 Starts the MySQL database server\n");

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2008-10-06 20:36:15 +0000
+++ b/sql/sql_plugin.cc	2008-12-03 20:47:11 +0000
@@ -3273,11 +3273,13 @@ void my_print_help_inc_plugins(my_option
   struct st_plugin_int *p;
   MEM_ROOT mem_root;
   my_option *opt;
+  bool printing_plugin_info= (getuid() != 0);
 
   init_alloc_root(&mem_root, 4096, 4096);
   my_init_dynamic_array(&all_options, sizeof(my_option), size, size/4);
 
-  if (initialized)
+  
+  if (printing_plugin_info && initialized)
     for (uint idx= 0; idx < plugin_array.elements; idx++)
     {
       p= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
@@ -3303,6 +3305,9 @@ void my_print_help_inc_plugins(my_option
   my_print_help((my_option*) all_options.buffer);
   my_print_variables((my_option*) all_options.buffer);
 
+  if (! printing_plugin_info)
+    sql_print_warning("Didn't read plugins help, as we are running as root.");
+
   delete_dynamic(&all_options);
   free_root(&mem_root, MYF(0));
 }

Thread
bzr commit into mysql-5.1-bugteam branch (chad:2725) Bug#30261Chad MILLER3 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (chad:2725) Bug#30261Sergei Golubchik22 Dec