* lib/net/ftp.rb (login): use "anonymous@" as a default password.

[ruby-dev:39451]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2009-10-12 14:29:05 +00:00
Родитель 9994d05b7e
Коммит b83a7c1076
2 изменённых файлов: 6 добавлений и 17 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Mon Oct 12 23:27:57 2009 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (login): use "anonymous@" as a default password.
[ruby-dev:39451]
Mon Oct 12 22:48:25 2009 Shugo Maeda <shugo@ruby-lang.org> Mon Oct 12 22:48:25 2009 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (retrlines): added a new block parameter. * lib/net/ftp.rb (retrlines): added a new block parameter.

Просмотреть файл

@ -363,22 +363,6 @@ module Net
end end
private :transfercmd private :transfercmd
def getaddress
thishost = Socket.gethostname
if not thishost.index(".")
thishost = Socket.gethostbyname(thishost)[0]
end
if ENV.has_key?("LOGNAME")
realuser = ENV["LOGNAME"]
elsif ENV.has_key?("USER")
realuser = ENV["USER"]
else
realuser = "anonymous"
end
return realuser + "@" + thishost
end
private :getaddress
# #
# Logs in to the remote host. The session must have been previously # Logs in to the remote host. The session must have been previously
# connected. If +user+ is the string "anonymous" and the +password+ is # connected. If +user+ is the string "anonymous" and the +password+ is
@ -389,7 +373,7 @@ module Net
# #
def login(user = "anonymous", passwd = nil, acct = nil) def login(user = "anonymous", passwd = nil, acct = nil)
if user == "anonymous" and passwd == nil if user == "anonymous" and passwd == nil
passwd = getaddress passwd = "anonymous@"
end end
resp = "" resp = ""