mirror of https://github.com/go-gitea/gitea.git
#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.
This commit is contained in:
parent
c79774e8d4
commit
9e09e48502
|
@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
|||
|
||||
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
|
||||
|
||||
##### Current version: 0.9.12
|
||||
##### Current version: 0.9.13
|
||||
|
||||
| Web | UI | Preview |
|
||||
|:-------------:|:-------:|:-------:|
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -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())
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.9.12.0316
|
||||
0.9.13.0318
|
Loading…
Reference in New Issue