Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions lib/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* See the COPYING-README file.
*/

use OCA\user_external\imap\imap_rcube;

/**
* User authentication against an IMAP mail server
*
Expand Down Expand Up @@ -87,31 +85,30 @@ public function checkPassword($uid, $password) {
$groups[] = $pieces[1];
}

$rcube = new imap_rcube();

$params = ["port"=>$this->port, "timeout"=>10];
$protocol = $this->sslmode ? "imaps" : "imap";
$url = "{$protocol}://{$this->mailbox}:{$this->port}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);

$params["ssl_mode"] = $this->sslmode ? $this->sslmode : null;
$params["force_caps"] = false;
$canconnect = $rcube->connect(
$this->mailbox,
$username,
$password,
$params
);
$canconnect = curl_exec($ch);

if($canconnect) {
$rcube->closeConnection();
curl_close($ch);
$uid = mb_strtolower($uid);
$this->storeUser($uid, $groups);
return $uid;
} else {
OC::$server->getLogger()->error(
'ERROR: Could not connect via roundcube lib: '.$rcube->error,
'ERROR: Could not connect to imap server via curl: '.curl_error($ch),
['app' => 'user_external']
);
}

curl_close($ch);

return false;
}
}
24 changes: 0 additions & 24 deletions lib/imap/imap_rcube.changes2upstream

This file was deleted.

Loading