e$BEOJUE/Li$G$9!#e(B
ruby 1.9 e$B$Ne(B net/smtp.rb e$B$K$Fe(B CRAM-MD5
e$B$N%a!<%kAw?.$,%(%i!<e(B
e$B$K$J$j$^$7$?!#DL?.@h$Oe(B @nifty e$B$K$J$j$^$9!#e(B
$ ruby -v
ruby 1.9.0 (2007-05-07 patchlevel 0) [i686-linux]
e$B<!$N%Q%C%A$G%a!<%k$rAw$k$3$H$,$G$-$^$7$?$N$G!"$*CN$i$;$7$^e(B
e$B$9!#e(B
— smtp.rb.org 2007-04-15 01:53:25.000000000 +0900
+++ smtp.rb 2007-05-07 22:50:16.000000000 +0900
@@ -745,7 +745,7 @@
def auth_cram_md5(user, secret)
check_auth_args user, secret
res = critical {
-
check_auth_continue get_response('AUTH CRAM-MD5')
-
res = check_auth_continue get_response('AUTH CRAM-MD5') crammed = cram_md5_response(secret, res.cram_md5_challenge) get_response(base64_encode("#{user} #{crammed}")) }
@@ -793,7 +793,7 @@
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
@@ -943,6 +943,7 @@
unless res.continue?
raise res.exception_class, res.message
end
-
res
end
class Response