ftpd 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c3fc097615e27f601d22ca3e2eafae1799e7ec6
4
- data.tar.gz: 7a0f7056bcc776576466baf64e7c957e0b751cdf
3
+ metadata.gz: fa6a9a475474687ea612712f4830113e899f673a
4
+ data.tar.gz: 586a68fd022bda0a95da5cf94da05982b25dcd4f
5
5
  SHA512:
6
- metadata.gz: 34bf396a9a6fa14971f9a63e6c29238f5b56dcfd40cbcb4cd1832025871186e7ecfc67ade325163039b998a24543b5a2ad5774538292ea787df5c3193de31332
7
- data.tar.gz: d8530f13d4da99b95836d5109aff4564c45ab0232af9447bd36b28d6d72af5bda4aa601e029440ac5a895593453b3f2d3a32f3391fd5b84a49b81cbe34fa3073
6
+ metadata.gz: 8ec864ec9526fa5f567fbfac0e248b8eaa491e49a7fb612d71f4511b9a6eeda7330e3f13d9e6aaf03bc76141b9757fbb51abec9491db8bf6c125f8077296082e
7
+ data.tar.gz: 30352a8101f4e74c61aad1eb4405116af35a72091b3e24f45f1c21e9e14f78b6ef9c62352bbc908b06ff5ba0b85fc451fe8d6967cf9e6de62605be2845976763
@@ -2,6 +2,11 @@ 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
+ ### 2.1.0 2017-07-23
6
+
7
+ * Introduced Release::VERSION and Release::DATE constants
8
+ * Fixed all known warnings in tests and example
9
+
5
10
  ### 2.0.5 2017-07-23
6
11
 
7
12
  * Fix DOS caused by fast socket disconnects (thanks iblue)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ftpd (2.0.4)
4
+ ftpd (2.1.0)
5
5
  memoizer (~> 1.0)
6
6
 
7
7
  GEM
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  yard (~> 0.8.7)
62
62
 
63
63
  BUNDLED WITH
64
- 1.15.2
64
+ 1.15.3
@@ -52,7 +52,7 @@ module Example
52
52
  private
53
53
 
54
54
  def option_parser
55
- op = OptionParser.new do |op|
55
+ OptionParser.new do |op|
56
56
  op.on('-p', '--port N', Integer, 'Bind to a specific port') do |t|
57
57
  @port = t
58
58
  end
@@ -1,4 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ require File.join(File.dirname(__FILE__), "lib/ftpd/release")
2
5
 
3
6
  class Readme
4
7
 
@@ -42,26 +45,13 @@ class Readme
42
45
 
43
46
  end
44
47
 
45
- class Version
46
-
47
- def to_s
48
- File.read(VERSION_PATH).strip
49
- end
50
-
51
- private
52
-
53
- VERSION_PATH = File.expand_path("VERSION", File.dirname(__FILE__))
54
- private_constant :VERSION_PATH
55
-
56
- end
57
-
58
48
  Gem::Specification.new do |s|
59
49
  s.name = "ftpd"
60
- s.version = Version.new.to_s
50
+ s.version = Ftpd::Release::VERSION
61
51
  s.required_rubygems_version = Gem::Requirement.new(">= 0")
62
52
  s.require_paths = ["lib"]
63
53
  s.authors = ["Wayne Conrad"]
64
- s.date = "2017-07-17"
54
+ s.date = Ftpd::Release::DATE
65
55
  s.description = Readme.new.description
66
56
  s.email = "kf7qga@gmail.com"
67
57
  s.executables = ["ftpdrb"]
@@ -77,7 +67,6 @@ Gem::Specification.new do |s|
77
67
  "LICENSE.md",
78
68
  "README.md",
79
69
  "Rakefile",
80
- "VERSION",
81
70
  "bin/ftpdrb",
82
71
  "ftpd.gemspec",
83
72
  "insecure-test-cert.pem",
@@ -77,7 +77,7 @@ require_relative 'ftpd/list_format/ls'
77
77
  require_relative 'ftpd/list_path'
