mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/net/ftp/test_ftp.rb (process_port_or_eprt): merge a part of
r56973 to pass the test introduced at previous commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@61251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1cfe43fd85
commit
3ec034c597
2 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Dec 14 23:53:41 2017 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/net/ftp/test_ftp.rb (process_port_or_eprt): merge a part of
|
||||||
|
r56973 to pass the test introduced at previous commit.
|
||||||
|
|
||||||
Thu Dec 14 22:55:05 2017 Shugo Maeda <shugo@ruby-lang.org>
|
Thu Dec 14 22:55:05 2017 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
Fix a command injection vulnerability in Net::FTP.
|
Fix a command injection vulnerability in Net::FTP.
|
||||||
|
|
|
@ -1900,4 +1900,22 @@ EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def process_port_or_eprt(sock, line)
|
||||||
|
case line
|
||||||
|
when /\APORT (.*)/
|
||||||
|
port_args = $1.split(/,/)
|
||||||
|
host = port_args[0, 4].join(".")
|
||||||
|
port = port_args[4, 2].map(&:to_i).inject {|x, y| (x << 8) + y}
|
||||||
|
sock.print("200 PORT command successful.\r\n")
|
||||||
|
return host, port
|
||||||
|
when /\AEPRT \|2\|(.*?)\|(.*?)\|/
|
||||||
|
host = $1
|
||||||
|
port = $2.to_i
|
||||||
|
sock.print("200 EPRT command successful.\r\n")
|
||||||
|
return host, port
|
||||||
|
else
|
||||||
|
flunk "PORT or EPRT expected"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue