ftpd 1.1.1 → 2.0.0

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 (156) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/Changelog.md +15 -0
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +57 -48
  6. data/README.md +8 -1
  7. data/VERSION +1 -1
  8. data/examples/example.rb +12 -0
  9. data/features/example/step_definitions/example_server.rb +2 -0
  10. data/features/ftp_server/eprt.feature +1 -0
  11. data/features/ftp_server/epsv.feature +1 -0
  12. data/features/ftp_server/get_ipv6.feature +3 -0
  13. data/features/ftp_server/pasv.feature +10 -3
  14. data/features/ftp_server/step_definitions/logging.rb +2 -0
  15. data/features/ftp_server/step_definitions/test_server.rb +6 -0
  16. data/features/step_definitions/append.rb +2 -0
  17. data/features/step_definitions/client.rb +3 -0
  18. data/features/step_definitions/client_and_server_files.rb +2 -0
  19. data/features/step_definitions/client_files.rb +2 -0
  20. data/features/step_definitions/command.rb +2 -0
  21. data/features/step_definitions/connect.rb +2 -0
  22. data/features/step_definitions/delete.rb +2 -0
  23. data/features/step_definitions/directory_navigation.rb +2 -0
  24. data/features/step_definitions/error_replies.rb +2 -0
  25. data/features/step_definitions/features.rb +2 -0
  26. data/features/step_definitions/file_structure.rb +2 -0
  27. data/features/step_definitions/generic_send.rb +2 -0
  28. data/features/step_definitions/get.rb +2 -0
  29. data/features/step_definitions/help.rb +2 -0
  30. data/features/step_definitions/invalid_commands.rb +2 -0
  31. data/features/step_definitions/ipv6.rb +11 -0
  32. data/features/step_definitions/line_endings.rb +2 -0
  33. data/features/step_definitions/list.rb +2 -0
  34. data/features/step_definitions/login.rb +2 -0
  35. data/features/step_definitions/mkdir.rb +2 -0
  36. data/features/step_definitions/mode.rb +2 -0
  37. data/features/step_definitions/mtime.rb +2 -0
  38. data/features/step_definitions/noop.rb +2 -0
  39. data/features/step_definitions/options.rb +2 -0
  40. data/features/step_definitions/passive.rb +7 -0
  41. data/features/step_definitions/pending.rb +2 -0
  42. data/features/step_definitions/port.rb +2 -0
  43. data/features/step_definitions/put.rb +2 -0
  44. data/features/step_definitions/quit.rb +2 -0
  45. data/features/step_definitions/rename.rb +2 -0
  46. data/features/step_definitions/rmdir.rb +2 -0
  47. data/features/step_definitions/server_files.rb +2 -0
  48. data/features/step_definitions/server_title.rb +2 -0
  49. data/features/step_definitions/size.rb +2 -0
  50. data/features/step_definitions/status.rb +2 -0
  51. data/features/step_definitions/success_replies.rb +2 -0
  52. data/features/step_definitions/system.rb +5 -0
  53. data/features/step_definitions/timing.rb +2 -0
  54. data/features/step_definitions/type.rb +2 -0
  55. data/features/support/env.rb +2 -0
  56. data/features/support/example_server.rb +3 -1
  57. data/features/support/test_client.rb +27 -19
  58. data/features/support/test_file_templates.rb +2 -0
  59. data/features/support/test_server.rb +31 -20
  60. data/features/support/test_server_files.rb +2 -0
  61. data/ftpd.gemspec +17 -11
  62. data/lib/ftpd.rb +2 -0
  63. data/lib/ftpd/auth_levels.rb +2 -0
  64. data/lib/ftpd/cmd_abor.rb +2 -0
  65. data/lib/ftpd/cmd_allo.rb +2 -0
  66. data/lib/ftpd/cmd_appe.rb +2 -0
  67. data/lib/ftpd/cmd_auth.rb +2 -0
  68. data/lib/ftpd/cmd_cdup.rb +2 -0
  69. data/lib/ftpd/cmd_cwd.rb +2 -0
  70. data/lib/ftpd/cmd_dele.rb +2 -0
  71. data/lib/ftpd/cmd_eprt.rb +2 -0
  72. data/lib/ftpd/cmd_epsv.rb +4 -2
  73. data/lib/ftpd/cmd_feat.rb +2 -0
  74. data/lib/ftpd/cmd_help.rb +2 -0
  75. data/lib/ftpd/cmd_list.rb +2 -0
  76. data/lib/ftpd/cmd_login.rb +2 -0
  77. data/lib/ftpd/cmd_mdtm.rb +2 -0
  78. data/lib/ftpd/cmd_mkd.rb +2 -0
  79. data/lib/ftpd/cmd_mode.rb +2 -0
  80. data/lib/ftpd/cmd_nlst.rb +2 -0
  81. data/lib/ftpd/cmd_noop.rb +2 -0
  82. data/lib/ftpd/cmd_opts.rb +2 -0
  83. data/lib/ftpd/cmd_pasv.rb +5 -3
  84. data/lib/ftpd/cmd_pbsz.rb +2 -0
  85. data/lib/ftpd/cmd_port.rb +2 -0
  86. data/lib/ftpd/cmd_prot.rb +2 -0
  87. data/lib/ftpd/cmd_pwd.rb +2 -0
  88. data/lib/ftpd/cmd_quit.rb +2 -0
  89. data/lib/ftpd/cmd_rein.rb +2 -0
  90. data/lib/ftpd/cmd_rename.rb +2 -0
  91. data/lib/ftpd/cmd_rest.rb +2 -0
  92. data/lib/ftpd/cmd_retr.rb +2 -0
  93. data/lib/ftpd/cmd_rmd.rb +2 -0
  94. data/lib/ftpd/cmd_site.rb +2 -0
  95. data/lib/ftpd/cmd_size.rb +2 -0
  96. data/lib/ftpd/cmd_smnt.rb +2 -0
  97. data/lib/ftpd/cmd_stat.rb +2 -0
  98. data/lib/ftpd/cmd_stor.rb +2 -0
  99. data/lib/ftpd/cmd_stou.rb +2 -0
  100. data/lib/ftpd/cmd_stru.rb +2 -0
  101. data/lib/ftpd/cmd_syst.rb +2 -0
  102. data/lib/ftpd/cmd_type.rb +2 -0
  103. data/lib/ftpd/command_handler.rb +3 -0
  104. data/lib/ftpd/command_handler_factory.rb +2 -0
  105. data/lib/ftpd/command_handlers.rb +2 -0
  106. data/lib/ftpd/command_loop.rb +2 -0
  107. data/lib/ftpd/command_sequence_checker.rb +2 -0
  108. data/lib/ftpd/config.rb +2 -0
  109. data/lib/ftpd/connection_throttle.rb +2 -0
  110. data/lib/ftpd/connection_tracker.rb +2 -0
  111. data/lib/ftpd/data_connection_helper.rb +2 -0
  112. data/lib/ftpd/data_server_factory.rb +44 -0
  113. data/lib/ftpd/data_server_factory/random_ephemeral_port.rb +26 -0
  114. data/lib/ftpd/data_server_factory/specific_port_range.rb +37 -0
  115. data/lib/ftpd/disk_file_system.rb +2 -0
  116. data/lib/ftpd/error.rb +2 -0
  117. data/lib/ftpd/exception_translator.rb +2 -0
  118. data/lib/ftpd/exceptions.rb +2 -0
  119. data/lib/ftpd/file_info.rb +2 -0
  120. data/lib/ftpd/file_system_helper.rb +2 -0
  121. data/lib/ftpd/ftp_server.rb +27 -0
  122. data/lib/ftpd/gets_peer_address.rb +2 -0
  123. data/lib/ftpd/insecure_certificate.rb +2 -0
  124. data/lib/ftpd/list_format/eplf.rb +2 -0
  125. data/lib/ftpd/list_format/ls.rb +2 -0
  126. data/lib/ftpd/list_path.rb +2 -0
  127. data/lib/ftpd/null_logger.rb +2 -0
  128. data/lib/ftpd/protocols.rb +2 -0
  129. data/lib/ftpd/read_only_disk_file_system.rb +2 -0
  130. data/lib/ftpd/server.rb +2 -0
  131. data/lib/ftpd/session.rb +7 -0
  132. data/lib/ftpd/session_config.rb +26 -2
  133. data/lib/ftpd/stream.rb +2 -0
  134. data/lib/ftpd/telnet.rb +3 -2
  135. data/lib/ftpd/temp_dir.rb +2 -0
  136. data/lib/ftpd/tls_server.rb +2 -0
  137. data/lib/ftpd/translate_exceptions.rb +2 -0
  138. data/spec/command_sequence_checker_spec.rb +2 -0
  139. data/spec/connection_throttle_spec.rb +2 -0
  140. data/spec/connection_tracker_spec.rb +2 -0
  141. data/spec/data_server_factory_spec.rb +104 -0
  142. data/spec/disk_file_system_spec.rb +2 -0
  143. data/spec/exception_translator_spec.rb +2 -0
  144. data/spec/file_info_spec.rb +2 -0
  145. data/spec/ftp_server_error_spec.rb +2 -0
  146. data/spec/list_format/eplf_spec.rb +2 -0
  147. data/spec/list_format/ls_spec.rb +2 -0
  148. data/spec/list_path_spec.rb +2 -0
  149. data/spec/null_logger_spec.rb +2 -0
  150. data/spec/protocols_spec.rb +58 -38
  151. data/spec/server_spec.rb +2 -0
  152. data/spec/spec_helper.rb +2 -0
  153. data/spec/telnet_spec.rb +2 -0
  154. data/spec/translate_exceptions_spec.rb +2 -0
  155. data/testlib/network.rb +17 -0
  156. metadata +13 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f15991457aaefd1d3575b3a81e365a5bf406353b
