Merge pull request #1833 from TheAssailant/patch-1

Use `random_bytes` if available in postfix plugin
This commit is contained in:
RainLoop Team 2019-03-28 01:14:02 +03:00 committed by GitHub
commit d717b96800
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,7 +286,11 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass
private function cryptPassword($sPassword, $oPdo)
{
$sResult = '';
$sSalt = substr(str_shuffle('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), 0, 16);
if (function_exists('random_bytes')) {
$sSalt = substr(base64_encode(random_bytes(32)), 0, 16);
} else {
$sSalt = substr(str_shuffle('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), 0, 16);
}
switch (strtolower($this->sEncrypt))
{
default: