MXS-1662: Move mxs_crypt into utils
Moved the mxs_crypt function into utils and renamed to mxs::crypt (no C code used it).
This commit is contained in:
@ -421,23 +421,6 @@ bool admin_linux_account_enabled(const char* uname)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define MXS_CRYPT_SIZE 60
|
||||
|
||||
void mxs_crypt(const char* password, const char* salt, char* output)
|
||||
{
|
||||
#if HAVE_GLIBC
|
||||
struct crypt_data cdata;
|
||||
cdata.initialized = 0;
|
||||
char* pw = crypt_r(password, salt, &cdata);
|
||||
snprintf(output, MXS_CRYPT_SIZE, "%s", pw);
|
||||
#else
|
||||
static std::mutex mxs_crypt_lock;
|
||||
std::lock_guard<std::mutex> guard(mxs_crypt_lock);
|
||||
char* pw = crypt(password, salt);
|
||||
snprintf(output, MXS_CRYPT_SIZE, "%s", pw);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Add insecure remote (network) basic user.
|
||||
*
|
||||
|
Reference in New Issue
Block a user