net-sftp 4.0.2 → 4.1.1
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.txt +18 -0
- data/README.rdoc +3 -0
- data/lib/net/sftp/operations/download.rb +220 -34
- data/lib/net/sftp/operations/upload.rb +126 -25
- data/lib/net/sftp/protocol/01/attributes.rb +5 -1
- data/lib/net/sftp/protocol/01/base.rb +2 -1
- data/lib/net/sftp/protocol/04/attributes.rb +2 -1
- data/lib/net/sftp/protocol/04/base.rb +2 -1
- data/lib/net/sftp/protocol/base.rb +2 -0
- data/lib/net/sftp/protocol/bounded_read.rb +25 -0
- data/lib/net/sftp/session.rb +16 -3
- data/lib/net/sftp/version.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +5 -16
- metadata.gz.sig +0 -0
- data/.github/pull_request_template.md +0 -1
- data/.github/workflows/changelog.yml +0 -18
- data/.github/workflows/ci.yml +0 -36
- data/.gitignore +0 -7
- data/CONTRIBUTING.md +0 -33
- data/Gemfile +0 -20
- data/Manifest +0 -55
- data/Rakefile +0 -152
- data/changelog.d/README.md +0 -1
- data/net-sftp-public_cert.pem +0 -21
- data/net-sftp.gemspec +0 -48
- data/setup.rb +0 -1331
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'net/ssh/buffer'
|
|
2
|
+
require 'net/sftp/protocol/bounded_read'
|
|
2
3
|
|
|
3
4
|
module Net; module SFTP; module Protocol; module V01
|
|
4
5
|
|
|
@@ -39,6 +40,8 @@ module Net; module SFTP; module Protocol; module V01
|
|
|
39
40
|
T_BLOCK_DEVICE = 8
|
|
40
41
|
T_FIFO = 9
|
|
41
42
|
|
|
43
|
+
extend Net::SFTP::Protocol::BoundedRead
|
|
44
|
+
|
|
42
45
|
class <<self
|
|
43
46
|
# Returns the array of attribute meta-data that defines the structure of
|
|
44
47
|
# the attributes packet as described by this version of the protocol.
|
|
@@ -106,7 +109,8 @@ module Net; module SFTP; module Protocol; module V01
|
|
|
106
109
|
# Parse the hash of extended data from the buffer.
|
|
107
110
|
def parse_extended(buffer)
|
|
108
111
|
extended = Hash.new
|
|
109
|
-
|
|
112
|
+
# Each pair is two strings, at least 8 bytes.
|
|
113
|
+
read_bounded_count!(buffer, 8, "extended attribute").times do
|
|
110
114
|
extended[buffer.read_string] = buffer.read_string
|
|
111
115
|
end
|
|
112
116
|
extended
|
|
@@ -54,7 +54,8 @@ module Net; module SFTP; module Protocol; module V01
|
|
|
54
54
|
def parse_name_packet(packet)
|
|
55
55
|
names = []
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
# Each entry is two strings and the attribute flags, at least 12 bytes.
|
|
58
|
+
read_bounded_count!(packet, 12, "name").times do
|
|
58
59
|
filename = packet.read_string
|
|
59
60
|
longname = packet.read_string
|
|
60
61
|
attrs = attribute_factory.from_buffer(packet)
|
|
@@ -69,7 +69,8 @@ module Net; module SFTP; module Protocol; module V04
|
|
|
69
69
|
def parse_acl(buffer)
|
|
70
70
|
acl_buf = Net::SSH::Buffer.new(buffer.read_string)
|
|
71
71
|
acl = []
|
|
72
|
-
|
|
72
|
+
# Each entry is three longs and a string, at least 16 bytes.
|
|
73
|
+
read_bounded_count!(acl_buf, 16, "ACL").times do
|
|
73
74
|
acl << ACL.new(acl_buf.read_long, acl_buf.read_long, acl_buf.read_long, acl_buf.read_string)
|
|
74
75
|
end
|
|
75
76
|
acl
|
|
@@ -28,7 +28,8 @@ module Net; module SFTP; module Protocol; module V04
|
|
|
28
28
|
def parse_name_packet(packet)
|
|
29
29
|
names = []
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
# Each entry is a string, the attribute flags and the type, at least 9 bytes.
|
|
32
|
+
read_bounded_count!(packet, 9, "name").times do
|
|
32
33
|
filename = packet.read_string
|
|
33
34
|
attrs = attribute_factory.from_buffer(packet)
|
|
34
35
|
names << name_factory.new(filename, attrs)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'net/ssh/loggable'
|
|
2
2
|
require 'net/sftp/constants'
|
|
3
|
+
require 'net/sftp/protocol/bounded_read'
|
|
3
4
|
|
|
4
5
|
module Net; module SFTP; module Protocol
|
|
5
6
|
|
|
@@ -10,6 +11,7 @@ module Net; module SFTP; module Protocol
|
|
|
10
11
|
include Net::SSH::Loggable
|
|
11
12
|
include Net::SFTP::Constants
|
|
12
13
|
include Net::SFTP::Constants::PacketTypes
|
|
14
|
+
include Net::SFTP::Protocol::BoundedRead
|
|
13
15
|
|
|
14
16
|
# The SFTP session object that acts as client to this protocol instance
|
|
15
17
|
attr_reader :session
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'net/sftp/errors'
|
|
2
|
+
|
|
3
|
+
module Net; module SFTP; module Protocol
|
|
4
|
+
|
|
5
|
+
# Several SFTP structures are a 32-bit item count followed by that many
|
|
6
|
+
# items. Net::SSH::Buffer returns nil instead of raising when a read runs
|
|
7
|
+
# past the end of the data, so a loop over an unchecked count from the
|
|
8
|
+
# server keeps allocating long after the packet is exhausted.
|
|
9
|
+
module BoundedRead
|
|
10
|
+
# Reads an item count from +buffer+ and raises Net::SFTP::Exception if it
|
|
11
|
+
# is missing, or larger than the remaining bytes could hold given that
|
|
12
|
+
# each item takes at least +min_item_size+ bytes.
|
|
13
|
+
def read_bounded_count!(buffer, min_item_size, what)
|
|
14
|
+
count = buffer.read_long
|
|
15
|
+
raise Net::SFTP::Exception, "truncated packet: missing #{what} count" if count.nil?
|
|
16
|
+
|
|
17
|
+
if count > buffer.available / min_item_size
|
|
18
|
+
raise Net::SFTP::Exception, "server sent #{count} #{what} entries in only #{buffer.available} bytes"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
count
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end; end; end
|
data/lib/net/sftp/session.rb
CHANGED
|
@@ -68,6 +68,10 @@ module Net; module SFTP
|
|
|
68
68
|
# the server has not yet responded to will be represented here.
|
|
69
69
|
attr_reader :pending_requests
|
|
70
70
|
|
|
71
|
+
# The extensions the server advertised in its FXP_VERSION packet, as a
|
|
72
|
+
# hash of name => data (e.g. "posix-rename@openssh.com" => "1").
|
|
73
|
+
attr_reader :extensions
|
|
74
|
+
|
|
71
75
|
# Creates a new Net::SFTP instance atop the given Net::SSH connection.
|
|
72
76
|
# This will return immediately, before the SFTP connection has been properly
|
|
73
77
|
# initialized. Once the connection is ready, the given block will be called.
|
|
@@ -81,6 +85,7 @@ module Net; module SFTP
|
|
|
81
85
|
@input = Net::SSH::Buffer.new
|
|
82
86
|
self.logger = session.logger
|
|
83
87
|
@state = :closed
|
|
88
|
+
@extensions = {}
|
|
84
89
|
@pending_requests = {}
|
|
85
90
|
|
|
86
91
|
connect(&block)
|
|
@@ -924,19 +929,27 @@ module Net; module SFTP
|
|
|
924
929
|
# version negotiation, instantiating the appropriate Protocol instance
|
|
925
930
|
# and invoking the callback given to #connect, if any.
|
|
926
931
|
def do_version(packet)
|
|
932
|
+
# Negotiation happens once. A later FXP_VERSION would swap the protocol
|
|
933
|
+
# driver and drop every pending request.
|
|
934
|
+
unless state == :init
|
|
935
|
+
raise Net::SFTP::Exception, "unexpected FXP_VERSION packet while session is #{state}"
|
|
936
|
+
end
|
|
937
|
+
|
|
927
938
|
debug { "negotiating sftp protocol version, mine is #{HIGHEST_PROTOCOL_VERSION_SUPPORTED}" }
|
|
928
939
|
|
|
929
940
|
server_version = packet.read_long
|
|
930
941
|
debug { "server reports sftp version #{server_version}" }
|
|
931
942
|
|
|
932
|
-
|
|
943
|
+
# Servers reply with their own version whatever we offered (OpenSSH
|
|
944
|
+
# always says 3), so cap at the version we offered as well.
|
|
945
|
+
negotiated_version = [server_version, @version, HIGHEST_PROTOCOL_VERSION_SUPPORTED].compact.min
|
|
933
946
|
info { "negotiated version is #{negotiated_version}" }
|
|
934
947
|
|
|
935
|
-
extensions = {}
|
|
948
|
+
@extensions = {}
|
|
936
949
|
until packet.eof?
|
|
937
950
|
name = packet.read_string
|
|
938
951
|
data = packet.read_string
|
|
939
|
-
extensions[name] = data
|
|
952
|
+
@extensions[name] = data
|
|
940
953
|
end
|
|
941
954
|
|
|
942
955
|
@protocol = Protocol.load(self, negotiated_version)
|
data/lib/net/sftp/version.rb
CHANGED
|
@@ -49,10 +49,10 @@ module Net
|
|
|
49
49
|
MAJOR = 4
|
|
50
50
|
|
|
51
51
|
# The minor component of this version of the Net::SFTP library
|
|
52
|
-
MINOR =
|
|
52
|
+
MINOR = 1
|
|
53
53
|
|
|
54
54
|
# The tiny component of this version of the Net::SFTP library
|
|
55
|
-
TINY =
|
|
55
|
+
TINY = 1
|
|
56
56
|
|
|
57
57
|
# The prerelease component of this version of the Net::SFTP library
|
|
58
58
|
# nil allowed
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: net-sftp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamis Buck
|
|
8
8
|
- Delano Mandelbaum
|
|
9
9
|
- Miklós Fazekas
|
|
10
10
|
autorequire:
|
|
11
|
-
bindir:
|
|
11
|
+
bindir: bin
|
|
12
12
|
cert_chain:
|
|
13
13
|
- |
|
|
14
14
|
-----BEGIN CERTIFICATE-----
|
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
|
32
32
|
mMdUtmMoVbjbik3hqkY/18G03c3PoFNpL38VLKuyyROYz1DaCqOaRju3sbOoirD+
|
|
33
33
|
piQTZDCWxeKuX0Iuxq02uxkYHfoGB6In0y3OOQ==
|
|
34
34
|
-----END CERTIFICATE-----
|
|
35
|
-
date: 2026-10-
|
|
35
|
+
date: 2026-10-29 00:00:00.000000000 Z
|
|
36
36
|
dependencies:
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
38
|
name: net-ssh
|
|
@@ -91,18 +91,9 @@ extra_rdoc_files:
|
|
|
91
91
|
- LICENSE.txt
|
|
92
92
|
- README.rdoc
|
|
93
93
|
files:
|
|
94
|
-
- ".github/pull_request_template.md"
|
|
95
|
-
- ".github/workflows/changelog.yml"
|
|
96
|
-
- ".github/workflows/ci.yml"
|
|
97
|
-
- ".gitignore"
|
|
98
94
|
- CHANGES.txt
|
|
99
|
-
- CONTRIBUTING.md
|
|
100
|
-
- Gemfile
|
|
101
95
|
- LICENSE.txt
|
|
102
|
-
- Manifest
|
|
103
96
|
- README.rdoc
|
|
104
|
-
- Rakefile
|
|
105
|
-
- changelog.d/README.md
|
|
106
97
|
- lib/net/sftp.rb
|
|
107
98
|
- lib/net/sftp/constants.rb
|
|
108
99
|
- lib/net/sftp/errors.rb
|
|
@@ -125,13 +116,11 @@ files:
|
|
|
125
116
|
- lib/net/sftp/protocol/06/attributes.rb
|
|
126
117
|
- lib/net/sftp/protocol/06/base.rb
|
|
127
118
|
- lib/net/sftp/protocol/base.rb
|
|
119
|
+
- lib/net/sftp/protocol/bounded_read.rb
|
|
128
120
|
- lib/net/sftp/request.rb
|
|
129
121
|
- lib/net/sftp/response.rb
|
|
130
122
|
- lib/net/sftp/session.rb
|
|
131
123
|
- lib/net/sftp/version.rb
|
|
132
|
-
- net-sftp-public_cert.pem
|
|
133
|
-
- net-sftp.gemspec
|
|
134
|
-
- setup.rb
|
|
135
124
|
homepage: https://github.com/net-ssh/net-sftp
|
|
136
125
|
licenses:
|
|
137
126
|
- MIT
|
|
@@ -144,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
144
133
|
requirements:
|
|
145
134
|
- - ">="
|
|
146
135
|
- !ruby/object:Gem::Version
|
|
147
|
-
version: '
|
|
136
|
+
version: '2.6'
|
|
148
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
138
|
requirements:
|
|
150
139
|
- - ">="
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!-- After opening the PR, add a changelog.d/<PR number>.<type>.txt fragment (none, change, security, breaking or breaking-security) instead of editing CHANGES.txt; see CONTRIBUTING.md#changelog. -->
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Changelog
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: read
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
changelog:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
with:
|
|
16
|
-
# HEAD is the PR merged into the base branch; HEAD^1 is the base it was merged into.
|
|
17
|
-
fetch-depth: 2
|
|
18
|
-
- uses: net-ssh/changelogd@v1
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
push: { branches: master }
|
|
5
|
-
permissions:
|
|
6
|
-
contents: read
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
strategy:
|
|
11
|
-
fail-fast: false
|
|
12
|
-
matrix:
|
|
13
|
-
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'ruby-head', 'jruby', 'truffleruby']
|
|
14
|
-
continue-on-error: ${{ contains(fromJSON('["ruby-head", "jruby", "truffleruby"]'), matrix.ruby-version) }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
18
|
-
uses: ruby/setup-ruby@v1
|
|
19
|
-
with:
|
|
20
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
21
|
-
bundler-cache: true
|
|
22
|
-
- name: Run Tests
|
|
23
|
-
run: bundle exec rake test
|
|
24
|
-
frozen-string-literal:
|
|
25
|
-
runs-on: ubuntu-latest
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@v4
|
|
28
|
-
- name: Set up Ruby
|
|
29
|
-
uses: ruby/setup-ruby@v1
|
|
30
|
-
with:
|
|
31
|
-
ruby-version: '4.0'
|
|
32
|
-
bundler-cache: true
|
|
33
|
-
- name: Run Tests with frozen string literals
|
|
34
|
-
run: bundle exec rake test
|
|
35
|
-
env:
|
|
36
|
-
RUBYOPT: --enable-frozen-string-literal
|
data/.gitignore
DELETED
data/CONTRIBUTING.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Contributing to net-sftp
|
|
2
|
-
|
|
3
|
-
Run the tests with `bundle exec rake test`.
|
|
4
|
-
|
|
5
|
-
## Changelog
|
|
6
|
-
|
|
7
|
-
Don't edit `CHANGES.txt`. Instead, add a fragment file to `changelog.d/` in your PR; the release's version bump (`rake vbump:*`) moves all fragments into a new `=== <version>` section at the top of `CHANGES.txt` and deletes them.
|
|
8
|
-
|
|
9
|
-
A fragment is named `<number>.<type>.txt`, where `<number>` is the PR number (so open the PR first, then add the fragment), and contains a single UTF-8 paragraph: the entry as it should read in `CHANGES.txt`, without the bullet or prefix. Lines are joined, so it can be wrapped. If it doesn't end with a reference list such as `[#106, #107]` or `[GHSA-xxxx-xxxx-xxxx]`, ` [#<number>]` is appended.
|
|
10
|
-
|
|
11
|
-
| Type | Written as | Use for |
|
|
12
|
-
| ------------------- | ------------------------------ | ------------------------------------------------------------ |
|
|
13
|
-
| `breaking-security` | `* BREAKING: Security: <text>` | an incompatible change made for security |
|
|
14
|
-
| `breaking` | `* BREAKING: <text>` | an incompatible change |
|
|
15
|
-
| `security` | `* Security: <text>` | a security fix or hardening |
|
|
16
|
-
| `change` | `* <text>` | any other user-visible fix or feature |
|
|
17
|
-
| `none` | nothing | PRs with no user-visible change (tests, CI, docs, refactors) |
|
|
18
|
-
|
|
19
|
-
Examples:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
rake "changelog:new[184,change,Fixed downloading files with multibyte names]"
|
|
23
|
-
# changelog.d/184.change.txt -> * Fixed downloading files with multibyte names [#184]
|
|
24
|
-
|
|
25
|
-
echo 'Refuse symlinks that point outside the download directory [GHSA-xxxx-xxxx-xxxx]' > changelog.d/185.security.txt
|
|
26
|
-
touch changelog.d/186.none.txt
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
For several entries from one PR add a suffix: `184.change.txt`, `184.change.2.txt` (`changelog:new` picks the next free one).
|
|
30
|
-
|
|
31
|
-
`rake changelog:check` validates the fragments and `rake changelog:preview` prints the section the next release would add. CI fails a PR that edits `CHANGES.txt` or doesn't add or modify a `changelog.d/<PR number>.<type>.txt` fragment, unless it only touches `changelog.d/` or a maintainer adds the `skip-changelog` label; Dependabot PRs are skipped.
|
|
32
|
-
|
|
33
|
-
The full rules, including how a release orders the entries, are in the [changelogd README](https://github.com/net-ssh/changelogd#readme).
|
data/Gemfile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in mygem.gemspec
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
# TODO: add to gemspec
|
|
7
|
-
gem "bundler", ">= 1.11"
|
|
8
|
-
gem "rake", ">= 12.0"
|
|
9
|
-
gem "rdoc"
|
|
10
|
-
gem "logger" # no longer a default gem in Ruby 4.0+
|
|
11
|
-
|
|
12
|
-
# git: rather than github:, which Bundler 1.x (the default on Ruby 2.6) expands to an unsupported git:// URL.
|
|
13
|
-
gem "changelogd", git: "https://github.com/net-ssh/changelogd.git", tag: "v1", group: :development
|
|
14
|
-
|
|
15
|
-
gem 'byebug', group: %i[development test] if !Gem.win_platform? && RUBY_ENGINE == "ruby"
|
|
16
|
-
|
|
17
|
-
if ENV["CI"]
|
|
18
|
-
gem 'codecov', require: false, group: :test
|
|
19
|
-
gem 'simplecov', require: false, group: :test
|
|
20
|
-
end
|
data/Manifest
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
CHANGELOG.rdoc
|
|
2
|
-
lib/net/sftp/constants.rb
|
|
3
|
-
lib/net/sftp/errors.rb
|
|
4
|
-
lib/net/sftp/operations/dir.rb
|
|
5
|
-
lib/net/sftp/operations/download.rb
|
|
6
|
-
lib/net/sftp/operations/file.rb
|
|
7
|
-
lib/net/sftp/operations/file_factory.rb
|
|
8
|
-
lib/net/sftp/operations/upload.rb
|
|
9
|
-
lib/net/sftp/packet.rb
|
|
10
|
-
lib/net/sftp/protocol/01/attributes.rb
|
|
11
|
-
lib/net/sftp/protocol/01/base.rb
|
|
12
|
-
lib/net/sftp/protocol/01/name.rb
|
|
13
|
-
lib/net/sftp/protocol/02/base.rb
|
|
14
|
-
lib/net/sftp/protocol/03/base.rb
|
|
15
|
-
lib/net/sftp/protocol/04/attributes.rb
|
|
16
|
-
lib/net/sftp/protocol/04/base.rb
|
|
17
|
-
lib/net/sftp/protocol/04/name.rb
|
|
18
|
-
lib/net/sftp/protocol/05/base.rb
|
|
19
|
-
lib/net/sftp/protocol/06/attributes.rb
|
|
20
|
-
lib/net/sftp/protocol/06/base.rb
|
|
21
|
-
lib/net/sftp/protocol/base.rb
|
|
22
|
-
lib/net/sftp/protocol.rb
|
|
23
|
-
lib/net/sftp/request.rb
|
|
24
|
-
lib/net/sftp/response.rb
|
|
25
|
-
lib/net/sftp/session.rb
|
|
26
|
-
lib/net/sftp/version.rb
|
|
27
|
-
lib/net/sftp.rb
|
|
28
|
-
Rakefile
|
|
29
|
-
README.rdoc
|
|
30
|
-
setup.rb
|
|
31
|
-
test/common.rb
|
|
32
|
-
test/protocol/01/test_attributes.rb
|
|
33
|
-
test/protocol/01/test_base.rb
|
|
34
|
-
test/protocol/01/test_name.rb
|
|
35
|
-
test/protocol/02/test_base.rb
|
|
36
|
-
test/protocol/03/test_base.rb
|
|
37
|
-
test/protocol/04/test_attributes.rb
|
|
38
|
-
test/protocol/04/test_base.rb
|
|
39
|
-
test/protocol/04/test_name.rb
|
|
40
|
-
test/protocol/05/test_base.rb
|
|
41
|
-
test/protocol/06/test_attributes.rb
|
|
42
|
-
test/protocol/06/test_base.rb
|
|
43
|
-
test/protocol/test_base.rb
|
|
44
|
-
test/test_all.rb
|
|
45
|
-
test/test_dir.rb
|
|
46
|
-
test/test_download.rb
|
|
47
|
-
test/test_file.rb
|
|
48
|
-
test/test_file_factory.rb
|
|
49
|
-
test/test_packet.rb
|
|
50
|
-
test/test_protocol.rb
|
|
51
|
-
test/test_request.rb
|
|
52
|
-
test/test_response.rb
|
|
53
|
-
test/test_session.rb
|
|
54
|
-
test/test_upload.rb
|
|
55
|
-
Manifest
|
data/Rakefile
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
require "rubygems"
|
|
2
|
-
require "rake"
|
|
3
|
-
require "rake/clean"
|
|
4
|
-
require "rdoc/task"
|
|
5
|
-
require "bundler/gem_tasks"
|
|
6
|
-
|
|
7
|
-
desc "When releasing make sure NET_SSH_BUILDGEM_SIGNED is set"
|
|
8
|
-
task :check_NET_SSH_BUILDGEM_SIGNED do
|
|
9
|
-
raise "NET_SSH_BUILDGEM_SIGNED should be set to release" unless ENV['NET_SSH_BUILDGEM_SIGNED']
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
Rake::Task[:release].enhance [:check_NET_SSH_BUILDGEM_SIGNED]
|
|
13
|
-
Rake::Task[:release].prerequisites.unshift(:check_NET_SSH_BUILDGEM_SIGNED)
|
|
14
|
-
|
|
15
|
-
task :default => ["build"]
|
|
16
|
-
CLEAN.include [ 'pkg', 'rdoc' ]
|
|
17
|
-
name = "net-sftp"
|
|
18
|
-
|
|
19
|
-
require_relative "lib/net/sftp/version"
|
|
20
|
-
version = Net::SFTP::Version::CURRENT
|
|
21
|
-
|
|
22
|
-
begin
|
|
23
|
-
require "changelogd/rake"
|
|
24
|
-
rescue LoadError
|
|
25
|
-
# A git gem isn't on the load path under plain `rake`, as the release workflow runs it; bundler/setup could clash with the running rake.
|
|
26
|
-
require "bundler"
|
|
27
|
-
$LOAD_PATH.unshift(*Bundler.definition.specs["changelogd"].flat_map(&:full_require_paths))
|
|
28
|
-
require "changelogd/rake"
|
|
29
|
-
end
|
|
30
|
-
Changelogd::RakeTasks.new(version_file: "lib/net/sftp/version.rb")
|
|
31
|
-
|
|
32
|
-
namespace :cert do
|
|
33
|
-
desc "Update public cert from private - only run if public is expired"
|
|
34
|
-
task :update_public_when_expired do
|
|
35
|
-
require 'openssl'
|
|
36
|
-
require 'time'
|
|
37
|
-
raw = File.read "net-sftp-public_cert.pem"
|
|
38
|
-
certificate = OpenSSL::X509::Certificate.new raw
|
|
39
|
-
raise Exception, "Not yet expired: #{certificate.not_after}" unless certificate.not_after < Time.now
|
|
40
|
-
sh "gem cert --build netssh@solutious.com --days 1825 --private-key /mnt/gem/net-ssh-private_key.pem"
|
|
41
|
-
sh "mv gem-public_cert.pem net-sftp-public_cert.pem"
|
|
42
|
-
sh "gem cert --add net-sftp-public_cert.pem"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
require 'rake/testtask'
|
|
47
|
-
Rake::TestTask.new do |t|
|
|
48
|
-
t.libs = ["lib", "test"]
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt ]
|
|
52
|
-
RDoc::Task.new do |rdoc|
|
|
53
|
-
rdoc.rdoc_dir = "rdoc"
|
|
54
|
-
rdoc.title = "#{name} #{version}"
|
|
55
|
-
rdoc.generator = 'hanna' # gem install hanna-nouveau
|
|
56
|
-
rdoc.main = 'README.rdoc'
|
|
57
|
-
rdoc.rdoc_files.include("README*")
|
|
58
|
-
rdoc.rdoc_files.include("bin/*.rb")
|
|
59
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
|
60
|
-
extra_files.each { |file|
|
|
61
|
-
rdoc.rdoc_files.include(file) if File.exist?(file)
|
|
62
|
-
}
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def change_version(&block)
|
|
66
|
-
Rake::Task["changelog:check"].invoke
|
|
67
|
-
version_file = 'lib/net/sftp/version.rb'
|
|
68
|
-
require_relative version_file
|
|
69
|
-
pre = Net::SFTP::Version::PRE
|
|
70
|
-
tiny = Net::SFTP::Version::TINY
|
|
71
|
-
result = block[pre: pre, tiny: Net::SFTP::Version::TINY]
|
|
72
|
-
raise ArgumentError, "Version change logic should always return a pre" unless result.key?(:pre)
|
|
73
|
-
|
|
74
|
-
new_pre = result[:pre]
|
|
75
|
-
new_tiny = result[:tiny] || tiny
|
|
76
|
-
found = { pre: false, tiny: false }
|
|
77
|
-
File.open("#{version_file}.new", "w") do |f|
|
|
78
|
-
File.readlines(version_file).each do |line|
|
|
79
|
-
match =
|
|
80
|
-
if pre.nil?
|
|
81
|
-
/^(\s+PRE\s+=\s+)nil(\s*)$/.match(line)
|
|
82
|
-
else
|
|
83
|
-
/^(\s+PRE\s+=\s+")#{pre}("\s*)$/.match(line)
|
|
84
|
-
end
|
|
85
|
-
if match
|
|
86
|
-
prefix = match[1]
|
|
87
|
-
postfix = match[2]
|
|
88
|
-
prefix.delete_suffix!('"')
|
|
89
|
-
postfix.delete_prefix!('"')
|
|
90
|
-
new_line = "#{prefix}#{new_pre.inspect}#{postfix}"
|
|
91
|
-
puts "Changing:\n - #{line} + #{new_line}"
|
|
92
|
-
line = new_line
|
|
93
|
-
found[:pre] = true
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
if new_tiny != tiny
|
|
97
|
-
match = /^(\s+TINY\s+=\s+)#{tiny}(\s*)$/.match(line)
|
|
98
|
-
if match
|
|
99
|
-
prefix = match[1]
|
|
100
|
-
postfix = match[2]
|
|
101
|
-
new_line = "#{prefix}#{new_tiny}#{postfix}"
|
|
102
|
-
puts "Changing:\n - #{line} + #{new_line}"
|
|
103
|
-
line = new_line
|
|
104
|
-
found[:tiny] = true
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
f.write(line)
|
|
109
|
-
end
|
|
110
|
-
raise ArgumentError, "Cound not find line: PRE = \"#{pre}\" in #{version_file}" unless found[:pre]
|
|
111
|
-
raise ArgumentError, "Cound not find line: TINY = \"#{tiny}\" in #{version_file}" unless found[:tiny] || new_tiny == tiny
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
FileUtils.mv version_file, "#{version_file}.old"
|
|
115
|
-
FileUtils.mv "#{version_file}.new", version_file
|
|
116
|
-
Rake::Task["changelog:release"].invoke
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
namespace :vbump do
|
|
120
|
-
desc "Final release"
|
|
121
|
-
task :final do
|
|
122
|
-
change_version do |pre:, tiny:|
|
|
123
|
-
_ = tiny
|
|
124
|
-
if pre.nil?
|
|
125
|
-
{ tiny: tiny + 1, pre: nil }
|
|
126
|
-
else
|
|
127
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if pre.nil?
|
|
128
|
-
|
|
129
|
-
{ pre: nil }
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
desc "Increment prerelease"
|
|
135
|
-
task :pre, [:type] do |_t, args|
|
|
136
|
-
change_version do |pre:, tiny:|
|
|
137
|
-
puts " PRE => #{pre.inspect}"
|
|
138
|
-
match = /^([a-z]+)(\d+)/.match(pre)
|
|
139
|
-
raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
|
|
140
|
-
|
|
141
|
-
if match.nil? || (!args[:type].nil? && args[:type] != match[1])
|
|
142
|
-
if pre.nil?
|
|
143
|
-
{ pre: "#{args[:type]}1", tiny: tiny + 1 }
|
|
144
|
-
else
|
|
145
|
-
{ pre: "#{args[:type]}1" }
|
|
146
|
-
end
|
|
147
|
-
else
|
|
148
|
-
{ pre: "#{match[1]}#{match[2].to_i + 1}" }
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
end
|
data/changelog.d/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Changelog fragments: one `<PR number>.<type>.txt` file per user-visible change, assembled into `CHANGES.txt` when the version is bumped. See [CONTRIBUTING.md](../CONTRIBUTING.md#changelog).
|
data/net-sftp-public_cert.pem
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
|
|
3
|
-
c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
|
|
4
|
-
b20wHhcNMjYxMDIyMDk1NDI1WhcNMjcxMDIyMDk1NDI1WjBBMQ8wDQYDVQQDDAZu
|
|
5
|
-
ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
|
|
6
|
-
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
|
|
7
|
-
pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
|
|
8
|
-
qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
|
|
9
|
-
6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
|
|
10
|
-
JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
|
|
11
|
-
KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
|
|
12
|
-
3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
|
13
|
-
BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
|
|
14
|
-
b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
|
|
15
|
-
9w0BAQsFAAOCAQEAbVrRpiCFmHDMLNU+SCjpg43snWYksQOtejPPTEMdOc9cCmmv
|
|
16
|
-
ctJbaPIySLUgzwFbQDZStDPbLJmIujh0fm5dHp/sDJpvPZ3Mm3FfzWQMJqzBx4uk
|
|
17
|
-
OMx00yJK8VeFrwUViE3zO5raWvw85dUybp25pgaKGW4AA5mJ/2UHqYLc4lefKFKK
|
|
18
|
-
9xFsyYSciMEKyAsUNSNTJzPKUo2vn7TNF/pS0ZL+h8Qkr0A0F0ncfj7uM1kOWjO0
|
|
19
|
-
mMdUtmMoVbjbik3hqkY/18G03c3PoFNpL38VLKuyyROYz1DaCqOaRju3sbOoirD+
|
|
20
|
-
piQTZDCWxeKuX0Iuxq02uxkYHfoGB6In0y3OOQ==
|
|
21
|
-
-----END CERTIFICATE-----
|
data/net-sftp.gemspec
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require_relative 'lib/net/sftp/version'
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name = "net-sftp"
|
|
5
|
-
spec.version = Net::SFTP::Version::STRING
|
|
6
|
-
spec.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
|
|
7
|
-
spec.email = ["net-ssh@solutious.com"]
|
|
8
|
-
|
|
9
|
-
if ENV['NET_SSH_BUILDGEM_SIGNED']
|
|
10
|
-
spec.cert_chain = ["net-sftp-public_cert.pem"]
|
|
11
|
-
spec.signing_key = "/mnt/gem/net-ssh-private_key.pem"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
spec.summary = %q{A pure Ruby implementation of the SFTP client protocol.}
|
|
15
|
-
spec.description = %q{A pure Ruby implementation of the SFTP client protocol}
|
|
16
|
-
spec.homepage = "https://github.com/net-ssh/net-sftp"
|
|
17
|
-
spec.license = "MIT"
|
|
18
|
-
spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version=
|
|
19
|
-
|
|
20
|
-
spec.extra_rdoc_files = [
|
|
21
|
-
"LICENSE.txt",
|
|
22
|
-
"README.rdoc"
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
-
spec.bindir = "exe"
|
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
|
-
spec.require_paths = ["lib"]
|
|
29
|
-
|
|
30
|
-
if spec.respond_to? :specification_version then
|
|
31
|
-
spec.specification_version = 3
|
|
32
|
-
|
|
33
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
34
|
-
spec.add_runtime_dependency(%q<net-ssh>, [">= 5.0.0", "< 9.0.0"])
|
|
35
|
-
spec.add_development_dependency(%q<minitest>, [">= 5"])
|
|
36
|
-
spec.add_development_dependency(%q<mocha>, [">= 0"])
|
|
37
|
-
else
|
|
38
|
-
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 9.0.0"])
|
|
39
|
-
spec.add_dependency(%q<minitest>, [">= 5"])
|
|
40
|
-
spec.add_dependency(%q<mocha>, [">= 0"])
|
|
41
|
-
end
|
|
42
|
-
else
|
|
43
|
-
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 9.0.0"])
|
|
44
|
-
spec.add_dependency(%q<minitest>, [">= 5"])
|
|
45
|
-
spec.add_dependency(%q<test-unit>, [">= 0"])
|
|
46
|
-
spec.add_dependency(%q<mocha>, [">= 0"])
|
|
47
|
-
end
|
|
48
|
-
end
|