Method: Net::SSH::Authentication::Agent#negotiate!
- Defined in:
- lib/net/ssh/authentication/agent/socket.rb
#negotiate! ⇒ Object
Attempts to negotiate the SSH agent protocol version. Raises an error if the version could not be negotiated successfully.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/net/ssh/authentication/agent/socket.rb', line 74 def negotiate! # determine what type of agent we're communicating with type, body = send_and_wait(SSH2_AGENT_REQUEST_VERSION, :string, Transport::ServerVersion::PROTO_VERSION) if type == SSH2_AGENT_VERSION_RESPONSE raise AgentNotAvailable, "SSH2 agents are not yet supported" elsif type == SSH2_AGENT_FAILURE debug { "Unexpected response type==#{type}, this will be ignored" } elsif type != SSH_AGENT_RSA_IDENTITIES_ANSWER1 && type != SSH_AGENT_RSA_IDENTITIES_ANSWER2 raise AgentNotAvailable, "unknown response from agent: #{type}, #{body.to_s.inspect}" end end |