78
78
  require_relative 'ftpd/null_logger'
79
79
  require_relative 'ftpd/protocols'
80
- require_relative 'ftpd/read_only_disk_file_system'
80
+ require_relative 'ftpd/release'
81
81
  require_relative 'ftpd/server'
82
82
  require_relative 'ftpd/session'
83
83
  require_relative 'ftpd/session_config'
@@ -8,11 +8,11 @@ module Ftpd
8
8
 
9
9
  def cmd_help(argument)
10
10
  if argument
11
- command = argument.upcase
12
- if supported_commands.include?(command)
13
- reply "214 Command #{command} is recognized"
11
+ target_command = argument.upcase
12
+ if supported_commands.include?(target_command)
13
+ reply "214 Command #{target_command} is recognized"
14
14
  else
15
- reply "214 Command #{command} is not recognized"
15
+ reply "214 Command #{target_command} is not recognized"
16
16
  end
17
17
  else
18
18
  reply '214-The following commands are recognized:'
@@ -18,8 +18,8 @@ module Ftpd
18
18
 
19
19
  private
20
20
 
21
- def name_list(path)
22
- path_list(path).map do |path|
21
+ def name_list(target_path)
22
+ path_list(target_path).map do |path|
23
23
  File.basename(path) + "\n"
24
24
  end.join
25
25
  end
@@ -8,9 +8,7 @@ module Ftpd
8
8
 
9
9
  def cmd_type(argument)
10
10
  ensure_logged_in
11
- syntax_error unless argument =~ /^(\S)(?: (\S+))?$/
12
- type_code = $1
13
- format_code = $2
11
+ syntax_error unless argument =~ /^\S(?: \S+)?$/
14
12
  unless argument =~ /^([AEI]( [NTC])?|L .*)$/
15
13
  error 'Invalid type code', 504
16
14
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'command_handler'
4
-
5
3
  module Ftpd
6
4
 
7
5
  module DataConnectionHelper
@@ -57,7 +57,7 @@ module Ftpd
57
57
  # @return [Boolean]
58
58
 
59
59
  def exists?(ftp_path)
60
- File.exists?(expand_ftp_path(ftp_path))
60
+ File.exist?(expand_ftp_path(ftp_path))
61
61
  end
62
62
 
63
63
  # Return true if the path exists and is a directory.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'command_handler'
4
-
5
3
  module Ftpd
6
4
 
7
5
  module FileSystemHelper
@@ -130,8 +130,8 @@ module Ftpd
130
130
 
131
131
  attr_accessor :server_name
132
132
 
133
- # The server's version, sent in a STAT reply. Defaults to the
134
- # contents of the VERSION file.
133
+ # The server's version, sent in a STAT reply. Defaults to
134
+ # Release::VERSION.
135
135
  #
136
136
  # Set this before calling #start.
137
137
  #
@@ -184,7 +184,7 @@ module Ftpd
184
184
  @auth_level = AUTH_PASSWORD
185
185
  @session_timeout = 300
186
186
  @server_name = DEFAULT_SERVER_NAME
187
- @server_version = read_version_file
187
+ @server_version = Release::VERSION
188
188
  @allow_low_data_ports = false
189
189
  @failed_login_delay = 0
190
190
  @nat_ip = nil
@@ -231,13 +231,5 @@ module Ftpd
231
231
  session.run
232
232
  end
233
233
 
234
- def read_version_file
235
- File.open(version_file_path, 'r', &:read).strip
236
- end
237
-
238
- def version_file_path
239
- File.expand_path('../../VERSION', File.dirname(__FILE__))
240
- end
241
-
242
234
  end
243
235
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "gets_peer_address"
4
-
5
3
  module Ftpd
6
4
 
7
5
  module GetsPeerAddress
@@ -29,7 +27,7 @@ module Ftpd
29
27
  if socket.respond_to?(:getpeername)
30
28
  # Non SSL
31
29
  sockaddr = socket.getpeername
