ftpd 2.0.5 → 2.1.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.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/Gemfile.lock +2 -2
- data/examples/example.rb +1 -1
- data/ftpd.gemspec +5 -16
- data/lib/ftpd.rb +1 -1
- data/lib/ftpd/cmd_help.rb +4 -4
- data/lib/ftpd/cmd_nlst.rb +2 -2
- data/lib/ftpd/cmd_type.rb +1 -3
- data/lib/ftpd/data_connection_helper.rb +0 -2
- data/lib/ftpd/disk_file_system.rb +1 -1
- data/lib/ftpd/file_system_helper.rb +0 -2
- data/lib/ftpd/ftp_server.rb +3 -11
- data/lib/ftpd/gets_peer_address.rb +1 -3
- data/lib/ftpd/release.rb +13 -0
- data/lib/ftpd/server.rb +2 -1
- data/lib/ftpd/temp_dir.rb +1 -1
- data/lib/ftpd/tls_server.rb +1 -2
- data/lib/ftpd/translate_exceptions.rb +3 -2
- metadata +3 -4
- data/VERSION +0 -1
- data/lib/ftpd/read_only_disk_file_system.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa6a9a475474687ea612712f4830113e899f673a
|
4
|
+
data.tar.gz: 586a68fd022bda0a95da5cf94da05982b25dcd4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec864ec9526fa5f567fbfac0e248b8eaa491e49a7fb612d71f4511b9a6eeda7330e3f13d9e6aaf03bc76141b9757fbb51abec9491db8bf6c125f8077296082e
|
7
|
+
data.tar.gz: 30352a8101f4e74c61aad1eb4405116af35a72091b3e24f45f1c21e9e14f78b6ef9c62352bbc908b06ff5ba0b85fc451fe8d6967cf9e6de62605be2845976763
|
data/Changelog.md
CHANGED
@@ -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)
|
data/Gemfile.lock
CHANGED
data/examples/example.rb
CHANGED
data/ftpd.gemspec
CHANGED
@@ -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 =
|
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 =
|
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",
|
data/lib/ftpd.rb
CHANGED
@@ -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/
|
80
|
+
require_relative 'ftpd/release'
|
81
81
|
require_relative 'ftpd/server'
|
82
82
|
require_relative 'ftpd/session'
|
83
83
|
require_relative 'ftpd/session_config'
|
data/lib/ftpd/cmd_help.rb
CHANGED
@@ -8,11 +8,11 @@ module Ftpd
|
|
8
8
|
|
9
9
|
def cmd_help(argument)
|
10
10
|
if argument
|
11
|
-
|
12
|
-
if supported_commands.include?(
|
13
|
-
reply "214 Command #{
|
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 #{
|
15
|
+
reply "214 Command #{target_command} is not recognized"
|
16
16
|
end
|
17
17
|
else
|
18
18
|
reply '214-The following commands are recognized:'
|
data/lib/ftpd/cmd_nlst.rb
CHANGED
data/lib/ftpd/cmd_type.rb
CHANGED
@@ -8,9 +8,7 @@ module Ftpd
|
|
8
8
|
|
9
9
|
def cmd_type(argument)
|
10
10
|
ensure_logged_in
|
11
|
-
syntax_error unless argument =~
|
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
|
data/lib/ftpd/ftp_server.rb
CHANGED
@@ -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
|
134
|
-
#
|
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 =
|
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
|
-
|
30
|
+
_port, host = Socket.unpack_sockaddr_in(sockaddr)
|
33
31
|
host
|
34
32
|
else
|
35
33
|
# SSL
|
data/lib/ftpd/release.rb
ADDED
data/lib/ftpd/server.rb
CHANGED
@@ -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
|
121
|
+
rescue OpenSSL::SSL::SSLError
|
121
122
|
ensure
|
122
123
|
close_socket socket
|
123
124
|
end
|
data/lib/ftpd/temp_dir.rb
CHANGED
data/lib/ftpd/tls_server.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
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-
|
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/
|
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
|