ftpd 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Changelog.md +15 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +57 -48
- data/README.md +8 -1
- data/VERSION +1 -1
- data/examples/example.rb +12 -0
- data/features/example/step_definitions/example_server.rb +2 -0
- data/features/ftp_server/eprt.feature +1 -0
- data/features/ftp_server/epsv.feature +1 -0
- data/features/ftp_server/get_ipv6.feature +3 -0
- data/features/ftp_server/pasv.feature +10 -3
- data/features/ftp_server/step_definitions/logging.rb +2 -0
- data/features/ftp_server/step_definitions/test_server.rb +6 -0
- data/features/step_definitions/append.rb +2 -0
- data/features/step_definitions/client.rb +3 -0
- data/features/step_definitions/client_and_server_files.rb +2 -0
- data/features/step_definitions/client_files.rb +2 -0
- data/features/step_definitions/command.rb +2 -0
- data/features/step_definitions/connect.rb +2 -0
- data/features/step_definitions/delete.rb +2 -0
- data/features/step_definitions/directory_navigation.rb +2 -0
- data/features/step_definitions/error_replies.rb +2 -0
- data/features/step_definitions/features.rb +2 -0
- data/features/step_definitions/file_structure.rb +2 -0
- data/features/step_definitions/generic_send.rb +2 -0
- data/features/step_definitions/get.rb +2 -0
- data/features/step_definitions/help.rb +2 -0
- data/features/step_definitions/invalid_commands.rb +2 -0
- data/features/step_definitions/ipv6.rb +11 -0
- data/features/step_definitions/line_endings.rb +2 -0
- data/features/step_definitions/list.rb +2 -0
- data/features/step_definitions/login.rb +2 -0
- data/features/step_definitions/mkdir.rb +2 -0
- data/features/step_definitions/mode.rb +2 -0
- data/features/step_definitions/mtime.rb +2 -0
- data/features/step_definitions/noop.rb +2 -0
- data/features/step_definitions/options.rb +2 -0
- data/features/step_definitions/passive.rb +7 -0
- data/features/step_definitions/pending.rb +2 -0
- data/features/step_definitions/port.rb +2 -0
- data/features/step_definitions/put.rb +2 -0
- data/features/step_definitions/quit.rb +2 -0
- data/features/step_definitions/rename.rb +2 -0
- data/features/step_definitions/rmdir.rb +2 -0
- data/features/step_definitions/server_files.rb +2 -0
- data/features/step_definitions/server_title.rb +2 -0
- data/features/step_definitions/size.rb +2 -0
- data/features/step_definitions/status.rb +2 -0
- data/features/step_definitions/success_replies.rb +2 -0
- data/features/step_definitions/system.rb +5 -0
- data/features/step_definitions/timing.rb +2 -0
- data/features/step_definitions/type.rb +2 -0
- data/features/support/env.rb +2 -0
- data/features/support/example_server.rb +3 -1
- data/features/support/test_client.rb +27 -19
- data/features/support/test_file_templates.rb +2 -0
- data/features/support/test_server.rb +31 -20
- data/features/support/test_server_files.rb +2 -0
- data/ftpd.gemspec +17 -11
- data/lib/ftpd.rb +2 -0
- data/lib/ftpd/auth_levels.rb +2 -0
- data/lib/ftpd/cmd_abor.rb +2 -0
- data/lib/ftpd/cmd_allo.rb +2 -0
- data/lib/ftpd/cmd_appe.rb +2 -0
- data/lib/ftpd/cmd_auth.rb +2 -0
- data/lib/ftpd/cmd_cdup.rb +2 -0
- data/lib/ftpd/cmd_cwd.rb +2 -0
- data/lib/ftpd/cmd_dele.rb +2 -0
- data/lib/ftpd/cmd_eprt.rb +2 -0
- data/lib/ftpd/cmd_epsv.rb +4 -2
- data/lib/ftpd/cmd_feat.rb +2 -0
- data/lib/ftpd/cmd_help.rb +2 -0
- data/lib/ftpd/cmd_list.rb +2 -0
- data/lib/ftpd/cmd_login.rb +2 -0
- data/lib/ftpd/cmd_mdtm.rb +2 -0
- data/lib/ftpd/cmd_mkd.rb +2 -0
- data/lib/ftpd/cmd_mode.rb +2 -0
- data/lib/ftpd/cmd_nlst.rb +2 -0
- data/lib/ftpd/cmd_noop.rb +2 -0
- data/lib/ftpd/cmd_opts.rb +2 -0
- data/lib/ftpd/cmd_pasv.rb +5 -3
- data/lib/ftpd/cmd_pbsz.rb +2 -0
- data/lib/ftpd/cmd_port.rb +2 -0
- data/lib/ftpd/cmd_prot.rb +2 -0
- data/lib/ftpd/cmd_pwd.rb +2 -0
- data/lib/ftpd/cmd_quit.rb +2 -0
- data/lib/ftpd/cmd_rein.rb +2 -0
- data/lib/ftpd/cmd_rename.rb +2 -0
- data/lib/ftpd/cmd_rest.rb +2 -0
- data/lib/ftpd/cmd_retr.rb +2 -0
- data/lib/ftpd/cmd_rmd.rb +2 -0
- data/lib/ftpd/cmd_site.rb +2 -0
- data/lib/ftpd/cmd_size.rb +2 -0
- data/lib/ftpd/cmd_smnt.rb +2 -0
- data/lib/ftpd/cmd_stat.rb +2 -0
- data/lib/ftpd/cmd_stor.rb +2 -0
- data/lib/ftpd/cmd_stou.rb +2 -0
- data/lib/ftpd/cmd_stru.rb +2 -0
- data/lib/ftpd/cmd_syst.rb +2 -0
- data/lib/ftpd/cmd_type.rb +2 -0
- data/lib/ftpd/command_handler.rb +3 -0
- data/lib/ftpd/command_handler_factory.rb +2 -0
- data/lib/ftpd/command_handlers.rb +2 -0
- data/lib/ftpd/command_loop.rb +2 -0
- data/lib/ftpd/command_sequence_checker.rb +2 -0
- data/lib/ftpd/config.rb +2 -0
- data/lib/ftpd/connection_throttle.rb +2 -0
- data/lib/ftpd/connection_tracker.rb +2 -0
- data/lib/ftpd/data_connection_helper.rb +2 -0
- data/lib/ftpd/data_server_factory.rb +44 -0
- data/lib/ftpd/data_server_factory/random_ephemeral_port.rb +26 -0
- data/lib/ftpd/data_server_factory/specific_port_range.rb +37 -0
- data/lib/ftpd/disk_file_system.rb +2 -0
- data/lib/ftpd/error.rb +2 -0
- data/lib/ftpd/exception_translator.rb +2 -0
- data/lib/ftpd/exceptions.rb +2 -0
- data/lib/ftpd/file_info.rb +2 -0
- data/lib/ftpd/file_system_helper.rb +2 -0
- data/lib/ftpd/ftp_server.rb +27 -0
- data/lib/ftpd/gets_peer_address.rb +2 -0
- data/lib/ftpd/insecure_certificate.rb +2 -0
- data/lib/ftpd/list_format/eplf.rb +2 -0
- data/lib/ftpd/list_format/ls.rb +2 -0
- data/lib/ftpd/list_path.rb +2 -0
- data/lib/ftpd/null_logger.rb +2 -0
- data/lib/ftpd/protocols.rb +2 -0
- data/lib/ftpd/read_only_disk_file_system.rb +2 -0
- data/lib/ftpd/server.rb +2 -0
- data/lib/ftpd/session.rb +7 -0
- data/lib/ftpd/session_config.rb +26 -2
- data/lib/ftpd/stream.rb +2 -0
- data/lib/ftpd/telnet.rb +3 -2
- data/lib/ftpd/temp_dir.rb +2 -0
- data/lib/ftpd/tls_server.rb +2 -0
- data/lib/ftpd/translate_exceptions.rb +2 -0
- data/spec/command_sequence_checker_spec.rb +2 -0
- data/spec/connection_throttle_spec.rb +2 -0
- data/spec/connection_tracker_spec.rb +2 -0
- data/spec/data_server_factory_spec.rb +104 -0
- data/spec/disk_file_system_spec.rb +2 -0
- data/spec/exception_translator_spec.rb +2 -0
- data/spec/file_info_spec.rb +2 -0
- data/spec/ftp_server_error_spec.rb +2 -0
- data/spec/list_format/eplf_spec.rb +2 -0
- data/spec/list_format/ls_spec.rb +2 -0
- data/spec/list_path_spec.rb +2 -0
- data/spec/null_logger_spec.rb +2 -0
- data/spec/protocols_spec.rb +58 -38
- data/spec/server_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/telnet_spec.rb +2 -0
- data/spec/translate_exceptions_spec.rb +2 -0
- data/testlib/network.rb +17 -0
- metadata +13 -7
data/ftpd.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ftpd
|
5
|
+
# stub: ftpd 2.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ftpd"
|
9
|
-
s.version = "
|
9
|
+
s.version = "2.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Wayne Conrad"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2016-06-02"
|
15
15
|
s.description = "ftpd is a pure Ruby FTP server library. It supports implicit and explicit TLS, IPV6, passive and active mode, and is unconditionally compliant per RFC-1123. It can be used as part of a test fixture or embedded in a program."
|
16
16
|
s.email = "wconrad@yagni.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -106,6 +106,7 @@ Gem::Specification.new do |s|
|
|
106
106
|
"features/step_definitions/get.rb",
|
107
107
|
"features/step_definitions/help.rb",
|
108
108
|
"features/step_definitions/invalid_commands.rb",
|
109
|
+
"features/step_definitions/ipv6.rb",
|
109
110
|
"features/step_definitions/line_endings.rb",
|
110
111
|
"features/step_definitions/list.rb",
|
111
112
|
"features/step_definitions/login.rb",
|
@@ -190,6 +191,9 @@ Gem::Specification.new do |s|
|
|
190
191
|
"lib/ftpd/connection_throttle.rb",
|
191
192
|
"lib/ftpd/connection_tracker.rb",
|
192
193
|
"lib/ftpd/data_connection_helper.rb",
|
194
|
+
"lib/ftpd/data_server_factory.rb",
|
195
|
+
"lib/ftpd/data_server_factory/random_ephemeral_port.rb",
|
196
|
+
"lib/ftpd/data_server_factory/specific_port_range.rb",
|
193
197
|
"lib/ftpd/disk_file_system.rb",
|
194
198
|
"lib/ftpd/error.rb",
|
195
199
|
"lib/ftpd/exception_translator.rb",
|
@@ -222,6 +226,7 @@ Gem::Specification.new do |s|
|
|
222
226
|
"spec/command_sequence_checker_spec.rb",
|
223
227
|
"spec/connection_throttle_spec.rb",
|
224
228
|
"spec/connection_tracker_spec.rb",
|
229
|
+
"spec/data_server_factory_spec.rb",
|
225
230
|
"spec/disk_file_system_spec.rb",
|
226
231
|
"spec/exception_translator_spec.rb",
|
227
232
|
"spec/file_info_spec.rb",
|
@@ -234,11 +239,12 @@ Gem::Specification.new do |s|
|
|
234
239
|
"spec/server_spec.rb",
|
235
240
|
"spec/spec_helper.rb",
|
236
241
|
"spec/telnet_spec.rb",
|
237
|
-
"spec/translate_exceptions_spec.rb"
|
242
|
+
"spec/translate_exceptions_spec.rb",
|
243
|
+
"testlib/network.rb"
|
238
244
|
]
|
239
245
|
s.homepage = "http://github.com/wconrad/ftpd"
|
240
246
|
s.licenses = ["MIT"]
|
241
|
-
s.rubygems_version = "2.4.
|
247
|
+
s.rubygems_version = "2.4.8"
|
242
248
|
s.summary = "Pure Ruby FTP server library"
|
243
249
|
|
244
250
|
if s.respond_to? :specification_version then
|
@@ -246,10 +252,10 @@ Gem::Specification.new do |s|
|
|
246
252
|
|
247
253
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
248
254
|
s.add_runtime_dependency(%q<memoizer>, ["~> 1.0"])
|
249
|
-
s.add_development_dependency(%q<cucumber>, ["~>
|
255
|
+
s.add_development_dependency(%q<cucumber>, ["~> 2.0"])
|
250
256
|
s.add_development_dependency(%q<double-bag-ftps>, ["~> 0.1"])
|
251
257
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
252
|
-
s.add_development_dependency(%q<rake>, ["~>
|
258
|
+
s.add_development_dependency(%q<rake>, ["~> 11.1"])
|
253
259
|
s.add_development_dependency(%q<redcarpet>, ["~> 3.1"])
|
254
260
|
s.add_development_dependency(%q<rspec>, ["~> 3.1"])
|
255
261
|
s.add_development_dependency(%q<rspec-its>, ["~> 1.0"])
|
@@ -257,10 +263,10 @@ Gem::Specification.new do |s|
|
|
257
263
|
s.add_development_dependency(%q<yard>, ["~> 0.8.7"])
|
258
264
|
else
|
259
265
|
s.add_dependency(%q<memoizer>, ["~> 1.0"])
|
260
|
-
s.add_dependency(%q<cucumber>, ["~>
|
266
|
+
s.add_dependency(%q<cucumber>, ["~> 2.0"])
|
261
267
|
s.add_dependency(%q<double-bag-ftps>, ["~> 0.1"])
|
262
268
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
263
|
-
s.add_dependency(%q<rake>, ["~>
|
269
|
+
s.add_dependency(%q<rake>, ["~> 11.1"])
|
264
270
|
s.add_dependency(%q<redcarpet>, ["~> 3.1"])
|
265
271
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
266
272
|
s.add_dependency(%q<rspec-its>, ["~> 1.0"])
|
@@ -269,10 +275,10 @@ Gem::Specification.new do |s|
|
|
269
275
|
end
|
270
276
|
else
|
271
277
|
s.add_dependency(%q<memoizer>, ["~> 1.0"])
|
272
|
-
s.add_dependency(%q<cucumber>, ["~>
|
278
|
+
s.add_dependency(%q<cucumber>, ["~> 2.0"])
|
273
279
|
s.add_dependency(%q<double-bag-ftps>, ["~> 0.1"])
|
274
280
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
275
|
-
s.add_dependency(%q<rake>, ["~>
|
281
|
+
s.add_dependency(%q<rake>, ["~> 11.1"])
|
276
282
|
s.add_dependency(%q<redcarpet>, ["~> 3.1"])
|
277
283
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
278
284
|
s.add_dependency(%q<rspec-its>, ["~> 1.0"])
|
data/lib/ftpd.rb
CHANGED
data/lib/ftpd/auth_levels.rb
CHANGED
data/lib/ftpd/cmd_abor.rb
CHANGED
data/lib/ftpd/cmd_allo.rb
CHANGED
data/lib/ftpd/cmd_appe.rb
CHANGED
data/lib/ftpd/cmd_auth.rb
CHANGED
data/lib/ftpd/cmd_cdup.rb
CHANGED
data/lib/ftpd/cmd_cwd.rb
CHANGED
data/lib/ftpd/cmd_dele.rb
CHANGED
data/lib/ftpd/cmd_eprt.rb
CHANGED
data/lib/ftpd/cmd_epsv.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'command_handler'
|
4
|
+
require_relative 'data_server_factory'
|
2
5
|
|
3
6
|
module Ftpd
|
4
7
|
|
@@ -17,8 +20,7 @@ module Ftpd
|
|
17
20
|
if protocol_code
|
18
21
|
ensure_protocol_supported protocol_code
|
19
22
|
end
|
20
|
-
|
21
|
-
self.data_server = TCPServer.new(interface, 0)
|
23
|
+
self.data_server = data_server_factory.make_tcp_server
|
22
24
|
port = data_server.addr[1]
|
23
25
|
reply "229 Entering extended passive mode (|||#{port}|)"
|
24
26
|
end
|
data/lib/ftpd/cmd_feat.rb
CHANGED
data/lib/ftpd/cmd_help.rb
CHANGED
data/lib/ftpd/cmd_list.rb
CHANGED
data/lib/ftpd/cmd_login.rb
CHANGED
data/lib/ftpd/cmd_mdtm.rb
CHANGED
data/lib/ftpd/cmd_mkd.rb
CHANGED
data/lib/ftpd/cmd_mode.rb
CHANGED
data/lib/ftpd/cmd_nlst.rb
CHANGED
data/lib/ftpd/cmd_noop.rb
CHANGED
data/lib/ftpd/cmd_opts.rb
CHANGED
data/lib/ftpd/cmd_pasv.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'command_handler'
|
4
|
+
require_relative 'data_server_factory'
|
2
5
|
|
3
6
|
module Ftpd
|
4
7
|
|
@@ -10,9 +13,8 @@ module Ftpd
|
|
10
13
|
if data_server
|
11
14
|
reply "200 Already in passive mode"
|
12
15
|
else
|
13
|
-
|
14
|
-
|
15
|
-
ip = data_server.addr[3]
|
16
|
+
self.data_server = data_server_factory.make_tcp_server
|
17
|
+
ip = config.nat_ip || data_server.addr[3]
|
16
18
|
port = data_server.addr[1]
|
17
19
|
quads = [
|
18
20
|
ip.scan(/\d+/),
|
data/lib/ftpd/cmd_pbsz.rb
CHANGED
data/lib/ftpd/cmd_port.rb
CHANGED
data/lib/ftpd/cmd_prot.rb
CHANGED
data/lib/ftpd/cmd_pwd.rb
CHANGED
data/lib/ftpd/cmd_quit.rb
CHANGED
data/lib/ftpd/cmd_rein.rb
CHANGED
data/lib/ftpd/cmd_rename.rb
CHANGED
data/lib/ftpd/cmd_rest.rb
CHANGED
data/lib/ftpd/cmd_retr.rb
CHANGED
data/lib/ftpd/cmd_rmd.rb
CHANGED
data/lib/ftpd/cmd_site.rb
CHANGED
data/lib/ftpd/cmd_size.rb
CHANGED
data/lib/ftpd/cmd_smnt.rb
CHANGED
data/lib/ftpd/cmd_stat.rb
CHANGED
data/lib/ftpd/cmd_stor.rb
CHANGED
data/lib/ftpd/cmd_stou.rb
CHANGED
data/lib/ftpd/cmd_stru.rb
CHANGED
data/lib/ftpd/cmd_syst.rb
CHANGED
data/lib/ftpd/cmd_type.rb
CHANGED
data/lib/ftpd/command_handler.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'data_connection_helper'
|
2
4
|
require_relative 'error'
|
3
5
|
require_relative 'file_system_helper'
|
@@ -55,6 +57,7 @@ module Ftpd
|
|
55
57
|
:data_port,
|
56
58
|
:data_server,
|
57
59
|
:data_server=,
|
60
|
+
:data_server_factory,
|
58
61
|
:data_type,
|
59
62
|
:data_type=,
|
60
63
|
:ensure_logged_in,
|