From 751dc7ea2af1f306b348af012f6158a25200fa5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Fri, 15 Apr 2022 08:15:32 +0200 Subject: [PATCH] Cs fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- lib/AppInfo/Application.php | 20 +++--- lib/Base.php | 12 ++-- lib/BasicAuth.php | 29 ++++----- lib/FTP.php | 20 +++--- lib/IMAP.php | 11 ++-- lib/SMB.php | 18 +++--- lib/SSH.php | 24 +++---- lib/WebDavAuth.php | 14 ++-- lib/XMPP.php | 124 ++++++++++++++++++------------------ tests/basic_auth.php | 16 ++--- tests/bootstrap.php | 3 +- tests/config.php | 40 ++++++------ tests/ftp.php | 16 ++--- tests/imap.php | 16 ++--- tests/smb.php | 16 ++--- 15 files changed, 185 insertions(+), 194 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 05dec26..442cd72 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -8,19 +8,15 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; -use OCP\Notification\IManager; -use OCP\User\Events; class Application extends App implements IBootstrap { + public function __construct() { + parent::__construct('user_external'); + } - public function __construct() { - parent::__construct('user_external'); - } + public function register(IRegistrationContext $context): void { + } - public function register(IRegistrationContext $context): void { - } - - public function boot(IBootContext $context): void { - } - -} \ No newline at end of file + public function boot(IBootContext $context): void { + } +} diff --git a/lib/Base.php b/lib/Base.php index 08b4138..4e59d04 100644 --- a/lib/Base.php +++ b/lib/Base.php @@ -21,7 +21,7 @@ namespace OCA\UserExternal; * @license http://www.gnu.org/licenses/agpl AGPL * @link http://github.com/owncloud/apps */ -abstract class Base extends \OC\User\Backend{ +abstract class Base extends \OC\User\Backend { protected $backend = ''; /** @@ -80,7 +80,6 @@ abstract class Base extends \OC\User\Backend{ * @return array with all displayNames (value) and the corresponding uids (key) */ public function getDisplayNames($search = '', $limit = null, $offset = null) { - $connection = \OC::$server->getDatabaseConnection(); $query = $connection->getQueryBuilder(); $query->select('uid', 'displayname') @@ -106,10 +105,10 @@ abstract class Base extends \OC\User\Backend{ } /** - * Get a list of all users - * - * @return array with all uids - */ + * Get a list of all users + * + * @return array with all uids + */ public function getUsers($search = '', $limit = null, $offset = null) { $connection = \OC::$server->getDatabaseConnection(); $query = $connection->getQueryBuilder(); @@ -231,5 +230,4 @@ abstract class Base extends \OC\User\Backend{ return $users > 0; } - } diff --git a/lib/BasicAuth.php b/lib/BasicAuth.php index 7d6222f..fee7a06 100644 --- a/lib/BasicAuth.php +++ b/lib/BasicAuth.php @@ -9,12 +9,11 @@ namespace OCA\UserExternal; class BasicAuth extends Base { - private $authUrl; public function __construct($authUrl) { parent::__construct($authUrl); - $this->authUrl =$authUrl; + $this->authUrl = $authUrl; } /** @@ -31,13 +30,13 @@ class BasicAuth extends Base { * URL is indeed authenticating or not... */ $context = stream_context_create(array( - 'http' => array( - 'method' => "GET", - 'follow_location' => 0 - )) + 'http' => array( + 'method' => "GET", + 'follow_location' => 0 + )) ); $canary = get_headers($this->authUrl, 1, $context); - if(!$canary) { + if (!$canary) { \OC::$server->getLogger()->error( 'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl, ['app' => 'user_external'] @@ -53,17 +52,17 @@ class BasicAuth extends Base { } $context = stream_context_create(array( - 'http' => array( - 'method' => "GET", - 'header' => "authorization: Basic " . base64_encode("$uid:$password"), - 'follow_location' => 0 - )) + 'http' => array( + 'method' => "GET", + 'header' => "authorization: Basic " . base64_encode("$uid:$password"), + 'follow_location' => 0 + )) ); $headers = get_headers($this->authUrl, 1, $context); - if(!$headers) { + if (!$headers) { \OC::$server->getLogger()->error( - 'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl, + 'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl, ['app' => 'user_external'] ); return false; @@ -84,7 +83,7 @@ class BasicAuth extends Base { return $uid; case "3": \OC::$server->getLogger()->error( - 'ERROR: Too many redirects from BasicAuth Url: '.$this->authUrl, + 'ERROR: Too many redirects from BasicAuth Url: '.$this->authUrl, ['app' => 'user_external'] ); return false; diff --git a/lib/FTP.php b/lib/FTP.php index 24a4a00..1aa7e38 100644 --- a/lib/FTP.php +++ b/lib/FTP.php @@ -17,7 +17,7 @@ namespace OCA\UserExternal; * @license http://www.gnu.org/licenses/agpl AGPL * @link http://github.com/owncloud/apps */ -class FTP extends Base{ +class FTP extends Base { private $host; private $secure; private $protocol; @@ -28,12 +28,12 @@ class FTP extends Base{ * @param string $host Hostname or IP of FTP server * @param boolean $secure TRUE to enable SSL */ - public function __construct($host,$secure=false) { - $this->host=$host; - $this->secure=$secure; - $this->protocol='ftp'; - if($this->secure) { - $this->protocol.='s'; + public function __construct($host, $secure = false) { + $this->host = $host; + $this->secure = $secure; + $this->protocol = 'ftp'; + if ($this->secure) { + $this->protocol .= 's'; } parent::__construct($this->protocol . '://' . $this->host); } @@ -56,11 +56,11 @@ class FTP extends Base{ } // opendir handles the as %-encoded string, but this is not true for usernames and passwords, encode them before passing them $url = sprintf('%s://%s:%s@%s/', $this->protocol, urlencode($uid), urlencode($password), $this->host); - $result=@opendir($url); - if(is_resource($result)) { + $result = @opendir($url); + if (is_resource($result)) { $this->storeUser($uid); return $uid; - }else{ + } else { return false; } } diff --git a/lib/IMAP.php b/lib/IMAP.php index 6406782..791d49a 100644 --- a/lib/IMAP.php +++ b/lib/IMAP.php @@ -9,7 +9,6 @@ */ namespace OCA\UserExternal; - /** * User authentication against an IMAP mail server * @@ -59,14 +58,14 @@ class IMAP extends Base { // Replace escaped @ symbol in uid (which is a mail address) // but only if there is no @ symbol and if there is a %40 inside the uid if (!(strpos($uid, '@') !== false) && (strpos($uid, '%40') !== false)) { - $uid = str_replace("%40","@",$uid); + $uid = str_replace("%40", "@", $uid); } $pieces = explode('@', $uid); if ($this->domain !== '') { if (count($pieces) === 1) { $username = $uid . '@' . $this->domain; - } else if(count($pieces) === 2 && $pieces[1] === $this->domain) { + } elseif (count($pieces) === 2 && $pieces[1] === $this->domain) { $username = $uid; if ($this->stripeDomain) { $uid = $pieces[0]; @@ -80,11 +79,11 @@ class IMAP extends Base { } } else { $username = $uid; - } + } $groups = []; if ($this->groupDomain && $pieces[1]) { - $groups[] = $pieces[1]; + $groups[] = $pieces[1]; } $protocol = ($this->sslmode === "ssl") ? "imaps" : "imap"; @@ -101,7 +100,7 @@ class IMAP extends Base { $canconnect = curl_exec($ch); - if($canconnect) { + if ($canconnect) { curl_close($ch); $uid = mb_strtolower($uid); $this->storeUser($uid, $groups); diff --git a/lib/SMB.php b/lib/SMB.php index f5fbe32..ec6e7e7 100644 --- a/lib/SMB.php +++ b/lib/SMB.php @@ -16,11 +16,11 @@ namespace OCA\UserExternal; * @license http://www.gnu.org/licenses/agpl AGPL * @link http://github.com/owncloud/apps */ -class SMB extends Base{ +class SMB extends Base { private $host; - const SMBCLIENT = 'smbclient -L'; - const LOGINERROR = 'NT_STATUS_LOGON_FAILURE'; + public const SMBCLIENT = 'smbclient -L'; + public const LOGINERROR = 'NT_STATUS_LOGON_FAILURE'; /** * Create new samba authentication provider @@ -29,7 +29,7 @@ class SMB extends Base{ */ public function __construct($host) { parent::__construct($host); - $this->host=$host; + $this->host = $host; } /** @@ -48,13 +48,13 @@ class SMB extends Base{ ['app' => 'user_external'] ); return false; - } else if (strpos($lastline, self::LOGINERROR) !== false) { + } elseif (strpos($lastline, self::LOGINERROR) !== false) { //normal login error return false; - } else if (strpos($lastline, 'NT_STATUS_BAD_NETWORK_NAME') !== false) { + } elseif (strpos($lastline, 'NT_STATUS_BAD_NETWORK_NAME') !== false) { //login on minor error goto login; - } else if ($retval !== 0) { + } elseif ($retval !== 0) { //some other error \OC::$server->getLogger()->error( 'ERROR: smbclient error: ' . trim($lastline), @@ -78,13 +78,13 @@ class SMB extends Base{ public function checkPassword($uid, $password) { // Check with an invalid password, if the user authenticates then fail $attemptWithInvalidPassword = $this->tryAuthentication($uid, base64_encode($password)); - if(is_string($attemptWithInvalidPassword)) { + if (is_string($attemptWithInvalidPassword)) { return false; } // Check with valid password $attemptWithValidPassword = $this->tryAuthentication($uid, $password); - if(is_string($attemptWithValidPassword)) { + if (is_string($attemptWithValidPassword)) { $this->storeUser($uid); return $uid; } diff --git a/lib/SSH.php b/lib/SSH.php index 5f7212c..0a95a3b 100644 --- a/lib/SSH.php +++ b/lib/SSH.php @@ -23,10 +23,10 @@ class SSH extends Base { private $port; /** - * Create a new SSH authentication provider - * - * @param string $host Hostname or IP address of SSH servr - */ + * Create a new SSH authentication provider + * + * @param string $host Hostname or IP address of SSH servr + */ public function __construct($host, $port = 22) { parent::__construct($host); $this->host = $host; @@ -34,14 +34,14 @@ class SSH extends Base { } /** - * Check if the password is correct without logging in - * Requires the php-ssh2 pecl extension - * - * @param string $uid The username - * @param string $password The password - * - * @return true/false - */ + * Check if the password is correct without logging in + * Requires the php-ssh2 pecl extension + * + * @param string $uid The username + * @param string $password The password + * + * @return true/false + */ public function checkPassword($uid, $password) { if (!extension_loaded('ssh2')) { \OC::$server->getLogger()->error( diff --git a/lib/WebDavAuth.php b/lib/WebDavAuth.php index 33c8ed0..73c0556 100644 --- a/lib/WebDavAuth.php +++ b/lib/WebDavAuth.php @@ -9,12 +9,11 @@ namespace OCA\UserExternal; class WebDavAuth extends Base { - private $webDavAuthUrl; public function __construct($webDavAuthUrl) { parent::__construct($webDavAuthUrl); - $this->webDavAuthUrl =$webDavAuthUrl; + $this->webDavAuthUrl = $webDavAuthUrl; } /** @@ -27,21 +26,20 @@ class WebDavAuth extends Base { */ public function checkPassword($uid, $password) { $arr = explode('://', $this->webDavAuthUrl, 2); - if( ! isset($arr) OR count($arr) !== 2) { + if (! isset($arr) or count($arr) !== 2) { \OC::$server->getLogger()->error('ERROR: Invalid WebdavUrl: "'.$this->webDavAuthUrl.'" ', ['app' => 'user_external']); return false; } list($protocol, $path) = $arr; - $url= $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path; + $url = $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path; $headers = get_headers($url); - if($headers === false) { + if ($headers === false) { \OC::$server->getLogger()->error('ERROR: Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', ['app' => 'user_external']); return false; - } - $returnCode= substr($headers[0], 9, 3); + $returnCode = substr($headers[0], 9, 3); - if(substr($returnCode, 0, 1) === '2') { + if (substr($returnCode, 0, 1) === '2') { $this->storeUser($uid); return $uid; } else { diff --git a/lib/XMPP.php b/lib/XMPP.php index c46f888..50c6dbe 100644 --- a/lib/XMPP.php +++ b/lib/XMPP.php @@ -34,89 +34,89 @@ class XMPP extends Base { } public function hmacSha1($key, $data) { - if (strlen($key) > 64) { - $key = str_pad(sha1($key, true), 64, chr(0)); + if (strlen($key) > 64) { + $key = str_pad(sha1($key, true), 64, chr(0)); } - if (strlen($key) < 64) { - $key = str_pad($key, 64, chr(0)); + if (strlen($key) < 64) { + $key = str_pad($key, 64, chr(0)); } - $oPad = str_repeat(chr(0x5C), 64); - $iPad = str_repeat(chr(0x36), 64); + $oPad = str_repeat(chr(0x5C), 64); + $iPad = str_repeat(chr(0x36), 64); - for ($i = 0; $i < strlen($key); $i++) { - $oPad[$i] = $oPad[$i] ^ $key[$i]; - $iPad[$i] = $iPad[$i] ^ $key[$i]; - } - return sha1($oPad.sha1($iPad.$data, true)); - } + for ($i = 0; $i < strlen($key); $i++) { + $oPad[$i] = $oPad[$i] ^ $key[$i]; + $iPad[$i] = $iPad[$i] ^ $key[$i]; + } + return sha1($oPad.sha1($iPad.$data, true)); + } - public function validateHashedPassword($user, $uid, $submittedPassword){ - foreach ($user as $key){ - if($key[3] === "salt") { - $internalSalt = $key['value']; - } - if($key[3] === "server_key") { - $internalServerKey = $key['value']; - } - if($key[3] === "stored_key") { - $internalStoredKey = $key['value']; - } - } - unset($user); - $internalIteration = '4096'; - $newSaltedPassword = hash_pbkdf2('sha1', $submittedPassword, $internalSalt, $internalIteration, 0, true); - $newServerKey = $this->hmacSha1($newSaltedPassword, 'Server Key'); - $newClientKey = $this->hmacSha1($newSaltedPassword, 'Client Key'); - $newStoredKey = sha1(hex2bin($newClientKey)); + public function validateHashedPassword($user, $uid, $submittedPassword) { + foreach ($user as $key) { + if ($key[3] === "salt") { + $internalSalt = $key['value']; + } + if ($key[3] === "server_key") { + $internalServerKey = $key['value']; + } + if ($key[3] === "stored_key") { + $internalStoredKey = $key['value']; + } + } + unset($user); + $internalIteration = '4096'; + $newSaltedPassword = hash_pbkdf2('sha1', $submittedPassword, $internalSalt, $internalIteration, 0, true); + $newServerKey = $this->hmacSha1($newSaltedPassword, 'Server Key'); + $newClientKey = $this->hmacSha1($newSaltedPassword, 'Client Key'); + $newStoredKey = sha1(hex2bin($newClientKey)); - if ($newServerKey === $internalServerKey - && $newStoredKey === $internalStoredKey) { - $uid = mb_strtolower($uid); - $this->storeUser($uid); - return $uid; - } else { - return false; - } + if ($newServerKey === $internalServerKey + && $newStoredKey === $internalStoredKey) { + $uid = mb_strtolower($uid); + $this->storeUser($uid); + return $uid; + } else { + return false; + } } public function validatePlainPassword($user, $uid, $submittedPassword) { - foreach ($user as $key) { - if($key[3] === "password") { - $internalPlainPassword = $key['value']; - } - } + foreach ($user as $key) { + if ($key[3] === "password") { + $internalPlainPassword = $key['value']; + } + } unset($user); - if ($submittedPassword === $internalPlainPassword) { - $uid = mb_strtolower($uid); - $this->storeUser($uid); - return $uid; - } else { - return false; - } + if ($submittedPassword === $internalPlainPassword) { + $uid = mb_strtolower($uid); + $this->storeUser($uid); + return $uid; + } else { + return false; + } } - public function checkPassword($uid, $password){ + public function checkPassword($uid, $password) { $pdo = new \PDO("mysql:host=$this->host;dbname=$this->xmppDb", $this->xmppDbUser, $this->xmppDbPassword); - if(isset($uid) + if (isset($uid) && isset($password)) { - if(!filter_var($uid, FILTER_VALIDATE_EMAIL) - || !strpos($uid, $this->xmppDomain) + if (!filter_var($uid, FILTER_VALIDATE_EMAIL) + || !strpos($uid, $this->xmppDomain) || substr($uid, -strlen($this->xmppDomain)) !== $this->xmppDomain ) { return false; } $user = explode("@", $uid); - $userName = strtolower($user[0]); - $submittedPassword = $password; - $statement = $pdo->prepare("SELECT * FROM prosody WHERE user = :user AND host = :xmppDomain AND store = 'accounts'"); - $result = $statement->execute(array( - 'user' => $userName, + $userName = strtolower($user[0]); + $submittedPassword = $password; + $statement = $pdo->prepare("SELECT * FROM prosody WHERE user = :user AND host = :xmppDomain AND store = 'accounts'"); + $result = $statement->execute(array( + 'user' => $userName, 'xmppDomain' => $this->xmppDomain )); - $user = $statement->fetchAll(); - if(empty($user)) { - return false; + $user = $statement->fetchAll(); + if (empty($user)) { + return false; } if ($this->passwordHashed === true) { diff --git a/tests/basic_auth.php b/tests/basic_auth.php index d7c77cd..e4156f2 100644 --- a/tests/basic_auth.php +++ b/tests/basic_auth.php @@ -16,20 +16,20 @@ class Test_User_BasicAuth extends \Test\TestCase { return include(__DIR__.'/config.php'); } - function skip() { - $config=$this->getConfig(); + public function skip() { + $config = $this->getConfig(); $this->skipUnless($config['basic_auth']['run']); } protected function setUp() { parent::setUp(); - $config=$this->getConfig(); - $this->instance=new OC_User_BasicAuth($config['basic_auth']['url']); + $config = $this->getConfig(); + $this->instance = new OC_User_BasicAuth($config['basic_auth']['url']); } - function testLogin() { - $config=$this->getConfig(); - $this->assertEquals($config['basic_auth']['user'],$this->instance->checkPassword($config['basic_auth']['user'],$config['basic_auth']['password'])); - $this->assertFalse($this->instance->checkPassword($config['basic_auth']['user'],$config['basic_auth']['password'].'foo')); + public function testLogin() { + $config = $this->getConfig(); + $this->assertEquals($config['basic_auth']['user'], $this->instance->checkPassword($config['basic_auth']['user'], $config['basic_auth']['password'])); + $this->assertFalse($this->instance->checkPassword($config['basic_auth']['user'], $config['basic_auth']['password'].'foo')); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c6a574c..3c21384 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,5 @@ array( - 'run'=>false, - 'mailbox'=>'{imap.gmail.com:993/imap/ssl}INBOX', //see http://php.net/manual/en/function.imap-open.php - 'user'=>'foo',//valid username/password combination - 'password'=>'bar', + 'imap' => array( + 'run' => false, + 'mailbox' => '{imap.gmail.com:993/imap/ssl}INBOX', //see http://php.net/manual/en/function.imap-open.php + 'user' => 'foo',//valid username/password combination + 'password' => 'bar', ), - 'smb'=>array( - 'run'=>false, - 'host'=>'localhost', - 'user'=>'test',//valid username/password combination - 'password'=>'test', + 'smb' => array( + 'run' => false, + 'host' => 'localhost', + 'user' => 'test',//valid username/password combination + 'password' => 'test', ), - 'ftp'=>array( - 'run'=>false, - 'host'=>'localhost', - 'user'=>'test',//valid username/password combination - 'password'=>'test', + 'ftp' => array( + 'run' => false, + 'host' => 'localhost', + 'user' => 'test',//valid username/password combination + 'password' => 'test', ), - 'basic_auth'=>array( - 'run'=>false, - 'url'=>'localhost/basic_auth', - 'user'=>'test',//valid username/password combination - 'password'=>'test', + 'basic_auth' => array( + 'run' => false, + 'url' => 'localhost/basic_auth', + 'user' => 'test',//valid username/password combination + 'password' => 'test', ), ); diff --git a/tests/ftp.php b/tests/ftp.php index a7c45d3..7afc288 100644 --- a/tests/ftp.php +++ b/tests/ftp.php @@ -16,20 +16,20 @@ class Test_User_FTP extends \Test\TestCase { return include(__DIR__.'/config.php'); } - function skip() { - $config=$this->getConfig(); + public function skip() { + $config = $this->getConfig(); $this->skipUnless($config['ftp']['run']); } protected function setUp() { parent::setUp(); - $config=$this->getConfig(); - $this->instance=new OC_User_FTP($config['ftp']['host']); + $config = $this->getConfig(); + $this->instance = new OC_User_FTP($config['ftp']['host']); } - function testLogin() { - $config=$this->getConfig(); - $this->assertEquals($config['ftp']['user'],$this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password'])); - $this->assertFalse($this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password'].'foo')); + public function testLogin() { + $config = $this->getConfig(); + $this->assertEquals($config['ftp']['user'], $this->instance->checkPassword($config['ftp']['user'], $config['ftp']['password'])); + $this->assertFalse($this->instance->checkPassword($config['ftp']['user'], $config['ftp']['password'].'foo')); } } diff --git a/tests/imap.php b/tests/imap.php index 578139e..162cabf 100644 --- a/tests/imap.php +++ b/tests/imap.php @@ -16,21 +16,21 @@ class Test_User_Imap extends \Test\TestCase { return include(__DIR__.'/config.php'); } - function skip() { - $config=$this->getConfig(); + public function skip() { + $config = $this->getConfig(); $this->skipUnless($config['imap']['run']); } protected function setUp() { parent::setUp(); - $config=$this->getConfig(); - $this->instance=new OC_User_IMAP($config['imap']['mailbox']); + $config = $this->getConfig(); + $this->instance = new OC_User_IMAP($config['imap']['mailbox']); } - function testLogin() { - $config=$this->getConfig(); - $this->assertEquals($config['imap']['user'],$this->instance->checkPassword($config['imap']['user'],$config['imap']['password'])); - $this->assertFalse($this->instance->checkPassword($config['imap']['user'],$config['imap']['password'].'foo')); + public function testLogin() { + $config = $this->getConfig(); + $this->assertEquals($config['imap']['user'], $this->instance->checkPassword($config['imap']['user'], $config['imap']['password'])); + $this->assertFalse($this->instance->checkPassword($config['imap']['user'], $config['imap']['password'].'foo')); } } diff --git a/tests/smb.php b/tests/smb.php index 63c0cda..9e6cdb1 100644 --- a/tests/smb.php +++ b/tests/smb.php @@ -16,21 +16,21 @@ class Test_User_SMB extends \Test\TestCase { return include(__DIR__.'/config.php'); } - function skip() { - $config=$this->getConfig(); + public function skip() { + $config = $this->getConfig(); $this->skipUnless($config['smb']['run']); } protected function setUp() { parent::setUp(); - $config=$this->getConfig(); - $this->instance=new OC_User_SMB($config['smb']['host']); + $config = $this->getConfig(); + $this->instance = new OC_User_SMB($config['smb']['host']); } - function testLogin() { - $config=$this->getConfig(); - $this->assertEquals($config['smb']['user'],$this->instance->checkPassword($config['smb']['user'],$config['smb']['password'])); - $this->assertFalse($this->instance->checkPassword($config['smb']['user'],$config['smb']['password'].'foo')); + public function testLogin() { + $config = $this->getConfig(); + $this->assertEquals($config['smb']['user'], $this->instance->checkPassword($config['smb']['user'], $config['smb']['password'])); + $this->assertFalse($this->instance->checkPassword($config['smb']['user'], $config['smb']['password'].'foo')); } }