adding space between) and {
This commit is contained in:
10
lib/ftp.php
10
lib/ftp.php
@@ -11,11 +11,11 @@ class OC_User_FTP extends OC_User_Backend{
|
||||
private $secure;
|
||||
private $protocol;
|
||||
|
||||
public function __construct($host,$secure=false){
|
||||
public function __construct($host,$secure=false) {
|
||||
$this->host=$host;
|
||||
$this->secure=$secure;
|
||||
$this->protocol='ftp';
|
||||
if($this->secure){
|
||||
if($this->secure) {
|
||||
$this->protocol.='s';
|
||||
}
|
||||
$this->protocol.='://';
|
||||
@@ -29,17 +29,17 @@ class OC_User_FTP extends OC_User_Backend{
|
||||
*
|
||||
* Check if the password is correct without logging in the user
|
||||
*/
|
||||
public function checkPassword($uid, $password){
|
||||
public function checkPassword($uid, $password) {
|
||||
$url=$this->protocol.$uid.':'.$password.'@'.$this->host.'/';
|
||||
$result=@opendir($url);
|
||||
if(is_resource($result)){
|
||||
if(is_resource($result)) {
|
||||
return $uid;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function userExists($uid){
|
||||
public function userExists($uid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class OC_User_IMAP extends OC_User_Backend{
|
||||
private $mailbox;
|
||||
|
||||
public function __construct($mailbox){
|
||||
public function __construct($mailbox) {
|
||||
$this->mailbox=$mailbox;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ class OC_User_IMAP extends OC_User_Backend{
|
||||
*
|
||||
* Check if the password is correct without logging in the user
|
||||
*/
|
||||
public function checkPassword($uid, $password){
|
||||
public function checkPassword($uid, $password) {
|
||||
$mbox = @imap_open($this->mailbox, $uid, $password);
|
||||
imap_errors();
|
||||
imap_alerts();
|
||||
if($mbox){
|
||||
if($mbox) {
|
||||
imap_close($mbox);
|
||||
return $uid;
|
||||
}else{
|
||||
@@ -33,7 +33,7 @@ class OC_User_IMAP extends OC_User_Backend{
|
||||
}
|
||||
}
|
||||
|
||||
public function userExists($uid){
|
||||
public function userExists($uid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class OC_User_SMB extends OC_User_Backend{
|
||||
const smbclient='smbclient';
|
||||
const loginError='NT_STATUS_LOGON_FAILURE';
|
||||
|
||||
public function __construct($host){
|
||||
public function __construct($host) {
|
||||
$this->host=$host;
|
||||
}
|
||||
|
||||
@@ -24,20 +24,20 @@ class OC_User_SMB extends OC_User_Backend{
|
||||
*
|
||||
* Check if the password is correct without logging in the user
|
||||
*/
|
||||
public function checkPassword($uid, $password){
|
||||
public function checkPassword($uid, $password) {
|
||||
$uidEscaped=escapeshellarg($uid);
|
||||
$password=escapeshellarg($password);
|
||||
$result=array();
|
||||
$command=self::smbclient.' //'.$this->host.'/dummy -U'.$uidEscaped.'%'.$password;
|
||||
$result=exec($command,$result);
|
||||
if(substr($result,-strlen(self::loginError))==self::loginError){
|
||||
if(substr($result,-strlen(self::loginError))==self::loginError) {
|
||||
return false;
|
||||
}else{
|
||||
return $uid;
|
||||
}
|
||||
}
|
||||
|
||||
public function userExists($uid){
|
||||
public function userExists($uid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user