mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
add unit test for https://github.com/postfixadmin/postfixadmin/issues/647
This commit is contained in:
parent
b1b4324a5b
commit
6f3c5a73ad
@ -276,6 +276,30 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/postfixadmin/postfixadmin/issues/647
|
||||
*/
|
||||
public function testSha512B64SupportsMd5CryptMigration()
|
||||
{
|
||||
global $CONF;
|
||||
|
||||
Config::write('encrypt', 'sha512.b64');
|
||||
$CONF['encrypt'] = 'sha512.b64';
|
||||
|
||||
$x = pacrypt('test123');
|
||||
|
||||
$this->assertRegExp('/^\{SHA512-CRYPT\.B64/', $x);
|
||||
$this->assertTrue(strlen($x) > 50);
|
||||
|
||||
$this->assertEquals($x, pacrypt('test123', $x));
|
||||
|
||||
// while we're configured for SHA512-CRYPT.B64, we still support MD5-CRYPT format ...
|
||||
$md5crypt = '{MD5-CRYPT}$1$c9809462$fC8eUPU2lq7arWRvxChMu1';
|
||||
|
||||
$x = pacrypt('test123', $md5crypt);
|
||||
$this->assertEquals($x, $md5crypt);
|
||||
}
|
||||
|
||||
public function testObviousMechanisms()
|
||||
{
|
||||
global $CONF;
|
||||
|
Loading…
Reference in New Issue
Block a user