mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-08 19:38:51 +01:00
refuse to run with ssh -t or -tt, detect nil runPacket
This commit is contained in:
parent
935500f1f1
commit
fec7721e32
@ -243,6 +243,10 @@ func handleRemote() {
|
|||||||
sender.SendErrorPacket(fmt.Sprintf("invalid packet '%s' sent to mshell", pk.GetType()))
|
sender.SendErrorPacket(fmt.Sprintf("invalid packet '%s' sent to mshell", pk.GetType()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if runPacket == nil {
|
||||||
|
sender.SendErrorPacket(fmt.Sprintf("no run packet received"))
|
||||||
|
return
|
||||||
|
}
|
||||||
cmd, err := shexec.RunCommand(runPacket, sender)
|
cmd, err := shexec.RunCommand(runPacket, sender)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sender.SendErrorPacket(fmt.Sprintf("error running command: %v", err))
|
sender.SendErrorPacket(fmt.Sprintf("error running command: %v", err))
|
||||||
@ -311,6 +315,9 @@ func parseClientOpts() (*shexec.ClientOpts, error) {
|
|||||||
opts.SSHOptsTerm = true
|
opts.SSHOptsTerm = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if argStr == "-t" || argStr == "-tt" {
|
||||||
|
return nil, fmt.Errorf("mshell cannot run over ssh -t")
|
||||||
|
}
|
||||||
opts.SSHOpts = append(opts.SSHOpts, argStr)
|
opts.SSHOpts = append(opts.SSHOpts, argStr)
|
||||||
}
|
}
|
||||||
if !opts.SSHOptsTerm {
|
if !opts.SSHOptsTerm {
|
||||||
|
Loading…
Reference in New Issue
Block a user