Commit 3c5e4bd9 authored by unknown's avatar unknown

more accurate processing of find_type result

(Bug #4998 --protocol doesn't reject bad values)


client/mysql.cc:
  more accurate processing of find_type result
client/mysqladmin.c:
  more accurate processing of find_type result
client/mysqlbinlog.cc:
  more accurate processing of find_type result
client/mysqlcheck.c:
  more accurate processing of find_type result
client/mysqldump.c:
  more accurate processing of find_type result
client/mysqlimport.c:
  more accurate processing of find_type result
client/mysqlshow.c:
  more accurate processing of find_type result
sql-common/client.c:
  more accurate processing of find_type result
parent 78088d91
...@@ -753,7 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -753,7 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1; opt_nopager= 1;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -249,7 +249,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -249,7 +249,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -633,7 +633,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -633,7 +633,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -582,7 +582,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -582,7 +582,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
case (int) OPT_MYSQL_PROTOCOL: case (int) OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -203,7 +203,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -203,7 +203,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif #endif
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -268,7 +268,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -268,7 +268,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0))) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", argument); fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1); exit(1);
......
...@@ -1057,9 +1057,8 @@ void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1057,9 +1057,8 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->max_allowed_packet= atoi(opt_arg); options->max_allowed_packet= atoi(opt_arg);
break; break;
case 28: /* protocol */ case 28: /* protocol */
if ((options->protocol = find_type(opt_arg, if ((options->protocol= find_type(opt_arg,
&sql_protocol_typelib,0)) &sql_protocol_typelib,0)) <= 0)
== ~(ulong) 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
exit(1); exit(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment