Unverified Commit b185b1a2 authored by Eric_Lee's avatar Eric_Lee Committed by GitHub

Merge pull request #138 from jumpserver/dev

Dev
parents 01a3d7d1 f5b2211a
...@@ -55,8 +55,8 @@ type Parser struct { ...@@ -55,8 +55,8 @@ type Parser struct {
command string command string
output string output string
cmdInputParser CmdParser cmdInputParser *CmdParser
cmdOutputParser CmdParser cmdOutputParser *CmdParser
cmdFilterRules []model.SystemUserFilterRule cmdFilterRules []model.SystemUserFilterRule
closed chan struct{} closed chan struct{}
......
...@@ -12,10 +12,10 @@ import ( ...@@ -12,10 +12,10 @@ import (
var ps1Pattern = regexp.MustCompile(`^\[?.*@.*\]?[\\$#]\s|mysql>\s`) var ps1Pattern = regexp.MustCompile(`^\[?.*@.*\]?[\\$#]\s|mysql>\s`)
func NewCmdParser(sid, name string) CmdParser { func NewCmdParser(sid, name string) *CmdParser {
parser := CmdParser{id: sid, name:name} parser := CmdParser{id: sid, name:name}
parser.initial() parser.initial()
return parser return &parser
} }
type CmdParser struct { type CmdParser struct {
......
...@@ -196,12 +196,14 @@ func (sc *SSHClientConfig) Dial() (client *gossh.Client, err error) { ...@@ -196,12 +196,14 @@ func (sc *SSHClientConfig) Dial() (client *gossh.Client, err error) {
} }
proxySock, err := proxyClient.Dial("tcp", net.JoinHostPort(sc.Host, sc.Port)) proxySock, err := proxyClient.Dial("tcp", net.JoinHostPort(sc.Host, sc.Port))
if err != nil { if err != nil {
err = errors.New("connect proxy host error 2: " + err.Error()) err = errors.New(fmt.Sprintf("tcp connect host %s:%s error 2: %s", sc.Host, sc.Port, err.Error()))
logger.Error("Connect proxy host error 2: ", err.Error()) logger.Errorf("Tcp connect host %s:%s error 2: %s", sc.Host, sc.Port, err.Error())
return client, err return client, err
} }
proxyConn, chans, reqs, err := gossh.NewClientConn(proxySock, net.JoinHostPort(sc.Host, sc.Port), cfg) proxyConn, chans, reqs, err := gossh.NewClientConn(proxySock, net.JoinHostPort(sc.Host, sc.Port), cfg)
if err != nil { if err != nil {
err = errors.New(fmt.Sprintf("ssh connect host %s:%s error 3: %s", sc.Host, sc.Port, err.Error()))
logger.Errorf("SSH Connect host %s:%s error 3: %s", sc.Host, sc.Port, err.Error())
return client, err return client, err
} }
sc.proxyConn = proxyConn sc.proxyConn = proxyConn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment