net-ssh 2.9.2 → 2.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aac9757449c9d417f334f8a5c44b9b69105c4c9b
4
- data.tar.gz: eda8ba20fad936162084101482eb1f1c821b67a3
3
+ metadata.gz: e7f14fbfcfd32cc75f187e18b727926b727993ec
4
+ data.tar.gz: 5aba78f7570373c5cbb0b441b620ade113c356d5
5
5
  SHA512:
6
- metadata.gz: fc1b60e3b51388d6b66fc38b7d4aaba56ead796820c2374a0aad1b48de094c2fb382db4159425d404f66612d8e61f0a1436b16dd90873235fcacca9b64bf3da5
7
- data.tar.gz: f5dce76345e1774539a47d70c4f516e52164171d38da7569fd2f0489f34cc8599d0914115ad2108d89ca12cf667fa36a062a188508d3d136692075421d4e0307
6
+ metadata.gz: 0f9f618270c98f579a6cb999fab3b4d1d58c38e200db68931c911cd8055a3e8cc51d1a84246de80889a5dabb1c138af5607d955766143d9a512ea5f2f6b95fc5
7
+ data.tar.gz: 5628810355c03a737accd6fae7225287183397edcce63b14a090caec1f3722455f6c98b76d4b4d5b11f19515ebe0f6ef3a78b37b4ef4fcd2ce4c8a868c786574
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 2.9.4-rc1
2
+
3
+ * Bugfix: CHANNEL_CLOSE was sent before draining ouput buffer #280 [Christopher F. Auston]
4
+
5
+ [Note: 2.9.3 release changes went to 3.0, 2.9.4 is backport of fix form 3.0]
6
+
7
+ === 2.9.2
1
8
  === 2.9.2-rc3
2
9
 
3
10
  * Remove advertised algorithms that were not working (curve25519-sha256@libssh.org) [mfazekas]
@@ -126,7 +126,7 @@ module Net; module SSH; module Connection
126
126
  @pending_requests = []
127
127
  @on_open_failed = @on_data = @on_extended_data = @on_process = @on_close = @on_eof = nil
128
128
  @on_request = {}
129
- @closing = @eof = @sent_eof = false
129
+ @closing = @eof = @sent_eof = @local_closed = @remote_closed = false
130
130
  end
131
131
 
132
132
  # A shortcut for accessing properties of the channel (see #properties).
@@ -269,14 +269,28 @@ module Net; module SSH; module Connection
269
269
  connection.loop { active? }
270
270
  end
271
271
 
272
- # Returns true if the channel is currently closing, but not actually
273
- # closed. A channel is closing when, for instance, #close has been
274
- # invoked, but the server has not yet responded with a CHANNEL_CLOSE
275
- # packet of its own.
272
+ # True if close() has been called; NOTE: if the channel has data waiting to
273
+ # be sent then the channel will close after all the data is sent. See
274
+ # closed?() to determine if we have actually sent CHANNEL_CLOSE to server.
275
+ # This may be true for awhile before closed? returns true if we are still
276
+ # sending buffered output to server.
276
277
  def closing?
277
278
  @closing
278
279
  end
279
280
 
281
+ # True if we have sent CHANNEL_CLOSE to the remote server.
282
+ def local_closed?
283
+ @local_closed
284
+ end
285
+
286
+ def remote_closed?
287
+ @remote_closed
288
+ end
289
+
290
+ def remote_closed!
291
+ @remote_closed = true
292
+ end
293
+
280
294
  # Requests that the channel be closed. If the channel is already closing,
281
295
  # this does nothing, nor does it do anything if the channel has not yet
282
296
  # been confirmed open (see #do_open_confirmation). Otherwise, it sends a
@@ -285,7 +299,6 @@ module Net; module SSH; module Connection
285
299
  return if @closing
286
300
  if remote_id
287
301
  @closing = true
288
- connection.send_message(Buffer.from(:byte, CHANNEL_CLOSE, :long, remote_id))
289
302
  end
