summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-20 18:33:25 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-20 18:33:25 +0000
commit696cbbd7a6c364687522cc41992b0896f3c0507b (patch)
tree1c820ce0d8097a76c62b16d14341c36243edafe4 /lib/net/smtp.rb
parent374e3d42d4fd7df67a77fb26dbc02fd22ef608f7 (diff)
* lib/net/smtp.rb: CRAM-MD5 authentication did not work. [ruby-dev:30770]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb9
1 files changed, 5 insertions, 4 deletions
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