4
- data.tar.gz: 5a555e7a075a1b67ea97f34610a3f46564fa0c27
3
+ metadata.gz: da62814ce49fab3ad30c35b6841810728722bc99
4
+ data.tar.gz: fd68f590b35708037f0ca1678dd84936dee7d4e1
5
5
  SHA512:
6
- metadata.gz: e110f5914d7c9ffe19aee3f0ad93eff70a31cf971b787d0035ddb107cd48ef1e437edac2e1bf1ebc69576f1330e38c2db13cbacdb24046fca682a30f3d77f736
7
- data.tar.gz: 51e353cafeb9d122030717415b981e1ae366ae2d53fbe805462cd04887625455d273285c63bf55dde5af59c740ef5b560335a8723dcd944c19759376de4bbf55
6
+ metadata.gz: a84a4a7d0554c71e71816376b7cac3268d0f6250a58d34ffa0a9bc1f5116468b73e36c5f09a333f28b173cf9c4dd9e7427ac5c9f9cb93cf12f63344ae7bfd09e
7
+ data.tar.gz: ffd9e7e5477c2afd9301158be878968ed7e601677433f5c8e2b0dfee050106f580026235368a726e05a84da0f92a25369de649ddf19a1fa03ff8b2e7d591ce98
data/.travis.yml CHANGED
@@ -3,3 +3,4 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0
5
5
  - 2.1
