summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap_generic.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-04 11:16:54 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-04 11:16:54 +0000
commitfe07ed295958d50c766b0972e647e28d8cf1b4ba (patch)
tree5e60689b11153e07714cbebfe5afcdaec08aa9a8 /roundcubemail/program/include/rcube_imap_generic.php
parent55c17c36edd4da23b16eab53d99f179c39a87f65 (diff)
- Use improved get_capability() syntax, saves CAPABILITY call in some cases
git-svn-id: https://svn.roundcube.net/trunk@4389 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap_generic.php')
-rw-r--r--roundcubemail/program/include/rcube_imap_generic.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/roundcubemail/program/include/rcube_imap_generic.php b/roundcubemail/program/include/rcube_imap_generic.php
index b5fd96871..b11266fd7 100644
--- a/roundcubemail/program/include/rcube_imap_generic.php
+++ b/roundcubemail/program/include/rcube_imap_generic.php
@@ -764,18 +764,14 @@ class rcube_imap_generic
// check for supported auth methods
if ($auth_method == 'CHECK') {
- if ($this->getCapability('AUTH=DIGEST-MD5')) {
- $auth_methods[] = 'DIGEST-MD5';
- }
- if ($this->getCapability('AUTH=CRAM-MD5') || $this->getCapability('AUTH=CRAM_MD5')) {
- $auth_methods[] = 'CRAM-MD5';
- }
- if ($this->getCapability('AUTH=PLAIN')) {
- $auth_methods[] = 'PLAIN';
+ if ($auth_caps = $this->getCapability('AUTH')) {
+ $auth_methods = $auth_caps;
}
// RFC 2595 (LOGINDISABLED) LOGIN disabled when connection is not secure
- if (!$this->getCapability('LOGINDISABLED')) {
- $auth_methods[] = 'LOGIN';
+ if (($key = array_search('LOGIN', $auth_methods)) !== false
+ && $this->getCapability('LOGINDISABLED')
+ ) {
+ unset($auth_methods[$key]);
}
}
else {
@@ -795,8 +791,10 @@ class rcube_imap_generic
// Authenticate
foreach ($auth_methods as $method) {
switch ($method) {
- case 'DIGEST-MD5':
+ case 'CRAM_MD5':
+ $method = 'CRAM-MD5';
case 'CRAM-MD5':
+ case 'DIGEST-MD5':
case 'PLAIN':
$result = $this->authenticate($user, $password, $method);
break;