diff --git a/lib/net/pop.rb b/lib/net/pop.rb index 046763e0a8..a6c002ce0c 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -337,20 +337,14 @@ Net::POP3 end - def auth( acnt, pass ) + def auth( account, pass ) critical { - @socket.writeline( "APOP #{acnt} #{digest(@stamp + pass)}" ) + @socket.writeline sprintf( 'APOP %s %s', + account, MD5.new(@stamp + pass).hexdigest ) check_reply_auth } end - - def digest( str ) - ret = '' - MD5.new( str ).digest.each_byte {|i| ret << sprintf('%02x', i) } - ret - end - end end diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 1d909bbb4b..399b2bbdd4 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -15,8 +15,6 @@ require 'socket' module Net - Version = '1.1.17' - =begin == Net::Protocol @@ -68,7 +66,7 @@ Object class Protocol - Version = ::Net::Version + Version = '1.1.18' class << self @@ -165,7 +163,7 @@ Object connect do_start *args @active = true - yield if iterator? + yield self if iterator? ensure finish if iterator? end @@ -591,7 +589,7 @@ Object do_write_do D_CRLF wsize = do_write_fin - @pipe << "wrote #{wsize} bytes text" if pipeon + @pipe << "wrote #{wsize} bytes text\n" if pipeon wsize end diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index fe3dd9e1b2..35e9118df8 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -109,9 +109,10 @@ Net::Protocol def do_start( helodom = nil, user = nil, secret = nil, authtype = nil ) unless helodom then - helodom = ENV['HOSTNAME'] || ENV['HOST'] + helodom = ::Socket.gethostname unless helodom then - raise ArgumentError, "cannot get hostname" + raise ArgumentError, + "cannot get localhost name; try 'smtp.start(local_host_name)'" end end