Merge 4a6466cca5
into 7be5935c55
This commit is contained in:
commit
e45042deeb
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -47,18 +48,6 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
|
|||
for req := range in {
|
||||
payload := cleanCommand(string(req.Payload))
|
||||
switch req.Type {
|
||||
case "env":
|
||||
args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v")
|
||||
if len(args) != 2 {
|
||||
log.Warn("SSH: Invalid env arguments: '%#v'", args)
|
||||
continue
|
||||
}
|
||||
args[0] = strings.TrimLeft(args[0], "\x04")
|
||||
_, _, err := com.ExecCmdBytes("env", args[0]+"="+args[1])
|
||||
if err != nil {
|
||||
log.Error(3, "env: %v", err)
|
||||
return
|
||||
}
|
||||
case "exec":
|
||||
cmdName := strings.TrimLeft(payload, "'()")
|
||||
log.Trace("SSH: Payload: %v", cmdName)
|
||||
|
|
Loading…
Reference in New Issue
Block a user