diff --git a/ChangeLog b/ChangeLog index d4ee13553e..0a8d9fe02b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon May 21 03:34:06 2007 Minero Aoki + + * lib/net/smtp.rb: CRAM-MD5 authentication did not work. + [ruby-dev:30770] + Sat May 19 10:26:01 2007 Tadayoshi Funaba * lib/date/format.rb (Date._parse): detects some OFX dates diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index f6ed08ca98..3c69846d15 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -745,8 +745,9 @@ module Net def auth_cram_md5(user, secret) check_auth_args user, secret res = critical { - check_auth_continue get_response('AUTH CRAM-MD5') - crammed = cram_md5_response(secret, res.cram_md5_challenge) + res0 = get_response('AUTH CRAM-MD5') + check_auth_continue res0 + crammed = cram_md5_response(secret, res0.cram_md5_challenge) get_response(base64_encode("#{user} #{crammed}")) } check_auth_response res @@ -793,7 +794,7 @@ module Net def cram_secret(secret, mask) secret = Digest::MD5.digest(secret) if secret.size > CRAM_BUFSIZE buf = secret.ljust(CRAM_BUFSIZE, "\0") - 0.upto(buf.size) do |i| + 0.upto(buf.size - 1) do |i| buf[i] = (buf[i].ord ^ mask).chr end buf @@ -981,7 +982,7 @@ module Net def capabilities return {} unless @string[3, 1] == '-' h = {} - @string.lines.to_a[1..-1].each do |line| + @string.lines.drop(1).each do |line| k, *v = line[4..-1].chomp.split(nil) h[k] = v end