Subject: | CRAM-MD5 base64 encode bug |
Date: | Mon, 16 Jun 2008 16:31:14 -0700 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | David Jonas <djonas [...] splitretina.com> |
Long usernames get a carriage return with encode_base64 in CRAM-MD5.
Here's a simple patch to fix it. It just adds the second argument to
encode_base64. Did it to PLAIN as well, but I didn't test that one.
Thanks for the great module!
David
--- Mail-IMAPClient-3.08/lib/Mail/IMAPClient.pm 2008-05-26 04:25:39.000000000 -0700
+++ Mail-IMAPClient-3.08-patched/lib/Mail/IMAPClient.pm 2008-06-16 16:17:33.000000000 -0700
@@ -2525,7 +2525,7 @@
{ my ($code, $client) = @_;
use Digest::HMAC_MD5;
my $hmac = Digest::HMAC_MD5::hmac_md5_hex(decode_base64($code), $client->Password);
- encode_base64($client->User." ".$hmac);
+ encode_base64($client->User." ".$hmac,'');
};
}
elsif($scheme eq 'DIGEST-MD5')
@@ -2558,7 +2558,7 @@
{ $response ||= sub
{ my ($code, $client) = @_;
encode_base64($client->User . chr(0) . $client->Proxy
- . chr(0) . $client->Password);
+ . chr(0) . $client->Password,'');
};
}
elsif($scheme eq 'NTLM')