- Use PLAIN auth when CRAM fails and imap_auth_type='check' (#1486371)

release-0.6
alecpl 15 years ago
parent 638fb8a972
commit d6584f7206

@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail CHANGELOG RoundCube Webmail
=========================== ===========================
- Use PLAIN auth when CRAM fails and imap_auth_type='check' (#1486371)
- Fix removal of <title> tag from HTML messages (#1486432) - Fix removal of <title> tag from HTML messages (#1486432)
- Fix 'force_https' to specified port when URL contains a port number (#1486411) - Fix 'force_https' to specified port when URL contains a port number (#1486411)
- Fix to-text converting of HTML entities inside b/strong/th/hX tags (#1486422) - Fix to-text converting of HTML entities inside b/strong/th/hX tags (#1486422)

@ -647,7 +647,7 @@ function iil_Connect($host, $user, $password, $options=null) {
$conn->capability = explode(' ', strtoupper($matches[1])); $conn->capability = explode(' ', strtoupper($matches[1]));
} }
$conn->message .= $line . "\n"; $conn->message .= $line;
// TLS connection // TLS connection
if ($ICL_SSL == 'tls' && iil_C_GetCapability($conn, 'STARTTLS')) { if ($ICL_SSL == 'tls' && iil_C_GetCapability($conn, 'STARTTLS')) {
@ -672,6 +672,8 @@ function iil_Connect($host, $user, $password, $options=null) {
} }
} }
$orig_method = $auth_method;
if ($auth_method == 'CHECK') { if ($auth_method == 'CHECK') {
// check for supported auth methods // check for supported auth methods
if (iil_C_GetCapability($conn, 'AUTH=CRAM-MD5') || iil_C_GetCapability($conn, 'AUTH=CRAM_MD5')) { if (iil_C_GetCapability($conn, 'AUTH=CRAM-MD5') || iil_C_GetCapability($conn, 'AUTH=CRAM_MD5')) {
@ -689,7 +691,7 @@ function iil_Connect($host, $user, $password, $options=null) {
$line = trim(iil_ReadLine($conn->fp, 1024)); $line = trim(iil_ReadLine($conn->fp, 1024));
if ($line[0] == '+') { if ($line[0] == '+') {
//got a challenge string, try CRAM-5 // got a challenge string, try CRAM-MD5
$result = iil_C_Authenticate($conn, $user, $password, substr($line,2)); $result = iil_C_Authenticate($conn, $user, $password, substr($line,2));
// stop if server sent BYE response // stop if server sent BYE response
@ -698,20 +700,19 @@ function iil_Connect($host, $user, $password, $options=null) {
$iil_errornum = $conn->errorNum; $iil_errornum = $conn->errorNum;
return false; return false;
} }
$conn->message .= "AUTH CRAM-MD5: $result\n"; }
} else {
$conn->message .= "AUTH CRAM-MD5: failed\n"; if (!is_resource($result) && $orig_method == 'CHECK') {
$auth_method = 'PLAIN'; $auth_method = 'PLAIN';
} }
} }
if (!$result || $auth_method == 'PLAIN') { if ($auth_method == 'PLAIN') {
// do plain text auth // do plain text auth
$result = iil_C_Login($conn, $user, $password); $result = iil_C_Login($conn, $user, $password);
$conn->message .= "AUTH PLAIN: $result\n";
} }
if (!is_int($result)) { if (is_resource($result)) {
iil_C_Namespace($conn); iil_C_Namespace($conn);
return $conn; return $conn;
} else { } else {

Loading…
Cancel
Save