Commit d4635150 authored by Sergei Golubchik's avatar Sergei Golubchik

fix dialog plugin to work on windows

parent ef45b799
...@@ -28,6 +28,16 @@ ...@@ -28,6 +28,16 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#if defined(_MSC_VER)
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
#endif
#else /*_MSC_VER */
#define MYSQL_PLUGIN_EXPORT
#endif
/* known plugin types */ /* known plugin types */
#define MYSQL_CLIENT_reserved1 0 #define MYSQL_CLIENT_reserved1 0
#define MYSQL_CLIENT_reserved2 1 #define MYSQL_CLIENT_reserved2 1
...@@ -38,6 +48,7 @@ ...@@ -38,6 +48,7 @@
#define MYSQL_CLIENT_MAX_PLUGINS 3 #define MYSQL_CLIENT_MAX_PLUGINS 3
#define mysql_declare_client_plugin(X) \ #define mysql_declare_client_plugin(X) \
MYSQL_PLUGIN_EXPORT \
struct st_mysql_client_plugin_ ## X \ struct st_mysql_client_plugin_ ## X \
_mysql_client_plugin_declaration_ = { \ _mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_ ## X ## _PLUGIN, \ MYSQL_CLIENT_ ## X ## _PLUGIN, \
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef _WIN32
#include <windows.h>
#endif
/** /**
@file @file
......
INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
SET(AUTH_SOURCES dialog.c)
MYSQL_PLUGIN(AUTH)
...@@ -33,13 +33,16 @@ ...@@ -33,13 +33,16 @@
a correct password. It shows the situation when a number of questions a correct password. It shows the situation when a number of questions
is not known in advance. is not known in advance.
*/ */
#define _GNU_SOURCE /* for RTLD_DEFAULT */ #include <my_global.h>
#include <mysql/plugin_auth.h>
#include <mysql/client_plugin.h> #include <mysql/client_plugin.h>
#include <mysql.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <stdlib.h> #if defined (_WIN32)
# define RTLD_DEFAULT GetModuleHandle(NULL)
#endif
#include <mysql/plugin_auth.h>
/** /**
first byte of the question string is the question "type". first byte of the question string is the question "type".
...@@ -51,8 +54,6 @@ ...@@ -51,8 +54,6 @@
#define PASSWORD_QUESTION "\4" #define PASSWORD_QUESTION "\4"
#define LAST_PASSWORD "\5" #define LAST_PASSWORD "\5"
typedef unsigned char uchar;
/********************* SERVER SIDE ****************************************/ /********************* SERVER SIDE ****************************************/
/** /**
...@@ -216,9 +217,6 @@ maria_declare_plugin_end; ...@@ -216,9 +217,6 @@ maria_declare_plugin_end;
dialog plugin will use it for communication with the user. Otherwise dialog plugin will use it for communication with the user. Otherwise
a default gets() based implementation will be used. a default gets() based implementation will be used.
*/ */
#include <mysql.h>
#include <dlfcn.h>
static mysql_authentication_dialog_ask_t ask; static mysql_authentication_dialog_ask_t ask;
static char *builtin_ask(MYSQL *mysql __attribute__((unused)), static char *builtin_ask(MYSQL *mysql __attribute__((unused)),
......
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