diff options
author | Unknwon <u@gogs.io> | 2016-03-18 06:13:16 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-18 06:13:16 -0400 |
commit | 9e09e4850283b2b521f6087418d5d165bcc7cf8f (patch) | |
tree | de37a9598d3ab094127089c56ce4895dd8fb01b5 | |
parent | c79774e8d48faed4a04be80eb0ede3fbc4276d4a (diff) |
#2850 fix potential SSH commands dislocation
When use builtin SSH server with concurrent operations, there are probabilities
One connection could use the command from another connections.
Fix this by set SSH_ORIGINAL_COMMAND for each command, not set in global scope.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | modules/ssh/ssh.go | 2 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
4 files changed, 4 insertions, 4 deletions
@@ -3,7 +3,7 @@ Gogs - Go Git Service [ -##### Current version: 0.9.12 +##### Current version: 0.9.13 | Web | UI | Preview | |:-------------:|:-------:|:-------:| @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.12.0316" +const APP_VER = "0.9.13.0318" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 18313d1e..ceecc9bb 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -62,12 +62,12 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) { } case "exec": cmdName := strings.TrimLeft(payload, "'()") - os.Setenv("SSH_ORIGINAL_COMMAND", cmdName) log.Trace("SSH: Payload: %v", cmdName) args := []string{"serv", "key-" + keyID, "--config=" + setting.CustomConf} log.Trace("SSH: Arguments: %v", args) cmd := exec.Command(setting.AppPath, args...) + cmd.Env = append(os.Environ(), "SSH_ORIGINAL_COMMAND="+cmdName) stdout, err := cmd.StdoutPipe() if err != nil { diff --git a/templates/.VERSION b/templates/.VERSION index 9ae71dfa..8655bc2f 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.12.0316
\ No newline at end of file +0.9.13.0318
\ No newline at end of file |