diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-11-06 18:09:26 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-11-06 18:09:26 +0100 |
commit | 0380b0e28034c8e5778e37540478f61d3d74a0bc (patch) | |
tree | 0352367fe9a101552fccf5e0d11e5e8824931467 /plugin | |
parent | 00e7915f35af84b96ce56c523e18d82abb1d0f93 (diff) | |
download | mariadb-git-0380b0e28034c8e5778e37540478f61d3d74a0bc.tar.gz |
build feedback plugin with ssl (changes for cmake).
fix the ssl related code to use newer function prototypes
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/feedback/CMakeLists.txt | 12 | ||||
-rw-r--r-- | plugin/feedback/url_http.cc | 27 |
2 files changed, 24 insertions, 15 deletions
diff --git a/plugin/feedback/CMakeLists.txt b/plugin/feedback/CMakeLists.txt index 627e4d643fb..3e14ef3918b 100644 --- a/plugin/feedback/CMakeLists.txt +++ b/plugin/feedback/CMakeLists.txt @@ -1,9 +1,11 @@ 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 url_base.cc url_http.cc utils.cc) +ADD_DEFINITIONS(${SSL_DEFINES}) + INCLUDE (CheckIncludeFiles) CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H) IF(HAVE_NETDB_H) @@ -11,8 +13,10 @@ IF(HAVE_NETDB_H) ENDIF(HAVE_NETDB_H) IF(WIN32) - #SET(FEEDBACK_LIBS Ws2_32) - MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY DEFAULT) + MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} + LINK_LIBRARIES ${SSL_LIBRARIES} + STATIC_ONLY DEFAULT) ELSE(WIN32) - MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}) + MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} + LINK_LIBRARIES ${SSL_LIBRARIES}) ENDIF(WIN32) diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc index a9d4c5bbbaf..da751810de0 100644 --- a/plugin/feedback/url_http.cc +++ b/plugin/feedback/url_http.cc @@ -29,12 +29,6 @@ namespace feedback { static const uint FOR_READING= 0; 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. @@ -199,12 +193,23 @@ int Url_http::send(const char* data, size_t data_length) struct st_VioSSLFd *UNINIT_VAR(ssl_fd); if (ssl) { - buf[0]= 0; - if (!(ssl_fd= new_VioSSLConnectorFd(0, 0, 0, 0, 0)) || - ssl_connect(ssl_fd, vio, send_timeout, buf)) + enum enum_ssl_init_error ssl_init_error= SSL_INITERR_NOERROR; + ulong ssl_error= 0; + 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", - full_url.str, buf); + full_url.str, err); if (ssl_fd) free_vio_ssl_acceptor_fd(ssl_fd); closesocket(fd); @@ -296,7 +301,7 @@ int Url_http::send(const char* data, size_t data_length) if (ssl) { SSL_CTX_free(ssl_fd->ssl_context); - my_free(ssl_fd, MYF(0)); + my_free(ssl_fd); } #endif |