net-ssh 3.2.0.rc1 → 3.2.0.rc2

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: 1477e274c366e8b51cf9112399b5c6b7854df2bd
4
- data.tar.gz: 7e5884773d502b4dcde4013810e4be0369a77e9e
3
+ metadata.gz: 4bc08b5859ba2b8174bc55389dd24b304f4f1404
4
+ data.tar.gz: d620847f2da3225dccb38c971ef076a5fb437c56
5
5
  SHA512:
6
- metadata.gz: 9f28aa655c03f370327c4a016652f8c48b535b6a7649d401763e28183e7718620eee881dfb4e0f40f1cda6d57954cd31ecd741be281bb2aa066fd8debd2d6637
7
- data.tar.gz: 1b46532ef715789b9a81e2128a11cebcf332b7c413514b0ae3657b4ecafe2f519b90a10f20837ac217e60f7d3344b8b995df46de83e47c44fbdb8fa677ee43bc
6
+ metadata.gz: 2ca9e04291a887bc9fe4b303c0c8bb2fab017157ba96e2996aacfc5f724c9e53c01dec38de0a612e6351141c788f3b5fe4b15723e3893f395b0c122de9f03c14
7
+ data.tar.gz: 93b1c9d9f68860bbebb0bc213662848b768d442a4718ca9d3190473912dd48655457195ac6d44d6d9084a156befe567773a8ed48d6b8e909ebc3dbd17517cce6
@@ -1,2 +1,2 @@
1
- ?O���.-2~��}h��T�(����E1�JZ3���`�۷4RR�[k����G>,}ro
2
- ;�|(��j���ã�:,nF����˶znXKx8^)1���Ȏoq�ۃ�,�?��5���乨� '��٬�7�4������v)�h�C�����ܰ\�%�!���1����7|�J�dmbˠ��~S ̠�ˍV�-�Z�\]<�~��ܦ���J�4h�� ��f��������s �?lEfT��
1
+ 8F�j�L�4G��_ط��bk��ֲM��_�ȝ�[�����T��#xh;�<-(��W�Ҳ��˙�.�Sٹ��?�j��)t�U�*X-\30cIg��-i
2
+ �}MN��BQl%��4}CM�% ՞��gCD ��p3�N(�^����V��_����zCtXe.��X��W����iSc��Ql3���7����Xҕ]�E���I$��!��a.޹(2F\��c]`����N~��=�T��col��b_
data.tar.gz.sig CHANGED
Binary file
@@ -70,7 +70,7 @@ module Net
70
70
  :known_hosts, :global_known_hosts_file, :user_known_hosts_file, :host_key_alias,
71
71
  :host_name, :user, :properties, :passphrase, :keys_only, :max_pkt_size,
72
72
  :max_win_size, :send_env, :use_agent, :number_of_password_prompts,
73
- :append_supported_algorithms, :non_interactive
73
+ :append_supported_algorithms, :non_interactive, :agent_socket_factory
74
74
  ]
75
75
 
76
76
  # The standard means of starting a new SSH connection. When used with a
@@ -192,6 +192,9 @@ module Net
192
192
  # password auth method
193
193
  # * :non_interactive => non interactive applications should set it to true
194
194
  # to prefer failing a password/etc auth methods vs asking for password
195
+ # * :agent_socket_factory => enables the user to pass a lambda/block that will serve as the socket factory
196
+ # Net::SSH::start(user,host,agent_socket_factory: ->{ UNIXSocket.open('/foo/bar') })
197
+ # example: ->{ UNIXSocket.open('/foo/bar')}
195
198
  #
196
199
  # If +user+ parameter is nil it defaults to USER from ssh_config, or
197
200
  # local username
@@ -19,7 +19,7 @@ module Net; module SSH; module Authentication
19
19
 
20
20
  # Instantiates a new agent object, connects to a running SSH agent,
21
21
  # negotiates the agent protocol version, and returns the agent object.
22
- def self.connect(logger=nil)
22
+ def self.connect(logger=nil, agent_socket_factory)
23
23
  agent = new(logger)
24
24
  agent.connect!
25
25
  agent
@@ -42,9 +42,9 @@ module Net; module SSH; module Authentication
42
42
 
43
43
  # Instantiates a new agent object, connects to a running SSH agent,
44
44
  # negotiates the agent protocol version, and returns the agent object.
