List:Internals« Previous MessageNext Message »
From:dlenev Date:September 22 2005 9:04pm
Subject:bk commit into 5.0 tree (dlenev:1.1998) BUG#13407
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of dlenev. When dlenev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1998 05/09/22 23:03:53 dlenev@stripped +5 -0
  Fix for bug #13407 "Remote connecting crashes server" and couple of similar
  problems which were introduced during work on WL#2787 "Add view definer/owner
  to the view definition (.frm) to check privileges on used tables and stored
  routines when using a VIEW."
  
  In some cases it is better to use value from Security_context::host_or_ip
  instead of value from Security_context::host since the latter can be NULL
  in certain situations (When we can't resolve hostname or we have not done
  this yet).

  sql/sql_show.cc
    1.285 05/09/22 23:03:48 dlenev@stripped +1 -1
    mysqld_list_processes():
      It is better to use value from Security_context::host_or_ip instead of
      value from Security_context::host in the processlist since the latter
      can be NULL in certain situations (When we can't resolve hostname or we
      have not done this yet. Reverted back to old code).

  sql/mysqld.cc
    1.501 05/09/22 23:03:48 dlenev@stripped +1 -1
    handle_connections_shared_memory():
     THD::host member has moved to the Security_context class.
     New THD::security_ctx member points to active security context.

  sql/item_strfunc.cc
    1.255 05/09/22 23:03:48 dlenev@stripped +1 -1
    Item_func_user::val_str():
      It is better to use value from Security_context::host_or_ip instead of
      value from Security_context::host in the result of USER() function since
      the latter can be NULL in certain situations (When we can't resolve hostname
      or we have not done this yet. Reverted back to old code).

  mysql-test/t/skip_name_resolve.test
    1.4 05/09/22 23:03:48 dlenev@stripped +10 -0
    Added test for bug #13407 "Remote connecting crashes server".

  mysql-test/r/skip_name_resolve.result
    1.2 05/09/22 23:03:48 dlenev@stripped +7 -0
    Added test for bug #13407 "Remote connecting crashes server".

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	dlenev
# Host:	brandersnatch.localdomain
# Root:	/home/dlenev/src/mysql-5.0-bg13407

--- 1.254/sql/item_strfunc.cc	2005-09-20 22:24:21 +04:00
+++ 1.255/sql/item_strfunc.cc	2005-09-22 23:03:48 +04:00
@@ -1608,7 +1608,7 @@
   else
   {
     user= thd->main_security_ctx.user;
-    host= thd->main_security_ctx.host;
+    host= thd->main_security_ctx.host_or_ip;
   }
 
   // For system threads (e.g. replication SQL thread) user may be empty

--- 1.500/sql/mysqld.cc	2005-09-21 19:42:26 +04:00
+++ 1.501/sql/mysqld.cc	2005-09-22 23:03:48 +04:00
@@ -4208,7 +4208,7 @@
       errmsg= 0;
       goto errorconn;
     }
-    thd->host= my_strdup(my_localhost,MYF(0)); /* Host is unknown */
+    thd->security_ctx->host= my_strdup(my_localhost, MYF(0)); /* Host is unknown */
     create_new_thread(thd);
     connect_number++;
     continue;

--- 1.284/sql/sql_show.cc	2005-09-20 22:24:21 +04:00
+++ 1.285/sql/sql_show.cc	2005-09-22 23:03:48 +04:00
@@ -1205,7 +1205,7 @@
 			"%s:%u", tmp_sctx->host_or_ip, tmp->peer_port);
 	}
 	else
-	  thd_info->host= thd->strdup(tmp_sctx->host);
+	  thd_info->host= thd->strdup(tmp_sctx->host_or_ip);
         if ((thd_info->db=tmp->db))             // Safe test
           thd_info->db=thd->strdup(thd_info->db);
         thd_info->command=(int) tmp->command;

--- 1.1/mysql-test/r/skip_name_resolve.result	2005-02-15 07:32:41 +03:00
+++ 1.2/mysql-test/r/skip_name_resolve.result	2005-09-22 23:03:48 +04:00
@@ -5,3 +5,10 @@
 GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
 REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
 DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
+select user();
+user()
+#
+show processlist;
+Id	User	Host	db	Command	Time	State	Info
+#	root	#	test	Sleep	#		NULL
+#	root	#	test	Query	#	NULL	show processlist

--- 1.3/mysql-test/t/skip_name_resolve.test	2005-07-28 04:21:49 +04:00
+++ 1.4/mysql-test/t/skip_name_resolve.test	2005-09-22 23:03:48 +04:00
@@ -8,3 +8,13 @@
 DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
 
 # End of 4.1 tests
+
+# Bug #13407 "Remote connecting crashes server".
+# Server crashed when one used USER() function in connection for which
+# was impossible to obtain peer hostname.
+connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
+--replace_column 1 #
+select user();
+--replace_column 1 # 6 # 3 #
+show processlist;
+connection default;
Thread
bk commit into 5.0 tree (dlenev:1.1998) BUG#13407dlenev22 Sep