composer format ...

pull/142/head
David Goodwin 7 years ago
parent 6446f3f6cc
commit b79ad2ae28

@ -902,7 +902,6 @@ function _pacrypt_md5crypt($pw, $pw_db) {
} }
function _pacrypt_crypt($pw, $pw_db) { function _pacrypt_crypt($pw, $pw_db) {
if ($pw_db) { if ($pw_db) {
return crypt($pw, $pw_db); return crypt($pw, $pw_db);
} }
@ -1061,11 +1060,11 @@ function pacrypt($pw, $pw_db="") {
return _pacrypt_md5crypt($pw, $pw_db); return _pacrypt_md5crypt($pw, $pw_db);
case 'md5': case 'md5':
return md5($pw); return md5($pw);
case 'system' : case 'system':
return _pacrypt_crypt($pw, $pw_db); return _pacrypt_crypt($pw, $pw_db);
case 'cleartext' : case 'cleartext':
return $pw; return $pw;
case 'mysql_encrypt' : case 'mysql_encrypt':
return _pacrypt_mysql_encrypt($pw, $pw_db); return _pacrypt_mysql_encrypt($pw, $pw_db);
case 'authlib': case 'authlib':
return _pacrypt_authlib($pw, $pw_db); return _pacrypt_authlib($pw, $pw_db);
@ -1076,7 +1075,6 @@ function pacrypt($pw, $pw_db="") {
} }
die('unknown/invalid $CONF["encrypt"] setting: ' . $CONF['encrypt']); die('unknown/invalid $CONF["encrypt"] setting: ' . $CONF['encrypt']);
} }
// //

@ -3,7 +3,6 @@
require_once('common.php'); require_once('common.php');
class PaCryptTest extends PHPUnit_Framework_TestCase { class PaCryptTest extends PHPUnit_Framework_TestCase {
public function testMd5Crypt() { public function testMd5Crypt() {
$hash = _pacrypt_md5crypt('test', ''); $hash = _pacrypt_md5crypt('test', '');
@ -23,11 +22,10 @@ class PaCryptTest extends PHPUnit_Framework_TestCase {
$this->assertNotEquals('test', $hash); $this->assertNotEquals('test', $hash);
$this->assertEquals($hash, _pacrypt_crypt('test', $hash)); $this->assertEquals($hash, _pacrypt_crypt('test', $hash));
} }
public function testMySQLEncrypt() { public function testMySQLEncrypt() {
if(!db_mysql()) { if (!db_mysql()) {
$this->markTestSkipped('Not using MySQL'); $this->markTestSkipped('Not using MySQL');
} }
@ -49,25 +47,24 @@ class PaCryptTest extends PHPUnit_Framework_TestCase {
public function testAuthlib() { public function testAuthlib() {
// too many options! // too many options!
foreach( foreach (
['md5raw' => '098f6bcd4621d373cade4e832627b4f6', ['md5raw' => '098f6bcd4621d373cade4e832627b4f6',
'md5' => 'CY9rzUYh03PK3k6DJie09g==', 'md5' => 'CY9rzUYh03PK3k6DJie09g==',
// crypt requires salt ... // crypt requires salt ...
'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) { 'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) {
$CONF['authlib_default_flavour'] = $flavour; $CONF['authlib_default_flavour'] = $flavour;
$stored = "{" . $flavour . "}$hash"; $stored = "{" . $flavour . "}$hash";
$hash = _pacrypt_authlib('test', $stored); $hash = _pacrypt_authlib('test', $stored);
$this->assertEquals($hash, $stored, "Hash: $hash vs Stored: $stored" ); $this->assertEquals($hash, $stored, "Hash: $hash vs Stored: $stored");
//var_dump("Hash: $hash from $flavour"); //var_dump("Hash: $hash from $flavour");
} }
} }
public function testPacryptDovecot() { public function testPacryptDovecot() {
global $CONF; global $CONF;
if(!file_exists('/usr/bin/doveadm')) { if (!file_exists('/usr/bin/doveadm')) {
$this->markTestSkipped("No /usr/bin/doveadm"); $this->markTestSkipped("No /usr/bin/doveadm");
} }
@ -79,10 +76,7 @@ class PaCryptTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($expected_hash, _pacrypt_dovecot('test', '')); $this->assertEquals($expected_hash, _pacrypt_dovecot('test', ''));
$this->assertEquals($expected_hash, _pacrypt_dovecot('test', $expected_hash)); $this->assertEquals($expected_hash, _pacrypt_dovecot('test', $expected_hash));
} }
} }
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */

@ -8,8 +8,6 @@
require_once('RemoteTest.php'); require_once('RemoteTest.php');
class RemoteUserTest extends RemoteTest { class RemoteUserTest extends RemoteTest {
public function testChangePassword() { public function testChangePassword() {
try { try {
$this->assertTrue($this->user->login($this->username, $this->password)); $this->assertTrue($this->user->login($this->username, $this->password));

Loading…
Cancel
Save