mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
Fix single command ssh exec (#483)
This commit is contained in:
parent
d13f4b5948
commit
c726d20578
3 changed files with 29 additions and 4 deletions
|
|
@ -81,11 +81,18 @@ func (s *session) handleRequests(in <-chan *ssh.Request, channel ssh.Channel) {
|
|||
case "exec":
|
||||
var payload = struct{ Value string }{}
|
||||
cErr := ssh.Unmarshal(req.Payload, &payload)
|
||||
if cErr == nil {
|
||||
s.dispatchCommand(payload.Value, &stringWriter{channel})
|
||||
} else {
|
||||
//TODO: log it
|
||||
if cErr != nil {
|
||||
req.Reply(false, nil)
|
||||
return
|
||||
}
|
||||
|
||||
req.Reply(true, nil)
|
||||
s.dispatchCommand(payload.Value, &stringWriter{channel})
|
||||
|
||||
//TODO: Fix error handling and report the proper status back
|
||||
status := struct{ Status uint32 }{uint32(0)}
|
||||
//TODO: I think this is how we shut down a shell as well?
|
||||
channel.SendRequest("exit-status", false, ssh.Marshal(status))
|
||||
channel.Close()
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue