Skip to content

Commit 6cd4175

Browse files
author
georg@skysql.com
committed
Fix for CONC-104: mysql_options doesn't support MYSQL_SECURE_AUTH option
1 parent fc58591 commit 6cd4175

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

include/errmsg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ extern const char *client_errors[]; /* Error messages */
6666
#define CR_PARAMS_NOT_BOUND 2031
6767
#define CR_INVALID_PARAMETER_NO 2034
6868
#define CR_UNSUPPORTED_PARAM_TYPE 2036
69+
#define CR_SECURE_AUTH 2049
6970
#define CR_NO_DATA 2051
7071
#define CR_NO_STMT_METADATA 2052
7172
#define CR_NOT_IMPLEMENTED 2054

libmariadb/errmsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const char *client_errors[]=
129129
/* 2046 */ "",
130130
/* 2047 */ "",
131131
/* 2048 */ "",
132-
/* 2049 */ "",
132+
/* 2049 */ "Connection with old authentication protocol refused.",
133133
/* 2050 */ "",
134134
/* 2051 */ "",
135135
/* 2052 */ "Prepared statement contains no metadata",

libmariadb/libmariadb.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,15 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
18661866
scramble_plugin= native_password_plugin_name;
18671867
}
18681868
} else
1869+
{
18691870
mysql->server_capabilities&= ~CLIENT_SECURE_CONNECTION;
1871+
if (mysql->options.secure_auth)
1872+
{
1873+
SET_CLIENT_ERROR(mysql, CR_SECURE_AUTH, unknown_sqlstate, 0);
1874+
goto error;
1875+
}
1876+
}
1877+
18701878

18711879
/* Set character set */
18721880
if (mysql->options.charset_name)
@@ -3076,7 +3084,9 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
30763084
}
30773085
}
30783086
break;
3079-
3087+
case MYSQL_SECURE_AUTH:
3088+
mysql->options.secure_auth= *(my_bool *)arg1;
3089+
break;
30803090
default:
30813091
va_end(ap);
30823092
DBUG_RETURN(-1);

0 commit comments

Comments
 (0)