fixed a Bug #4998 "--protocol doesn't reject bad values"
This commit is contained in:
parent
f0fffbe21b
commit
237615bc53
@ -753,8 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
opt_nopager= 1;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) ==
|
||||
~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -249,7 +249,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -633,8 +633,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) ==
|
||||
~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -271,7 +271,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
case 'V': print_version(); exit(0);
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -582,8 +582,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
}
|
||||
case (int) OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib, 0))
|
||||
== ~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -203,7 +203,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
#endif
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
@ -268,7 +268,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
{
|
||||
if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0)
|
||||
if (!(opt_protocol= find_type(argument, &sql_protocol_typelib,0)))
|
||||
{
|
||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||
exit(1);
|
||||
|
9
mysql-test/r/mysql_protocols.result
Normal file
9
mysql-test/r/mysql_protocols.result
Normal file
@ -0,0 +1,9 @@
|
||||
<default>
|
||||
ok
|
||||
TCP
|
||||
ok
|
||||
SOCKET
|
||||
ok
|
||||
ERROR 2047: Wrong or unknown protocol
|
||||
ERROR 2047: Wrong or unknown protocol
|
||||
Unknown option to protocol: NullS
|
10
mysql-test/t/mysql_protocols.test
Normal file
10
mysql-test/t/mysql_protocols.test
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
# test for Bug #4998 "--protocol doesn't reject bad values"
|
||||
|
||||
--exec echo "select ' ok' as '<default>'" | $MYSQL
|
||||
--exec echo "select ' ok' as 'TCP'" | $MYSQL --protocol=TCP
|
||||
--exec echo "select ' ok' as 'SOCKET'" | $MYSQL --protocol=SOCKET
|
||||
--exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1
|
||||
--exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1
|
||||
--exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1
|
||||
|
Loading…
x
Reference in New Issue
Block a user