net-ssh 3.2.1.beta1 → 3.3.0.beta1
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.tar.gz.sig +0 -0
- data/.travis.yml +0 -1
- data/CHANGES.txt +4 -0
- data/lib/net/ssh/authentication/key_manager.rb +1 -1
- data/lib/net/ssh/buffer.rb +23 -2
- data/lib/net/ssh/connection/session.rb +1 -0
- data/lib/net/ssh/transport/algorithms.rb +2 -2
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +1 -1
- data/lib/net/ssh/transport/openssl.rb +1 -1
- data/lib/net/ssh/version.rb +2 -2
- data/net-ssh.gemspec +5 -4
- data/test/integration/test_encoding.rb +23 -0
- data/test/test_buffer.rb +29 -1
- metadata +4 -3
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4ac524bacb278642fe098d34f8f85d1a4f0579f
|
4
|
+
data.tar.gz: b6725236e2cae6de59f5994602cf3ead0c39bd8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e76a59cde72ff7dba71135482a0409b295e6b624a5b7c870bb8fd87d55af9c3cc446237dd8ffa3e53da453fbda52e3d96979e83d032c22177b7dfb62ebeca2
|
7
|
+
data.tar.gz: adcd1157982585d306d5bed0fcf5b64e9c001674d511054b683a4fee1ac0a75aa023fb462ff02f335570717fc6d011dc14bd6bc7273d2b2cf80437909f7d88f4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/CHANGES.txt
CHANGED
data/lib/net/ssh/buffer.rb
CHANGED
@@ -34,6 +34,7 @@ module Net; module SSH
|
|
34
34
|
# * :long => write a 4-byte integer (#write_long)
|
35
35
|
# * :byte => write a single byte (#write_byte)
|
36
36
|
# * :string => write a 4-byte length followed by character data (#write_string)
|
37
|
+
# * :mstring => same as string, but caller cannot resuse the string, avoids potential duplication (#write_moved)
|
37
38
|
# * :bool => write a single byte, interpreted as a boolean (#write_bool)
|
38
39
|
# * :bignum => write an SSH-encoded bignum (#write_bignum)
|
39
40
|
# * :key => write an SSH-encoded key value (#write_key)
|
@@ -182,7 +183,7 @@ module Net; module SSH
|
|
182
183
|
consume!
|
183
184
|
data
|
184
185
|
end
|
185
|
-
|
186
|
+
|
186
187
|
# Return the next 8 bytes as a 64-bit integer (in network byte order).
|
187
188
|
# Returns nil if there are less than 8 bytes remaining to be read in the
|
188
189
|
# buffer.
|
@@ -281,7 +282,14 @@ module Net; module SSH
|
|
281
282
|
# Writes the given data literally into the string. Does not alter the
|
282
283
|
# read position. Returns the buffer object.
|
283
284
|
def write(*data)
|
284
|
-
data.each { |datum| @content << datum }
|
285
|
+
data.each { |datum| @content << datum.dup.force_encoding('BINARY') }
|
286
|
+
self
|
287
|
+
end
|
288
|
+
|
289
|
+
# Optimized version of write where the caller gives up ownership of string
|
290
|
+
# to the method. This way we can mutate the string.
|
291
|
+
def write_moved(string)
|
292
|
+
@content << string.force_encoding('BINARY')
|
285
293
|
self
|
286
294
|
end
|
287
295
|
|
@@ -324,6 +332,19 @@ module Net; module SSH
|
|
324
332
|
self
|
325
333
|
end
|
326
334
|
|
335
|
+
# Writes each argument to the buffer as an SSH2-encoded string. Each
|
336
|
+
# string is prefixed by its length, encoded as a 4-byte long integer.
|
337
|
+
# Does not alter the read position. Returns the buffer object.
|
338
|
+
# Might alter arguments see write_moved
|
339
|
+
def write_mstring(*text)
|
340
|
+
text.each do |string|
|
341
|
+
s = string.to_s
|
342
|
+
write_long(s.bytesize)
|
343
|
+
write_moved(s)
|
344
|
+
end
|
345
|
+
self
|
346
|
+
end
|
347
|
+
|
327
348
|
# Writes each argument to the buffer as a (C-style) boolean, with 1
|
328
349
|
# meaning true, and 0 meaning false. Does not alter the read position.
|
329
350
|
# Returns the buffer object.
|
@@ -295,8 +295,8 @@ module Net; module SSH; module Transport
|
|
295
295
|
|
296
296
|
Net::SSH::Buffer.from(:byte, KEXINIT,
|
297
297
|
:long, [rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF)],
|
298
|
-
:
|
299
|
-
:
|
298
|
+
:mstring, [kex, host_key, encryption, encryption, hmac, hmac],
|
299
|
+
:mstring, [compression, compression, language, language],
|
300
300
|
:bool, false, :long, 0)
|
301
301
|
end
|
302
302
|
|
@@ -57,7 +57,7 @@ module Net; module SSH; module Transport; module Kex
|
|
57
57
|
# send the KEXECDH_INIT message
|
58
58
|
## byte SSH_MSG_KEX_ECDH_INIT
|
59
59
|
## string Q_C, client's ephemeral public key octet string
|
60
|
-
buffer = Net::SSH::Buffer.from(:byte, init, :
|
60
|
+
buffer = Net::SSH::Buffer.from(:byte, init, :mstring, ecdh.public_key.to_bn.to_s(2))
|
61
61
|
connection.send_message(buffer)
|
62
62
|
|
63
63
|
# expect the following KEXECDH_REPLY message
|
@@ -185,7 +185,7 @@ module OpenSSL
|
|
185
185
|
def to_blob
|
186
186
|
@blob ||= Net::SSH::Buffer.from(:string, ssh_type,
|
187
187
|
:string, CurveNameAliasInv[self.group.curve_name],
|
188
|
-
:
|
188
|
+
:mstring, self.public_key.to_bn.to_s(2)).to_s
|
189
189
|
@blob
|
190
190
|
end
|
191
191
|
|
data/lib/net/ssh/version.rb
CHANGED
@@ -48,10 +48,10 @@ module Net; module SSH
|
|
48
48
|
MAJOR = 3
|
49
49
|
|
50
50
|
# The minor component of this version of the Net::SSH library
|
51
|
-
MINOR =
|
51
|
+
MINOR = 3
|
52
52
|
|
53
53
|
# The tiny component of this version of the Net::SSH library
|
54
|
-
TINY =
|
54
|
+
TINY = 0
|
55
55
|
|
56
56
|
# The prerelease component of this version of the Net::SSH library
|
57
57
|
# nil allowed
|
data/net-ssh.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: net-ssh 3.
|
5
|
+
# stub: net-ssh 3.3.0.beta1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "net-ssh"
|
9
|
-
s.version = "3.
|
9
|
+
s.version = "3.3.0.beta1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
|
14
14
|
s.cert_chain = ["net-ssh-public_cert.pem"]
|
15
|
-
s.date = "2016-
|
15
|
+
s.date = "2016-11-09"
|
16
16
|
s.description = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
|
17
17
|
s.email = "net-ssh@solutious.com"
|
18
18
|
s.extra_rdoc_files = [
|
@@ -144,6 +144,7 @@ Gem::Specification.new do |s|
|
|
144
144
|
"test/integration/Vagrantfile",
|
145
145
|
"test/integration/common.rb",
|
146
146
|
"test/integration/playbook.yml",
|
147
|
+
"test/integration/test_encoding.rb",
|
147
148
|
"test/integration/test_forward.rb",
|
148
149
|
"test/integration/test_id_rsa_keys.rb",
|
149
150
|
"test/integration/test_proxy.rb",
|
@@ -191,7 +192,7 @@ Gem::Specification.new do |s|
|
|
191
192
|
s.licenses = ["MIT"]
|
192
193
|
s.required_ruby_version = Gem::Requirement.new(">= 2.0")
|
193
194
|
s.rubyforge_project = "net-ssh"
|
194
|
-
s.rubygems_version = "2.
|
195
|
+
s.rubygems_version = "2.5.1"
|
195
196
|
s.signing_key = "/mnt/gem/net-ssh-private_key.pem"
|
196
197
|
s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
|
197
198
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'common'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
require 'net/ssh'
|
6
|
+
|
7
|
+
class TestEncoding < NetSSHTest
|
8
|
+
def test_unicode_character
|
9
|
+
ret = Net::SSH.start("localhost", "net_ssh_1", password: 'foopwd') do |ssh|
|
10
|
+
ssh.exec! "echo \"hello from:$USER\" \u2603"
|
11
|
+
end
|
12
|
+
assert_equal ret, "hello from:net_ssh_1 \u2603\n"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_long_command_with_unicode_in_it
|
16
|
+
string = "eeeeeeeeeeeeeeeeeeeeeeeeeewwowowowìeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
17
|
+
command = "echo \"#{string}\""
|
18
|
+
ret = Net::SSH.start("localhost", "net_ssh_1", password: 'foopwd') do |ssh|
|
19
|
+
ssh.exec! command
|
20
|
+
end
|
21
|
+
assert_equal ret, "#{string}\n"
|
22
|
+
end
|
23
|
+
end
|
data/test/test_buffer.rb
CHANGED
@@ -26,6 +26,34 @@ class TestBuffer < Test::Unit::TestCase
|
|
26
26
|
assert_equal "\1\0\0\0\2\0\0\0\0\0\0\0\3\0\0\0\0014\1\0\000\000\000\004I\226\002\322something", buffer.to_s
|
27
27
|
end
|
28
28
|
|
29
|
+
def test_from_should_build_new_buffer_that_includes_utf8_string_128_characters
|
30
|
+
length = 128
|
31
|
+
# letter A has a 1 byte UTF8 representation
|
32
|
+
buffer = Net::SSH::Buffer.from(:long, 2, :string, 'A' * length)
|
33
|
+
# long of 2 + length 128 as network endian + 128 A's
|
34
|
+
expected = "\x00\x00\x00\x02" + [length].pack('N*') + ("\x41" * length)
|
35
|
+
assert_equal expected, buffer.to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_from_should_build_new_buffer_with_frozen_strings
|
39
|
+
foo = 'foo'.freeze
|
40
|
+
buffer = Net::SSH::Buffer.from(:string, foo)
|
41
|
+
assert_equal "\0\0\0\3foo", buffer.to_s
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_from_should_build_new_buffer_with_utf8_frozen_strings
|
45
|
+
foo = "\u2603".freeze
|
46
|
+
buffer = Net::SSH::Buffer.from(:string, foo)
|
47
|
+
assert_equal "\0\0\0\3\u2603".force_encoding('BINARY'), buffer.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_from_should_not_change_regular_paramaters
|
51
|
+
foo = "\u2603"
|
52
|
+
buffer = Net::SSH::Buffer.from(:string, foo)
|
53
|
+
assert_equal "\0\0\0\3\u2603".force_encoding('BINARY'), buffer.to_s
|
54
|
+
assert_equal foo.encoding.to_s, "UTF-8"
|
55
|
+
end
|
56
|
+
|
29
57
|
def test_from_with_array_argument_should_write_multiple_of_the_given_type
|
30
58
|
buffer = Net::SSH::Buffer.from(:byte, [1,2,3,4,5])
|
31
59
|
assert_equal "\1\2\3\4\5", buffer.to_s
|
@@ -33,7 +61,7 @@ class TestBuffer < Test::Unit::TestCase
|
|
33
61
|
|
34
62
|
def test_from_should_measure_bytesize_of_utf_8_string_correctly
|
35
63
|
buffer = Net::SSH::Buffer.from(:string, "\u2603") # Snowman is 3 bytes
|
36
|
-
assert_equal "\0\0\0\3\u2603", buffer.to_s
|
64
|
+
assert_equal "\0\0\0\3\u2603".force_encoding('BINARY'), buffer.to_s
|
37
65
|
end
|
38
66
|
|
39
67
|
def test_read_without_argument_should_read_to_end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
s/ZUKye79ELwFYKJOhjW5g725OL3hy+llhEleytwKRwgXFQBPTC4f5UkdxZVVWGH
|
32
32
|
e2C9M1m/2odPZo8h
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: test-unit
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- test/integration/Vagrantfile
|
196
196
|
- test/integration/common.rb
|
197
197
|
- test/integration/playbook.yml
|
198
|
+
- test/integration/test_encoding.rb
|
198
199
|
- test/integration/test_forward.rb
|
199
200
|
- test/integration/test_id_rsa_keys.rb
|
200
201
|
- test/integration/test_proxy.rb
|
@@ -257,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
258
|
version: 1.3.1
|
258
259
|
requirements: []
|
259
260
|
rubyforge_project: net-ssh
|
260
|
-
rubygems_version: 2.
|
261
|
+
rubygems_version: 2.5.1
|
261
262
|
signing_key:
|
262
263
|
specification_version: 4
|
263
264
|
summary: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
|
metadata.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
���
|
3
|
-
srU��Qh���5����� �ȡ/�m���CE"G=����R�^�8��O��@`8�W�Y��o���!�k�G~�o�bP��"�w��$��I7^��V��i V�'l�;t
|
1
|
+
�������v��qD�8�6�����6(k�M�Q^�:gI�}I����Օ����6|�A���c��#_���>H��'�K��֡�?\�c'��{��}�KXm/Eu��9�(�d�s����2���_UӔ}��!ܪ�a�w@���G��:\>�!Ӛ`lŖ`��G�\�r<а���П�t���W�zБ��v�;�Zָ��{4���Hĝ^�b���7m*&R�n��<' ӟ( �����p�[t���7
|