Browse Source

ignore invalid env

pull/2168/head
Bruno 9 years ago
parent
commit
3383988078
  1. 17
      modules/ssh/ssh.go

17
modules/ssh/ssh.go

@ -52,14 +52,15 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
switch req.Type { switch req.Type {
case "env": case "env":
args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v") args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v")
if len(args) != 2 { if len(args) == 2 {
return args[0] = strings.TrimLeft(args[0], "\x04")
} _, _, err := com.ExecCmdBytes("env", args[0]+"="+args[1])
args[0] = strings.TrimLeft(args[0], "\x04") if err != nil {
_, _, err := com.ExecCmdBytes("env", args[0]+"="+args[1]) log.Error(3, "env: %v", err)
if err != nil { return
log.Error(3, "env: %v", err) }
return } else {
log.Warn("Invalid env arguments: '%#v'", args)
} }
case "exec": case "exec":
cmdName := strings.TrimLeft(payload, "'()") cmdName := strings.TrimLeft(payload, "'()")

Loading…
Cancel
Save