Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
fleetctl: fixed incorrect "[email protected]" behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Mar 10, 2016
1 parent bbb59d8 commit 8a62ab6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ import (
type SSHForwardingClient struct {
agentForwarding bool
*gossh.Client
agentForwardingEnabled bool
}

func (s *SSHForwardingClient) ForwardAgentAuthentication(session *gossh.Session) error {
if s.agentForwarding {
if s.agentForwarding && !s.agentForwardingEnabled {
// We are allowed to send "[email protected]" request only once per channel
// otherwise ssh daemon replies with the "SSH2_MSG_CHANNEL_FAILURE 100"
s.agentForwardingEnabled = true
return gosshagent.RequestAgentForwarding(session)
}
return nil
Expand All @@ -50,7 +54,7 @@ func newSSHForwardingClient(client *gossh.Client, agentForwarding bool) (*SSHFor
return nil, err
}

return &SSHForwardingClient{agentForwarding, client}, nil
return &SSHForwardingClient{agentForwarding, client, false}, nil
}

// makeSession initializes a gossh.Session connected to the invoking process's stdout/stderr/stdout.
Expand Down

0 comments on commit 8a62ab6

Please sign in to comment.