]> source.dussan.org Git - gitea.git/commitdiff
internal/ssh: ignore env command totally (#6825)
authorAntoine GIRARD <sapk@users.noreply.github.com>
Thu, 9 May 2019 22:41:43 +0000 (00:41 +0200)
committertechknowlogick <techknowlogick@gitea.io>
Thu, 9 May 2019 22:41:43 +0000 (18:41 -0400)
* ssh: ignore env command totally

* Remove commented code

Needed fix described in issue #6889

modules/ssh/ssh.go

index f42c576cdb7a607f32211621b3aba27a2394a671..98ff50bfeca9ad9bc797c83022012f9eb99865d9 100644 (file)
@@ -52,18 +52,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("env: %v", err)
-                                               return
-                                       }
                                case "exec":
                                        cmdName := strings.TrimLeft(payload, "'()")
                                        log.Trace("SSH: Payload: %v", cmdName)