ftpd 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +6 -0
  3. data/Gemfile +2 -15
  4. data/Gemfile.lock +12 -51
  5. data/README.md +12 -0
  6. data/VERSION +1 -1
  7. data/bin/ftpdrb +17 -12
  8. data/examples/write_only.rb +61 -0
  9. data/ftpd.gemspec +59 -261
  10. data/lib/ftpd/session.rb +51 -51
  11. metadata +11 -153
  12. data/.travis.yml +0 -6
  13. data/features/example/eplf.feature +0 -14
  14. data/features/example/example.feature +0 -18
  15. data/features/example/read_only.feature +0 -63
  16. data/features/example/step_definitions/example_server.rb +0 -13
  17. data/features/ftp_server/abort.feature +0 -13
  18. data/features/ftp_server/allo.feature +0 -33
  19. data/features/ftp_server/append.feature +0 -94
  20. data/features/ftp_server/cdup.feature +0 -36
  21. data/features/ftp_server/command_errors.feature +0 -13
  22. data/features/ftp_server/concurrent_sessions.feature +0 -14
  23. data/features/ftp_server/delay_after_failed_login.feature +0 -23
  24. data/features/ftp_server/delete.feature +0 -60
  25. data/features/ftp_server/directory_navigation.feature +0 -59
  26. data/features/ftp_server/disconnect_after_failed_logins.feature +0 -25
  27. data/features/ftp_server/eprt.feature +0 -56
  28. data/features/ftp_server/epsv.feature +0 -37
  29. data/features/ftp_server/features.feature +0 -38
  30. data/features/ftp_server/file_structure.feature +0 -43
  31. data/features/ftp_server/get.feature +0 -80
  32. data/features/ftp_server/get_ipv6.feature +0 -46
  33. data/features/ftp_server/get_tls.feature +0 -23
  34. data/features/ftp_server/help.feature +0 -21
  35. data/features/ftp_server/implicit_tls.feature +0 -23
  36. data/features/ftp_server/invertability.feature +0 -15
  37. data/features/ftp_server/list.feature +0 -94
  38. data/features/ftp_server/list_tls.feature +0 -29
  39. data/features/ftp_server/logging.feature +0 -11
  40. data/features/ftp_server/login_auth_level_account.feature +0 -51
  41. data/features/ftp_server/login_auth_level_password.feature +0 -59
  42. data/features/ftp_server/login_auth_level_user.feature +0 -31
  43. data/features/ftp_server/max_connections.feature +0 -39
  44. data/features/ftp_server/mdtm.feature +0 -53
  45. data/features/ftp_server/mkdir.feature +0 -70
  46. data/features/ftp_server/mode.feature +0 -43
  47. data/features/ftp_server/name_list.feature +0 -77
  48. data/features/ftp_server/name_list_tls.feature +0 -30
  49. data/features/ftp_server/noop.feature +0 -17
  50. data/features/ftp_server/options.feature +0 -17
  51. data/features/ftp_server/pasv.feature +0 -30
  52. data/features/ftp_server/port.feature +0 -49
  53. data/features/ftp_server/put.feature +0 -79
  54. data/features/ftp_server/put_tls.feature +0 -23
  55. data/features/ftp_server/put_unique.feature +0 -56
  56. data/features/ftp_server/quit.feature +0 -23
  57. data/features/ftp_server/reinitialize.feature +0 -13
  58. data/features/ftp_server/rename.feature +0 -97
  59. data/features/ftp_server/rmdir.feature +0 -71
  60. data/features/ftp_server/site.feature +0 -13
  61. data/features/ftp_server/size.feature +0 -69
  62. data/features/ftp_server/status.feature +0 -18
  63. data/features/ftp_server/step_definitions/logging.rb +0 -10
  64. data/features/ftp_server/step_definitions/test_server.rb +0 -71
  65. data/features/ftp_server/structure_mount.feature +0 -13
  66. data/features/ftp_server/syntax_errors.feature +0 -18
  67. data/features/ftp_server/syst.feature +0 -18
  68. data/features/ftp_server/timeout.feature +0 -26
  69. data/features/ftp_server/type.feature +0 -59
  70. data/features/step_definitions/append.rb +0 -17
  71. data/features/step_definitions/client.rb +0 -27
  72. data/features/step_definitions/client_and_server_files.rb +0 -26
  73. data/features/step_definitions/client_files.rb +0 -16
  74. data/features/step_definitions/command.rb +0 -7
  75. data/features/step_definitions/connect.rb +0 -39
  76. data/features/step_definitions/delete.rb +0 -17
  77. data/features/step_definitions/directory_navigation.rb +0 -28
  78. data/features/step_definitions/error_replies.rb +0 -117
  79. data/features/step_definitions/features.rb +0 -23
  80. data/features/step_definitions/file_structure.rb +0 -18
  81. data/features/step_definitions/generic_send.rb +0 -11
  82. data/features/step_definitions/get.rb +0 -18
  83. data/features/step_definitions/help.rb +0 -20
  84. data/features/step_definitions/invalid_commands.rb +0 -13
  85. data/features/step_definitions/ipv6.rb +0 -11
  86. data/features/step_definitions/line_endings.rb +0 -9
  87. data/features/step_definitions/list.rb +0 -75
  88. data/features/step_definitions/login.rb +0 -84
  89. data/features/step_definitions/mkdir.rb +0 -11
  90. data/features/step_definitions/mode.rb +0 -17
  91. data/features/step_definitions/mtime.rb +0 -25
  92. data/features/step_definitions/noop.rb +0 -17
  93. data/features/step_definitions/options.rb +0 -11
  94. data/features/step_definitions/passive.rb +0 -10
  95. data/features/step_definitions/pending.rb +0 -5
  96. data/features/step_definitions/port.rb +0 -7
  97. data/features/step_definitions/put.rb +0 -31
  98. data/features/step_definitions/quit.rb +0 -17
  99. data/features/step_definitions/rename.rb +0 -13
  100. data/features/step_definitions/rmdir.rb +0 -11
  101. data/features/step_definitions/server_files.rb +0 -63
  102. data/features/step_definitions/server_title.rb +0 -14
  103. data/features/step_definitions/size.rb +0 -22
  104. data/features/step_definitions/status.rb +0 -11
  105. data/features/step_definitions/success_replies.rb +0 -9
  106. data/features/step_definitions/system.rb +0 -12
  107. data/features/step_definitions/timing.rb +0 -21
  108. data/features/step_definitions/type.rb +0 -17
  109. data/features/support/env.rb +0 -6
  110. data/features/support/example_server.rb +0 -69
  111. data/features/support/file_templates/ascii_unix +0 -4
  112. data/features/support/file_templates/ascii_windows +0 -4
  113. data/features/support/file_templates/binary +0 -0
  114. data/features/support/test_client.rb +0 -258
  115. data/features/support/test_file_templates.rb +0 -35
  116. data/features/support/test_server.rb +0 -304
  117. data/features/support/test_server_files.rb +0 -59
  118. data/rake_tasks/cucumber.rake +0 -9
  119. data/rake_tasks/default.rake +0 -1
  120. data/rake_tasks/jeweler.rake +0 -52
  121. data/rake_tasks/spec.rake +0 -3
  122. data/rake_tasks/test.rake +0 -2
  123. data/rake_tasks/yard.rake +0 -3
  124. data/spec/command_sequence_checker_spec.rb +0 -85
  125. data/spec/connection_throttle_spec.rb +0 -101
  126. data/spec/connection_tracker_spec.rb +0 -99
  127. data/spec/data_server_factory_spec.rb +0 -104
  128. data/spec/disk_file_system_spec.rb +0 -322
  129. data/spec/exception_translator_spec.rb +0 -38
  130. data/spec/file_info_spec.rb +0 -61
  131. data/spec/ftp_server_error_spec.rb +0 -15
  132. data/spec/list_format/eplf_spec.rb +0 -63
  133. data/spec/list_format/ls_spec.rb +0 -272
  134. data/spec/list_path_spec.rb +0 -23
  135. data/spec/null_logger_spec.rb +0 -26
  136. data/spec/protocols_spec.rb +0 -159
  137. data/spec/server_spec.rb +0 -83
  138. data/spec/spec_helper.rb +0 -17
  139. data/spec/telnet_spec.rb +0 -77
  140. data/spec/translate_exceptions_spec.rb +0 -42
  141. data/testlib/network.rb +0 -17
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def logged_in?
4
- step "the client lists the directory"
5
- @error.nil?
6
- end
7
-
8
- def login(tokens, client_name = nil)
9
- capture_error do
10
- client(client_name).login *tokens
11
- end
12
- end
13
-
14
- Given /^a successful connection( with \w+ TLS)?$/ do |with_tls|
15
- step "the client connects#{with_tls}"
16
- end
17
-
18
- Given /^a successful login( with \w+ TLS)?$/ do |with_tls|
19
- step "a successful connection#{with_tls}"
20
- step 'the client logs in'
21
- end
22
-
23
- Given /^a failed login$/ do
24
- step 'the client connects'
25
- step 'the client logs in with bad user'
26
- end
27
-
28
- When /^the(?: (\w+))? client logs in(?: with bad (\w+))?$/ do
29
- |client_name, bad|
30
- tokens = [
31
- if bad == 'user'
32
- 'bad_user'
33
- else
34
- @server.user
35
- end,
36
- if bad == 'password'
37
- 'bad_password'
38
- else
39
- @server.password
40
- end,
41
- if bad == 'account'
42
- 'bad_account'
43
- else
44
- @server.account
45
- end,
46
- ][0..server.auth_level]
47
- @error = login(tokens, client_name)
48
- end
49
-
50
- Then /^the client should( not)? be logged in$/ do |neg|
51
- matcher_method = if neg
52
- :be_falsey
53
- else
54
- :be_truthy
55
- end
56
- expect(logged_in?).to send(matcher_method)
57
- end
58
-
59
- When /^the client sends a password( with no parameter)?$/ do |no_param|
60
- capture_error do
61
- args = if no_param
62
- []
63
- else
64
- [server.password]
65
- end
66
- client.raw 'PASS', *args
67
- end
68
- end
69
-
70
- When /^the client sends a user( with no parameter)?$/ do |no_param|
71
- capture_error do
72
- args = if no_param
73
- []
74
- else
75
- [server.user]
76
- end
77
- client.raw 'USER', *args
78
- end
79
- end
80
-
81
- Given /^the (\w+) client connects and logs in$/ do |client_name|
82
- step "the #{client_name} client connects"
83
- step "the #{client_name} client logs in"
84
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client makes directory "(.*?)"$/ do |path|
4
- capture_error do
5
- step %Q(the client successfully makes directory "#{path}")
6
- end
7
- end
8
-
9
- When /^the client successfully makes directory "(.*?)"$/ do |path|
10
- mkdir_response = client.mkdir path
11
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully sets mode "(.*?)"$/ do |mode|
4
- client.raw 'MODE', mode
5
- end
6
-
7
- When /^the client sets mode "(.*?)"$/ do |mode|
8
- capture_error do
9
- step %Q'the client successfully sets mode "#{mode}"'
10
- end
11
- end
12
-
13
- When /^the client sets mode with no parameter$/ do
14
- capture_error do
15
- client.raw 'MODE'
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'date'
4
-
5
- When /^the client successfully gets mtime of "(.*?)"$/ \
6
- do |remote_path|
7
- @mtime = client.get_mtime remote_path
8
- end
9
-
10
- When /^the client gets mtime of "(.*?)"$/ do |path|
11
- capture_error do
12
- step %Q(the client successfully gets mtime of "#{path}")
13
- end
14
- end
15
-
16
- When /^the client gets mtime with no path$/ do
17
- capture_error do
18
- client.raw 'MDTM'
19
- end
20
- end
21
-
22
- Then(/^the reported mtime should be "(.*?)"$/) do |mtime|
23
- expected_time = DateTime.parse(mtime).to_time.utc
24
- expect(@mtime).to eq expected_time
25
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the( \w+)? client successfully does nothing( with a parameter)?$/ do
4
- |client_name, with_param|
5
- if with_param
6
- client(client_name).raw 'NOOP', 'foo'
7
- else
8
- client(client_name).noop
9
- end
10
- end
11
-
12
- When /^the( \w+)? client does nothing( with a parameter)?$/ do
13
- |client_name, with_param|
14
- capture_error do
15
- step "the#{client_name} client successfully does nothing#{with_param}"
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully sets option "(.*?)"$/ do |option|
4
- client.set_option option
5
- end
6
-
7
- When /^the client sets option "(.*?)"$/ do |option|
8
- capture_error do
9
- step %q'the client successfully sets option "#{option}"'
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Given /^the client is in (passive|active) mode$/ do |mode|
4
- client.passive = mode == 'passive'
5
- end
6
-
7
- Then(/^the server advertises passive IP (\S+)$/) do |ip|
8
- quads = @reply.scan(/\d+/)[1..4].join(".")
9
- expect(quads).to eq ip
10
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Given /^PENDING/ do
4
- pending
5
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client sends PORT "(.*?)"$/ do |param|
4
- capture_error do
5
- client.raw 'PORT', param
6
- end
7
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully puts (text|binary) "(.*?)"$/ do
4
- |mode, local_path|
5
- client.put mode, local_path
6
- end
7
-
8
- When /^the client puts (\S+) "(.*?)"$/ do |mode, path|
9
- capture_error do
10
- step %Q(the client successfully puts #{mode} "#{path}")
11
- end
12
- end
13
-
14
- When /^the client puts with no path$/ do
15
- capture_error do
16
- client.raw 'STOR'
17
- end
18
- end
19
-
20
- When /^the client successfully stores unique "(.*?)"(?: to "(.*?)")?$/ do
21
- |local_path, remote_path|
22
- client.store_unique local_path, remote_path
23
- end
24
-
25
- When /^the client stores unique "(.*?)"( to ".*?")?$/ do
26
- |local_path, remote_path|
27
- capture_error do
28
- step(%Q'the client successfully stores unique ' +
29
- %Q'"#{local_path}"#{remote_path}')
30
- end
31
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully quits$/ do
4
- client.quit
5
- end
6
-
7
- When /^the client quits$/ do
8
- capture_error do
9
- step 'the client successfully quits'
10
- end
11
- end
12
-
13
- When /^the client quits with a parameter$/ do
14
- capture_error do
15
- client.raw 'QUIT', 'foo'
16
- end
17
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client renames "(.*?)" to "(.*?)"$/ do
4
- |from_path, to_path|
5
- capture_error do
6
- step %Q'the client successfully renames "#{from_path}" to "#{to_path}"'
7
- end
8
- end
9
-
10
- When /^the client successfully renames "(.*?)" to "(.*?)"$/ do
11
- |from_path, to_path|
12
- client.rename(from_path, to_path)
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client removes directory "(.*?)"$/ do |path|
4
- capture_error do
5
- step %Q(the client successfully removes directory "#{path}")
6
- end
7
- end
8
-
9
- When /^the client successfully removes directory "(.*?)"$/ do |path|
10
- mkdir_response = client.rmdir path
11
- end
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'date'
4
-
5
- Given /^the server has directory "(.*?)"$/ do |remote_path|
6
- server.add_directory remote_path
7
- end
8
-
9
- Given /^the server has file "(.*?)"$/ do |remote_path|
10
- server.add_file remote_path
11
- end
12
-
13
- Given(/^the file "(.*?)" has mtime "(.*?)"$/) do |remote_path, mtime|
14
- mtime = DateTime.parse(mtime).to_time.utc
15
- server.set_mtime remote_path, mtime
16
- end
17
-
18
- Then /^the server should( not)? have file "(.*?)"$/ do |neg, path|
19
- matcher = if neg
20
- :be_falsey
21
- else
22
- :be_truthy
23
- end
24
- expect(server.has_file?(path)).to send(matcher)
25
- end
26
-
27
- Then /^the server should( not)? have directory "(.*?)"$/ do |neg, path|
28
- matcher = if neg
29
- :be_falsey
30
- else
31
- :be_truthy
32
- end
33
- expect(server.has_directory?(path)).to send(matcher)
34
- end
35
-
36
- Then /^the remote file "(.*?)" should have (unix|windows) line endings$/ do
37
- |remote_path, line_ending_type|
38
- expect(line_ending_type(server.file_contents(remote_path))).to eq \
39
- line_ending_type.to_sym
40
- end
41
-
42
- Then /^the server should have a file with the contents of "(.*?)"$/ do
43
- |path|
44
- expect(server.has_file_with_contents_of?(path)).to be_truthy
45
- end
46
-
47
- Then /^the server should have (\d+) files? with "(.*?)" in the name$/ do
48
- |count, name|
49
- expect(server.files_named_like(name).size).to eq count.to_i
50
- end
51
-
52
- Then /^the remote file "(.*?)" should match "(\w+)" \+ "(\w+)"$/ do
53
- |remote_path, template1, template2|
54
- expected = @server.template(template1) + @server.template(template2)
55
- actual = @server.file_contents(remote_path)
56
- expect(actual).to eq expected
57
- end
58
-
59
- Then /^the remote file "(.*?)" should match "(\w+)"$/ do |remote_path, template|
60
- expected = @server.template(template)
61
- actual = @server.file_contents(remote_path)
62
- expect(actual).to eq expected
63
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then /^the server returns its title$/ do
4
- step 'the server returns its name'
5
- step 'the server returns its version'
6
- end
7
-
8
- Then /^the server returns its name$/ do
9
- expect(@response).to include @server.server_name
10
- end
11
-
12
- Then /^the server returns its version$/ do
13
- expect(@response).to match /\b\d+\.\d+\.\d+\b/
14
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully gets size of (text|binary) "(.*?)"$/ \
4
- do |mode, remote_path|
5
- @size = client.get_size mode, remote_path
6
- end
7
-
8
- When /^the client gets size of (\S+) "(.*?)"$/ do |mode, path|
9
- capture_error do
10
- step %Q(the client successfully gets size of #{mode} "#{path}")
11
- end
12
- end
13
-
14
- When /^the client gets size with no path$/ do
15
- capture_error do
16
- client.raw 'SIZE'
17
- end
18
- end
19
-
20
- Then(/^the reported size should be "(.*?)"$/) do |size|
21
- expect(@size).to eq size.to_i
22
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully requests status$/ do
4
- @response = client.status
5
- end
6
-
7
- When /^the client requests status$/ do
8
- capture_error do
9
- step 'the client successfully requests status'
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then /^the server returns a "(.*?)" reply$/ do |reply|
4
- expect(@reply).to eq reply + "\n"
5
- end
6
-
7
- Then /^the server returns a not necessary reply$/ do
8
- step 'the server returns a "202 Command not needed at this site" reply'
9
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully queries system ID$/ do
4
- @reply = client.system
5
- # Prior to ruby-2.3.0, the #system call returned a string ending in
6
- # a new-line.
7
- @reply += "\n" unless @reply =~ /\n$/
8
- end
9
-
10
- Then /^the server returns a system ID reply$/ do
11
- step 'the server returns a "UNIX Type: L8" reply'
12
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Before do
4
- @start_time = Time.now
5
- end
6
-
7
- When /^the client is idle for (\S+) seconds$/ do |seconds|
8
- sleep seconds.to_f
9
- end
10
-
11
- Then /^it should take at least (\S+) seconds$/ do |s|
12
- min_elapsed_time = s.to_f
13
- elapsed_time = Time.now - @start_time
14
- expect(elapsed_time).to be >= min_elapsed_time
15
- end
16
-
17
- Then /^it should take less than (\S+) seconds$/ do |s|
18
- max_elapsed_time = s.to_f
19
- elapsed_time = Time.now - @start_time
20
- expect(elapsed_time).to be < max_elapsed_time
21
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client successfully sets type "(.*?)"$/ do |type|
4
- client.raw 'TYPE', type
5
- end
6
-
7
- When /^the client sets type "(.*?)"$/ do |type|
8
- capture_error do
9
- step %Q'the client successfully sets type "#{type}"'
10
- end
11
- end
12
-
13
- When /^the client sets type with no parameter$/ do
14
- capture_error do
15
- client.raw 'TYPE'
16
- end
17
- end