include pastebin
This commit is contained in:
parent
13a0b53e3e
commit
83b37864ef
9 changed files with 188 additions and 14 deletions
|
|
@ -86,16 +86,20 @@ func handleChannel(newChannel ssh.NewChannel, conn *ssh.ServerConn, config *Conf
|
|||
exit = true
|
||||
case "exec":
|
||||
appstring := string(req.Payload[4:]) // skip the first four bytes, which are length of string
|
||||
appspaced := strings.SplitN(appstring, " ", 1)
|
||||
appspaced := strings.SplitN(appstring, " ", 2)
|
||||
if len(appspaced) == 0 {
|
||||
exit = true
|
||||
break
|
||||
}
|
||||
v, ok := config.SSHApps[appspaced]
|
||||
v, ok := config.SSHApps[appspaced[0]]
|
||||
if ok {
|
||||
v.HandleExec(appstring, conn, connection)
|
||||
err := v.HandleExec(appstring, conn, connection)
|
||||
if err != nil {
|
||||
fmt.Fprintln(connection.Stderr(), err)
|
||||
log.Printf("Got error while handling ssh session: %s", err)
|
||||
}
|
||||
} else {
|
||||
log.Printf("Can't find app %s", appname)
|
||||
log.Printf("Can't find app %s", appspaced[0])
|
||||
}
|
||||
exit = true
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue