summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-06-18 06:44:39 +0000
committerthomascube <thomas@roundcube.net>2008-06-18 06:44:39 +0000
commit1fb78c57ccd93c5fd58c2c42a82824dae738417c (patch)
tree3aa4e760d99e4205d3f1cf6077442791ca29fe8e /program/lib
parentccd944ea2100e59a71ed39781b2164dc58029ace (diff)
Revert changes from r994 and make cram-md5 work again (#1484819)
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/imap.inc12
1 files changed, 5 insertions, 7 deletions
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index e2cd724da..7a1ac0aa7 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -297,12 +297,10 @@ function iil_C_Authenticate(&$conn, $user, $pass, $encChallenge) {
}
// generate hash
- $hash = iil_xor($pass,$opad);
- $hash .= pack("H*", md5(iil_xor($pass, $ipad) . base64_decode($encChallenge)));
- $hash = md5($hash);
+ $hash = md5(iil_xor($pass,$opad) . pack("H*", md5(iil_xor($pass, $ipad) . base64_decode($encChallenge))));
// generate reply
- $reply = base64_encode('"' . $user . '" "' . $hash . '"');
+ $reply = base64_encode($user . ' ' . $hash);
// send result, get reply
iil_PutLine($conn->fp, $reply);
@@ -544,9 +542,9 @@ function iil_Connect($host, $user, $password) {
//do CRAM-MD5 authentication
iil_PutLine($conn->fp, "a000 AUTHENTICATE CRAM-MD5");
$line = trim(iil_ReadLine($conn->fp, 1024));
-
+
$conn->message .= "$line\n";
-
+
if ($line[0] == '+') {
$conn->message .= 'Got challenge: ' . htmlspecialchars($line) . "\n";
@@ -556,7 +554,7 @@ function iil_Connect($host, $user, $password) {
$conn->message .= "Tried CRAM-MD5: $result \n";
} else {
$conn->message .='No challenge ('.htmlspecialchars($line)."), try plain\n";
- $auth = 'plain';
+ $auth = 'plain';
}
}