290
303
  end
291
304
 
@@ -311,10 +324,16 @@ module Net; module SSH; module Connection
311
324
  @on_process.call(self) if @on_process
312
325
  enqueue_pending_output
313
326
 
314
- if @eof and not @sent_eof and output.empty? and remote_id
327
+ if @eof and not @sent_eof and output.empty? and remote_id and not @local_closed
315
328
  connection.send_message(Buffer.from(:byte, CHANNEL_EOF, :long, remote_id))
316
329
  @sent_eof = true
317
330
  end
331
+
332
+ if @closing and not @local_closed and output.empty? and remote_id
333
+ connection.send_message(Buffer.from(:byte, CHANNEL_CLOSE, :long, remote_id))
334
+ @local_closed = true
335
+ connection.cleanup_channel(self)
336
+ end
318
337
  end
319
338
 
320
339
  # Registers a callback to be invoked when data packets are received by the
@@ -220,7 +220,7 @@ module Net; module SSH; module Connection
220
220
  def preprocess
221
221
  return false if block_given? && !yield(self)
222
222
  dispatch_incoming_packets
223
- channels.each { |id, channel| channel.process unless channel.closing? }
223
+ channels.each { |id, channel| channel.process unless channel.local_closed? }
224
224
  return false if block_given? && !yield(self)
225
225
  return true
226
226
  end
@@ -453,6 +453,14 @@ module Net; module SSH; module Connection
453
453
  old
454
454
  end
455
455
 
456
+ def cleanup_channel(channel)
457
+ if channel.local_closed? and channel.remote_closed?
458
+ info { "#{host} delete channel #{channel.local_id} which closed locally and remotely" }
459
+ channels.delete(channel.local_id)
460
+ end
461
+ end
462
+
463
+
456
464
  private
457
465
 
458
466
  # Read all pending packets from the connection and dispatch them as
@@ -581,9 +589,10 @@ module Net; module SSH; module Connection
581
589
  info { "channel_close: #{packet[:local_id]}" }
582
590
 
583
591
  channel = channels[packet[:local_id]]
592
+ channel.remote_closed!
584
593
  channel.close
585
594
 
586
- channels.delete(packet[:local_id])
595
+ cleanup_channel(channel)
587
596
  channel.do_close
588
597
  end
589
598
 
@@ -51,9 +51,9 @@ module Net; module SSH
51
51
  MINOR = 9
52
52
 
53
53
  # The tiny component of this version of the Net::SSH library
54
- TINY = 2
54
+ TINY = 4
55
55
 
56
- # The prerelease component of this version of the Net::SSH library
56
+ # The prerelease component of this version of the Net::SSH library
57
57
  # nil allowed
58
58
  PRE = nil
59
59
 
@@ -1,20 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDODCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBCMRAwDgYDVQQDDAduZXQt
3
3
  c3NoMRkwFwYKCZImiZPyLGQBGRYJc29sdXRpb3VzMRMwEQYKCZImiZPyLGQBGRYD
