Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: disable wantReply in some requests to comply with OpenSSH #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ssh/agent/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ import (
// ForwardToAgent or ForwardToRemote should be called to route
// the authentication requests.
func RequestAgentForwarding(session *ssh.Session) error {
ok, err := session.SendRequest("[email protected]", true, nil)
if err != nil {
return err
}
if !ok {
return errors.New("forwarding request denied")
}
return nil
_, err := session.SendRequest("[email protected]", false, nil)
return err
}

// ForwardToAgent routes authentication requests to the given keyring.
Expand Down
5 changes: 1 addition & 4 deletions ssh/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ func (s *Session) Setenv(name, value string) error {
Name: name,
Value: value,
}
ok, err := s.ch.SendRequest("env", true, Marshal(&msg))
if err == nil && !ok {
err = errors.New("ssh: setenv failed")
}
_, err := s.ch.SendRequest("env", false, Marshal(&msg))
return err
}

Expand Down
5 changes: 1 addition & 4 deletions ssh/streamlocal.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ func (l *unixListener) Close() error {
m := streamLocalChannelForwardMsg{
l.socketPath,
}
ok, _, err := l.conn.SendRequest("[email protected]", true, Marshal(&m))
if err == nil && !ok {
err = errors.New("ssh: [email protected] failed")
}
_, _, err := l.conn.SendRequest("[email protected]", false, Marshal(&m))
return err
}

Expand Down
5 changes: 1 addition & 4 deletions ssh/tcpip.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,7 @@ func (l *tcpListener) Close() error {

// this also closes the listener.
l.conn.forwards.remove(l.laddr)
ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m))
if err == nil && !ok {
err = errors.New("ssh: cancel-tcpip-forward failed")
}
_, _, err := l.conn.SendRequest("cancel-tcpip-forward", false, Marshal(&m))
return err
}

Expand Down