45
- def self.connect(logger=nil)
45
+ def self.connect(logger=nil, agent_socket_factory = nil)
46
46
  agent = new(logger)
47
- agent.connect!
47
+ agent.connect!(agent_socket_factory)
48
48
  agent.negotiate!
49
49
  agent
50
50
  end
@@ -59,10 +59,10 @@ module Net; module SSH; module Authentication
59
59
  # given by the attribute writers. If the agent on the other end of the
60
60
  # socket reports that it is an SSH2-compatible agent, this will fail
61
61
  # (it only supports the ssh-agent distributed by OpenSSH).
62
- def connect!
62
+ def connect!(agent_socket_factory = nil)
63
63
  begin
64
64
  debug { "connecting to ssh-agent" }
65
- @socket = agent_socket_factory.open(ENV['SSH_AUTH_SOCK'])
65
+ @socket = agent_socket_factory.nil? ? socket_class.open(ENV['SSH_AUTH_SOCK']) : agent_socket_factory.call
66
66
  rescue
67
67
  error { "could not connect to ssh-agent" }
68
68
  raise AgentNotAvailable, $!.message
@@ -132,7 +132,7 @@ module Net; module SSH; module Authentication
132
132
  private
133
133
 
134
134
  # Returns the agent socket factory to use.
135
- def agent_socket_factory
135
+ def socket_class
136
136
  if Net::SSH::Authentication::PLATFORM == :win32
137
137
  Pageant::Socket
138
138
  else
@@ -176,7 +176,7 @@ module Net
176
176
  # or if the agent is otherwise not available.
177
177
  def agent
178
178
  return unless use_agent?
179
- @agent ||= Agent.connect(logger)
179
+ @agent ||= Agent.connect(logger, options[:agent_socket_factory])
180
180
  rescue AgentNotAvailable
181
181
  @use_agent = false
182
182
  nil
@@ -357,7 +357,7 @@ module Net; module SSH; module Service
357
357
  channel[:invisible] = true
358
358
 
359
359
  begin
360
- agent = Authentication::Agent.connect(logger)
360
+ agent = Authentication::Agent.connect(logger, session.options[:agent_socket_factory])
361
361
  if (agent.socket.is_a? ::IO)
362
362
  prepare_client(agent.socket, channel, :agent)
363
363
  else
@@ -55,7 +55,7 @@ module Net; module SSH
55
55
 
56
56
  # The prerelease component of this version of the Net::SSH library
57
57
  # nil allowed
58
- PRE = "rc1"
58
+ PRE = "rc2"
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.2.0.rc1 ruby lib
5
+ # stub: net-ssh 3.2.0.rc2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "net-ssh"
9
- s.version = "3.2.0.rc1"
9
+ s.version = "3.2.0.rc2"
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-05-27"
15
+ s.date = "2016-05-29"
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 = [
@@ -32,6 +32,11 @@ module Authentication
32
32
  agent(false).connect!
33
33
  end
34
34
 
35
+ def test_connect_should_use_agent_socket_factory_instead_of_factory
36
+ assert_equal agent.connect!, socket
37
+ assert_equal agent.connect!(agent_socket_factory), "/foo/bar.sock"
38
+ end
39
+
35
40
  def test_connect_should_raise_error_if_connection_could_not_be_established
36
41
  factory.expects(:open).raises(SocketError)
37
42
  assert_raises(Net::SSH::Authentication::AgentNotAvailable) { agent(false).connect! }
@@ -213,12 +218,15 @@ module Authentication
213
218
  def agent(auto=:connect)
214
219
  @agent ||= begin
215
220
  agent = Net::SSH::Authentication::Agent.new
216
- agent.stubs(:agent_socket_factory).returns(factory)
221
+ agent.stubs(:socket_class).returns(factory)
217
222
  agent.connect! if auto == :connect
218
223
  agent
219
224
  end
220
225
  end
221
226
 
227
+ def agent_socket_factory
228
+ @agent_socket_factory ||= ->{"/foo/bar.sock"}
229
+ end
222
230
  end
223
231
 
224
232
  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.2.0.rc1
4
+ version: 3.2.0.rc2
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-05-27 00:00:00.000000000 Z
34
+ date: 2016-05-29 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: test-unit
metadata.gz.sig CHANGED
Binary file