HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix

Compilation correction after MDEV-33420.
This commit is contained in:
Julius Goryavsky 2024-04-20 03:51:31 +02:00
commit 8fd515e0d2
2 changed files with 11 additions and 2 deletions

View file

@ -1,16 +1,21 @@
FIND_PACKAGE(CURL)
IF(NOT CURL_FOUND)
# Can't build plugin
MESSAGE_ONCE(WARNING "Hashicorp Key Management plugin requires curl development package")
RETURN()
ENDIF()
SET_PACKAGE_PROPERTIES(CURL PROPERTIES TYPE REQUIRED)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
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::libcurl
LINK_LIBRARIES ${CURL_LIBRARIES}
CONFIG hashicorp_key_management.cnf
COMPONENT hashicorp-key-management
MODULE_ONLY)

View file

@ -987,7 +987,11 @@ int HCData::init ()
bool not_equal= token_env != NULL && strcmp(token_env, token) != 0;
if (token_env == NULL || not_equal)
{
setenv("VAULT_TOKEN", token, 1);
#if defined(HAVE_SETENV) || !defined(_WIN32)
setenv("VAULT_TOKEN", token, 1);
#else
_putenv_s("VAULT_TOKEN", token);
#endif
if (not_equal)
{
my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER