diff --git a/plugin/hashicorp_key_management/CMakeLists.txt b/plugin/hashicorp_key_management/CMakeLists.txt index bd1eee844ab90..bef7e65be2715 100644 --- a/plugin/hashicorp_key_management/CMakeLists.txt +++ b/plugin/hashicorp_key_management/CMakeLists.txt @@ -1,18 +1,16 @@ -INCLUDE(FindCURL) +FIND_PACKAGE(CURL) IF(NOT CURL_FOUND) # Can't build plugin RETURN() ENDIF() -INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) - set(CPACK_RPM_hashicorp-key-management_PACKAGE_SUMMARY "Hashicorp Key Management plugin for MariaDB" PARENT_SCOPE) set(CPACK_RPM_hashicorp-key-management_PACKAGE_DESCRIPTION "This encryption plugin uses Hashicorp Vault for storing encryption keys for MariaDB Data-at-Rest encryption." PARENT_SCOPE) MYSQL_ADD_PLUGIN(HASHICORP_KEY_MANAGEMENT hashicorp_key_management_plugin.cc - LINK_LIBRARIES ${CURL_LIBRARIES} + LINK_LIBRARIES CURL::libcurl CONFIG hashicorp_key_management.cnf COMPONENT hashicorp-key-management MODULE_ONLY) diff --git a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc index bdc2f7345f1aa..3365346fdf950 100644 --- a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc +++ b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc @@ -29,12 +29,6 @@ #include #include -#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) -#define HASHICORP_HAVE_EXCEPTIONS 1 -#else -#define HASHICORP_HAVE_EXCEPTIONS 0 -#endif - #define HASHICORP_DEBUG_LOGGING 0 #define PLUGIN_ERROR_HEADER "hashicorp: " @@ -209,15 +203,6 @@ unsigned int if (key_version == ENCRYPTION_KEY_VERSION_INVALID) { clock_t timestamp; -#if HASHICORP_HAVE_EXCEPTIONS - try - { - VER_INFO &ver_info = latest_version_cache.at(key_id); - version = ver_info.key_version; - timestamp = ver_info.timestamp; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { @@ -225,7 +210,6 @@ unsigned int timestamp = ver_iter->second.timestamp; } else -#endif { mtx.unlock(); return ENCRYPTION_KEY_VERSION_INVALID; @@ -246,13 +230,6 @@ unsigned int } } KEY_INFO info; -#if HASHICORP_HAVE_EXCEPTIONS - try - { - info = key_info_cache.at(KEY_ID_AND_VERSION(key_id, version)); - } - catch (const std::out_of_range &e) -#else KEY_MAP::const_iterator key_iter = key_info_cache.find(KEY_ID_AND_VERSION(key_id, version)); if (key_iter != key_info_cache.end()) @@ -260,7 +237,6 @@ unsigned int info = key_iter->second; } else -#endif { mtx.unlock(); return ENCRYPTION_KEY_VERSION_INVALID; @@ -305,20 +281,12 @@ unsigned int HCData::cache_get_version (unsigned int key_id) { unsigned int version; mtx.lock(); -#if HASHICORP_HAVE_EXCEPTIONS - try - { - version = latest_version_cache.at(key_id).key_version; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { version = ver_iter->second.key_version; } else -#endif { version = ENCRYPTION_KEY_VERSION_INVALID; } @@ -331,15 +299,6 @@ unsigned int HCData::cache_check_version (unsigned int key_id) unsigned int version; clock_t timestamp; mtx.lock(); -#if HASHICORP_HAVE_EXCEPTIONS - try - { - VER_INFO &ver_info = latest_version_cache.at(key_id); - version = ver_info.key_version; - timestamp = ver_info.timestamp; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { @@ -347,7 +306,6 @@ unsigned int HCData::cache_check_version (unsigned int key_id) timestamp = ver_iter->second.timestamp; } else -#endif { mtx.unlock(); #if HASHICORP_DEBUG_LOGGING @@ -978,29 +936,6 @@ struct st_mariadb_encryption hashicorp_key_management_plugin= { 0, 0, 0, 0, 0 }; -#ifdef _MSC_VER - -static int setenv (const char *name, const char *value, int overwrite) -{ - if (!overwrite) - { - size_t len= 0; - int rc= getenv_s(&len, NULL, 0, name); - if (rc) - { - return rc; - } - if (len) - { - errno = EINVAL; - return EINVAL; - } - } - return _putenv_s(name, value); -} - -#endif - #define MAX_URL_SIZE 32768 int HCData::init () diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 79a638b9d5afa..3cc8cee88d02c 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -53,7 +53,7 @@ add_component(Backup DESCRIPTION "Installs backup utilities(mariabackup and mbstream)") #Miscellaneous hidden components, part of server / or client programs -foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine) +foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine plugin-hashicorp-key-management) add_component(${comp} GROUP MySQLServer HIDDEN) endforeach()