ftpd 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
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,71 +0,0 @@
1
- Feature: Remove directory
2
-
3
- As a client
4
- I want to remove a directory
5
- To reduce clutter
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Make directory
11
- Given a successful login
12
- And the server has directory "foo"
13
- When the client successfully removes directory "foo"
14
- Then the server should not have directory "foo"
15
-
16
- Scenario: Directory of a directory
17
- Given a successful login
18
- And the server has directory "foo/bar"
19
- When the client successfully removes directory "foo/bar"
20
- Then the server should not have directory "foo/bar"
21
- And the server has directory "foo"
22
-
23
- Scenario: After cwd
24
- Given a successful login
25
- And the server has directory "foo/bar"
26
- And the client successfully cd's to "foo"
27
- When the client successfully removes directory "bar"
28
- Then the server should not have directory "foo/bar"
29
-
30
- Scenario: XRMD
31
- Given a successful login
32
- And the server has directory "foo"
33
- When the client successfully sends "XRMD foo"
34
- Then the server should not have directory "foo"
35
-
36
- Scenario: Missing directory
37
- Given a successful login
38
- When the client removes directory "foo/bar"
39
- Then the server returns a not found error
40
-
41
- Scenario: Not logged in
42
- Given a successful connection
43
- When the client removes directory "foo"
44
- Then the server returns a not logged in error
45
-
46
- Scenario: Does not exist
47
- Given a successful login
48
- When the client removes directory "foo"
49
- Then the server returns a not found error
50
-
51
- Scenario: Remove a file
52
- Given a successful login
53
- And the server has file "foo"
54
- When the client removes directory "foo"
55
- Then the server returns a not a directory error
56
-
57
- Scenario: Rmdir not enabled
58
- Given the test server lacks rmdir
59
- And a successful login
60
- When the client removes directory "foo"
61
- Then the server returns an unimplemented command error
62
-
63
- Scenario: Missing path
64
- Given a successful login
65
- When the client sends "RMD"
66
- Then the server returns a syntax error
67
-
68
- Scenario: Access denied
69
- Given a successful login
70
- When the client removes directory "forbidden"
71
- Then the server returns an access denied error
@@ -1,13 +0,0 @@
1
- Feature: Site
2
-
3
- As a client
4
- I want to know this command is not supported
5
- So that I can avoid using it
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Unimplemented
11
- Given a successful connection
12
- When the client sends command "SITE"
13
- Then the server returns an unimplemented command error
@@ -1,69 +0,0 @@
1
- Feature: Size
2
-
3
- As a client
4
- I want to know the size of a file
5
- So that I can tell how long it will take to get it
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: ASCII file with *nix line endings
11
- Given a successful login
12
- And the server has file "ascii_unix"
13
- When the client successfully gets size of text "ascii_unix"
14
- Then the reported size should be "83"
15
-
16
- Scenario: ASCII file with windows line endings
17
- Given a successful login
18
- And the server has file "ascii_windows"
19
- When the client successfully gets size of text "ascii_windows"
20
- Then the reported size should be "83"
21
-
22
- Scenario: Binary file
23
- Given a successful login
24
- And the server has file "binary"
25
- When the client successfully gets size of binary "binary"
26
- Then the reported size should be "256"
27
-
28
- Scenario: File in subdirectory
29
- Given a successful login
30
- And the server has file "foo/ascii_unix"
31
- Then the client successfully gets size of text "foo/ascii_unix"
32
-
33
- Scenario: Non-root working directory
34
- Given a successful login
35
- And the server has file "foo/ascii_unix"
36
- And the client successfully cd's to "foo"
37
- Then the client successfully gets size of text "ascii_unix"
38
-
39
- Scenario: Access denied
40
- Given a successful login
41
- When the client gets size of text "forbidden"
42
- Then the server returns an access denied error
43
-
44
- Scenario: Missing file
45
- Given a successful login
46
- When the client gets size of text "foo"
47
- Then the server returns a not found error
48
-
49
- Scenario: Not logged in
50
- Given a successful connection
51
- When the client gets size of text "foo"
52
- Then the server returns a not logged in error
53
-
54
- Scenario: Missing path
55
- Given a successful login
56
- When the client gets size with no path
57
- Then the server returns a syntax error
58
-
59
- Scenario: File system error
60
- Given a successful login
61
- When the client gets size of text "unable"
62
- Then the server returns an action not taken error
63
-
64
- Scenario: Read not enabled
65
- Given the test server lacks read
66
- And a successful login
67
- And the server has file "foo"
68
- When the client gets size of text "foo"
69
- Then the server returns an unimplemented command error
@@ -1,18 +0,0 @@
1
- Feature: Status
2
-
3
- As a client
4
- I want server status
5
- To know what state the server is in
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Not logged in
11
- Given a successful connection
12
- When the client requests status
13
- Then the server returns a not logged in error
14
-
15
- Scenario: Server status
16
- Given a successful login
17
- When the client successfully requests status
18
- Then the server returns its title
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then /^the server should have written( no)? log output$/ do |neg|
4
- verb = if neg
5
- :to
6
- else
7
- :to_not
8
- end
9
- expect(server.log_output).send(verb, eq(''))
10
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def server
4
- @server ||= TestServer.new
5
- end
6
-
7
- Given /^the test server is started$/ do
8
- server.start
9
- end
10
-
11
- Given /^the test server has TLS mode "(\w+)"$/ do |mode|
12
- server.tls = mode.to_sym
13
- end
14
-
15
- Given(/^the test server is bound to "(.*?)"$/) do |ip_address|
16
- server.interface = ip_address
17
- end
18
-
19
- Given /^the test server has logging (enabled|disabled)$/ do |state|
20
- server.logging = state == 'enabled'
21
- end
22
-
23
- Given /^the test server lacks (\w+)$/ do |feature|
24
- server.send "#{feature}=", false
25
- end
26
-
27
- Given /^the test server has auth level "(.*?)"$/ do |auth_level|
28
- auth_level = Ftpd.const_get(auth_level)
29
- server.auth_level = auth_level
30
- end
31
-
32
- Given /^the test server has session timeout set to (\S+) seconds$/ do
33
- |timeout|
34
- server.session_timeout = timeout.to_f
35
- end
36
-
37
- Given /^the test server has session timeout disabled$/ do
38
- server.session_timeout = nil
39
- end
40
-
41
- Given /^the test server disallows low data ports$/ do
42
- server.allow_low_data_ports = false
43
- end
44
-
45
- Given /^the test server allows low data ports$/ do
46
- server.allow_low_data_ports = true
47
- end
48
-
49
- Given /^the test server has max_connections set to (\d+)$/ do |s|
50
- server.max_connections = s.to_i
51
- end
52
-
53
- Given /^the test server has max_connections_per_ip set to (\d+)$/ do |s|
54
- server.max_connections_per_ip = s.to_i
55
- end
56
-
57
- Given /^the test server has no max failed login attempts$/ do
58
- server.max_failed_logins = nil
59
- end
60
-
61
- Given /^the test server has a max of (\d+) failed login attempts$/ do |s|
62
- server.max_failed_logins = s.to_i
63
- end
64
-
65
- Given /^the test server has a failed login delay of (\S+) seconds$/ do |s|
66
- server.failed_login_delay = s.to_f
67
- end
68
-
69
- Given /^the test server has a NAT IP of (\S+)$/ do |s|
70
- server.nat_ip = s
71
- end
@@ -1,13 +0,0 @@
1
- Feature: Structure Mount
2
-
3
- As a client
4
- I want to know this command is not supported
5
- So that I can avoid using it
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Unimplemented
11
- Given a successful connection
12
- When the client sends command "SMNT"
13
- Then the server returns an unimplemented command error
@@ -1,18 +0,0 @@
1
- Feature: Syntax Errors
2
-
3
- As a client
4
- I want good error messages
5
- So that I can figure out what went wrong
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Empty command
11
- Given a successful connection
12
- When the client sends an empty command
13
- Then the server returns a syntax error
14
-
15
- Scenario: Command contains non-word characters
16
- Given a successful connection
17
- When the client sends a non-word command
18
- Then the server returns a syntax error
@@ -1,18 +0,0 @@
1
- Feature: Port
2
-
3
- As a client
4
- I want to identify the server
5
- So that I know how it will behave
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: Success
11
- Given a successful connection
12
- When the client successfully queries system ID
13
- Then the server returns a system ID reply
14
-
15
- Scenario: With argument
16
- Given a successful login
17
- When the client sends "SYST 1"
18
- Then the server returns a syntax error
@@ -1,26 +0,0 @@
1
- Feature: Port
2
-
3
- As a programmer
4
- I want idle sessions to timeout and disconnect
5
- So that I can claim RFC compliance
6
-
7
- Scenario: Session idle too long
8
- Given the test server has session timeout set to 0.5 seconds
9
- And the test server is started
10
- And a successful login
11
- When the client is idle for 0.6 seconds
12
- Then the client should not be connected
13
-
14
- Scenario: Session not idle too long
15
- Given the test server has session timeout set to 0.5 seconds
16
- And the test server is started
17
- And a successful login
18
- When the client is idle for 0 seconds
19
- Then the client should be connected
20
-
21
- Scenario: Timeout disabled
22
- Given the test server has session timeout disabled
23
- And the test server is started
24
- And a successful login
25
- When the client is idle for 0.6 seconds
26
- Then the client should be connected
@@ -1,59 +0,0 @@
1
- Feature: Representation Type
2
-
3
- As a client
4
- I want to set the representation type
5
- So that I can interoperate with foreign operating systems
6
-
7
- Background:
8
- Given the test server is started
9
-
10
- Scenario: ASCII/default
11
- Given a successful login
12
- Then the client successfully sets type "A"
13
-
14
- Scenario: ASCII/Non-print
15
- Given a successful login
16
- Then the client successfully sets type "A N"
17
-
18
- Scenario: ASCII/Telnet
19
- Given a successful login
20
- When the client successfully sets type "A T"
21
-
22
- Scenario: Type IMAGE
23
- Given a successful login
24
- Then the client successfully sets type "I"
25
-
26
- Scenario: Type EBCDIC
27
- Given a successful login
28
- When the client sets type "E"
29
- Then the server returns a type not implemented error
30
-
31
- Scenario: Type Local
32
- Given a successful login
33
- When the client sets type "L 7"
34
- Then the server returns a type not implemented error
35
-
36
- Scenario: Invalid Type
37
- Given a successful login
38
- When the client sets type "*"
39
- Then the server returns an invalid type error
40
-
41
- Scenario: Format Carriage Control
42
- Given a successful login
43
- When the client sets type "A C"
44
- Then the server returns a type not implemented error
45
-
46
- Scenario: Invalid Format
47
- Given a successful login
48
- When the client sets type "A *"
49
- Then the server returns an invalid type error
50
-
51
- Scenario: Not logged in
52
- Given a successful connection
53
- When the client sets type "S"
54
- Then the server returns a not logged in error
55
-
56
- Scenario: Missing parameter
57
- Given a successful login
58
- When the client sets type with no parameter
59
- Then the server returns a syntax error
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- When /^the client appends (.*)$/ do |args|
4
- capture_error do
5
- step "the client successfully appends #{args}"
6
- end
7
- end
8
-
9
- When /^the client successfully appends text "(.*?)" onto "(.*?)"$/ do
10
- |local_path, remote_path|
11
- client.append_text local_path, remote_path
12
- end
13
-
14
- When /^the client successfully appends binary "(.*?)" onto "(.*?)"$/ do
15
- |local_path, remote_path|
16
- client.append_binary local_path, remote_path
17
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'singleton'
4
-
5
- class Clients
6
-
7
- include Singleton
8
-
9
- def initialize
10
- @clients = {}
11
- end
12
-
13
- def [](client_name)
14
- @clients[client_name] ||= TestClient.new
15
- end
16
-
17
- def close
18
- @clients.values.each(&:close)
19
- end
20
-
21
- end
22
-
23
- def client(client_name = nil)
24
- client_name ||= 'client'
25
- client_name = client_name.strip
26
- Clients.instance[client_name]
27
- end