From eba6c0c5962f442d9706227a5408aab777a440c6 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 2 May 2018 15:41:03 +0300 Subject: [PATCH] MXS-1842 Compile all authenticators as C++ Minimal changes, only what is needed to compile. --- .../authenticator/CDCPlainAuth/CMakeLists.txt | 2 +- .../{cdc_plain_auth.c => cdc_plain_auth.cc} | 6 +++++- server/modules/authenticator/CMakeLists.txt | 2 +- .../authenticator/GSSAPI/GSSAPIAuth/CMakeLists.txt | 2 +- .../GSSAPIAuth/{gssapi_auth.c => gssapi_auth.cc} | 14 +++++++++----- .../GSSAPI/GSSAPIBackendAuth/CMakeLists.txt | 2 +- ...ssapi_backend_auth.c => gssapi_backend_auth.cc} | 8 ++++++-- ...{gssapi_auth_common.c => gssapi_auth_common.cc} | 0 .../modules/authenticator/HTTPAuth/CMakeLists.txt | 2 +- .../HTTPAuth/{http_auth.c => http_auth.cc} | 5 ++++- .../authenticator/MaxAdminAuth/CMakeLists.txt | 2 +- .../{max_admin_auth.c => max_admin_auth.cc} | 3 +++ .../modules/authenticator/MySQLAuth/CMakeLists.txt | 2 +- .../MySQLAuth/{dbusers.c => dbusers.cc} | 8 ++++---- .../MySQLAuth/{mysql_auth.c => mysql_auth.cc} | 12 +++++++++--- .../authenticator/MySQLBackendAuth/CMakeLists.txt | 2 +- ...{mysql_backend_auth.c => mysql_backend_auth.cc} | 5 ++++- .../authenticator/NullAuthAllow/CMakeLists.txt | 2 +- .../{null_auth_allow.c => null_auth_allow.cc} | 3 +++ .../authenticator/NullAuthDeny/CMakeLists.txt | 2 +- .../{null_auth_deny.c => null_auth_deny.cc} | 3 +++ .../modules/authenticator/PAM/PAMAuth/pam_auth.cc | 6 ++++-- .../PAM/PAMBackendAuth/pam_backend_auth.cc | 6 ++++-- 23 files changed, 68 insertions(+), 31 deletions(-) rename server/modules/authenticator/CDCPlainAuth/{cdc_plain_auth.c => cdc_plain_auth.cc} (99%) rename server/modules/authenticator/GSSAPI/GSSAPIAuth/{gssapi_auth.c => gssapi_auth.cc} (97%) rename server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/{gssapi_backend_auth.c => gssapi_backend_auth.cc} (97%) rename server/modules/authenticator/GSSAPI/{gssapi_auth_common.c => gssapi_auth_common.cc} (100%) rename server/modules/authenticator/HTTPAuth/{http_auth.c => http_auth.cc} (98%) rename server/modules/authenticator/MaxAdminAuth/{max_admin_auth.c => max_admin_auth.cc} (99%) rename server/modules/authenticator/MySQLAuth/{dbusers.c => dbusers.cc} (99%) rename server/modules/authenticator/MySQLAuth/{mysql_auth.c => mysql_auth.cc} (98%) rename server/modules/authenticator/MySQLBackendAuth/{mysql_backend_auth.c => mysql_backend_auth.cc} (97%) rename server/modules/authenticator/NullAuthAllow/{null_auth_allow.c => null_auth_allow.cc} (99%) rename server/modules/authenticator/NullAuthDeny/{null_auth_deny.c => null_auth_deny.cc} (99%) diff --git a/server/modules/authenticator/CDCPlainAuth/CMakeLists.txt b/server/modules/authenticator/CDCPlainAuth/CMakeLists.txt index 457c87044..f347a2cf1 100644 --- a/server/modules/authenticator/CDCPlainAuth/CMakeLists.txt +++ b/server/modules/authenticator/CDCPlainAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(cdcplainauth SHARED cdc_plain_auth.c) +add_library(cdcplainauth SHARED cdc_plain_auth.cc) target_link_libraries(cdcplainauth maxscale-common) set_target_properties(cdcplainauth PROPERTIES VERSION "1.0.0") install_module(cdcplainauth core) diff --git a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc similarity index 99% rename from server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c rename to server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc index 262cc548c..f68d9658a 100644 --- a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c +++ b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc @@ -107,7 +107,7 @@ static bool cdc_add_new_user(const MODULECMD_ARG *args, json_t** output) if (fd != -1) { - if (write(fd, final_data, sizeof(final_data)) == sizeof(final_data)) + if (write(fd, final_data, sizeof(final_data)) == static_cast(sizeof(final_data))) { MXS_NOTICE("Added user '%s' to service '%s'", user, service->name); rval = true; @@ -137,6 +137,8 @@ static bool cdc_add_new_user(const MODULECMD_ARG *args, json_t** output) return rval; } +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -192,6 +194,8 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } +} + /** * @brief Function to easily call authentication check. * diff --git a/server/modules/authenticator/CMakeLists.txt b/server/modules/authenticator/CMakeLists.txt index 3ac008644..695d3d6b1 100644 --- a/server/modules/authenticator/CMakeLists.txt +++ b/server/modules/authenticator/CMakeLists.txt @@ -3,11 +3,11 @@ if(BUILD_CDC) endif() add_subdirectory(GSSAPI) -add_subdirectory(PAM) add_subdirectory(HTTPAuth) add_subdirectory(MaxAdminAuth) add_subdirectory(MySQLAuth) add_subdirectory(MySQLBackendAuth) add_subdirectory(NullAuthAllow) add_subdirectory(NullAuthDeny) +add_subdirectory(PAM) diff --git a/server/modules/authenticator/GSSAPI/GSSAPIAuth/CMakeLists.txt b/server/modules/authenticator/GSSAPI/GSSAPIAuth/CMakeLists.txt index a94d9d8f5..e0de53327 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIAuth/CMakeLists.txt +++ b/server/modules/authenticator/GSSAPI/GSSAPIAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(gssapiauth SHARED gssapi_auth.c ../gssapi_auth_common.c) +add_library(gssapiauth SHARED gssapi_auth.cc ../gssapi_auth_common.cc) target_link_libraries(gssapiauth maxscale-common ${GSSAPI_LIBS} ${SQLITE_LIBRARIES} mysqlcommon) set_target_properties(gssapiauth PROPERTIES VERSION "1.0.0") install_module(gssapiauth core) diff --git a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc similarity index 97% rename from server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c rename to server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc index 2fb3f9a3a..ea472ad92 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c +++ b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc @@ -106,7 +106,7 @@ typedef struct gssapi_instance */ void* gssapi_auth_init(char **options) { - GSSAPI_INSTANCE *instance = MXS_MALLOC(sizeof(GSSAPI_INSTANCE)); + GSSAPI_INSTANCE *instance = static_cast(MXS_MALLOC(sizeof(GSSAPI_INSTANCE))); if (instance) { @@ -162,7 +162,7 @@ void* gssapi_auth_init(char **options) void* gssapi_auth_alloc(void *instance) { - gssapi_auth_t* rval = MXS_MALLOC(sizeof(gssapi_auth_t)); + gssapi_auth_t* rval = static_cast(MXS_MALLOC(sizeof(gssapi_auth_t))); if (rval) { @@ -250,7 +250,7 @@ bool store_client_token(DCB *dcb, GWBUF *buffer) size_t plen = gw_mysql_get_byte3(hdr); MYSQL_session *ses = (MYSQL_session*)dcb->data; - if ((ses->auth_token = MXS_MALLOC(plen))) + if ((ses->auth_token = static_cast(MXS_MALLOC(plen)))) { gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, plen, ses->auth_token); ses->auth_token_len = plen; @@ -384,7 +384,7 @@ static bool validate_gssapi_token(char* principal, uint8_t* token, size_t len, c return false; } - char *princ_name = MXS_MALLOC(client_name.length + 1); + char *princ_name = static_cast(MXS_MALLOC(client_name.length + 1)); if (!princ_name) { @@ -515,7 +515,7 @@ void gssapi_auth_free_data(DCB *dcb) { if (dcb->data) { - MYSQL_session *ses = dcb->data; + MYSQL_session *ses = static_cast(dcb->data); MXS_FREE(ses->auth_token); MXS_FREE(ses); dcb->data = NULL; @@ -667,6 +667,8 @@ int gssapi_auth_load_users(SERV_LISTENER *listener) return rval; } +extern "C" +{ /** * Module handle entry point */ @@ -705,3 +707,5 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } + +} diff --git a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/CMakeLists.txt b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/CMakeLists.txt index 98b1a81e0..33de2f509 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/CMakeLists.txt +++ b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(gssapibackendauth SHARED gssapi_backend_auth.c ../gssapi_auth_common.c) +add_library(gssapibackendauth SHARED gssapi_backend_auth.cc ../gssapi_auth_common.cc) target_link_libraries(gssapibackendauth maxscale-common ${GSSAPI_LIBS} mysqlcommon) set_target_properties(gssapibackendauth PROPERTIES VERSION "1.0.0") install_module(gssapibackendauth core) diff --git a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc similarity index 97% rename from server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c rename to server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc index a2340277c..7d7ae629c 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c +++ b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc @@ -28,7 +28,7 @@ void* gssapi_backend_auth_alloc(void *instance) { - gssapi_auth_t* rval = MXS_MALLOC(sizeof(gssapi_auth_t)); + gssapi_auth_t* rval = static_cast(MXS_MALLOC(sizeof(gssapi_auth_t))); if (rval) { @@ -176,7 +176,7 @@ bool extract_principal_name(DCB *dcb, GWBUF *buffer) if (buflen > 0) { - uint8_t *principal = MXS_MALLOC(buflen + 1); + uint8_t *principal = static_cast(MXS_MALLOC(buflen + 1)); if (principal) { @@ -264,6 +264,8 @@ static int gssapi_backend_auth_authenticate(DCB *dcb) return rval; } +extern "C" +{ /** * Module handle entry point */ @@ -302,3 +304,5 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } + +} diff --git a/server/modules/authenticator/GSSAPI/gssapi_auth_common.c b/server/modules/authenticator/GSSAPI/gssapi_auth_common.cc similarity index 100% rename from server/modules/authenticator/GSSAPI/gssapi_auth_common.c rename to server/modules/authenticator/GSSAPI/gssapi_auth_common.cc diff --git a/server/modules/authenticator/HTTPAuth/CMakeLists.txt b/server/modules/authenticator/HTTPAuth/CMakeLists.txt index 8bfcfe844..2ec18a4fd 100644 --- a/server/modules/authenticator/HTTPAuth/CMakeLists.txt +++ b/server/modules/authenticator/HTTPAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(httpauth SHARED http_auth.c) +add_library(httpauth SHARED http_auth.cc) target_link_libraries(httpauth maxscale-common) set_target_properties(httpauth PROPERTIES VERSION "1.0.0") install_module(httpauth core) diff --git a/server/modules/authenticator/HTTPAuth/http_auth.c b/server/modules/authenticator/HTTPAuth/http_auth.cc similarity index 98% rename from server/modules/authenticator/HTTPAuth/http_auth.c rename to server/modules/authenticator/HTTPAuth/http_auth.cc index 32f6ba186..3c644f06a 100644 --- a/server/modules/authenticator/HTTPAuth/http_auth.c +++ b/server/modules/authenticator/HTTPAuth/http_auth.cc @@ -47,6 +47,8 @@ typedef struct http_auth char* pw; } HTTP_AUTH; +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -91,6 +93,7 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } /*lint +e14 */ +} /** * @brief Authentication of a user/password combination. @@ -153,7 +156,7 @@ http_auth_set_protocol_data(DCB *dcb, GWBUF *buf) if (pw_start) { *pw_start++ = '\0'; - HTTP_AUTH *ses = MXS_MALLOC(sizeof(*ses)); + HTTP_AUTH *ses = static_cast(MXS_MALLOC(sizeof(*ses))); char* user = MXS_STRDUP(outbuf); char* pw = MXS_STRDUP(pw_start); diff --git a/server/modules/authenticator/MaxAdminAuth/CMakeLists.txt b/server/modules/authenticator/MaxAdminAuth/CMakeLists.txt index 6ea6328dc..d03570a06 100644 --- a/server/modules/authenticator/MaxAdminAuth/CMakeLists.txt +++ b/server/modules/authenticator/MaxAdminAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(maxadminauth SHARED max_admin_auth.c) +add_library(maxadminauth SHARED max_admin_auth.cc) target_link_libraries(maxadminauth maxscale-common) set_target_properties(maxadminauth PROPERTIES VERSION "1.0.0") install_module(maxadminauth core) diff --git a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc similarity index 99% rename from server/modules/authenticator/MaxAdminAuth/max_admin_auth.c rename to server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc index 8c9412061..3b8a1a0e4 100644 --- a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c +++ b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc @@ -41,6 +41,8 @@ static bool max_admin_auth_is_client_ssl_capable(DCB *dcb); static int max_admin_auth_authenticate(DCB *dcb); static void max_admin_auth_free_client_data(DCB *dcb); +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -85,6 +87,7 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } /*lint +e14 */ +} /** * @brief Authentication of a user/password combination. diff --git a/server/modules/authenticator/MySQLAuth/CMakeLists.txt b/server/modules/authenticator/MySQLAuth/CMakeLists.txt index d6ac92947..cd451d1aa 100644 --- a/server/modules/authenticator/MySQLAuth/CMakeLists.txt +++ b/server/modules/authenticator/MySQLAuth/CMakeLists.txt @@ -1,7 +1,7 @@ if(SQLITE_VERSION VERSION_LESS 3.3) message(FATAL_ERROR "SQLite version 3.3 or higher is required") else() - add_library(mysqlauth SHARED mysql_auth.c dbusers.c) + add_library(mysqlauth SHARED mysql_auth.cc dbusers.cc) target_link_libraries(mysqlauth maxscale-common mysqlcommon) set_target_properties(mysqlauth PROPERTIES VERSION "1.0.0") install_module(mysqlauth core) diff --git a/server/modules/authenticator/MySQLAuth/dbusers.c b/server/modules/authenticator/MySQLAuth/dbusers.cc similarity index 99% rename from server/modules/authenticator/MySQLAuth/dbusers.c rename to server/modules/authenticator/MySQLAuth/dbusers.cc index 66288f887..015fc7d56 100644 --- a/server/modules/authenticator/MySQLAuth/dbusers.c +++ b/server/modules/authenticator/MySQLAuth/dbusers.cc @@ -62,7 +62,7 @@ static char* get_new_users_query(const char *server_version, bool include_root) const char *with_root = include_root ? "" : " AND u.user NOT IN ('root')"; size_t n_bytes = snprintf(NULL, 0, NEW_LOAD_DBUSERS_QUERY, password, with_root, password, with_root); - char *rval = MXS_MALLOC(n_bytes + 1); + char *rval = static_cast(MXS_MALLOC(n_bytes + 1)); if (rval) { @@ -536,12 +536,12 @@ static bool check_server_permissions(SERVICE *service, SERVER* server, mxs_mysql_set_server_version(mysql, server); } - const char *template = "SELECT user, host, %s, Select_priv FROM mysql.user limit 1"; + const char* format = "SELECT user, host, %s, Select_priv FROM mysql.user limit 1"; const char* query_pw = strstr(server->version_string, "5.7.") ? MYSQL57_PASSWORD : MYSQL_PASSWORD; - char query[strlen(template) + strlen(query_pw) + 1]; + char query[strlen(format) + strlen(query_pw) + 1]; bool rval = true; - sprintf(query, template, query_pw); + sprintf(query, format, query_pw); if (mxs_mysql_query(mysql, query) != 0) { diff --git a/server/modules/authenticator/MySQLAuth/mysql_auth.c b/server/modules/authenticator/MySQLAuth/mysql_auth.cc similarity index 98% rename from server/modules/authenticator/MySQLAuth/mysql_auth.c rename to server/modules/authenticator/MySQLAuth/mysql_auth.cc index 7a4635aee..3c3d8f456 100644 --- a/server/modules/authenticator/MySQLAuth/mysql_auth.c +++ b/server/modules/authenticator/MySQLAuth/mysql_auth.cc @@ -66,6 +66,9 @@ int mysql_auth_reauthenticate(DCB *dcb, const char *user, uint8_t *token, size_t token_len, uint8_t *scramble, size_t scramble_len, uint8_t *output_token, size_t output_token_len); + +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -110,6 +113,8 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } +} + static bool open_instance_database(const char *path, sqlite3 **handle) { int rc = sqlite3_open_v2(path, handle, db_flags, NULL); @@ -170,9 +175,10 @@ static bool should_check_permissions(MYSQL_AUTH* instance) */ static void* mysql_auth_init(char **options) { - MYSQL_AUTH *instance = MXS_MALLOC(sizeof(*instance)); + MYSQL_AUTH *instance = static_cast(MXS_MALLOC(sizeof(*instance))); - if (instance && (instance->handles = MXS_CALLOC(config_threadcount(), sizeof(sqlite3*)))) + if (instance && + (instance->handles = static_cast(MXS_CALLOC(config_threadcount(), sizeof(sqlite3*))))) { bool error = false; instance->cache_dir = NULL; @@ -404,7 +410,7 @@ mysql_auth_set_client_data( MySQLProtocol *protocol, GWBUF *buffer) { - size_t client_auth_packet_size = gwbuf_length(buffer); + int client_auth_packet_size = gwbuf_length(buffer); uint8_t client_auth_packet[client_auth_packet_size]; gwbuf_copy_data(buffer, 0, client_auth_packet_size, client_auth_packet); diff --git a/server/modules/authenticator/MySQLBackendAuth/CMakeLists.txt b/server/modules/authenticator/MySQLBackendAuth/CMakeLists.txt index 26880ed36..de84e2fb2 100644 --- a/server/modules/authenticator/MySQLBackendAuth/CMakeLists.txt +++ b/server/modules/authenticator/MySQLBackendAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(mysqlbackendauth SHARED mysql_backend_auth.c) +add_library(mysqlbackendauth SHARED mysql_backend_auth.cc) target_link_libraries(mysqlbackendauth maxscale-common mysqlcommon) set_target_properties(mysqlbackendauth PROPERTIES VERSION "1.0.0") install_module(mysqlbackendauth core) diff --git a/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c b/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.cc similarity index 97% rename from server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c rename to server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.cc index 3f02d6674..21f49877a 100644 --- a/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c +++ b/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.cc @@ -50,7 +50,7 @@ typedef struct mysql_backend_auth */ void* auth_backend_create(void *instance) { - mysql_backend_auth_t* mba = MXS_MALLOC(sizeof(*mba)); + mysql_backend_auth_t* mba = static_cast(MXS_MALLOC(sizeof(*mba))); if (mba) { @@ -143,6 +143,8 @@ static bool auth_backend_ssl(DCB *dcb) return dcb->server->server_ssl != NULL; } +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -189,3 +191,4 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } /*lint +e14 */ +} diff --git a/server/modules/authenticator/NullAuthAllow/CMakeLists.txt b/server/modules/authenticator/NullAuthAllow/CMakeLists.txt index fb1ee7e2f..d8c23b831 100644 --- a/server/modules/authenticator/NullAuthAllow/CMakeLists.txt +++ b/server/modules/authenticator/NullAuthAllow/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(nullauthallow SHARED null_auth_allow.c) +add_library(nullauthallow SHARED null_auth_allow.cc) target_link_libraries(nullauthallow maxscale-common mysqlcommon) set_target_properties(nullauthallow PROPERTIES VERSION "1.0.0") install_module(nullauthallow core) diff --git a/server/modules/authenticator/NullAuthAllow/null_auth_allow.c b/server/modules/authenticator/NullAuthAllow/null_auth_allow.cc similarity index 99% rename from server/modules/authenticator/NullAuthAllow/null_auth_allow.c rename to server/modules/authenticator/NullAuthAllow/null_auth_allow.cc index 66768fd37..131e61d63 100644 --- a/server/modules/authenticator/NullAuthAllow/null_auth_allow.c +++ b/server/modules/authenticator/NullAuthAllow/null_auth_allow.cc @@ -43,6 +43,8 @@ static bool null_auth_is_client_ssl_capable(DCB *dcb); static int null_auth_authenticate(DCB *dcb); static void null_auth_free_client_data(DCB *dcb); +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -89,6 +91,7 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } /*lint +e14 */ +} /** * @brief Null authentication of a user. diff --git a/server/modules/authenticator/NullAuthDeny/CMakeLists.txt b/server/modules/authenticator/NullAuthDeny/CMakeLists.txt index d3650588c..d3b37cab2 100644 --- a/server/modules/authenticator/NullAuthDeny/CMakeLists.txt +++ b/server/modules/authenticator/NullAuthDeny/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(nullauthdeny SHARED null_auth_deny.c) +add_library(nullauthdeny SHARED null_auth_deny.cc) target_link_libraries(nullauthdeny maxscale-common) set_target_properties(nullauthdeny PROPERTIES VERSION "1.0.0") install_module(nullauthdeny core) diff --git a/server/modules/authenticator/NullAuthDeny/null_auth_deny.c b/server/modules/authenticator/NullAuthDeny/null_auth_deny.cc similarity index 99% rename from server/modules/authenticator/NullAuthDeny/null_auth_deny.c rename to server/modules/authenticator/NullAuthDeny/null_auth_deny.cc index 46b1ab7bc..bb2657ad7 100644 --- a/server/modules/authenticator/NullAuthDeny/null_auth_deny.c +++ b/server/modules/authenticator/NullAuthDeny/null_auth_deny.cc @@ -40,6 +40,8 @@ static bool null_auth_is_client_ssl_capable(DCB *dcb); static int null_auth_authenticate(DCB *dcb); static void null_auth_free_client_data(DCB *dcb); +extern "C" +{ /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -86,6 +88,7 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } /*lint +e14 */ +} /** * @brief Null authentication of a user. diff --git a/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc b/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc index 4c5e5d56d..731427668 100644 --- a/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc +++ b/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc @@ -152,7 +152,8 @@ static json_t* pam_auth_diagnostic_json(const SERV_LISTENER *listener) return inst->diagnostic_json(); } -MXS_BEGIN_DECLS +extern "C" +{ /** * Module handle entry point */ @@ -191,4 +192,5 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } -MXS_END_DECLS + +} diff --git a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc index 81ada76bf..4d9f09f28 100644 --- a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc +++ b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc @@ -71,7 +71,8 @@ static int pam_backend_auth_authenticate(DCB *dcb) return pses->authenticate(dcb); } -MXS_BEGIN_DECLS +extern "C" +{ /** * Module handle entry point */ @@ -110,4 +111,5 @@ MXS_MODULE* MXS_CREATE_MODULE() return &info; } -MXS_END_DECLS + +}