List:Commits« Previous MessageNext Message »
From:gluh Date:April 23 2008 12:25pm
Subject:bk commit into 5.0 tree (gluh:1.2611) BUG#35924
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh.  When gluh 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@stripped, 2008-04-23 15:25:07+05:00, gluh@stripped +5 -0
  Bug#35924 DEFINER should be stored 'quoted' in I_S
  The '@' symbol can not be used in the host name according to rfc952.
  The fix:
  added function check_host_name(LEX_STRING *str)
  which checks that all symbols in host name string are valid and
  host name length is not more than max host name length
  (just moved check_string_length() function from the parser into check_host_name()).

  mysql-test/r/create.result@stripped, 2008-04-23 15:25:05+05:00, gluh@stripped +2 -0
    test result

  mysql-test/t/create.test@stripped, 2008-04-23 15:25:05+05:00, gluh@stripped +5 -0
    test case

  sql/mysql_priv.h@stripped, 2008-04-23 15:25:05+05:00, gluh@stripped +1 -0
    added function check_host_name(LEX_STRING *str)

  sql/sql_parse.cc@stripped, 2008-04-23 15:25:06+05:00, gluh@stripped +32 -0
    added function check_host_name(LEX_STRING *str)
    which checks that all symbols in host name string are valid and
    host name length is not more than max host name length(HOSTNAME_LENGTH).

  sql/sql_yacc.yy@stripped, 2008-04-23 15:25:06+05:00, gluh@stripped +1 -2
    using newly added function check_host_name()

diff -Nrup a/mysql-test/r/create.result b/mysql-test/r/create.result
--- a/mysql-test/r/create.result	2008-02-01 12:00:39 +04:00
+++ b/mysql-test/r/create.result	2008-04-23 15:25:05 +05:00
@@ -1546,4 +1546,6 @@ SHOW INDEX FROM t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t1	1	c1	1	c1	A	NULL	NULL	NULL	YES	BTREE	
 DROP TABLE t1;
+create user mysqltest_1@'test@test';
+ERROR HY000: Malformed hostname (illegal symbol: '@')
 End of 5.0 tests
diff -Nrup a/mysql-test/t/create.test b/mysql-test/t/create.test
--- a/mysql-test/t/create.test	2008-02-01 12:00:39 +04:00
+++ b/mysql-test/t/create.test	2008-04-23 15:25:05 +05:00
@@ -1171,5 +1171,10 @@ CREATE TABLE t1(c1 VARCHAR(33), KEY USIN
 SHOW INDEX FROM t1;
 DROP TABLE t1;
 
+#
+# Bug#35924 DEFINER should be stored 'quoted' in I_S
+#
+--error ER_UNKNOWN_ERROR
+create user mysqltest_1@'test@test';
 
 --echo End of 5.0 tests
diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
--- a/sql/mysql_priv.h	2008-03-28 15:31:49 +04:00
+++ b/sql/mysql_priv.h	2008-04-23 15:25:05 +05:00
@@ -614,6 +614,7 @@ LEX_USER *create_definer(THD *thd, LEX_S
 LEX_USER *get_current_user(THD *thd, LEX_USER *user);
 bool check_string_length(LEX_STRING *str,
                          const char *err_msg, uint max_length);
+bool check_host_name(LEX_STRING *str);
 
 enum enum_mysql_completiontype {
   ROLLBACK_RELEASE=-2, ROLLBACK=1,  ROLLBACK_AND_CHAIN=7,
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2008-03-21 19:23:14 +04:00
+++ b/sql/sql_parse.cc	2008-04-23 15:25:06 +05:00
@@ -7943,3 +7943,35 @@ static bool test_if_data_home_dir(const 
   DBUG_RETURN(0);
 }
 
+
+/**
+  Check that host name string is valid.
+
+  @param[in] str string to be checked
+
+  @return             Operation status
+    @retval  FALSE    host name is ok
+    @retval  TRUE     host name string is longer than max_length or
+                      has invalid symbols
+*/
+
+bool check_host_name(LEX_STRING *str)
+{
+  const char *name= str->str;
+  const char *end= str->str + str->length;
+  if (check_string_length(str, ER(ER_HOSTNAME), HOSTNAME_LENGTH))
+    return TRUE;
+
+  while (name != end)
+  {
+    if (*name == '@')
+    {
+      my_printf_error(ER_UNKNOWN_ERROR, 
+                      "Malformed hostname (illegal symbol: '%c')", MYF(0),
+                      *name);
+      return TRUE;
+    }
+    name++;
+  }
+  return FALSE;
+}
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2008-03-15 21:51:30 +04:00
+++ b/sql/sql_yacc.yy	2008-04-23 15:25:06 +05:00
@@ -8198,8 +8198,7 @@ user:
 
 	    if (check_string_length(&$$->user,
                                     ER(ER_USERNAME), USERNAME_LENGTH) ||
-	        check_string_length(&$$->host,
-                                    ER(ER_HOSTNAME), HOSTNAME_LENGTH))
+                check_host_name(&$$->host))
 	      MYSQL_YYABORT;
 	  }
 	| CURRENT_USER optional_braces
Thread
bk commit into 5.0 tree (gluh:1.2611) BUG#35924gluh23 Apr