diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2008-10-02 16:57:52 +0500 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2008-10-02 16:57:52 +0500 |
commit | d51e2c0760f5dca2aff03aa16b77bf70e0b06dbc (patch) | |
tree | 080bb32fe11caa26d06b5fd11bdf84560d383d59 /sql/sql_parse.cc | |
parent | 7e60f71001595df62b92a089869dd67fcc15a1ee (diff) | |
download | mariadb-git-d51e2c0760f5dca2aff03aa16b77bf70e0b06dbc.tar.gz |
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:
test result
mysql-test/t/create.test:
test case
sql/mysql_priv.h:
added function check_host_name(LEX_STRING *str)
sql/sql_parse.cc:
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:
using newly added function check_host_name()
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 83b111b7c4c..713aca9de47 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7982,3 +7982,35 @@ int test_if_data_home_dir(const char *dir) C_MODE_END + +/** + 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; +} |