You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Follow up of fix for CONC-680:
mysql_old_password is disabled by default (setting DISABLED YES), but can be used if the plugin was added to the list of restricted authentication plugins (via mysql_optionsv using option MARIADB_OPT_RESTRICTED_AUTH).
This commit is contained in:
@@ -547,6 +547,7 @@ ENDIF()
|
|||||||
MESSAGE1(STATUS "MariaDB Connector/c configuration:
|
MESSAGE1(STATUS "MariaDB Connector/c configuration:
|
||||||
-- Static PLUGINS ${PLUGINS_STATIC}
|
-- Static PLUGINS ${PLUGINS_STATIC}
|
||||||
-- Dynamic PLUGINS ${PLUGINS_DYNAMIC}
|
-- Dynamic PLUGINS ${PLUGINS_DYNAMIC}
|
||||||
|
-- Disabled PLUGINS ${PLUGINS_DISABLED}
|
||||||
-- CPack generation: ${CPACK_GENERATOR}
|
-- CPack generation: ${CPACK_GENERATOR}
|
||||||
-- SSL support: ${WITH_SSL} Libs: ${SSL_LIBRARIES}
|
-- SSL support: ${WITH_SSL} Libs: ${SSL_LIBRARIES}
|
||||||
-- Zlib support: ${zlib_status}
|
-- Zlib support: ${zlib_status}
|
||||||
|
@@ -12,7 +12,7 @@ include(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
|||||||
|
|
||||||
FUNCTION(REGISTER_PLUGIN)
|
FUNCTION(REGISTER_PLUGIN)
|
||||||
|
|
||||||
SET(one_value_keywords TARGET DEFAULT TYPE)
|
SET(one_value_keywords TARGET DISABLED TYPE DEFAULT)
|
||||||
SET(multi_value_keywords CONFIGURATIONS SOURCES LIBRARIES INCLUDES COMPILE_OPTIONS)
|
SET(multi_value_keywords CONFIGURATIONS SOURCES LIBRARIES INCLUDES COMPILE_OPTIONS)
|
||||||
|
|
||||||
cmake_parse_arguments(CC_PLUGIN
|
cmake_parse_arguments(CC_PLUGIN
|
||||||
@@ -43,6 +43,12 @@ FUNCTION(REGISTER_PLUGIN)
|
|||||||
message(FATAL_ERROR "Invalid plugin type ${CC_PLUGIN_DEFAULT}. Allowed plugin types are ${CC_PLUGIN_CONFIGURATIONS}")
|
message(FATAL_ERROR "Invalid plugin type ${CC_PLUGIN_DEFAULT}. Allowed plugin types are ${CC_PLUGIN_CONFIGURATIONS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# check if plugin is disabled
|
||||||
|
string(TOUPPER "${CC_PLUGIN_DISABLED}" CC_PLUGIN_DISABLED)
|
||||||
|
if("${CC_PLUGIN_DISABLED}" STREQUAL "YES")
|
||||||
|
set(PLUGINS_DISABLED ${PLUGINS_DISABLED} ${CC_PLUGIN_TARGET} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ${CC_PLUGIN_DEFAULT} STREQUAL "OFF")
|
if(NOT ${CC_PLUGIN_DEFAULT} STREQUAL "OFF")
|
||||||
set(PLUGIN_${CC_PLUGIN_TARGET}_TYPE ${CC_PLUGIN_TYPE})
|
set(PLUGIN_${CC_PLUGIN_TARGET}_TYPE ${CC_PLUGIN_TYPE})
|
||||||
|
|
||||||
|
@@ -46,6 +46,8 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *disabled_plugins= "@PLUGINS_DISABLED@";
|
||||||
|
|
||||||
struct st_client_plugin_int {
|
struct st_client_plugin_int {
|
||||||
struct st_client_plugin_int *next;
|
struct st_client_plugin_int *next;
|
||||||
void *dlhandle;
|
void *dlhandle;
|
||||||
|
@@ -130,7 +130,8 @@ ENDIF()
|
|||||||
REGISTER_PLUGIN(TARGET mysql_old_password
|
REGISTER_PLUGIN(TARGET mysql_old_password
|
||||||
TYPE MARIADB_CLIENT_PLUGIN_AUTH
|
TYPE MARIADB_CLIENT_PLUGIN_AUTH
|
||||||
CONFIGURATIONS STATIC DYNAMIC OFF
|
CONFIGURATIONS STATIC DYNAMIC OFF
|
||||||
DEFAULT OFF
|
DEFAULT STATIC
|
||||||
|
DISABLED YES
|
||||||
SOURCES ${AUTH_DIR}/old_password.c)
|
SOURCES ${AUTH_DIR}/old_password.c)
|
||||||
|
|
||||||
# Cleartext
|
# Cleartext
|
||||||
|
@@ -15,6 +15,7 @@ extern void read_user_name(char *name);
|
|||||||
extern char *ma_send_connect_attr(MYSQL *mysql, unsigned char *buffer);
|
extern char *ma_send_connect_attr(MYSQL *mysql, unsigned char *buffer);
|
||||||
extern int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length);
|
extern int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length);
|
||||||
extern unsigned char *mysql_net_store_length(unsigned char *packet, ulonglong length);
|
extern unsigned char *mysql_net_store_length(unsigned char *packet, ulonglong length);
|
||||||
|
extern const char *disabled_plugins;
|
||||||
|
|
||||||
#define hashing(p) (p->interface_version >= 0x0101 && p->hash_password_bin)
|
#define hashing(p) (p->interface_version >= 0x0101 && p->hash_password_bin)
|
||||||
|
|
||||||
@@ -696,11 +697,11 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
|
|||||||
retry:
|
retry:
|
||||||
mpvio.plugin= auth_plugin;
|
mpvio.plugin= auth_plugin;
|
||||||
|
|
||||||
if (auth_plugin_name &&
|
if (auth_plugin_name)
|
||||||
mysql->options.extension &&
|
|
||||||
mysql->options.extension->restricted_auth)
|
|
||||||
{
|
{
|
||||||
if (!strstr(mysql->options.extension->restricted_auth, auth_plugin_name))
|
if ((mysql->options.extension && mysql->options.extension->restricted_auth)
|
||||||
|
? !strstr(mysql->options.extension->restricted_auth, auth_plugin_name)
|
||||||
|
: strstr(disabled_plugins, auth_plugin_name) != NULL)
|
||||||
{
|
{
|
||||||
my_set_error(mysql, CR_PLUGIN_NOT_ALLOWED, SQLSTATE_UNKNOWN, 0, data_plugin);
|
my_set_error(mysql, CR_PLUGIN_NOT_ALLOWED, SQLSTATE_UNKNOWN, 0, data_plugin);
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -688,6 +688,7 @@ void run_tests(struct my_tests_st *test) {
|
|||||||
|
|
||||||
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0))
|
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0))
|
||||||
{
|
{
|
||||||
|
diag("Error: %s", mysql_error(mysql));
|
||||||
BAIL_OUT("Can't establish TLS connection to server.");
|
BAIL_OUT("Can't establish TLS connection to server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user