net-ssh 3.1.1 → 3.2.0.rc1

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: 4a7137b024d13eff1d07bc383f9af459276cd6e6
4
- data.tar.gz: b41b06db8a85bad4f82bd8e45b608f22d5fe5691
3
+ metadata.gz: 1477e274c366e8b51cf9112399b5c6b7854df2bd
4
+ data.tar.gz: 7e5884773d502b4dcde4013810e4be0369a77e9e
5
5
  SHA512:
6
- metadata.gz: 79a6eabb6968b82c503586f8d6d7e2e97770092797a4111309055040bc76db7e49df2dd34122be103c40192c94a4848323a6d7c5c3cb42d93e534556e8cfc98e
7
- data.tar.gz: 9c5abba527c9c1c6ecb97246ea31d23e31825f3a60f4de37a7c38362c04b2b0446f8591de49014781cefeac25d38db6df68295ef295aa5cb94efc46763c45d7b
6
+ metadata.gz: 9f28aa655c03f370327c4a016652f8c48b535b6a7649d401763e28183e7718620eee881dfb4e0f40f1cda6d57954cd31ecd741be281bb2aa066fd8debd2d6637
7
+ data.tar.gz: 1b46532ef715789b9a81e2128a11cebcf332b7c413514b0ae3657b4ecafe2f519b90a10f20837ac217e60f7d3344b8b995df46de83e47c44fbdb8fa677ee43bc
@@ -1 +1,2 @@
1
- ����g=X?��?"7��{}�b+��FOyCY�,H'�F�����`<w.�ŠKݍ}�F��bhN�\���r��$[ iY�|웊�rjK�x!� ���<�o6�E{���<'l��
1
+ ?O���.-2~��}h��T(����E1�JZ3���`�۷4RR�[k����G>,}r�o
2
+ ;�|(��j���ã�:,nF����˶zn�XK�x�8^)1���Ȏo�q�ۃ�,�?��5���乨� '��٬�7�4������v�)�h�C�����ܰ\�%�!���1����7|�J�dmbˠ��~S ̠�ˍV�-�Z�\]<�~��ܦ���J�4h�� ��f��������s �?lE�fT��
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 3.2.0
2
+
3
+ * Added agent_socket_factory option [Alon Goldboim]
4
+ * Send KEXINIT asap don't wait for server [Miklos Fazekas]
5
+ * Close channels in case server closed connection [Miklos Fazekas]
6
+
1
7
  === 3.1.1
2
8
 
3
9
  * added missing etc require
@@ -210,6 +210,9 @@ module Net; module SSH; module Connection
210
210
  readers, writers, = Net::SSH::Compat.io_select(r, w, nil, io_select_wait(wait))
211
211
 
212
212
  postprocess(readers, writers)
213
+ rescue
214
+ force_channel_cleanup_on_close if closed?
215
+ raise
213
216
  end
214
217
 
215
218
  # This is called internally as part of #process. It dispatches any
@@ -475,6 +478,9 @@ module Net; module SSH; module Connection
475
478
 
476
479
  send(MAP[packet.type], packet)
477
480
  end
481
+ rescue
482
+ force_channel_cleanup_on_close if closed?
483
+ raise
478
484
  end
479
485
 
480
486
  # Returns the next available channel id to be assigned, and increments
@@ -483,6 +489,16 @@ module Net; module SSH; module Connection
483
489
  @channel_id_counter += 1
484
490
  end
485
491
 
492
+ def force_channel_cleanup_on_close
493
+ channels.each do |id, channel|
494
+ channel.remote_closed!
495
+ channel.close
496
+
497
+ cleanup_channel(channel)
498
+ channel.do_close
499
+ end
500
+ end
501
+
486
502
  # Invoked when a global request is received. The registered global
487
503
  # request callback will be invoked, if one exists, and the necessary
488
504
  # reply returned.
@@ -25,8 +25,8 @@ module Net; module SSH; module Test
25
25
 
26
26
  @script = Script.new
27
27
 
28
- script.gets(:kexinit, 1, 2, 3, 4, "test", "ssh-rsa", "none", "none", "none", "none", "none", "none", "", "", false)
29
28
  script.sends(:kexinit)
29
+ script.gets(:kexinit, 1, 2, 3, 4, "test", "ssh-rsa", "none", "none", "none", "none", "none", "none", "", "", false)
30
30
  script.sends(:newkeys)
31
31
  script.gets(:newkeys)
32
32
  end
@@ -124,6 +124,12 @@ module Net; module SSH; module Transport
124
124
  prepare_preferred_algorithms!
125
125
  end
126
126
 
127
+ # Start the algorithm negotation
128
+ def start
129
+ raise ArgumentError, "Cannot call start if it's negoitation started or done" if @pending || @initialized
130
+ send_kexinit
131
+ end
132
+
127
133
  # Request a rekey operation. This will return immediately, and does not
128
134
  # actually perform the rekey operation. It does cause the session to change
129
135
  # state, however--until the key exchange finishes, no new packets will be
@@ -84,6 +84,7 @@ module Net; module SSH; module Transport
84
84
  @server_version = ServerVersion.new(socket, logger, options[:timeout])
85
85
 
86
86
  @algorithms = Algorithms.new(self, options)
87
+ @algorithms.start
87
88
  wait { algorithms.initialized? }
88
89
  rescue Errno::ETIMEDOUT
89
90
  raise Net::SSH::ConnectionTimeout
@@ -48,14 +48,14 @@ 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 = 1
51
+ MINOR = 2
52
52
 
53
53
  # The tiny component of this version of the Net::SSH library
54
- TINY = 1
54
+ TINY = 0
55
55
 
56
56
  # The prerelease component of this version of the Net::SSH library
57
57
  # nil allowed
58
- PRE = nil
58
+ PRE = "rc1"
59
59
 
60
60
  # The current version of the Net::SSH library as a Version instance
61
61
  CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
@@ -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.1.1 ruby lib
5
+ # stub: net-ssh 3.2.0.rc1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "net-ssh"
9
- s.version = "3.1.1"
9
+ s.version = "3.2.0.rc1"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
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-03-23"
15
+ s.date = "2016-05-27"
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 = [
@@ -191,7 +191,7 @@ Gem::Specification.new do |s|
191
191
  s.licenses = ["MIT"]
192
192
  s.required_ruby_version = Gem::Requirement.new(">= 2.0")
193
193
  s.rubyforge_project = "net-ssh"
194
- s.rubygems_version = "2.4.6"
194
+ s.rubygems_version = "2.4.3"
195
195
  s.signing_key = "/mnt/gem/net-ssh-private_key.pem"
196
196
  s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
197
197
 
@@ -15,6 +15,18 @@ require 'ostruct'
15
15
  $original_config_default_files = Net::SSH::Config.default_files.dup
16
16
  Net::SSH::Config.default_files.clear
17
17
 
18
+ def with_restored_default_files(&block)
19
+ act_default_files = Net::SSH::Config.default_files.dup
20
+ begin
21
+ Net::SSH::Config.default_files.clear
22
+ Net::SSH::Config.default_files.concat($_original_config_default_files) # rubocop:disable Style/GlobalVars
23
+ yield
24
+ ensure
25
+ Net::SSH::Config.default_files.clear
26
+ Net::SSH::Config.default_files.concat(act_default_files)
27
+ end
28
+ end
29
+
18
30
  def P(*args)
19
31
  Net::SSH::Packet.new(Net::SSH::Buffer.from(*args))
20
32
  end
@@ -71,6 +83,10 @@ class MockTransport < Net::SSH::Transport::Session
71
83
  end
72
84
  end
73
85
 
86
+ def closed?
87
+ false
88
+ end
89
+
74
90
  def poll_message
75
91
  @queue.shift
76
92
  end
@@ -182,6 +182,7 @@ module Connection
182
182
  end
183
183
 
184
184
  def test_global_request_handler_returning_other_value_should_raise_error
185
+ transport.expects(:closed?).at_least_once.returns(false)
185
186
  session.on_global_request("testing") { "bug" }
186
187
  transport.return(GLOBAL_REQUEST, :string, "testing", :bool, true)
187
188
  assert_raises(RuntimeError) { process_times(2) }
@@ -17,6 +17,7 @@
17
17
  require_relative './common'
18
18
  require 'net/ssh/buffer'
19
19
  require 'net/ssh'
20
+ require 'net/ssh/proxy/command'
20
21
  require 'timeout'
21
22
  require 'tempfile'
22
23
 
@@ -31,8 +32,8 @@ class TestForward < Test::Unit::TestCase
31
32
  'net_ssh_1'
32
33
  end
33
34
 
34
- def ssh_start_params
35
- [localhost ,user , {:keys => @key_id_rsa, :verbose => :debug}]
35
+ def ssh_start_params(options = {})
36
+ [localhost ,user , {:keys => @key_id_rsa}.merge(options)]
36
37
  end
37
38
 
38
39
  def setup_ssh_env(&block)
@@ -338,6 +339,110 @@ class TestForward < Test::Unit::TestCase
338
339
  end
339
340
  end
340
341
 
342
+ class TCPProxy
343
+ def initialize()
344
+ @sockets = []
345
+ end
346
+ attr_reader :sockets
347
+
348
+ def open(host, port, connection_options = nil)
349
+ socket = TCPSocket.new(host,port)
350
+ @sockets << socket
351
+ socket
352
+ end
353
+
354
+ def close_all
355
+ sockets.each do |socket|
356
+ socket.close
357
+ end
358
+ end
359
+ end
360
+
361
+ def test_transport_close_should_closes_channels_with_tcps
362
+ setup_ssh_env do
363
+ server = start_server do |client|
364
+ client.puts "Hello"
365
+ sleep(100)
366
+ client.puts "Hallo"
367
+ end
368
+ proxy = TCPProxy.new()
369
+ session = Net::SSH.start(*ssh_start_params(proxy: proxy))
370
+ remote_port = server.addr[1]
371
+ local_port = session.forward.local(0, localhost, remote_port)
372
+
373
+ # read on forwarded port
374
+ client_done = Queue.new
375
+ Thread.start do
376
+ begin
377
+ client = TCPSocket.new(localhost, local_port)
378
+ client.read(6)
379
+ proxy.close_all
380
+ client.read(7)
381
+ client.close
382
+ client_done << true
383
+ rescue
384
+ client_done << $!
385
+ end
386
+ end
387
+ Timeout.timeout(5) do
388
+ begin
389
+ session.loop(0.1) { true }
390
+ rescue EOFError, IOError
391
+ #puts "Error: #{$!} #{$!.backtrace.join("\n")}"
392
+ end
393
+ end
394
+ begin
395
+ Timeout.timeout(5) do
396
+ assert_equal true, client_done.pop
397
+ end
398
+ rescue
399
+ puts "Server error: #{server_error.class} #{server_error} bt:#{server_error.backtrace.join("\n")}"
400
+ raise
401
+ end
402
+ end
403
+ end
404
+
405
+ def todo_test_transport_close_should_closes_channels_with_proxy
406
+ setup_ssh_env do
407
+ server = start_server do |client|
408
+ client.puts "Hello"
409
+ sleep(100)
410
+ client.puts "Hallo"
411
+ end
412
+ proxy = Net::SSH::Proxy::Command.new("/bin/nc localhost 22")
413
+ session = Net::SSH.start(*ssh_start_params(proxy: proxy))
414
+ remote_port = server.addr[1]
415
+ local_port = session.forward.local(0, localhost, remote_port)
416
+
417
+ # read on forwarded port
418
+ client_done = Queue.new
419
+ Thread.start do
420
+ begin
421
+ client = TCPSocket.new(localhost, local_port)
422
+ client.read(6)
423
+ system("killall /bin/nc")
424
+ client.read(7)
425
+ client.close
426
+ client_done << true
427
+ rescue
428
+ client_done << $!
429
+ end
430
+ end
431
+ Timeout.timeout(5) do
432
+ begin
433
+ session.loop(0.1) { true }
434
+ rescue EOFError
435
+ begin
436
+ session.close
437
+ rescue
438
+ end
439
+ #puts "Error: #{$!} #{$!.backtrace.join("\n")}"
440
+ end
441
+ assert_equal true, client_done.pop
442
+ end
443
+ end
444
+ end
445
+
341
446
  def test_client_close_should_be_handled
342
447
  setup_ssh_env do
343
448
  message = "This is a small message!"*1000
@@ -309,7 +309,7 @@ module Transport
309
309
  end
310
310
 
311
311
  def algorithms
312
- @algorithms ||= stub("algorithms", :initialized? => true, :allow? => true)
312
+ @algorithms ||= stub("algorithms", :initialized? => true, :allow? => true, :start => true)
313
313
  end
314
314
 
315
315
  def session(options={})
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.1.1
4
+ version: 3.2.0.rc1
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-03-23 00:00:00.000000000 Z
34
+ date: 2016-05-27 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: test-unit
@@ -252,12 +252,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
252
  version: '2.0'
253
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - ">="
255
+ - - ">"
256
256
  - !ruby/object:Gem::Version
257
- version: '0'
257
+ version: 1.3.1
258
258
  requirements: []
259
259
  rubyforge_project: net-ssh
260
- rubygems_version: 2.4.6
260
+ rubygems_version: 2.4.3
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
metadata.gz.sig CHANGED
Binary file