4
- Y29tMB4XDTE0MTIwMjE3MzkyMFoXDTE1MTIwMjE3MzkyMFowQjEQ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6
+ ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMYnhNtn0f6p
7
+ nTylB8mE8lMdoMLJC8KwpMWsvk73Pe2WVDsH/OSwwwz6oUGk1i70cJyDjIEBNpwT
8
+ 88GpVXJSumvqVsf9fCg3mWNeb5t0J+aeNm9MIvYVMTqj5tydoXQiwnILRDYHV9tZ
9
+ 1c3o59/VlahSTpZ7YEgzVufpAkvEGkbJiG849exiipK7MN/ZIkMOxYVnyRXk43Xc
10
+ 6GYlsHOfSgPwcXwW5g57DCwLQLWrjDsTka28dxDmO7B5Lv5EqzINxVxWsu43OgZG
11
+ 21Io/jIyf5PNpeKPKNGDuAQJ8mvdMYBJoDhtCwgsUYbl0BZzA7g4ytl51HtIeP+j
12
+ Qp/eAvs/RrECAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUBfKiwO2eM4NE
13
+ iRrVG793qEPLYyMwCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQCfZFdb
14
+ p4jzkfIzGDbiOxd0R8sdqJoC4nMLEgnQ7dLulawwA3IXe3sHAKgA5kmH3prsKc5H
15
+ zVmM5NlH2P1nRbegIkQTYiIod1hZQCNxdmVG/fprMqPq0ybpUOjjrP5pj0OtszE1
16
+ F2dQia1hOEstMR+n0nAtWII9HJAEyeZjVV0s2Cl7Pt85XJ3hxFcCKwzqsK5xRI7a
17
+ B3vwh3/JJYrFonIohQ//Lg9qTZASEkoKLlq1/hFeICoCGGIGLq45ZB7CzXLooCKi
18
+ s/ZUKye79ELwFYKJOhjW5g725OL3hy+llhEleytwKRwgXFQBPTC4f5UkdxZVVWGH
19
+ e2C9M1m/2odPZo8h
20
20
  -----END CERTIFICATE-----
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 2.9.2 ruby lib
5
+ # stub: net-ssh 2.9.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "net-ssh"
9
- s.version = "2.9.2"
9
+ s.version = "2.9.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") 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 = "2015-01-09"
15
+ s.date = "2016-01-30"
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 = [
@@ -181,7 +181,7 @@ Gem::Specification.new do |s|
181
181
  s.homepage = "https://github.com/net-ssh/net-ssh"
182
182
  s.licenses = ["MIT"]
183
183
  s.rubyforge_project = "net-ssh"
184
- s.rubygems_version = "2.2.2"
184
+ s.rubygems_version = "2.4.6"
185
185
  s.signing_key = "/mnt/gem/net-ssh-private_key.pem"
186
186
  s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
187
187
 
@@ -74,8 +74,11 @@ module Connection
74
74
  assert !channel.closing?
75
75
 
76
76
  connection.expect { |t,packet| assert_equal CHANNEL_CLOSE, packet.type }
77
+ connection.expects(:cleanup_channel).with(channel)
77
78
  channel.close
78
79
 
80
+ channel.process
81
+
79
82
  assert channel.closing?
80
83
  end
81
84
 
@@ -117,14 +117,14 @@ module Connection
117
117
  end
118
118
 
119
119
  def test_process_should_exit_after_processing_if_block_is_true_then_false
120
- session.channels[0] = stub("channel", :closing? => false)
120
+ session.channels[0] = stub("channel", :local_closed? => false)
121
121
  session.channels[0].expects(:process)
122
122
  IO.expects(:select).never
123
123
  process_times(2)
124
124
  end
125
125
 
126
126
  def test_process_should_not_process_channels_that_are_closing
127
- session.channels[0] = stub("channel", :closing? => true)
127
+ session.channels[0] = stub("channel", :local_closed? => true)
128
128
  session.channels[0].expects(:process).never
129
129
  IO.expects(:select).never
130
130
  process_times(2)
@@ -299,8 +299,17 @@ module Connection
299
299
  end
300
300
 
301
301
  def test_channel_close_packet_should_be_routed_to_corresponding_channel_and_channel_should_be_closed_and_removed
302
- channel_at(14).expects(:do_close).with()
303
- session.channels[14].expects(:close).with()
302
+ session.channels[14] = stub("channel") do
303
+ # this simulates the case where we closed the channel first, sent
304
+ # CHANNEL_CLOSE to server and are waiting for server's response.
305
+ expects(:local_closed?).returns(true)
306
+ expects(:do_close)
307
+ expects(:close).with()
308
+ expects(:remote_closed!).with()
309
+ expects(:remote_closed?).with().returns(true)
310
+ expects(:local_id).returns(14)
311
+ end
312
+
304
313
  transport.return(CHANNEL_CLOSE, :long, 14)
305
314
  process_times(2)
306
315
  assert session.channels.empty?
@@ -523,7 +532,7 @@ module Connection
523
532
  end
524
533
 
525
534
  def channel_at(local_id)
526
- session.channels[local_id] = stub("channel", :process => true, :closing? => false)
535
+ session.channels[local_id] = stub("channel", :process => true, :local_closed? => false)
527
536
  end
528
537
 
529
538
  def transport(options={})
data.tar.gz.sig CHANGED
Binary file
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: 2.9.2
4
+ version: 2.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -14,51 +14,51 @@ cert_chain:
14
14
  -----BEGIN CERTIFICATE-----
15
15
  MIIDODCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBCMRAwDgYDVQQDDAduZXQt
16
16
  c3NoMRkwFwYKCZImiZPyLGQBGRYJc29sdXRpb3VzMRMwEQYKCZImiZPyLGQBGRYD
17
- Y29tMB4XDTE0MTIwMjE3MzkyMFoXDTE1MTIwMjE3MzkyMFowQjEQMA4GA1UEAwwH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bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMYnhNtn0f6p
20
+ nTylB8mE8lMdoMLJC8KwpMWsvk73Pe2WVDsH/OSwwwz6oUGk1i70cJyDjIEBNpwT
21
+ 88GpVXJSumvqVsf9fCg3mWNeb5t0J+aeNm9MIvYVMTqj5tydoXQiwnILRDYHV9tZ
22
+ 1c3o59/VlahSTpZ7YEgzVufpAkvEGkbJiG849exiipK7MN/ZIkMOxYVnyRXk43Xc
23
+ 6GYlsHOfSgPwcXwW5g57DCwLQLWrjDsTka28dxDmO7B5Lv5EqzINxVxWsu43OgZG
24
+ 21Io/jIyf5PNpeKPKNGDuAQJ8mvdMYBJoDhtCwgsUYbl0BZzA7g4ytl51HtIeP+j
25
+ Qp/eAvs/RrECAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUBfKiwO2eM4NE
26
+ iRrVG793qEPLYyMwCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQCfZFdb
27
+ p4jzkfIzGDbiOxd0R8sdqJoC4nMLEgnQ7dLulawwA3IXe3sHAKgA5kmH3prsKc5H
28
+ zVmM5NlH2P1nRbegIkQTYiIod1hZQCNxdmVG/fprMqPq0ybpUOjjrP5pj0OtszE1
29
+ F2dQia1hOEstMR+n0nAtWII9HJAEyeZjVV0s2Cl7Pt85XJ3hxFcCKwzqsK5xRI7a
30
+ B3vwh3/JJYrFonIohQ//Lg9qTZASEkoKLlq1/hFeICoCGGIGLq45ZB7CzXLooCKi
31
+ s/ZUKye79ELwFYKJOhjW5g725OL3hy+llhEleytwKRwgXFQBPTC4f5UkdxZVVWGH
32
+ e2C9M1m/2odPZo8h
33
33
  -----END CERTIFICATE-----
34
- date: 2015-01-09 00:00:00.000000000 Z
34
+ date: 2016-01-30 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: test-unit
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: mocha
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  description: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It
@@ -71,7 +71,7 @@ extra_rdoc_files:
71
71
  - LICENSE.txt
72
72
  - README.rdoc
73
73
  files:
74
- - .travis.yml
74
+ - ".travis.yml"
75
75
  - CHANGES.txt
76
76
  - LICENSE.txt
77
77
  - Manifest
@@ -238,17 +238,17 @@ require_paths:
238
238
  - lib
239
239
  required_ruby_version: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - '>='
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - '>='
246
+ - - ">="
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project: net-ssh
251
- rubygems_version: 2.2.2
251
+ rubygems_version: 2.4.6
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
metadata.gz.sig CHANGED
Binary file