investtools-ftpd 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -0
- data/.yardopts +7 -0
- data/Changelog.md +310 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +93 -0
- data/LICENSE.md +9 -0
- data/README.md +371 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/doc/benchmarks.md +82 -0
- data/doc/references.md +66 -0
- data/doc/rfc-compliance.md +292 -0
- data/examples/example.rb +275 -0
- data/examples/example_spec.rb +93 -0
- data/examples/hello_world.rb +32 -0
- data/features/example/eplf.feature +14 -0
- data/features/example/example.feature +18 -0
- data/features/example/read_only.feature +63 -0
- data/features/example/step_definitions/example_server.rb +11 -0
- data/features/ftp_server/abort.feature +13 -0
- data/features/ftp_server/allo.feature +33 -0
- data/features/ftp_server/append.feature +94 -0
- data/features/ftp_server/cdup.feature +36 -0
- data/features/ftp_server/command_errors.feature +13 -0
- data/features/ftp_server/concurrent_sessions.feature +14 -0
- data/features/ftp_server/delay_after_failed_login.feature +23 -0
- data/features/ftp_server/delete.feature +60 -0
- data/features/ftp_server/directory_navigation.feature +59 -0
- data/features/ftp_server/disconnect_after_failed_logins.feature +25 -0
- data/features/ftp_server/eprt.feature +55 -0
- data/features/ftp_server/epsv.feature +36 -0
- data/features/ftp_server/features.feature +38 -0
- data/features/ftp_server/file_structure.feature +43 -0
- data/features/ftp_server/get.feature +80 -0
- data/features/ftp_server/get_ipv6.feature +43 -0
- data/features/ftp_server/get_tls.feature +23 -0
- data/features/ftp_server/help.feature +21 -0
- data/features/ftp_server/implicit_tls.feature +23 -0
- data/features/ftp_server/invertability.feature +15 -0
- data/features/ftp_server/list.feature +94 -0
- data/features/ftp_server/list_tls.feature +29 -0
- data/features/ftp_server/logging.feature +11 -0
- data/features/ftp_server/login_auth_level_account.feature +51 -0
- data/features/ftp_server/login_auth_level_password.feature +59 -0
- data/features/ftp_server/login_auth_level_user.feature +31 -0
- data/features/ftp_server/max_connections.feature +39 -0
- data/features/ftp_server/mdtm.feature +53 -0
- data/features/ftp_server/mkdir.feature +70 -0
- data/features/ftp_server/mode.feature +43 -0
- data/features/ftp_server/name_list.feature +77 -0
- data/features/ftp_server/name_list_tls.feature +30 -0
- data/features/ftp_server/noop.feature +17 -0
- data/features/ftp_server/options.feature +17 -0
- data/features/ftp_server/pasv.feature +23 -0
- data/features/ftp_server/port.feature +49 -0
- data/features/ftp_server/put.feature +79 -0
- data/features/ftp_server/put_tls.feature +23 -0
- data/features/ftp_server/put_unique.feature +56 -0
- data/features/ftp_server/quit.feature +23 -0
- data/features/ftp_server/reinitialize.feature +13 -0
- data/features/ftp_server/rename.feature +97 -0
- data/features/ftp_server/rmdir.feature +71 -0
- data/features/ftp_server/site.feature +13 -0
- data/features/ftp_server/size.feature +69 -0
- data/features/ftp_server/status.feature +18 -0
- data/features/ftp_server/step_definitions/logging.rb +8 -0
- data/features/ftp_server/step_definitions/test_server.rb +65 -0
- data/features/ftp_server/structure_mount.feature +13 -0
- data/features/ftp_server/syntax_errors.feature +18 -0
- data/features/ftp_server/syst.feature +18 -0
- data/features/ftp_server/timeout.feature +26 -0
- data/features/ftp_server/type.feature +59 -0
- data/features/step_definitions/append.rb +15 -0
- data/features/step_definitions/client.rb +24 -0
- data/features/step_definitions/client_and_server_files.rb +24 -0
- data/features/step_definitions/client_files.rb +14 -0
- data/features/step_definitions/command.rb +5 -0
- data/features/step_definitions/connect.rb +37 -0
- data/features/step_definitions/delete.rb +15 -0
- data/features/step_definitions/directory_navigation.rb +26 -0
- data/features/step_definitions/error_replies.rb +115 -0
- data/features/step_definitions/features.rb +21 -0
- data/features/step_definitions/file_structure.rb +16 -0
- data/features/step_definitions/generic_send.rb +9 -0
- data/features/step_definitions/get.rb +16 -0
- data/features/step_definitions/help.rb +18 -0
- data/features/step_definitions/invalid_commands.rb +11 -0
- data/features/step_definitions/line_endings.rb +7 -0
- data/features/step_definitions/list.rb +73 -0
- data/features/step_definitions/login.rb +82 -0
- data/features/step_definitions/mkdir.rb +9 -0
- data/features/step_definitions/mode.rb +15 -0
- data/features/step_definitions/mtime.rb +23 -0
- data/features/step_definitions/noop.rb +15 -0
- data/features/step_definitions/options.rb +9 -0
- data/features/step_definitions/passive.rb +3 -0
- data/features/step_definitions/pending.rb +3 -0
- data/features/step_definitions/port.rb +5 -0
- data/features/step_definitions/put.rb +29 -0
- data/features/step_definitions/quit.rb +15 -0
- data/features/step_definitions/rename.rb +11 -0
- data/features/step_definitions/rmdir.rb +9 -0
- data/features/step_definitions/server_files.rb +61 -0
- data/features/step_definitions/server_title.rb +12 -0
- data/features/step_definitions/size.rb +20 -0
- data/features/step_definitions/status.rb +9 -0
- data/features/step_definitions/success_replies.rb +7 -0
- data/features/step_definitions/system.rb +7 -0
- data/features/step_definitions/timing.rb +19 -0
- data/features/step_definitions/type.rb +15 -0
- data/features/support/env.rb +4 -0
- data/features/support/example_server.rb +67 -0
- data/features/support/file_templates/ascii_unix +4 -0
- data/features/support/file_templates/ascii_windows +4 -0
- data/features/support/file_templates/binary +0 -0
- data/features/support/test_client.rb +250 -0
- data/features/support/test_file_templates.rb +33 -0
- data/features/support/test_server.rb +293 -0
- data/features/support/test_server_files.rb +57 -0
- data/ftpd.gemspec +283 -0
- data/insecure-test-cert.pem +29 -0
- data/investtools-ftpd.gemspec +284 -0
- data/lib/ftpd.rb +86 -0
- data/lib/ftpd/auth_levels.rb +9 -0
- data/lib/ftpd/cmd_abor.rb +13 -0
- data/lib/ftpd/cmd_allo.rb +20 -0
- data/lib/ftpd/cmd_appe.rb +24 -0
- data/lib/ftpd/cmd_auth.rb +21 -0
- data/lib/ftpd/cmd_cdup.rb +16 -0
- data/lib/ftpd/cmd_cwd.rb +20 -0
- data/lib/ftpd/cmd_dele.rb +21 -0
- data/lib/ftpd/cmd_eprt.rb +23 -0
- data/lib/ftpd/cmd_epsv.rb +30 -0
- data/lib/ftpd/cmd_feat.rb +44 -0
- data/lib/ftpd/cmd_help.rb +29 -0
- data/lib/ftpd/cmd_list.rb +33 -0
- data/lib/ftpd/cmd_login.rb +60 -0
- data/lib/ftpd/cmd_mdtm.rb +27 -0
- data/lib/ftpd/cmd_mkd.rb +23 -0
- data/lib/ftpd/cmd_mode.rb +27 -0
- data/lib/ftpd/cmd_nlst.rb +27 -0
- data/lib/ftpd/cmd_noop.rb +14 -0
- data/lib/ftpd/cmd_opts.rb +14 -0
- data/lib/ftpd/cmd_pasv.rb +28 -0
- data/lib/ftpd/cmd_pbsz.rb +23 -0
- data/lib/ftpd/cmd_port.rb +28 -0
- data/lib/ftpd/cmd_prot.rb +34 -0
- data/lib/ftpd/cmd_pwd.rb +15 -0
- data/lib/ftpd/cmd_quit.rb +18 -0
- data/lib/ftpd/cmd_rein.rb +13 -0
- data/lib/ftpd/cmd_rename.rb +32 -0
- data/lib/ftpd/cmd_rest.rb +13 -0
- data/lib/ftpd/cmd_retr.rb +24 -0
- data/lib/ftpd/cmd_rmd.rb +22 -0
- data/lib/ftpd/cmd_site.rb +13 -0
- data/lib/ftpd/cmd_size.rb +29 -0
- data/lib/ftpd/cmd_smnt.rb +13 -0
- data/lib/ftpd/cmd_stat.rb +15 -0
- data/lib/ftpd/cmd_stor.rb +25 -0
- data/lib/ftpd/cmd_stou.rb +25 -0
- data/lib/ftpd/cmd_stru.rb +27 -0
- data/lib/ftpd/cmd_syst.rb +16 -0
- data/lib/ftpd/cmd_type.rb +28 -0
- data/lib/ftpd/command_handler.rb +90 -0
- data/lib/ftpd/command_handler_factory.rb +51 -0
- data/lib/ftpd/command_handlers.rb +60 -0
- data/lib/ftpd/command_loop.rb +80 -0
- data/lib/ftpd/command_sequence_checker.rb +58 -0
- data/lib/ftpd/config.rb +13 -0
- data/lib/ftpd/connection_throttle.rb +56 -0
- data/lib/ftpd/connection_tracker.rb +82 -0
- data/lib/ftpd/data_connection_helper.rb +123 -0
- data/lib/ftpd/disk_file_system.rb +434 -0
- data/lib/ftpd/error.rb +21 -0
- data/lib/ftpd/exception_translator.rb +32 -0
- data/lib/ftpd/exceptions.rb +62 -0
- data/lib/ftpd/file_info.rb +115 -0
- data/lib/ftpd/file_system_helper.rb +67 -0
- data/lib/ftpd/ftp_server.rb +214 -0
- data/lib/ftpd/gets_peer_address.rb +41 -0
- data/lib/ftpd/insecure_certificate.rb +16 -0
- data/lib/ftpd/list_format/eplf.rb +74 -0
- data/lib/ftpd/list_format/ls.rb +154 -0
- data/lib/ftpd/list_path.rb +28 -0
- data/lib/ftpd/null_logger.rb +22 -0
- data/lib/ftpd/protocols.rb +60 -0
- data/lib/ftpd/read_only_disk_file_system.rb +22 -0
- data/lib/ftpd/server.rb +139 -0
- data/lib/ftpd/session.rb +220 -0
- data/lib/ftpd/session_config.rb +111 -0
- data/lib/ftpd/stream.rb +80 -0
- data/lib/ftpd/telnet.rb +114 -0
- data/lib/ftpd/temp_dir.rb +22 -0
- data/lib/ftpd/tls_server.rb +111 -0
- data/lib/ftpd/translate_exceptions.rb +68 -0
- data/rake_tasks/cucumber.rake +9 -0
- data/rake_tasks/default.rake +1 -0
- data/rake_tasks/jeweler.rake +52 -0
- data/rake_tasks/spec.rake +3 -0
- data/rake_tasks/test.rake +2 -0
- data/rake_tasks/yard.rake +3 -0
- data/spec/command_sequence_checker_spec.rb +83 -0
- data/spec/connection_throttle_spec.rb +99 -0
- data/spec/connection_tracker_spec.rb +97 -0
- data/spec/disk_file_system_spec.rb +320 -0
- data/spec/exception_translator_spec.rb +36 -0
- data/spec/file_info_spec.rb +59 -0
- data/spec/ftp_server_error_spec.rb +13 -0
- data/spec/list_format/eplf_spec.rb +61 -0
- data/spec/list_format/ls_spec.rb +270 -0
- data/spec/list_path_spec.rb +21 -0
- data/spec/null_logger_spec.rb +24 -0
- data/spec/protocols_spec.rb +139 -0
- data/spec/server_spec.rb +81 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/telnet_spec.rb +75 -0
- data/spec/translate_exceptions_spec.rb +40 -0
- metadata +404 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Quit
|
2
|
+
|
3
|
+
As a client
|
4
|
+
In order to free up resources
|
5
|
+
I want to close the connection
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given the test server is started
|
9
|
+
|
10
|
+
Scenario: Logged in
|
11
|
+
Given a successful login
|
12
|
+
When the client successfully quits
|
13
|
+
Then the client should not be logged in
|
14
|
+
|
15
|
+
Scenario: With a parameter
|
16
|
+
Given a successful connection
|
17
|
+
When the client quits with a parameter
|
18
|
+
Then the server returns a syntax error
|
19
|
+
|
20
|
+
Scenario: Not logged in
|
21
|
+
Given a successful connection
|
22
|
+
When the client quits
|
23
|
+
Then the server returns a not logged in error
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Reinitialize
|
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 "REIN"
|
13
|
+
Then the server returns an unimplemented command error
|
@@ -0,0 +1,97 @@
|
|
1
|
+
Feature: Rename
|
2
|
+
|
3
|
+
As a client
|
4
|
+
I want to rename a file
|
5
|
+
To correct an improper name
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given the test server is started
|
9
|
+
|
10
|
+
Scenario: Rename
|
11
|
+
Given a successful login
|
12
|
+
And the server has file "foo"
|
13
|
+
When the client successfully renames "foo" to "bar"
|
14
|
+
Then the server should not have file "foo"
|
15
|
+
And the server should have file "bar"
|
16
|
+
|
17
|
+
Scenario: Move
|
18
|
+
Given a successful login
|
19
|
+
And the server has file "foo/bar"
|
20
|
+
And the server has directory "baz"
|
21
|
+
When the client successfully renames "foo/bar" to "baz/qux"
|
22
|
+
Then the server should not have file "foo/bar"
|
23
|
+
And the server should have file "baz/qux"
|
24
|
+
|
25
|
+
Scenario: Non-root working directory
|
26
|
+
Given a successful login
|
27
|
+
And the server has file "foo/bar"
|
28
|
+
And the client successfully cd's to "foo"
|
29
|
+
When the client successfully renames "bar" to "baz"
|
30
|
+
Then the server should not have file "foo/bar"
|
31
|
+
Then the server should have file "foo/baz"
|
32
|
+
|
33
|
+
Scenario: Access denied (source)
|
34
|
+
Given a successful login
|
35
|
+
When the client renames "forbidden" to "foo"
|
36
|
+
Then the server returns an access denied error
|
37
|
+
|
38
|
+
Scenario: Access denied (destination)
|
39
|
+
Given a successful login
|
40
|
+
And the server has file "foo"
|
41
|
+
When the client renames "foo" to "forbidden"
|
42
|
+
Then the server returns an access denied error
|
43
|
+
|
44
|
+
Scenario: Source missing
|
45
|
+
Given a successful login
|
46
|
+
When the client renames "foo" to "bar"
|
47
|
+
Then the server returns a not found error
|
48
|
+
|
49
|
+
Scenario: Destination exists
|
50
|
+
Given a successful login
|
51
|
+
And the server has file "foo"
|
52
|
+
And the server has file "bar"
|
53
|
+
When the client renames "foo" to "bar"
|
54
|
+
Then the server returns an already exists error
|
55
|
+
|
56
|
+
Scenario: Not logged in (RNFR)
|
57
|
+
Given a successful connection
|
58
|
+
When the client sends "RNFR foo"
|
59
|
+
Then the server returns a not logged in error
|
60
|
+
|
61
|
+
Scenario: Not logged in (RNTO)
|
62
|
+
Given a successful connection
|
63
|
+
When the client sends "RNTO foo"
|
64
|
+
# Although the RNTO command checks for logged in, sequence error
|
65
|
+
# gets triggered first.
|
66
|
+
Then the server returns a bad sequence error
|
67
|
+
|
68
|
+
Scenario: Missing path (RNFR)
|
69
|
+
Given a successful login
|
70
|
+
When the client sends "RNFR"
|
71
|
+
Then the server returns a syntax error
|
72
|
+
|
73
|
+
Scenario: Missing path (RNTO)
|
74
|
+
Given a successful login
|
75
|
+
And the server has file "foo"
|
76
|
+
And the client successfully sends "RNFR foo"
|
77
|
+
When the client sends "RNTO"
|
78
|
+
Then the server returns a syntax error
|
79
|
+
|
80
|
+
Scenario: Rename not enabled
|
81
|
+
Given the test server lacks rename
|
82
|
+
And a successful login
|
83
|
+
And the server has file "foo"
|
84
|
+
When the client renames "foo" to "bar"
|
85
|
+
Then the server returns an unimplemented command error
|
86
|
+
|
87
|
+
Scenario: RNTO without RNFR
|
88
|
+
Given a successful login
|
89
|
+
When the client sends "RNTO bar"
|
90
|
+
Then the server returns a bad sequence error
|
91
|
+
|
92
|
+
Scenario: RNFR not followed by RNTO
|
93
|
+
Given a successful login
|
94
|
+
And the server has file "foo"
|
95
|
+
And the client sends "RNFR foo"
|
96
|
+
When the client sends "NOOP"
|
97
|
+
Then the server returns a bad sequence error
|
@@ -0,0 +1,71 @@
|
|
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
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -0,0 +1,69 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,65 @@
|
|
1
|
+
def server
|
2
|
+
@server ||= TestServer.new
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^the test server is started$/ do
|
6
|
+
server.start
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^the test server has TLS mode "(\w+)"$/ do |mode|
|
10
|
+
server.tls = mode.to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
Given(/^the test server is bound to "(.*?)"$/) do |ip_address|
|
14
|
+
server.interface = ip_address
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /^the test server has logging (enabled|disabled)$/ do |state|
|
18
|
+
server.logging = state == 'enabled'
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^the test server lacks (\w+)$/ do |feature|
|
22
|
+
server.send "#{feature}=", false
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /^the test server has auth level "(.*?)"$/ do |auth_level|
|
26
|
+
auth_level = Ftpd.const_get(auth_level)
|
27
|
+
server.auth_level = auth_level
|
28
|
+
end
|
29
|
+
|
30
|
+
Given /^the test server has session timeout set to (\S+) seconds$/ do
|
31
|
+
|timeout|
|
32
|
+
server.session_timeout = timeout.to_f
|
33
|
+
end
|
34
|
+
|
35
|
+
Given /^the test server has session timeout disabled$/ do
|
36
|
+
server.session_timeout = nil
|
37
|
+
end
|
38
|
+
|
39
|
+
Given /^the test server disallows low data ports$/ do
|
40
|
+
server.allow_low_data_ports = false
|
41
|
+
end
|
42
|
+
|
43
|
+
Given /^the test server allows low data ports$/ do
|
44
|
+
server.allow_low_data_ports = true
|
45
|
+
end
|
46
|
+
|
47
|
+
Given /^the test server has max_connections set to (\d+)$/ do |s|
|
48
|
+
server.max_connections = s.to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
Given /^the test server has max_connections_per_ip set to (\d+)$/ do |s|
|
52
|
+
server.max_connections_per_ip = s.to_i
|
53
|
+
end
|
54
|
+
|
55
|
+
Given /^the test server has no max failed login attempts$/ do
|
56
|
+
server.max_failed_logins = nil
|
57
|
+
end
|
58
|
+
|
59
|
+
Given /^the test server has a max of (\d+) failed login attempts$/ do |s|
|
60
|
+
server.max_failed_logins = s.to_i
|
61
|
+
end
|
62
|
+
|
63
|
+
Given /^the test server has a failed login delay of (\S+) seconds$/ do |s|
|
64
|
+
server.failed_login_delay = s.to_f
|
65
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|