6
+ - 2.2
data/Changelog.md CHANGED
@@ -2,6 +2,21 @@ This is the change log for the main branch of ftpd, which supports
2
2
  Ruby 1.9 and greater. For ruby 1.8.7, please use the latest version
3
3
  before 0.8.0.
4
4
 
5
+ ### Development
6
+
7
+ Breaking changes:
8
+
9
+ * Freeze strings by default. This is an unlikely but potential
10
+ breaking change for users of Ruby >= 2.3.
11
+
12
+ Non-breaking changes
13
+
14
+ * Added option #nat_ip to configure the advertised IP for passive mode
15
+ connections.
16
+
17
+ * Added option #passive_ports to configure the port range for passive
18
+ mode server sockets.
19
+
5
20
  ### 1.1.1 (2014-11-22)
6
21
 
7
22
  Administration
data/Gemfile CHANGED
@@ -3,10 +3,10 @@ source 'http://rubygems.org'
3
3
  gem 'memoizer', '~> 1.0'
4
4
 
5
5
  group :development do
6
- gem 'cucumber', '~> 1.3'
6
+ gem 'cucumber', '~> 2.0'
7
7
  gem 'double-bag-ftps', '~> 0.1'
8
8
  gem 'jeweler', '~> 2.0'
9
- gem 'rake', '~> 10.3'
9
+ gem 'rake', '~> 11.1'
10
10
  gem 'redcarpet', '~> 3.1'
11
11
  gem 'rspec', '~> 3.1'
12
12
  gem 'rspec-its', '~> 1.0'
data/Gemfile.lock CHANGED
@@ -1,34 +1,37 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.6)
4
+ addressable (2.4.0)
5
5
  builder (3.2.2)
6
- cucumber (1.3.17)
6
+ cucumber (2.3.3)
7
7
  builder (>= 2.1.2)
