Commit 0380b0e2 authored by Sergei Golubchik's avatar Sergei Golubchik

build feedback plugin with ssl (changes for cmake).

fix the ssl related code to use newer function prototypes
parent 00e7915f
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include) ${SSL_INCLUDE_DIRS})
SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc
url_base.cc url_http.cc utils.cc) url_base.cc url_http.cc utils.cc)
ADD_DEFINITIONS(${SSL_DEFINES})
INCLUDE (CheckIncludeFiles) INCLUDE (CheckIncludeFiles)
CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H) CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H)
IF(HAVE_NETDB_H) IF(HAVE_NETDB_H)
...@@ -11,8 +13,10 @@ IF(HAVE_NETDB_H) ...@@ -11,8 +13,10 @@ IF(HAVE_NETDB_H)
ENDIF(HAVE_NETDB_H) ENDIF(HAVE_NETDB_H)
IF(WIN32) IF(WIN32)
#SET(FEEDBACK_LIBS Ws2_32) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}
MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY DEFAULT) LINK_LIBRARIES ${SSL_LIBRARIES}
STATIC_ONLY DEFAULT)
ELSE(WIN32) ELSE(WIN32)
MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}
LINK_LIBRARIES ${SSL_LIBRARIES})
ENDIF(WIN32) ENDIF(WIN32)
...@@ -29,12 +29,6 @@ namespace feedback { ...@@ -29,12 +29,6 @@ namespace feedback {
static const uint FOR_READING= 0; static const uint FOR_READING= 0;
static const uint FOR_WRITING= 1; static const uint FOR_WRITING= 1;
#ifdef MARIADB_BASE_VERSION
#define ssl_connect(A,B,C,D) sslconnect(A,B,C,D)
#else
#define ssl_connect(A,B,C,D) sslconnect(A,B,C)
#endif
/** /**
implementation of the Url class that sends the data via HTTP POST request. implementation of the Url class that sends the data via HTTP POST request.
...@@ -199,12 +193,23 @@ int Url_http::send(const char* data, size_t data_length) ...@@ -199,12 +193,23 @@ int Url_http::send(const char* data, size_t data_length)
struct st_VioSSLFd *UNINIT_VAR(ssl_fd); struct st_VioSSLFd *UNINIT_VAR(ssl_fd);
if (ssl) if (ssl)
{ {
buf[0]= 0; enum enum_ssl_init_error ssl_init_error= SSL_INITERR_NOERROR;
if (!(ssl_fd= new_VioSSLConnectorFd(0, 0, 0, 0, 0)) || ulong ssl_error= 0;
ssl_connect(ssl_fd, vio, send_timeout, buf)) if (!(ssl_fd= new_VioSSLConnectorFd(0, 0, 0, 0, 0, &ssl_init_error)) ||
sslconnect(ssl_fd, vio, send_timeout, &ssl_error))
{ {
const char *err;
if (ssl_init_error != SSL_INITERR_NOERROR)
err= sslGetErrString(ssl_init_error);
else
{
ERR_error_string_n(ssl_error, buf, sizeof(buf));
buf[sizeof(buf)-1]= 0;
err= buf;
}
sql_print_error("feedback plugin: ssl failed for url '%s' %s", sql_print_error("feedback plugin: ssl failed for url '%s' %s",
full_url.str, buf); full_url.str, err);
if (ssl_fd) if (ssl_fd)
free_vio_ssl_acceptor_fd(ssl_fd); free_vio_ssl_acceptor_fd(ssl_fd);
closesocket(fd); closesocket(fd);
...@@ -296,7 +301,7 @@ int Url_http::send(const char* data, size_t data_length) ...@@ -296,7 +301,7 @@ int Url_http::send(const char* data, size_t data_length)
if (ssl) if (ssl)
{ {
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd, MYF(0)); my_free(ssl_fd);
} }
#endif #endif
......
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