You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Reworked plugin interface
Plugin configuration happens now in CMakeLists.txt files in corresponding plugin directories. plugins.cmake now contains REGISTER_PLUGIN_FUNCTION which accepts the following parameters: - TARGET: the name of the plugin (dynamic plugins will be named ${TARGET}.so (or .dll) - SOURCES: source files - LIBRARIES: additional libraries for linking - INCLUDES: include directories - CONFIGURATIONS: possible plugin configurations: valid arguments are DYNAMIC, STATIC, OFF - DEFAULT: default configuration (see CONFIGURATIONS) - COMPILE_OPTIONS: compiler flags The default plugin configuration can be specified via cmake parameter -DCLIENT_PLUGIN_${TARGET}=[DYNAMIC|STATIC|OFF]
This commit is contained in:
@@ -68,13 +68,6 @@ ADD_OPTION(WITH_SSL "Enables use of TLS/SSL library" ON)
|
|||||||
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/misc.cmake)
|
INCLUDE(${CC_SOURCE_DIR}/cmake/misc.cmake)
|
||||||
|
|
||||||
IF (WITH_CURL)
|
|
||||||
INCLUDE(FindCURL)
|
|
||||||
IF(CURL_FOUND)
|
|
||||||
ADD_DEFINITIONS(-DHAVE_CURL=1)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(WITH_SIGNCODE)
|
IF(WITH_SIGNCODE)
|
||||||
IF(WIN32 AND NOT SIGN_OPTIONS)
|
IF(WIN32 AND NOT SIGN_OPTIONS)
|
||||||
SET(SIGN_OPTIONS /a /t http://timestamp.verisign.com/scripts/timstamp.dll)
|
SET(SIGN_OPTIONS /a /t http://timestamp.verisign.com/scripts/timstamp.dll)
|
||||||
@@ -313,7 +306,8 @@ IF(NOT WITH_SSL STREQUAL "OFF")
|
|||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
IF(WITH_SSL STREQUAL "SCHANNEL")
|
IF(WITH_SSL STREQUAL "SCHANNEL")
|
||||||
ADD_DEFINITIONS(-DHAVE_SCHANNEL -DHAVE_TLS)
|
ADD_DEFINITIONS(-DHAVE_SCHANNEL -DHAVE_TLS)
|
||||||
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/schannel.c" "${CC_SOURCE_DIR}/libmariadb/secure/ma_schannel.c")
|
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/schannel.c"
|
||||||
|
"${CC_SOURCE_DIR}/libmariadb/secure/ma_schannel.c")
|
||||||
INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
|
INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
|
||||||
SET(SSL_LIBRARIES secur32)
|
SET(SSL_LIBRARIES secur32)
|
||||||
SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
|
SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
|
||||||
@@ -371,9 +365,9 @@ IF(NOT WIN32)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
INCLUDE(${CMAKE_SOURCE_DIR}/plugins/CMakeLists.txt)
|
||||||
ADD_SUBDIRECTORY(include)
|
ADD_SUBDIRECTORY(include)
|
||||||
ADD_SUBDIRECTORY(libmariadb)
|
ADD_SUBDIRECTORY(libmariadb)
|
||||||
ADD_SUBDIRECTORY(plugins)
|
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
ADD_SUBDIRECTORY(mariadb_config)
|
ADD_SUBDIRECTORY(mariadb_config)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -475,6 +469,8 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
MESSAGE1(STATUS "MariaDB Connector/c configuration:
|
MESSAGE1(STATUS "MariaDB Connector/c configuration:
|
||||||
|
-- Static PLUGINS ${PLUGINS_STATIC}
|
||||||
|
-- Dynamic PLUGINS ${PLUGINS_DYNAMIC}
|
||||||
-- 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}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2013-2016 MariaDB Corporation AB
|
# Copyright (C) 2013-2018 MariaDB Corporation AB
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the New
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
# BSD license.
|
# BSD license.
|
||||||
@@ -7,102 +7,85 @@
|
|||||||
#
|
#
|
||||||
# plugin configuration
|
# plugin configuration
|
||||||
|
|
||||||
MACRO(REGISTER_PLUGIN name source struct type target allow)
|
include(${CC_SOURCE_DIR}/cmake/install_plugins.cmake)
|
||||||
SET(PLUGIN_TYPE ${${name}})
|
include(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
||||||
IF(NOT PLUGIN_TYPE STREQUAL "OFF" AND NOT PLUGIN_TYPE)
|
|
||||||
SET(PLUGIN_TYPE ${type})
|
|
||||||
ENDIF()
|
|
||||||
IF(PLUGINS)
|
|
||||||
LIST(REMOVE_ITEM PLUGINS ${name})
|
|
||||||
ENDIF()
|
|
||||||
SET(${name}_PLUGIN_SOURCE ${source})
|
|
||||||
MARK_AS_ADVANCED(${name}_PLUGIN_SOURCE})
|
|
||||||
SET(${name}_PLUGIN_TYPE ${PLUGIN_TYPE})
|
|
||||||
IF(NOT ${target} STREQUAL "")
|
|
||||||
SET(${name}_PLUGIN_TARGET ${target})
|
|
||||||
ENDIF()
|
|
||||||
SET(${name}_PLUGIN_STRUCT ${struct})
|
|
||||||
SET(${name}_PLUGIN_SOURCE ${source})
|
|
||||||
SET(${name}_PLUGIN_CHG ${allow})
|
|
||||||
SET(PLUGINS ${PLUGINS} "${name}")
|
|
||||||
ADD_DEFINITIONS(-DHAVE_${name}=1)
|
|
||||||
ENDMACRO()
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(PLUGINS)
|
FUNCTION(REGISTER_PLUGIN)
|
||||||
|
|
||||||
# CIO
|
SET(one_value_keywords TARGET DEFAULT TYPE)
|
||||||
REGISTER_PLUGIN("SOCKET" "${CC_SOURCE_DIR}/plugins/pvio/pvio_socket.c" "pvio_socket_plugin" "STATIC" pvio_socket 0)
|
SET(multi_value_keywords CONFIGURATIONS SOURCES LIBRARIES INCLUDES COMPILE_OPTIONS)
|
||||||
IF(WIN32)
|
|
||||||
REGISTER_PLUGIN("NPIPE" "${CC_SOURCE_DIR}/plugins/pvio/pvio_npipe.c" "pvio_npipe_plugin" "STATIC" pvio_npipe 1)
|
|
||||||
REGISTER_PLUGIN("SHMEM" "${CC_SOURCE_DIR}/plugins/pvio/pvio_shmem.c" "pvio_shmem_plugin" "STATIC" pvio_shmem 1)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# AUTHENTICATION
|
cmake_parse_arguments(CC_PLUGIN
|
||||||
IF(WIN32 OR WITH_SSL STREQUAL "OPENSSL")
|
"${options}"
|
||||||
REGISTER_PLUGIN("AUTH_SHA256PW" "${CC_SOURCE_DIR}/plugins/auth/sha256_pw.c" "sha256_password_client_plugin" "DYNAMIC" sha256_password 1)
|
"${one_value_keywords}"
|
||||||
ENDIF()
|
"${multi_value_keywords}"
|
||||||
REGISTER_PLUGIN("AUTH_NATIVE" "${CC_SOURCE_DIR}/plugins/auth/my_auth.c" "native_password_client_plugin" "STATIC" "" 0)
|
${ARGN})
|
||||||
REGISTER_PLUGIN("AUTH_OLDPASSWORD" "${CC_SOURCE_DIR}/plugins/auth/old_password.c" "old_password_client_plugin" "STATIC" "" 1)
|
|
||||||
SET(DIALOG_SOURCES ${CC_SOURCE_DIR}/plugins/auth/dialog.c ${CC_SOURCE_DIR}/libmariadb/get_password.c)
|
|
||||||
REGISTER_PLUGIN("AUTH_DIALOG" "${DIALOG_SOURCES}" "auth_dialog_plugin" "DYNAMIC" dialog 1)
|
|
||||||
REGISTER_PLUGIN("AUTH_CLEARTEXT" "${CC_SOURCE_DIR}/plugins/auth/mariadb_clear_text.c" "auth_cleartext_plugin" "DYNAMIC" "mysql_clear_password" 1)
|
|
||||||
IF(WIN32)
|
|
||||||
SET(GSSAPI_SOURCES ${CC_SOURCE_DIR}/plugins/auth/auth_gssapi_client.c ${CC_SOURCE_DIR}/plugins/auth/sspi_client.c ${CC_SOURCE_DIR}/plugins/auth/sspi_errmsg.c)
|
|
||||||
REGISTER_PLUGIN("AUTH_GSSAPI" "${GSSAPI_SOURCES}" "auth_gssapi_plugin" "DYNAMIC" "auth_gssapi_client" 1)
|
|
||||||
ELSE()
|
|
||||||
IF(GSSAPI_FOUND)
|
|
||||||
SET(GSSAPI_SOURCES ${CC_SOURCE_DIR}/plugins/auth/auth_gssapi_client.c ${CC_SOURCE_DIR}/plugins/auth/gssapi_client.c ${CC_SOURCE_DIR}/plugins/auth/gssapi_errmsg.c)
|
|
||||||
REGISTER_PLUGIN("AUTH_GSSAPI" "${GSSAPI_SOURCES}" "auth_gssapi_plugin" "DYNAMIC" "auth_gssapi_client" 1)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#Remote_IO
|
# overwrite default if it was specified with cmake option
|
||||||
IF(CURL_FOUND)
|
string(TOUPPER ${CC_PLUGIN_TARGET} cc_plugin)
|
||||||
IF(WIN32)
|
if(NOT "${CLIENT_PLUGIN_${cc_plugin}}" STREQUAL "")
|
||||||
REGISTER_PLUGIN("REMOTEIO" "${CC_SOURCE_DIR}/plugins/io/remote_io.c" "remote_io_plugin" "DYNAMIC" "remote_io" 1)
|
SET(CC_PLUGIN_DEFAULT ${CLIENT_PLUGIN_${cc_plugin}})
|
||||||
ELSE()
|
endif()
|
||||||
REGISTER_PLUGIN("REMOTEIO" "${CC_SOURCE_DIR}/plugins/io/remote_io.c" "remote_io_plugin" "DYNAMIC" "remote_io" 1)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#Trace
|
# use uppercase
|
||||||
REGISTER_PLUGIN("TRACE_EXAMPLE" "${CC_SOURCE_DIR}/plugins/trace/trace_example.c" "trace_example_plugin" "OFF" "trace_example" 1)
|
string(TOUPPER ${CC_PLUGIN_TARGET} target_name)
|
||||||
|
string(TOUPPER "${CC_PLUGIN_CONFIGURATIONS}" CC_PLUGIN_CONFIGURATIONS)
|
||||||
|
|
||||||
#Connection
|
if(NOT ${PLUGIN_${target_name}} STREQUAL "")
|
||||||
REGISTER_PLUGIN("REPLICATION" "${CC_SOURCE_DIR}/plugins/connection/replication.c" "connection_replication_plugin" "OFF" "replication" 1)
|
string(TOUPPER ${PLUGIN_${target_name}} PLUGIN_${target_name})
|
||||||
REGISTER_PLUGIN("AURORA" "${CC_SOURCE_DIR}/plugins/connection/aurora.c" "connection_aurora_plugin" "OFF" "aurora" 1)
|
set(CC_PLUGIN_DEFAULT ${PLUGIN_${target_name}})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Allow registration of additional plugins
|
# check if default value is valid
|
||||||
IF(PLUGIN_CONF_FILE)
|
string(TOUPPER ${CC_PLUGIN_DEFAULT} CC_PLUGIN_DEFAULT)
|
||||||
INCLUDE(${PLUGIN_CONF_FILE})
|
list(FIND CC_PLUGIN_CONFIGURATIONS ${CC_PLUGIN_DEFAULT} configuration_found)
|
||||||
ENDIF()
|
if(${configuration_found} EQUAL -1)
|
||||||
|
message(FATAL_ERROR "Invalid plugin type ${CC_PLUGIN_DEFAULT}. Allowed plugin types are ${CC_PLUGIN_CONFIGURATIONS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${CC_PLUGIN_DEFAULT} STREQUAL "OFF")
|
||||||
|
set(PLUGIN_${CC_PLUGIN_TARGET}_TYPE ${CC_PLUGIN_TYPE})
|
||||||
|
|
||||||
SET(LIBMARIADB_SOURCES "")
|
if(${CC_PLUGIN_DEFAULT} STREQUAL "DYNAMIC")
|
||||||
|
set_source_files_properties(${CC_PLUGIN_SOURCES}
|
||||||
|
PROPERTIES COMPILE_FLAGS
|
||||||
|
"-DPLUGIN_DYNAMIC=1 ${CC_PLUGIN_COMPILE_OPTIONS}")
|
||||||
|
set(PLUGINS_DYNAMIC ${PLUGINS_DYNAMIC} ${CC_PLUGIN_TARGET} PARENT_SCOPE)
|
||||||
|
if(WIN32)
|
||||||
|
set(target ${CC_PLUGIN_TARGET})
|
||||||
|
set(FILE_TYPE "VFT_DLL")
|
||||||
|
set(FILE_DESCRIPTION "MariaDB client plugin")
|
||||||
|
set(FILE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||||
|
set(ORIGINAL_FILE_NAME "${target}.dll")
|
||||||
|
configure_file(${CC_SOURCE_DIR}/win/resource.rc.in
|
||||||
|
${CC_BINARY_DIR}/win/${target}.rc
|
||||||
|
@ONLY)
|
||||||
|
set(CC_PLUGIN_SOURCES ${CC_PLUGIN_SOURCES} ${CC_BINARY_DIR}/win/${target}.rc ${CC_SOURCE_DIR}/plugins/plugin.def)
|
||||||
|
MESSAGE(STATUS "PLugin sources: ${CC_PLUGIN_SOURCES}")
|
||||||
|
endif()
|
||||||
|
add_library(${CC_PLUGIN_TARGET} MODULE ${CC_PLUGIN_SOURCES})
|
||||||
|
target_link_libraries(${CC_PLUGIN_TARGET} ${CC_PLUGIN_LIBRARIES})
|
||||||
|
set_target_properties(${CC_PLUGIN_TARGET} PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(${CC_PLUGIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CC_BINARY_DIR}/plugins/lib")
|
||||||
|
if (NOT "${CC_PLUGIN_INCLUDES}" STREQUAL "")
|
||||||
|
target_include_directories(${CC_PLUGIN_TARGET} PRIVATE ${CC_PLUGIN_INCLUDES})
|
||||||
|
endif()
|
||||||
|
if (${CC_TARGET_COMPILE_OPTIONS})
|
||||||
|
target_compile_options(${CC_PLUGIN_TARGET} ${CC_TARGET_COMPILE_OPTIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
FOREACH(PLUGIN ${PLUGINS})
|
if(WIN32)
|
||||||
IF(${OPT}WITH_${PLUGIN}_PLUGIN AND ${${PLUGIN}_PLUGIN_CHG} GREATER 0)
|
SIGN_TARGET(${target})
|
||||||
SET(${PLUGIN}_PLUGIN_TYPE ${${OPT}WITH_${PLUGIN}_PLUGIN})
|
endif()
|
||||||
ENDIF()
|
INSTALL_PLUGIN(${CC_PLUGIN_TARGET} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
IF(${PLUGIN}_PLUGIN_TYPE MATCHES "STATIC")
|
elseif(${CC_PLUGIN_DEFAULT} STREQUAL "STATIC")
|
||||||
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${${PLUGIN}_PLUGIN_SOURCE})
|
set(PLUGINS_STATIC ${PLUGINS_STATIC} ${CC_PLUGIN_TARGET} PARENT_SCOPE)
|
||||||
SET(EXTERNAL_PLUGINS "${EXTERNAL_PLUGINS}extern struct st_mysql_client_plugin ${${PLUGIN}_PLUGIN_STRUCT};\n")
|
set(LIBMARIADB_PLUGIN_CFLAGS ${LIBMARIADB_PLUGIN_CFLAGS} ${CC_PLUGIN_COMPILE_OPTIONS} PARENT_SCOPE)
|
||||||
SET(BUILTIN_PLUGINS "${BUILTIN_PLUGINS}(struct st_mysql_client_plugin *)&${${PLUGIN}_PLUGIN_STRUCT},\n")
|
set(LIBMARIADB_PLUGIN_INCLUDES ${LIBMARIADB_PLUGIN_INCLUDES} ${CC_PLUGIN_INCLUDES} PARENT_SCOPE)
|
||||||
ENDIF()
|
set(LIBMARIADB_PLUGIN_SOURCES ${LIBMARIADB_PLUGIN_SOURCES} ${CC_PLUGIN_SOURCES} PARENT_SCOPE)
|
||||||
SET(plugin_config "${plugin_config}\n-- ${PLUGIN}: ${${PLUGIN}_PLUGIN_TYPE}")
|
set(LIBMARIADB_PLUGIN_LIBS ${LIBMARIADB_PLUGIN_LIBS} ${CC_PLUGIN_LIBRARIES} PARENT_SCOPE)
|
||||||
MARK_AS_ADVANCED(${PLUGIN}_PLUGIN_TYPE)
|
endif()
|
||||||
ENDFOREACH()
|
else()
|
||||||
MESSAGE1(plugin_config "Plugin configuration:${plugin_config}")
|
set(PLUGINS_OFF ${PLUGINS_OFF} ${CC_PLUGIN_TARGET})
|
||||||
MESSAGE1(LIBMARIADB_SOURCES "STATIC PLUGIN SOURCES: ${LIBMARIADB_SOURCES}")
|
endif()
|
||||||
|
endfunction()
|
||||||
IF(NOT REMOTEIO_PLUGIN_TYPE MATCHES "NO")
|
|
||||||
FIND_PACKAGE(CURL)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# since some files contain multiple plugins, remove duplicates from source files
|
|
||||||
LIST(REMOVE_DUPLICATES LIBMARIADB_SOURCES)
|
|
||||||
|
|
||||||
CONFIGURE_FILE(${CC_SOURCE_DIR}/libmariadb/ma_client_plugin.c.in
|
|
||||||
${CC_BINARY_DIR}/libmariadb/ma_client_plugin.c)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(LIBMARIADB_SOURCES)
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#define _ma_io_h_
|
#define _ma_io_h_
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_REMOTEIO
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ enum enum_file_type {
|
|||||||
MA_FILE_REMOTE=2
|
MA_FILE_REMOTE=2
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
enum enum_file_type type;
|
enum enum_file_type type;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
/* Connector/C specific plugin types */
|
/* Connector/C specific plugin types */
|
||||||
#define MARIADB_CLIENT_REMOTEIO_PLUGIN 100 /* communication IO */
|
#define MARIADB_CLIENT_REMOTEIO_PLUGIN 100 /* communication IO */
|
||||||
#define MARIADB_CLIENT_PVIO_PLUGIN 101
|
#define MARIADB_CLIENT_PVIO_PLUGIN 101
|
||||||
#define MARIADB_CLIENT_TRACE_PLUGIN 102
|
#define MARIADB_CLIENT_TRACE_PLUGIN 102
|
||||||
#define MARIADB_CLIENT_CONNECTION_PLUGIN 103
|
#define MARIADB_CLIENT_CONNECTION_PLUGIN 103
|
||||||
|
|
||||||
@@ -89,15 +89,19 @@ struct st_mysql_client_plugin
|
|||||||
struct st_mysql;
|
struct st_mysql;
|
||||||
|
|
||||||
/********* connection handler plugin specific declarations **********/
|
/********* connection handler plugin specific declarations **********/
|
||||||
|
|
||||||
typedef struct st_ma_connection_plugin
|
typedef struct st_ma_connection_plugin
|
||||||
{
|
{
|
||||||
MYSQL_CLIENT_PLUGIN_HEADER
|
MYSQL_CLIENT_PLUGIN_HEADER
|
||||||
/* functions */
|
/* functions */
|
||||||
MYSQL *(*connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd,
|
MYSQL *(*connect)(MYSQL *mysql, const char *host,
|
||||||
const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);
|
const char *user, const char *passwd,
|
||||||
|
const char *db, unsigned int port,
|
||||||
|
const char *unix_socket, unsigned long clientflag);
|
||||||
void (*close)(MYSQL *mysql);
|
void (*close)(MYSQL *mysql);
|
||||||
int (*set_options)(MYSQL *mysql, enum mysql_option, void *arg);
|
int (*set_optionsv)(MYSQL *mysql, unsigned int option, ...);
|
||||||
int (*set_connection)(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
int (*set_connection)(MYSQL *mysql,enum enum_server_command command,
|
||||||
|
const char *arg,
|
||||||
size_t length, my_bool skipp_check, void *opt_arg);
|
size_t length, my_bool skipp_check, void *opt_arg);
|
||||||
my_bool (*reconnect)(MYSQL *mysql);
|
my_bool (*reconnect)(MYSQL *mysql);
|
||||||
int (*reset)(MYSQL *mysql);
|
int (*reset)(MYSQL *mysql);
|
||||||
|
@@ -253,7 +253,19 @@ SET(MARIADB_NONBLOCK_SYMBOLS
|
|||||||
mysql_store_result_start
|
mysql_store_result_start
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# handle static plugins
|
||||||
|
SET(LIBMARIADB_SOURCES ${LIBMARIADB_PLUGIN_SOURCES})
|
||||||
|
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS})
|
||||||
|
ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS})
|
||||||
|
FOREACH(plugin ${PLUGINS_STATIC})
|
||||||
|
SET(EXTERNAL_PLUGINS "${EXTERNAL_PLUGINS} extern struct st_mysql_client_plugin ${plugin}_client_plugin;\n")
|
||||||
|
SET(BUILTIN_PLUGINS "${BUILTIN_PLUGINS} (struct st_mysql_client_plugin *)&${plugin}_client_plugin,\n")
|
||||||
|
ENDFOREACH()
|
||||||
|
CONFIGURE_FILE(${CC_SOURCE_DIR}/libmariadb/ma_client_plugin.c.in
|
||||||
|
${CC_BINARY_DIR}/libmariadb/ma_client_plugin.c)
|
||||||
|
|
||||||
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES}
|
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES}
|
||||||
|
${CC_SOURCE_DIR}/plugins/auth/my_auth.c
|
||||||
ma_array.c
|
ma_array.c
|
||||||
ma_charset.c
|
ma_charset.c
|
||||||
ma_hash.c
|
ma_hash.c
|
||||||
|
@@ -2616,7 +2616,7 @@ uchar *ma_get_hash_keyval(const uchar *hash_entry,
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ma_hash_free(void *p)
|
void ma_int_hash_free(void *p)
|
||||||
{
|
{
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
@@ -2855,7 +2855,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
if (!hash_inited(&mysql->options.extension->userdata))
|
if (!hash_inited(&mysql->options.extension->userdata))
|
||||||
{
|
{
|
||||||
if (_hash_init(&mysql->options.extension->userdata,
|
if (_hash_init(&mysql->options.extension->userdata,
|
||||||
0, 0, 0, ma_get_hash_keyval, ma_hash_free, 0))
|
0, 0, 0, ma_get_hash_keyval, ma_int_hash_free, 0))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -2917,7 +2917,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
if (!hash_inited(&mysql->options.extension->connect_attrs))
|
if (!hash_inited(&mysql->options.extension->connect_attrs))
|
||||||
{
|
{
|
||||||
if (_hash_init(&mysql->options.extension->connect_attrs,
|
if (_hash_init(&mysql->options.extension->connect_attrs,
|
||||||
0, 0, 0, ma_get_hash_keyval, ma_hash_free, 0))
|
0, 0, 0, ma_get_hash_keyval, ma_int_hash_free, 0))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -4113,5 +4113,6 @@ struct st_mariadb_methods MARIADB_DEFAULT_METHODS = {
|
|||||||
my_set_error,
|
my_set_error,
|
||||||
/* invalidate statements */
|
/* invalidate statements */
|
||||||
ma_invalidate_stmts,
|
ma_invalidate_stmts,
|
||||||
|
/* API functions */
|
||||||
&MARIADB_API
|
&MARIADB_API
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
SET(PLUGIN_EXTRA_FILES ${CC_SOURCE_DIR}/libmariadb/ma_errmsg.c)
|
SET(PLUGIN_EXTRA_FILES ${CC_SOURCE_DIR}/libmariadb/ma_errmsg.c)
|
||||||
|
|
||||||
|
|
||||||
FILE(GLOB plugin_dirs ${CC_SOURCE_DIR}/plugins/*)
|
FILE(GLOB plugin_dirs ${CC_SOURCE_DIR}/plugins/*)
|
||||||
FOREACH(dir ${plugin_dirs})
|
FOREACH(dir ${plugin_dirs})
|
||||||
IF (EXISTS ${dir}/CMakeLists.txt)
|
IF (EXISTS ${dir}/CMakeLists.txt)
|
||||||
ADD_SUBDIRECTORY(${dir})
|
INCLUDE(${dir}/CMakeLists.txt)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
@@ -100,8 +100,8 @@ static int gssapi_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
|||||||
|
|
||||||
|
|
||||||
/* register client plugin */
|
/* register client plugin */
|
||||||
#ifndef HAVE_AUTH_GSSAPI_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION auth_gssapi_plugin=
|
struct st_mysql_client_plugin_AUTHENTICATION auth_gssapi_client_plugin=
|
||||||
#else
|
#else
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Copyright (C) 2014 MariaDB Corporation AB
|
Copyright (C) 2014-2018 MariaDB Corporation AB
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -34,15 +34,15 @@
|
|||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
extern char *get_tty_password(char *opt_message, char *buff, int bufflen);
|
extern char *get_tty_password(char *opt_message, char *buff, int bufflen);
|
||||||
static int auth_dialog_open(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
|
static int auth_dialog_open(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
|
||||||
static int auth_dialog_init(char *unused1,
|
static int auth_dialog_init(char *unused1,
|
||||||
size_t unused2,
|
size_t unused2,
|
||||||
int unused3,
|
int unused3,
|
||||||
va_list);
|
va_list);
|
||||||
|
|
||||||
mysql_authentication_dialog_ask_t auth_dialog_func;
|
mysql_authentication_dialog_ask_t auth_dialog_func;
|
||||||
|
|
||||||
#ifndef HAVE_DIALOG_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION auth_dialog_plugin=
|
struct st_mysql_client_plugin_AUTHENTICATION dialog_client_plugin=
|
||||||
#else
|
#else
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Copyright (C) 2014 MariaDB Corporation AB
|
Copyright (C) 2014-2018 MariaDB Corporation AB
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -53,8 +53,8 @@ static int clear_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
#ifndef HAVE_DIALOG_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION auth_cleartext_plugin=
|
struct st_mysql_client_plugin_AUTHENTICATION mysql_clear_password_client_plugin=
|
||||||
#else
|
#else
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
|
@@ -34,7 +34,7 @@ do {\
|
|||||||
} while (0);
|
} while (0);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auth_plugin_t native_password_client_plugin=
|
auth_plugin_t mysql_native_password_client_plugin=
|
||||||
{
|
{
|
||||||
MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
|
MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
|
||||||
MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION,
|
MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION,
|
||||||
@@ -93,8 +93,6 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
|||||||
return CR_OK;
|
return CR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int send_change_user_packet(MCPVIO_EXT *mpvio,
|
static int send_change_user_packet(MCPVIO_EXT *mpvio,
|
||||||
const uchar *data, int data_len)
|
const uchar *data, int data_len)
|
||||||
{
|
{
|
||||||
@@ -313,7 +311,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
|
|||||||
}
|
}
|
||||||
free(buff);
|
free(buff);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(buff);
|
free(buff);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -516,11 +514,11 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mysql->server_capabilities & CLIENT_PROTOCOL_41)
|
if (mysql->server_capabilities & CLIENT_PROTOCOL_41)
|
||||||
auth_plugin= &native_password_client_plugin;
|
auth_plugin= &mysql_native_password_client_plugin;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(auth_plugin= (auth_plugin_t*)mysql_client_find_plugin(mysql,
|
if (!(auth_plugin= (auth_plugin_t*)mysql_client_find_plugin(mysql,
|
||||||
"old_password", MYSQL_CLIENT_AUTHENTICATION_PLUGIN)))
|
"mysql_old_password", MYSQL_CLIENT_AUTHENTICATION_PLUGIN)))
|
||||||
return 1; /* not found */
|
return 1; /* not found */
|
||||||
}
|
}
|
||||||
auth_plugin_name= auth_plugin->name;
|
auth_plugin_name= auth_plugin->name;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Copyright (C) 2014,2015 MariaDB Corporation AB
|
Copyright (C) 2014,2015,2018 MariaDB Corporation AB
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -46,8 +46,8 @@ typedef struct {
|
|||||||
int last_read_packet_len; /**< the length of the last *read* packet */
|
int last_read_packet_len; /**< the length of the last *read* packet */
|
||||||
} MCPVIO_EXT;
|
} MCPVIO_EXT;
|
||||||
|
|
||||||
#ifndef HAVE_OLDPASSWORD_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION old_password_client_plugin=
|
struct st_mysql_client_plugin_AUTHENTICATION mysql_old_password_client_plugin=
|
||||||
#else
|
#else
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
|
@@ -60,7 +60,7 @@ static int auth_sha256_init(char *unused1,
|
|||||||
va_list);
|
va_list);
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_SHA256PW_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION sha256_password_client_plugin=
|
struct st_mysql_client_plugin_AUTHENTICATION sha256_password_client_plugin=
|
||||||
#else
|
#else
|
||||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||||
@@ -235,7 +235,7 @@ static int auth_sha256_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
|||||||
/* Create context and load public key */
|
/* Create context and load public key */
|
||||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO,
|
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO,
|
||||||
der_buffer, der_buffer_len,
|
der_buffer, der_buffer_len,
|
||||||
CRYPT_ENCODE_ALLOC_FLAG, NULL,
|
CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||||
&publicKeyInfo, (DWORD *)&publicKeyInfoLen))
|
&publicKeyInfo, (DWORD *)&publicKeyInfoLen))
|
||||||
goto error;
|
goto error;
|
||||||
LocalFree(der_buffer);
|
LocalFree(der_buffer);
|
||||||
@@ -288,6 +288,8 @@ error:
|
|||||||
RSA_free(pubkey);
|
RSA_free(pubkey);
|
||||||
#elif defined(HAVE_WINCRYPT)
|
#elif defined(HAVE_WINCRYPT)
|
||||||
CryptReleaseContext(hProv, 0);
|
CryptReleaseContext(hProv, 0);
|
||||||
|
if (publicKeyInfo)
|
||||||
|
LocalFree(publicKeyInfo);
|
||||||
#endif
|
#endif
|
||||||
free(filebuffer);
|
free(filebuffer);
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -1,46 +1,13 @@
|
|||||||
IF(WIN32)
|
# Aurora
|
||||||
SET(EXPORT_FILE "../plugin.def")
|
REGISTER_PLUGIN(TARGET aurora
|
||||||
ENDIF()
|
TYPE MARIADB_CLIENT_PLUGIN_CONNECTION
|
||||||
|
CONFIGURATIONS STATIC DYNAMIC OFF
|
||||||
|
DEFAULT OFF
|
||||||
|
SOURCES ${CC_SOURCE_DIR}/plugins/connection/aurora.c)
|
||||||
|
|
||||||
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
|
# Replication
|
||||||
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)
|
REGISTER_PLUGIN(TARGET replication
|
||||||
|
TYPE MARIADB_CLIENT_PLUGIN_CONNECTION
|
||||||
IF(REPLICATION_PLUGIN_TYPE MATCHES "DYNAMIC")
|
CONFIGURATIONS STATIC DYNAMIC OFF
|
||||||
IF(WIN32)
|
DEFAULT OFF
|
||||||
SET_VERSION_INFO("TARGET:replication"
|
SOURCES ${CC_SOURCE_DIR}/plugins/connection/replication.c)
|
||||||
"FILE_TYPE:VFT_DLL"
|
|
||||||
"SOURCE_FILE:plugins/connection/replication.c"
|
|
||||||
"ORIGINAL_FILE_NAME:replication.dll"
|
|
||||||
"FILE_DESCRIPTION:Connection plugin for master/slave environment")
|
|
||||||
ENDIF()
|
|
||||||
ADD_DEFINITIONS(-DHAVE_REPLICATION_DYNAMIC=1)
|
|
||||||
ADD_LIBRARY(replication MODULE ${replication_RC} replication.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
|
||||||
IF(WIN32)
|
|
||||||
TARGET_LINK_LIBRARIES(replication libmariadb)
|
|
||||||
ENDIF()
|
|
||||||
SET(INSTALL_LIBS replication)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(AURORA_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|
||||||
IF(WIN32)
|
|
||||||
SET_VERSION_INFO("TARGET:aurora"
|
|
||||||
"FILE_TYPE:VFT_DLL"
|
|
||||||
"SOURCE_FILE:plugins/connection/aurora.c"
|
|
||||||
"ORIGINAL_FILE_NAME:aurora.dll"
|
|
||||||
"FILE_DESCRIPTION:Connection plugin for Amazon AWS Aurora")
|
|
||||||
ENDIF()
|
|
||||||
ADD_DEFINITIONS(-DHAVE_AURORA_DYNAMIC=1)
|
|
||||||
ADD_LIBRARY(aurora MODULE ${aurora_RC} aurora.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
|
||||||
IF(WIN32)
|
|
||||||
TARGET_LINK_LIBRARIES(aurora libmariadb)
|
|
||||||
ENDIF()
|
|
||||||
SET(INSTALL_LIBS ${INSTALL_LIBS} aurora)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
IF(INSTALL_LIBS)
|
|
||||||
INSTALL(TARGETS
|
|
||||||
${INSTALL_LIBS}
|
|
||||||
COMPONENT ClientPlugins
|
|
||||||
DESTINATION "${INSTALL_PLUGINDIR}")
|
|
||||||
ENDIF()
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Copyright (C) 2015 MariaDB Corporation AB
|
Copyright (C) 2015-2018 MariaDB Corporation AB
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -55,8 +55,10 @@ my_bool aurora_reconnect(MYSQL *mysql);
|
|||||||
#define AURORA_REPLICA 1
|
#define AURORA_REPLICA 1
|
||||||
#define AURORA_UNAVAILABLE 2
|
#define AURORA_UNAVAILABLE 2
|
||||||
|
|
||||||
#ifndef HAVE_AURORA_DYNAMIC
|
static struct st_mariadb_api *libmariadb_api= NULL;
|
||||||
MARIADB_CONNECTION_PLUGIN connection_aurora_plugin =
|
|
||||||
|
#ifndef PLUGIN_DYNAMIC
|
||||||
|
MARIADB_CONNECTION_PLUGIN aurora_client_plugin =
|
||||||
#else
|
#else
|
||||||
MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
@@ -80,7 +82,6 @@ MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
struct st_mariadb_api *mariadb_api= NULL;
|
|
||||||
|
|
||||||
typedef struct st_aurora_instance {
|
typedef struct st_aurora_instance {
|
||||||
char *host;
|
char *host;
|
||||||
@@ -256,11 +257,11 @@ int aurora_get_instance_type(MYSQL *mysql)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mysql->extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
if (!mariadb_api->mysql_query(mysql, query))
|
if (!libmariadb_api->mysql_query(mysql, query))
|
||||||
{
|
{
|
||||||
MYSQL_RES *res= mariadb_api->mysql_store_result(mysql);
|
MYSQL_RES *res= libmariadb_api->mysql_store_result(mysql);
|
||||||
rc= mariadb_api->mysql_num_rows(res) ? AURORA_PRIMARY : AURORA_REPLICA;
|
rc= libmariadb_api->mysql_num_rows(res) ? AURORA_PRIMARY : AURORA_REPLICA;
|
||||||
mariadb_api->mysql_free_result(res);
|
libmariadb_api->mysql_free_result(res);
|
||||||
}
|
}
|
||||||
mysql->extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
return rc;
|
return rc;
|
||||||
@@ -286,15 +287,15 @@ my_bool aurora_get_primary_id(MYSQL *mysql, AURORA *aurora)
|
|||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
mysql->extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
if (!mariadb_api->mysql_query(mysql, "select server_id from information_schema.replica_host_status "
|
if (!libmariadb_api->mysql_query(mysql, "select server_id from information_schema.replica_host_status "
|
||||||
"where session_id = 'MASTER_SESSION_ID'"))
|
"where session_id = 'MASTER_SESSION_ID'"))
|
||||||
{
|
{
|
||||||
MYSQL_RES *res;
|
MYSQL_RES *res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
|
||||||
if ((res= mariadb_api->mysql_store_result(mysql)))
|
if ((res= libmariadb_api->mysql_store_result(mysql)))
|
||||||
{
|
{
|
||||||
if ((row= mariadb_api->mysql_fetch_row(res)))
|
if ((row= libmariadb_api->mysql_fetch_row(res)))
|
||||||
{
|
{
|
||||||
if (row[0])
|
if (row[0])
|
||||||
{
|
{
|
||||||
@@ -302,7 +303,7 @@ my_bool aurora_get_primary_id(MYSQL *mysql, AURORA *aurora)
|
|||||||
rc= 1;
|
rc= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mariadb_api->mysql_free_result(res);
|
libmariadb_api->mysql_free_result(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysql->extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
@@ -354,7 +355,7 @@ void aurora_refresh_blacklist(AURORA *aurora)
|
|||||||
/* {{{ MYSQL *aurora_connect_instance() */
|
/* {{{ MYSQL *aurora_connect_instance() */
|
||||||
MYSQL *aurora_connect_instance(AURORA *aurora, AURORA_INSTANCE *instance, MYSQL *mysql)
|
MYSQL *aurora_connect_instance(AURORA *aurora, AURORA_INSTANCE *instance, MYSQL *mysql)
|
||||||
{
|
{
|
||||||
if (!mariadb_api->mysql_real_connect(mysql,
|
if (!libmariadb_api->mysql_real_connect(mysql,
|
||||||
instance->host,
|
instance->host,
|
||||||
aurora->username,
|
aurora->username,
|
||||||
aurora->password,
|
aurora->password,
|
||||||
@@ -398,7 +399,7 @@ void aurora_close_internal(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
mysql->extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
memset(&mysql->options, 0, sizeof(struct st_mysql_options));
|
memset(&mysql->options, 0, sizeof(struct st_mysql_options));
|
||||||
mariadb_api->mysql_close(mysql);
|
libmariadb_api->mysql_close(mysql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@@ -420,7 +421,7 @@ my_bool aurora_find_replica(AURORA *aurora)
|
|||||||
while (valid_instances && !replica_found)
|
while (valid_instances && !replica_found)
|
||||||
{
|
{
|
||||||
int random_pick= rand() % valid_instances;
|
int random_pick= rand() % valid_instances;
|
||||||
mysql= mariadb_api->mysql_init(NULL);
|
mysql= libmariadb_api->mysql_init(NULL);
|
||||||
mysql->options= aurora->save_mysql.options;
|
mysql->options= aurora->save_mysql.options;
|
||||||
|
|
||||||
/* don't execute init_command on slave */
|
/* don't execute init_command on slave */
|
||||||
@@ -488,7 +489,7 @@ my_bool aurora_find_primary(AURORA *aurora)
|
|||||||
|
|
||||||
for (i=0; i < aurora->num_instances; i++)
|
for (i=0; i < aurora->num_instances; i++)
|
||||||
{
|
{
|
||||||
mysql= mariadb_api->mysql_init(NULL);
|
mysql= libmariadb_api->mysql_init(NULL);
|
||||||
mysql->options= aurora->save_mysql.options;
|
mysql->options= aurora->save_mysql.options;
|
||||||
|
|
||||||
if (check_primary && aurora->primary_id[0])
|
if (check_primary && aurora->primary_id[0])
|
||||||
@@ -527,8 +528,8 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
AURORA *aurora= NULL;
|
AURORA *aurora= NULL;
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
if (!mariadb_api)
|
if (!libmariadb_api)
|
||||||
mariadb_api= mysql->methods->api;
|
libmariadb_api= mysql->methods->api;
|
||||||
|
|
||||||
/* we call aurora_connect either from mysql_real_connect or from mysql_reconnect,
|
/* we call aurora_connect either from mysql_real_connect or from mysql_reconnect,
|
||||||
* so make sure in case of reconnect we don't allocate aurora twice */
|
* so make sure in case of reconnect we don't allocate aurora twice */
|
||||||
@@ -536,7 +537,7 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
{
|
{
|
||||||
if (!(aurora= (AURORA *)calloc(1, sizeof(AURORA))))
|
if (!(aurora= (AURORA *)calloc(1, sizeof(AURORA))))
|
||||||
{
|
{
|
||||||
mysql->methods->set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
mysql->methods->set_error(mysql, CR_OUT_OF_MEMORY, "HY000", 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
aurora->save_mysql= *mysql;
|
aurora->save_mysql= *mysql;
|
||||||
@@ -740,7 +741,7 @@ int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *ar
|
|||||||
if (aurora->mysql[AURORA_REPLICA] && mysql->thread_id == aurora->mysql[AURORA_PRIMARY]->thread_id)
|
if (aurora->mysql[AURORA_REPLICA] && mysql->thread_id == aurora->mysql[AURORA_PRIMARY]->thread_id)
|
||||||
{
|
{
|
||||||
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= 0;
|
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= 0;
|
||||||
mariadb_api->mysql_select_db(aurora->mysql[AURORA_REPLICA], arg);
|
libmariadb_api->mysql_select_db(aurora->mysql[AURORA_REPLICA], arg);
|
||||||
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= mysql->extension->conn_hdlr;
|
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= mysql->extension->conn_hdlr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -759,8 +760,8 @@ int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *ar
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
||||||
break;
|
break;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Copyright (C) 2015 MariaDB Corporation AB
|
Copyright (C) 2015-2018 MariaDB Corporation AB
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -41,15 +41,15 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
void repl_close(MYSQL *mysql);
|
void repl_close(MYSQL *mysql);
|
||||||
int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||||
size_t length, my_bool skipp_check, void *opt_arg);
|
size_t length, my_bool skipp_check, void *opt_arg);
|
||||||
int repl_set_options(MYSQL *msql, enum mysql_option option, void *arg);
|
int repl_set_optionsv(MYSQL *mysql, unsigned int option, ...);
|
||||||
|
|
||||||
#define MARIADB_MASTER 0
|
#define MARIADB_MASTER 0
|
||||||
#define MARIADB_SLAVE 1
|
#define MARIADB_SLAVE 1
|
||||||
|
|
||||||
struct st_mariadb_api *mariadb_api= NULL;
|
static struct st_mariadb_api *libmariadb_api= NULL;
|
||||||
|
|
||||||
#ifndef HAVE_REPLICATION_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
MARIADB_CONNECTION_PLUGIN connection_replication_plugin =
|
MARIADB_CONNECTION_PLUGIN replication_client_plugin =
|
||||||
#else
|
#else
|
||||||
MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
@@ -67,7 +67,7 @@ MARIADB_CONNECTION_PLUGIN _mysql_client_plugin_declaration_ =
|
|||||||
NULL,
|
NULL,
|
||||||
repl_connect,
|
repl_connect,
|
||||||
repl_close,
|
repl_close,
|
||||||
repl_set_options,
|
repl_set_optionsv,
|
||||||
repl_command,
|
repl_command,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
@@ -185,8 +185,8 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
REPL_DATA *data= NULL;
|
REPL_DATA *data= NULL;
|
||||||
MA_CONNECTION_HANDLER *hdlr= mysql->extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
if (!mariadb_api)
|
if (!libmariadb_api)
|
||||||
mariadb_api= mysql->methods->api;
|
libmariadb_api= mysql->methods->api;
|
||||||
|
|
||||||
if ((data= (REPL_DATA *)hdlr->data))
|
if ((data= (REPL_DATA *)hdlr->data))
|
||||||
{
|
{
|
||||||
@@ -197,7 +197,7 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
|
|
||||||
if (!(data= calloc(1, sizeof(REPL_DATA))))
|
if (!(data= calloc(1, sizeof(REPL_DATA))))
|
||||||
{
|
{
|
||||||
mysql->methods->set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
mysql->methods->set_error(mysql, CR_OUT_OF_MEMORY, "HY000", 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(data->pvio, 0, 2 * sizeof(MARIADB_PVIO *));
|
memset(data->pvio, 0, 2 * sizeof(MARIADB_PVIO *));
|
||||||
@@ -206,7 +206,7 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* try to connect to master */
|
/* try to connect to master */
|
||||||
if (!(mariadb_api->mysql_real_connect(mysql, data->host[MARIADB_MASTER], user, passwd, db,
|
if (!(libmariadb_api->mysql_real_connect(mysql, data->host[MARIADB_MASTER], user, passwd, db,
|
||||||
data->port[MARIADB_MASTER] ? data->port[MARIADB_MASTER] : port, unix_socket, clientflag)))
|
data->port[MARIADB_MASTER] ? data->port[MARIADB_MASTER] : port, unix_socket, clientflag)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@@ -218,12 +218,12 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
* connecting to slave(s) in background */
|
* connecting to slave(s) in background */
|
||||||
|
|
||||||
/* if slave connection will fail, we will not return error but use master instead */
|
/* if slave connection will fail, we will not return error but use master instead */
|
||||||
if (!(data->slave_mysql= mariadb_api->mysql_init(NULL)) ||
|
if (!(data->slave_mysql= libmariadb_api->mysql_init(NULL)) ||
|
||||||
!(mysql->methods->db_connect(data->slave_mysql, data->host[MARIADB_SLAVE], user, passwd, db,
|
!(mysql->methods->db_connect(data->slave_mysql, data->host[MARIADB_SLAVE], user, passwd, db,
|
||||||
data->port[MARIADB_SLAVE] ? data->port[MARIADB_SLAVE] : port, unix_socket, clientflag)))
|
data->port[MARIADB_SLAVE] ? data->port[MARIADB_SLAVE] : port, unix_socket, clientflag)))
|
||||||
{
|
{
|
||||||
if (data->slave_mysql)
|
if (data->slave_mysql)
|
||||||
mariadb_api->mysql_close(data->slave_mysql);
|
libmariadb_api->mysql_close(data->slave_mysql);
|
||||||
data->pvio[MARIADB_SLAVE]= NULL;
|
data->pvio[MARIADB_SLAVE]= NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -255,7 +255,7 @@ void repl_close(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
/* restore mysql */
|
/* restore mysql */
|
||||||
data->pvio[MARIADB_SLAVE]->mysql= data->slave_mysql;
|
data->pvio[MARIADB_SLAVE]->mysql= data->slave_mysql;
|
||||||
mariadb_api->mysql_close(data->slave_mysql);
|
libmariadb_api->mysql_close(data->slave_mysql);
|
||||||
data->pvio[MARIADB_SLAVE]= NULL;
|
data->pvio[MARIADB_SLAVE]= NULL;
|
||||||
data->slave_mysql= NULL;
|
data->slave_mysql= NULL;
|
||||||
}
|
}
|
||||||
@@ -334,19 +334,24 @@ int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int repl_set_options(MYSQL *mysql, enum mysql_option option, void *arg)
|
int repl_set_optionsv(MYSQL *mysql, unsigned int option, ...)
|
||||||
{
|
{
|
||||||
REPL_DATA *data= (REPL_DATA *)mysql->extension->conn_hdlr->data;
|
REPL_DATA *data= (REPL_DATA *)mysql->extension->conn_hdlr->data;
|
||||||
|
va_list ap;
|
||||||
|
void *arg1;
|
||||||
|
int rc= 0;
|
||||||
|
|
||||||
|
va_start(ap, option);
|
||||||
|
arg1= va_arg(ap, void *);
|
||||||
|
|
||||||
switch(option) {
|
switch(option) {
|
||||||
case MARIADB_OPT_CONNECTION_READ_ONLY:
|
case MARIADB_OPT_CONNECTION_READ_ONLY:
|
||||||
data->read_only= *(my_bool *)arg;
|
data->read_only= *(my_bool *)arg1;
|
||||||
return 0;
|
break;
|
||||||
/*
|
|
||||||
case MARIADB_OPT_CONNECTION_ROUND_ROBIN:
|
|
||||||
data->round_robin= *(my_bool *)arg;
|
|
||||||
return 0; */
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
rc= -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
va_end(ap);
|
||||||
|
return(rc);
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +1,15 @@
|
|||||||
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)
|
IF (WITH_CURL)
|
||||||
|
INCLUDE(FindCURL)
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/install_plugins.cmake)
|
|
||||||
IF(WITH_SIGNCODE)
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(REMOTEIO_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|
||||||
IF(CURL_FOUND)
|
IF(CURL_FOUND)
|
||||||
IF(WIN32)
|
|
||||||
SET_VERSION_INFO("TARGET:remote_io"
|
ADD_DEFINITIONS(-DHAVE_REMOTEIO=1)
|
||||||
"FILE_TYPE:VFT_DLL"
|
#remote io plugin
|
||||||
"SOURCE_FILE:plugins/io/remote_io.c"
|
REGISTER_PLUGIN(TARGET remote_io
|
||||||
"ORIGINAL_FILE_NAME:remote_io.dll"
|
TYPE MARIADB_CLIENT_PLUGIN_IO
|
||||||
"FILE_DESCRIPTION:Plugin for remote file access")
|
CONFIGURATIONS DYNAMIC STATIC OFF
|
||||||
ENDIF()
|
DEFAULT DYNAMIC
|
||||||
# remote file plugin
|
SOURCES ${CC_SOURCE_DIR}/plugins/io/remote_io.c
|
||||||
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
|
INCLUDES ${CURL_INCLUDE_DIR}
|
||||||
SET(REMOTE_IO_SOURCES ${remote_io_RC} remote_io.c)
|
LIBRARIES ${CURL_LIBRARIES})
|
||||||
ADD_DEFINITIONS(-DHAVE_REMOTEIO_DYNAMIC=1)
|
|
||||||
ADD_LIBRARY(remote_io MODULE ${REMOTE_IO_SOURCES} ${CC_SOURCE_DIR}/plugins/plugin.def)
|
|
||||||
TARGET_LINK_LIBRARIES(remote_io ${CURL_LIBRARIES})
|
|
||||||
SET_TARGET_PROPERTIES(remote_io PROPERTIES PREFIX "")
|
|
||||||
INSTALL_PLUGIN(remote_io ${CC_BINARY_DIR}/plugins/io)
|
|
||||||
SIGN_TARGET(remote_io)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Copyright (C) 2015, 2016 Monty Program AB
|
* Copyright (C) 2015 - 2018 MariaDB Corporation AB
|
||||||
* Copyright (c) 2003 Simtec Electronics
|
* Copyright (c) 2003 Simtec Electronics
|
||||||
*
|
*
|
||||||
* Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive
|
* Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive
|
||||||
@@ -91,7 +91,7 @@ typedef struct
|
|||||||
|
|
||||||
CURLM *multi_handle= NULL;
|
CURLM *multi_handle= NULL;
|
||||||
|
|
||||||
#ifndef HAVE_REMOTEIO_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
MARIADB_REMOTEIO_PLUGIN remote_io_plugin=
|
MARIADB_REMOTEIO_PLUGIN remote_io_plugin=
|
||||||
#else
|
#else
|
||||||
MARIADB_REMOTEIO_PLUGIN _mysql_client_plugin_declaration_ =
|
MARIADB_REMOTEIO_PLUGIN _mysql_client_plugin_declaration_ =
|
||||||
@@ -112,7 +112,10 @@ MARIADB_REMOTEIO_PLUGIN _mysql_client_plugin_declaration_ =
|
|||||||
mysql_end_client_plugin;
|
mysql_end_client_plugin;
|
||||||
|
|
||||||
/* {{{ ma_rio_init - Plugin initialization */
|
/* {{{ ma_rio_init - Plugin initialization */
|
||||||
int ma_rio_init(char *unused1, size_t unused2, int unused3, va_list unused4)
|
int ma_rio_init(char *unused1 __attribute__((unused)),
|
||||||
|
size_t unused2 __attribute__((unused)),
|
||||||
|
int unused3 __attribute__((unused)),
|
||||||
|
va_list unused4 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if (!multi_handle)
|
if (!multi_handle)
|
||||||
|
@@ -1,55 +1,27 @@
|
|||||||
IF(WIN32)
|
SET(PVIO_DIR ${CC_SOURCE_DIR}/plugins/pvio)
|
||||||
SET(EXPORT_FILE "pvio_plugin.def")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/install_plugins.cmake)
|
|
||||||
IF(WITH_SIGNCODE)
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${PVIO_DIR})
|
||||||
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)
|
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)
|
||||||
|
|
||||||
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
|
#native password
|
||||||
|
REGISTER_PLUGIN(TARGET pvio_socket
|
||||||
IF(SOCKET_PLUGIN_TYPE MATCHES "DYNAMIC")
|
TYPE MARIADB_CLIENT_PLUGIN_PVIO
|
||||||
IF(WIN32)
|
CONFIGURATIONS STATIC DYNAMIC DEFAULT
|
||||||
SET_VERSION_INFO("TARGET:pvio_socket"
|
DEFAULT STATIC
|
||||||
"FILE_TYPE:VFT_DLL"
|
SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_socket.c)
|
||||||
"SOURCE_FILE:plugins/pvio/pvio_socket.c"
|
|
||||||
"ORIGINAL_FILE_NAME:pvio_socket.dll"
|
|
||||||
"FILE_DESCRIPTION:VIO plugin for socket communication")
|
|
||||||
ENDIF()
|
|
||||||
ADD_DEFINITIONS(-DHAVE_SOCKET_DYNAMIC=1)
|
|
||||||
ADD_LIBRARY(pvio_socket MODULE ${pvio_socket_RC} pvio_socket.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
|
||||||
INSTALL_PLUGIN(pvio_socket ${CC_BINARY_DIR}/plugins/pvio)
|
|
||||||
SIGN_TARGET(pvio_socket)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
IF(NPIPE_PLUGIN_TYPE MATCHES "DYNAMIC")
|
# named pipe
|
||||||
IF(WIN32)
|
REGISTER_PLUGIN(TARGET pvio_npipe
|
||||||
SET_VERSION_INFO("TARGET:pvio_npipe"
|
TYPE MARIADB_CLIENT_PLUGIN_PVIO
|
||||||
"FILE_TYPE:VFT_DLL"
|
CONFIGURATIONS STATIC DYNAMIC DEFAULT
|
||||||
"SOURCE_FILE:plugins/pvio/pvio_npipe.c"
|
DEFAULT DYNAMIC
|
||||||
"ORIGINAL_FILE_NAME:pvio_npipe.dll"
|
SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_npipe.c)
|
||||||
"FILE_DESCRIPTION:VIO plugin for named pipe communication")
|
|
||||||
ENDIF()
|
# shared memory
|
||||||
ADD_DEFINITIONS(-DHAVE_NPIPE_DYNAMIC=1)
|
REGISTER_PLUGIN(TARGET pvio_shmem
|
||||||
ADD_LIBRARY(pvio_npipe MODULE ${pvio_npipe_RC} pvio_npipe.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
TYPE MARIADB_CLIENT_PLUGIN_PVIO
|
||||||
INSTALL_PLUGIN(pvio_npipe ${CC_BINARY_DIR}/plugins/pvio)
|
CONFIGURATIONS STATIC DYNAMIC DEFAULT
|
||||||
SIGN_TARGET(pvio_npipe)
|
DEFAULT DYNAMIC
|
||||||
ENDIF()
|
SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_shmem.c)
|
||||||
IF(SHMEM_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|
||||||
ADD_DEFINITIONS(-DHAVE_SHMEM_DYNAMIC=1)
|
|
||||||
IF(WIN32)
|
|
||||||
SET_VERSION_INFO("TARGET:pvio_shmem"
|
|
||||||
"FILE_TYPE:VFT_DLL"
|
|
||||||
"SOURCE_FILE:plugins/pvio/pvio_shmm.c"
|
|
||||||
"ORIGINAL_FILE_NAME:pvio_shmem.dll"
|
|
||||||
"FILE_DESCRIPTION:VIO plugin for shared memory communication")
|
|
||||||
ENDIF()
|
|
||||||
ADD_LIBRARY(pvio_shmem MODULE ${pvio_shmem_RC} pvio_shmem.c ${PLUGIN_EXTRA_FILES} ${EXPORT_FILE})
|
|
||||||
INSTALL_PLUGIN(pvio_shmem ${CC_BINARY_DIR}/plugins/pvio)
|
|
||||||
SIGN_TARGET(pvio_shmem)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -68,8 +68,8 @@ struct st_ma_pvio_methods pvio_npipe_methods= {
|
|||||||
pvio_npipe_shutdown
|
pvio_npipe_shutdown
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HAVE_NPIPE_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
MARIADB_PVIO_PLUGIN pvio_npipe_plugin =
|
MARIADB_PVIO_PLUGIN pvio_npipe_client_plugin =
|
||||||
#else
|
#else
|
||||||
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_ =
|
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_ =
|
||||||
#endif
|
#endif
|
||||||
@@ -234,7 +234,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
|
|
||||||
if (!(cpipe= (struct st_pvio_npipe *)LocalAlloc(LMEM_ZEROINIT, sizeof(struct st_pvio_npipe))))
|
if (!(cpipe= (struct st_pvio_npipe *)LocalAlloc(LMEM_ZEROINIT, sizeof(struct st_pvio_npipe))))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, "");
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, "HY000", 0, "");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
memset(cpipe, 0, sizeof(struct st_pvio_npipe));
|
memset(cpipe, 0, sizeof(struct st_pvio_npipe));
|
||||||
@@ -271,14 +271,14 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
|
|
||||||
if (GetLastError() != ERROR_PIPE_BUSY)
|
if (GetLastError() != ERROR_PIPE_BUSY)
|
||||||
{
|
{
|
||||||
pvio->set_error(pvio->mysql, CR_NAMEDPIPEOPEN_ERROR, SQLSTATE_UNKNOWN, 0,
|
pvio->set_error(pvio->mysql, CR_NAMEDPIPEOPEN_ERROR, "HY000", 0,
|
||||||
cinfo->host, cinfo->unix_socket, GetLastError());
|
cinfo->host, cinfo->unix_socket, GetLastError());
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_timedout || !WaitNamedPipe(szPipeName, pvio->timeout[PVIO_CONNECT_TIMEOUT]))
|
if (has_timedout || !WaitNamedPipe(szPipeName, pvio->timeout[PVIO_CONNECT_TIMEOUT]))
|
||||||
{
|
{
|
||||||
pvio->set_error(pvio->mysql, CR_NAMEDPIPEWAIT_ERROR, SQLSTATE_UNKNOWN, 0,
|
pvio->set_error(pvio->mysql, CR_NAMEDPIPEWAIT_ERROR, "HY000", 0,
|
||||||
cinfo->host, cinfo->unix_socket, GetLastError());
|
cinfo->host, cinfo->unix_socket, GetLastError());
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
|
dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
|
||||||
if (!SetNamedPipeHandleState(cpipe->pipe, &dwMode, NULL, NULL))
|
if (!SetNamedPipeHandleState(cpipe->pipe, &dwMode, NULL, NULL))
|
||||||
{
|
{
|
||||||
pvio->set_error(pvio->mysql, CR_NAMEDPIPESETSTATE_ERROR, SQLSTATE_UNKNOWN, 0,
|
pvio->set_error(pvio->mysql, CR_NAMEDPIPESETSTATE_ERROR, "HY000", 0,
|
||||||
cinfo->host, cinfo->unix_socket, (ulong) GetLastError());
|
cinfo->host, cinfo->unix_socket, (ulong) GetLastError());
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
/* Register event handler for overlapped IO */
|
/* Register event handler for overlapped IO */
|
||||||
if (!(cpipe->overlapped.hEvent= CreateEvent(NULL, FALSE, FALSE, NULL)))
|
if (!(cpipe->overlapped.hEvent= CreateEvent(NULL, FALSE, FALSE, NULL)))
|
||||||
{
|
{
|
||||||
pvio->set_error(pvio->mysql, CR_EVENT_CREATE_FAILED, SQLSTATE_UNKNOWN, 0,
|
pvio->set_error(pvio->mysql, CR_EVENT_CREATE_FAILED, "HY000", 0,
|
||||||
GetLastError());
|
GetLastError());
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@@ -63,8 +63,8 @@ struct st_ma_pvio_methods pvio_shm_methods= {
|
|||||||
pvio_shm_shutdown
|
pvio_shm_shutdown
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HAVE_SHMEM_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
MARIADB_PVIO_PLUGIN pvio_shmem_plugin=
|
MARIADB_PVIO_PLUGIN pvio_shmem_client_plugin=
|
||||||
#else
|
#else
|
||||||
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_=
|
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_=
|
||||||
#endif
|
#endif
|
||||||
@@ -249,11 +249,11 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
hdlConnectRequestAnswer= NULL,
|
hdlConnectRequestAnswer= NULL,
|
||||||
file_map= NULL;
|
file_map= NULL;
|
||||||
LPVOID map= NULL;
|
LPVOID map= NULL;
|
||||||
PVIO_SHM *pvio_shm= (PVIO_SHM*)LocalAlloc(LMEM_ZEROINIT, sizeof(PVIO_SHM));
|
PVIO_SHM *pvio_shm= (PVIO_SHM*)LocalAlloc(LMEM_ZEROINIT, sizeof(PVIO_SHM));
|
||||||
|
|
||||||
if (!pvio_shm)
|
if (!pvio_shm)
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, "");
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, "HY000", 0, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
|
|
||||||
if (!(shm_name= (char *)LocalAlloc(LMEM_ZEROINIT, strlen(base_memory_name) + 40)))
|
if (!(shm_name= (char *)LocalAlloc(LMEM_ZEROINIT, strlen(base_memory_name) + 40)))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, "");
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, "HY000", 0, "");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,14 +287,14 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
}
|
}
|
||||||
if (!hdlConnectRequest)
|
if (!hdlConnectRequest)
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Opening CONNECT_REQUEST event failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Opening CONNECT_REQUEST event failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(shm_suffix, "CONNECT_ANSWER");
|
strcpy(shm_suffix, "CONNECT_ANSWER");
|
||||||
if (!(hdlConnectRequestAnswer= OpenEvent(dwDesiredAccess, 0, shm_name)))
|
if (!(hdlConnectRequestAnswer= OpenEvent(dwDesiredAccess, 0, shm_name)))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Opening CONNECT_ANSWER event failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Opening CONNECT_ANSWER event failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,42 +302,42 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
strcpy(shm_suffix, "CONNECT_DATA");
|
strcpy(shm_suffix, "CONNECT_DATA");
|
||||||
if (!(file_map= OpenFileMapping(FILE_MAP_WRITE, 0, shm_name)))
|
if (!(file_map= OpenFileMapping(FILE_MAP_WRITE, 0, shm_name)))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "OpenFileMapping failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "OpenFileMapping failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to get first 4 bytes, which represents connection_id */
|
/* try to get first 4 bytes, which represents connection_id */
|
||||||
if (!(map= MapViewOfFile(file_map, FILE_MAP_WRITE, 0, 0, sizeof(cid))))
|
if (!(map= MapViewOfFile(file_map, FILE_MAP_WRITE, 0, 0, sizeof(cid))))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Reading connection_id failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Reading connection_id failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* notify server */
|
/* notify server */
|
||||||
if (!SetEvent(hdlConnectRequest))
|
if (!SetEvent(hdlConnectRequest))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Failed sending connection request", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Failed sending connection request", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for server answer */
|
/* Wait for server answer */
|
||||||
switch(WaitForSingleObject(hdlConnectRequestAnswer, pvio->timeout[PVIO_CONNECT_TIMEOUT])) {
|
switch(WaitForSingleObject(hdlConnectRequestAnswer, pvio->timeout[PVIO_CONNECT_TIMEOUT])) {
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Mutex was not released in time", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Mutex was not released in time", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Operation wait failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Operation wait failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Operation timed out", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Operation timed out", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Wait for server failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Wait for server failed", GetLastError());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,12 +350,12 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
pvio_shm->file_map= OpenFileMapping(FILE_MAP_WRITE, 0, shm_name);
|
pvio_shm->file_map= OpenFileMapping(FILE_MAP_WRITE, 0, shm_name);
|
||||||
if (pvio_shm->file_map == NULL)
|
if (pvio_shm->file_map == NULL)
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "OpenFileMapping failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "OpenFileMapping failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (!(pvio_shm->map= MapViewOfFile(pvio_shm->file_map, FILE_MAP_WRITE, 0, 0, PVIO_SHM_BUFFER_SIZE)))
|
if (!(pvio_shm->map= MapViewOfFile(pvio_shm->file_map, FILE_MAP_WRITE, 0, 0, PVIO_SHM_BUFFER_SIZE)))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "MapViewOfFile failed", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "MapViewOfFile failed", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
strcpy(shm_suffix, StrEvent[i]);
|
strcpy(shm_suffix, StrEvent[i]);
|
||||||
if (!(pvio_shm->event[i]= OpenEvent(dwDesiredAccess, 0, shm_name)))
|
if (!(pvio_shm->event[i]= OpenEvent(dwDesiredAccess, 0, shm_name)))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, unknown_sqlstate, 0, "Couldn't create event", GetLastError());
|
PVIO_SET_ERROR(cinfo->mysql, CR_SHARED_MEMORY_CONNECT_ERROR, "HY000", 0, "Couldn't create event", GetLastError());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
my_bool pvio_socket_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
|
my_bool pvio_socket_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
|
||||||
int pvio_socket_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
|
int pvio_socket_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
|
||||||
@@ -128,8 +127,8 @@ struct st_ma_pvio_methods pvio_socket_methods= {
|
|||||||
pvio_socket_shutdown
|
pvio_socket_shutdown
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HAVE_SOCKET_DYNAMIC
|
#ifndef PLUGIN_DYNAMIC
|
||||||
MARIADB_PVIO_PLUGIN pvio_socket_plugin=
|
MARIADB_PVIO_PLUGIN pvio_socket_client_plugin=
|
||||||
#else
|
#else
|
||||||
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_
|
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/install_plugins.cmake)
|
|
||||||
IF(WITH_SIGNCODE)
|
|
||||||
INCLUDE(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Trace example plugin
|
|
||||||
IF(TRACE_EXAMPLE_PLUGIN_TYPE MATCHES "DYNAMIC")
|
|
||||||
IF(WIN32)
|
|
||||||
SET_VERSION_INFO("TARGET:trace_example"
|
|
||||||
"FILE_TYPE:VFT_DLL"
|
|
||||||
"SOURCE_FILE:plugins/trace/trace_example.c"
|
|
||||||
"ORIGINAL_FILE_NAME:trace_example.dll"
|
|
||||||
"FILE_DESCRIPTION:Trace example")
|
|
||||||
ENDIF()
|
|
||||||
ADD_DEFINITIONS(-DHAVE_TRACE_EXAMPLE_PLUGIN_DYNAMIC=1)
|
|
||||||
SET(TRACE_EXAMPLE_SOURCES ${trace_example_RC} trace_example.c)
|
|
||||||
IF(WIN32)
|
|
||||||
SET(TRACE_EXAMPLE_SOURCES ${TRACE_EXAMPLE_SOURCES} ${CC_SOURCE_DIR}/plugins/plugin.def)
|
|
||||||
ENDIF()
|
|
||||||
ADD_LIBRARY(trace_example MODULE ${TRACE_EXAMPLE_SOURCES})
|
|
||||||
SET_TARGET_PROPERTIES(trace_example PROPERTIES PREFIX "")
|
|
||||||
INSTALL_PLUGIN(trace_example ${CC_BINARY_DIR}/plugins/trace)
|
|
||||||
SIGN_TARGET(trace_example)
|
|
||||||
ENDIF()
|
|
@@ -707,6 +707,9 @@ static int test_wl4284_1(MYSQL *mysql)
|
|||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
|
|
||||||
|
diag("Test temporarily disabled");
|
||||||
|
return SKIP;
|
||||||
|
|
||||||
if (mysql_get_server_version(mysql) < 60000) {
|
if (mysql_get_server_version(mysql) < 60000) {
|
||||||
diag("Test requires MySQL Server version 6.0 or above");
|
diag("Test requires MySQL Server version 6.0 or above");
|
||||||
return SKIP;
|
return SKIP;
|
||||||
@@ -1088,7 +1091,7 @@ static int test_mdev12965(MYSQL *unused __attribute__((unused)))
|
|||||||
fprintf(fp, "[client]\ndefault-character-set=latin2\nreconnect=1\n");
|
fprintf(fp, "[client]\ndefault-character-set=latin2\nreconnect=1\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "client");
|
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "");
|
||||||
my_test_connect(mysql, hostname, username, password,
|
my_test_connect(mysql, hostname, username, password,
|
||||||
schema, 0, socketname, 0);
|
schema, 0, socketname, 0);
|
||||||
|
|
||||||
|
@@ -525,8 +525,13 @@ MYSQL *my_test_connect(MYSQL *mysql,
|
|||||||
unsigned long clientflag)
|
unsigned long clientflag)
|
||||||
{
|
{
|
||||||
if (force_tls)
|
if (force_tls)
|
||||||
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &force_tls);
|
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &force_tls);
|
||||||
mysql= mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, clientflag);
|
if (!mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, clientflag))
|
||||||
|
{
|
||||||
|
diag("error: %s", mysql_error(mysql));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (mysql && force_tls && !mysql_get_ssl_cipher(mysql))
|
if (mysql && force_tls && !mysql_get_ssl_cipher(mysql))
|
||||||
{
|
{
|
||||||
diag("Error: TLS connection not established");
|
diag("Error: TLS connection not established");
|
||||||
|
Reference in New Issue
Block a user