8
+ cucumber-core (~> 1.4.0)
9
+ cucumber-wire (~> 0.0.1)
8
10
  diff-lcs (>= 1.1.3)
9
- gherkin (~> 2.12)
11
+ gherkin (~> 3.2.0)
10
12
  multi_json (>= 1.7.5, < 2.0)
11
- multi_test (>= 0.1.1)
13
+ multi_test (>= 0.1.2)
14
+ cucumber-core (1.4.0)
15
+ gherkin (~> 3.2.0)
16
+ cucumber-wire (0.0.1)
12
17
  descendants_tracker (0.0.4)
13
18
  thread_safe (~> 0.3, >= 0.3.1)
14
19
  diff-lcs (1.2.5)
15
20
  double-bag-ftps (0.1.2)
16
- faraday (0.9.0)
21
+ faraday (0.9.2)
17
22
  multipart-post (>= 1.2, < 3)
18
- gherkin (2.12.2)
19
- multi_json (~> 1.3)
20
- git (1.2.8)
21
- github_api (0.12.1)
22
- addressable (~> 2.3)
23
+ gherkin (3.2.0)
24
+ git (1.3.0)
25
+ github_api (0.13.1)
26
+ addressable (~> 2.4.0)
23
27
  descendants_tracker (~> 0.0.4)
24
28
  faraday (~> 0.8, < 0.10)
25
- hashie (>= 3.2)
29
+ hashie (>= 3.4)
26
30
  multi_json (>= 1.7.5, < 2.0)
27
- nokogiri (~> 1.6.3)
28
31
  oauth2
29
- hashie (3.3.1)
30
- highline (1.6.21)
31
- jeweler (2.0.1)
32
+ hashie (3.4.3)
33
+ highline (1.7.8)
34
+ jeweler (2.1.1)
32
35
  builder
33
36
  bundler (>= 1.0)
34
37
  git (>= 1.2.5)
@@ -37,57 +40,63 @@ GEM
37
40
  nokogiri (>= 1.5.10)
38
41
  rake
39
42
  rdoc
40
- json (1.8.1)
41
- jwt (1.0.0)
43
+ semver
44
+ json (1.8.3)
45
+ jwt (1.5.1)
42
46
  memoizer (1.0.1)
43
- mini_portile (0.6.0)
44
- multi_json (1.10.1)
45
- multi_test (0.1.1)
47
+ mini_portile2 (2.0.0)
48
+ multi_json (1.11.2)
49
+ multi_test (0.1.2)
46
50
  multi_xml (0.5.5)
47
51
  multipart-post (2.0.0)
48
- nokogiri (1.6.3.1)
49
- mini_portile (= 0.6.0)
50
- oauth2 (1.0.0)
52
+ nokogiri (1.6.7.2)
53
+ mini_portile2 (~> 2.0.0.rc2)
54
+ oauth2 (1.1.0)
51
55
  faraday (>= 0.8, < 0.10)
52
- jwt (~> 1.0)
56
+ jwt (~> 1.0, < 1.5.2)
53
57
  multi_json (~> 1.3)
54
58
  multi_xml (~> 0.5)
55
- rack (~> 1.2)
56
- rack (1.5.2)
57
- rake (10.3.2)
58
- rdoc (4.1.2)
59
+ rack (>= 1.2, < 3)
60
+ rack (1.6.4)
61
+ rake (11.1.2)
62
+ rdoc (4.2.2)
59
63
  json (~> 1.4)
60
- redcarpet (3.1.2)
61
- rspec (3.1.0)
62
- rspec-core (~> 3.1.0)
63
- rspec-expectations (~> 3.1.0)
64
- rspec-mocks (~> 3.1.0)
65
- rspec-core (3.1.4)
66
- rspec-support (~> 3.1.0)
67
- rspec-expectations (3.1.2)
64
+ redcarpet (3.3.4)
65
+ rspec (3.4.0)
66
+ rspec-core (~> 3.4.0)
67
+ rspec-expectations (~> 3.4.0)
68
+ rspec-mocks (~> 3.4.0)
69
+ rspec-core (3.4.4)
70
+ rspec-support (~> 3.4.0)
71
+ rspec-expectations (3.4.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.4.0)
74
+ rspec-its (1.2.0)
75
+ rspec-core (>= 3.0.0)
76
+ rspec-expectations (>= 3.0.0)
77
+ rspec-mocks (3.4.1)
68
78
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.1.0)
70
- rspec-its (1.0.1)
71
- rspec-core (>= 2.99.0.beta1)
72
- rspec-expectations (>= 2.99.0.beta1)
73
- rspec-mocks (3.1.2)
74
- rspec-support (~> 3.1.0)
75
- rspec-support (3.1.1)
76
- thread_safe (0.3.4)
77
- timecop (0.7.1)
78
- yard (0.8.7.4)
79
+ rspec-support (~> 3.4.0)
80
+ rspec-support (3.4.1)
81
+ semver (1.0.1)
82
+ thread_safe (0.3.5)
83
+ timecop (0.8.1)
84
+ yard (0.8.7.6)
79
85
 