32
- port, host = Socket.unpack_sockaddr_in(sockaddr)
30
+ _port, host = Socket.unpack_sockaddr_in(sockaddr)
33
31
  host
34
32
  else
35
33
  # SSL
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ftpd
4
+
5
+ # Release information. This is used both by the library and by the
6
+ # gemspec.
7
+ module Release
8
+
9
+ VERSION = "2.1.0"
10
+ DATE = "2017-07-23"
11
+
12
+ end
13
+ end
@@ -28,6 +28,7 @@ module Ftpd
28
28
  @interface = '127.0.0.1'
29
29
  @port = 0
30
30
  @stopping = false
31
+ @server_thread = nil
31
32
  end
32
33
 
33
34
  # The port the server is bound to. Must not be called until after
@@ -117,7 +118,7 @@ module Ftpd
117
118
  Thread.new do
118
119
  begin
119
120
  session socket
120
- rescue OpenSSL::SSL::SSLError => e
121
+ rescue OpenSSL::SSL::SSLError
121
122
  ensure
122
123
  close_socket socket
123
124
  end
@@ -14,7 +14,7 @@ module Ftpd
14
14
  Dir.mktmpdir.tap do |path|
15
15
  at_exit do
16
16
  FileUtils.rm_rf path
17
- Dir.rmdir path if File.exists?(path)
17
+ Dir.rmdir(path) if File.exist?(path)
18
18
  end
19
19
  end
20
20
  end
@@ -42,7 +42,7 @@ module Ftpd
42
42
  def make_server_socket
43
43
  socket = super
44
44
  if tls_enabled?
45
- socket = OpenSSL::SSL::SSLServer.new(socket, ssl_context);
45
+ socket = OpenSSL::SSL::SSLServer.new(socket, ssl_context)
46
46
  socket.start_immediately = false
47
47
  end
48
48
  socket
@@ -85,7 +85,6 @@ module Ftpd
85
85
  # make life a little easier.
86
86
 
87
87
  def add_tls_methods_to_socket(socket)
88
- context = @ssl_context
89
88
  class << socket
90
89
 
91
90
  def ssl_context
@@ -42,9 +42,10 @@ module Ftpd
42
42
 
43
43
  def translate_exceptions(method_name)
44
44
  original_method = instance_method(method_name)
45
- define_method method_name do |*args, &block|
45
+ remove_method(method_name)
46
+ define_method(method_name) do |*args, &block|
46
47
  exception_translator.translate_exceptions do
47
- original_method.bind(self).call *args, &block
48
+ original_method.bind(self).call(*args, &block)
48
49
  end
49
50
  end
50
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ftpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Conrad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memoizer
@@ -160,7 +160,6 @@ files:
160
160
  - LICENSE.md
161
161
  - README.md
162
162
  - Rakefile
163
- - VERSION
164
163
  - bin/ftpdrb
165
164
  - doc/benchmarks.md
166
165
  - doc/references.md
@@ -238,7 +237,7 @@ files:
238
237
  - lib/ftpd/list_path.rb
239
238
  - lib/ftpd/null_logger.rb
240
239
  - lib/ftpd/protocols.rb
241
- - lib/ftpd/read_only_disk_file_system.rb
240
+ - lib/ftpd/release.rb
242
241
  - lib/ftpd/server.rb
243
242
  - lib/ftpd/session.rb
244
243
  - lib/ftpd/session_config.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.0.5
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ftpd
4
-
5
- # A disk file system that does not allow any modification (writes,
6
- # deletes, etc.)
7
-
8
- class ReadOnlyDiskFileSystem
9
-
10
- include DiskFileSystem::Base
11
- include DiskFileSystem::List
12
- include DiskFileSystem::Read
13
-
14
- # Make a new instance to serve a directory. data_dir should be an
15
- # absolute path.
16
-
17
- def initialize(data_dir)
18
- set_data_dir data_dir
19
- translate_exception SystemCallError
20
- end
21
-
22
- end
23
-
24
- end