80
86
  PLATFORMS
81
87
  ruby
82
88
 
83
89
  DEPENDENCIES
84
- cucumber (~> 1.3)
90
+ cucumber (~> 2.0)
85
91
  double-bag-ftps (~> 0.1)
86
92
  jeweler (~> 2.0)
87
93
  memoizer (~> 1.0)
88
- rake (~> 10.3)
94
+ rake (~> 11.1)
89
95
  redcarpet (~> 3.1)
90
96
  rspec (~> 3.1)
91
97
  rspec-its (~> 1.0)
92
98
  timecop (~> 0.7)
93
99
  yard (~> 0.8.7)
100
+
101
+ BUNDLED WITH
102
+ 1.11.2
data/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  [![Build Status](https://travis-ci.org/wconrad/ftpd.png)](https://travis-ci.org/wconrad/ftpd)
5
5
  [![Code Climate](https://codeclimate.com/github/wconrad/ftpd.png)](https://codeclimate.com/github/wconrad/ftpd)
6
6
 
7
-
8
7
  ftpd is a pure Ruby FTP server library. It supports implicit and
9
8
  explicit TLS, IPV6, passive and active mode, and is unconditionally
10
9
  compliant per [RFC-1123][1]. It can be used as part of a test fixture
@@ -175,6 +174,8 @@ server.start
175
174
 
176
175
  You can set any of these attributes before starting the server:
177
176
 
177
+ # {Ftpd::FtpServer#nat_ip}
178
+ # {Ftpd::FtpServer#passive_ports}
178
179
  * {Ftpd::FtpServer#allow_low_data_ports}
179
180
  * {Ftpd::FtpServer#auth_level}
180
181
  * {Ftpd::FtpServer#exception_handler}
@@ -284,6 +285,12 @@ that branch, use this line in your Gemfile:
284
285
  Does it work for you? Is it busted? Please report your experience
285
286
  [here](https://github.com/wconrad/ftpd/issues/3).
286
287
 
288
+ ## Versioning
289
+
290
+ This library uses [Semantic Versioning](http://semver.org/). Ftpd
291
+ promises not to make breaking changes to its API without bumping the
292
+ major version.
293
+
287
294
  ## Development
288
295
 
289
296
  ### Tests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 2.0.0
data/examples/example.rb CHANGED
@@ -19,6 +19,8 @@ module Example
19
19
  attr_reader :debug
20
20
  attr_reader :eplf
21
21
  attr_reader :interface
22
+ attr_reader :nat_ip
23
+ attr_reader :passive_ports
22
24
  attr_reader :password
23
25
  attr_reader :port
24
26
  attr_reader :read_only
@@ -36,6 +38,8 @@ module Example
36
38
  @account = ''
37
39
  @session_timeout = default_session_timeout
38
40
  @log = nil
41
+ @nat_ip = nil
42
+ @passive_ports = nil
39
43
  op = option_parser
40
44
  op.parse!(argv)
41
45
  rescue OptionParser::ParseError => e
@@ -88,6 +92,12 @@ module Example
88
92
  op.on('-d', '--debug', 'Write server debug log to stdout') do |t|
89
93
  @debug = t
90
94
  end
95
+ op.on('--nat-ip IP', 'Set advertised passive mode IP') do |t|
96
+ @nat_ip = t
97
+ end
98
+ op.on('--ports MIN..MAX', 'Port numbers for passive mode sockets') do |v|
99
+ @passive_ports = Range.new(*v.split(/\.\./).map(&:to_i))
100
+ end
91
101
  end
92
102
  end
93
103
 
@@ -181,6 +191,7 @@ module Example
181
191
  @server.interface = @args.interface
182
192
  @server.port = @args.port
183
193
  @server.tls = @args.tls
194
+ @server.passive_ports = @args.passive_ports
184
195
  @server.certfile_path = insecure_certfile_path
185
196
  if @args.eplf
186
197
  @server.list_formatter = Ftpd::ListFormat::Eplf
@@ -188,6 +199,7 @@ module Example
188
199
  @server.auth_level = auth_level
189
200
  @server.session_timeout = @args.session_timeout
190
201
  @server.log = make_log
202
+ @server.nat_ip = @args.nat_ip
191
203
  end
192
204
 
193
205
  def auth_level
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def example_args
2
4
  @example_args ||= []
3
5
  end
@@ -5,6 +5,7 @@ Feature: EPRT
5
5
  So that I can correct problems
6
6
 
7
7
  Background:
8
+ Given the stack supports ipv6
8
9
  Given the test server is bound to "::"
9
10
  Given the test server is started
10
11
 
@@ -5,6 +5,7 @@ Feature: EPSV
5
5
  So that I can correct problems
6
6
 
7
7
  Background:
8
+ Given the stack supports ipv6
8
9
  Given the test server is bound to "::"
9
10
  And the test server is started
10
11
 
@@ -4,6 +4,9 @@ Feature: Get IPV6
4
4
  I want to get a file
5
5
  So that I have it on my computer
6
6
 
7
+ Background:
8
+ Given the stack supports ipv6
9
+
7
10
  Scenario: Active
8
11
  Given the test server is bound to "::1"
9
12
  And the test server is started
@@ -4,20 +4,27 @@ Feature: PASV
4
4
  I want good error messages
5
5
  So that I can correct problems
6
6
 
7
- Background:
8
- Given the test server is started
9
-
10
7
  Scenario: No argument
8
+ Given the test server is started
11
9
  Given a successful login
12
10
  Then the client successfully sends "PASV"
13
11
 
14
12
  Scenario: After "EPSV ALL"
13
+ Given the test server is started
15
14
  Given a successful login
16
15
  Given the client successfully sends "EPSV ALL"
17
16
  When the client sends "PASV"
18
17
  Then the server sends a not allowed after epsv all error
19
18
 
20
19
  Scenario: Not logged in
20
+ Given the test server is started
21
21
  Given a successful connection
22
22
  When the client sends "EPSV"
23
23
  Then the server returns a not logged in error
24
+
25
+ Scenario: Configured with NAT IP
26
+ Given the test server has a NAT IP of 10.1.2.3
27
+ Given the test server is started
28
+ And a successful login
29
+ When the client successfully sends "PASV"
30
+ Then the server advertises passive IP 10.1.2.3
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Then /^the server should have written( no)? log output$/ do |neg|
2
4
  verb = if neg
3
5
  :to
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def server
2
4
  @server ||= TestServer.new
3
5
  end
@@ -63,3 +65,7 @@ end
63
65
  Given /^the test server has a failed login delay of (\S+) seconds$/ do |s|
64
66
  server.failed_login_delay = s.to_f
65
67
  end
68
+
69
+ Given /^the test server has a NAT IP of (\S+)$/ do |s|
70
+ server.nat_ip = s
71
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When /^the client appends (.*)$/ do |args|
2
4
  capture_error do
3
5
  step "the client successfully appends #{args}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'singleton'
2
4
 
3
5
  class Clients
@@ -20,5 +22,6 @@ end
20
22
 
21
23
  def client(client_name = nil)
22
24
  client_name ||= 'client'
25
+ client_name = client_name.strip
23
26
  Clients.instance[client_name]
24
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def unix_line_endings(exactly, s)
2
4
  return s if exactly
3
5
  s.gsub(/\r\n/, "\n")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Given /^the client has file "(.*?)"$/ do |local_path|
2
4
  client.add_file local_path
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When /^the client sends command "(.*?)"$/ do |command|
2
4
  capture_error do
3
5
  client.raw command
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'double_bag_ftps'
2
4
  require 'net/ftp'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When /^the client deletes "(.*?)"$/ do |path|
2
4
  capture_error do
3
5
  step %Q(the client successfully deletes "#{path}")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When /^the client cd's to "(.*?)"$/ do |path|
2
4
  capture_error do
3
5
  step %Q(the client successfully cd's to "#{path}")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def capture_error
2
4
  yield
3
5
  @error = nil