Commit d38f78cf authored by Eric's avatar Eric Committed by Eric_Lee

fix bugs: telnet auto connect error

parent bd4faf1c
...@@ -83,6 +83,7 @@ func (p *Parser) ParseStream() { ...@@ -83,6 +83,7 @@ func (p *Parser) ParseStream() {
defer func() { defer func() {
close(p.userOutputChan) close(p.userOutputChan)
close(p.srvOutputChan) close(p.srvOutputChan)
close(p.cmdRecordChan)
logger.Debug("Parser parse stream routine done") logger.Debug("Parser parse stream routine done")
}() }()
for { for {
...@@ -140,7 +141,6 @@ func (p *Parser) parseCmdInput() { ...@@ -140,7 +141,6 @@ func (p *Parser) parseCmdInput() {
data := p.cmdBuf.Bytes() data := p.cmdBuf.Bytes()
p.command = p.cmdInputParser.Parse(data) p.command = p.cmdInputParser.Parse(data)
p.cmdBuf.Reset() p.cmdBuf.Reset()
//p.inputBuf.Reset()
} }
// parseCmdOutput 解析命令输出 // parseCmdOutput 解析命令输出
...@@ -262,5 +262,4 @@ func (p *Parser) Close() { ...@@ -262,5 +262,4 @@ func (p *Parser) Close() {
} }
close(p.userInputChan) close(p.userInputChan)
close(p.srvInputChan) close(p.srvInputChan)
close(p.cmdRecordChan)
} }
...@@ -12,6 +12,7 @@ import ( ...@@ -12,6 +12,7 @@ import (
"github.com/jumpserver/koko/pkg/logger" "github.com/jumpserver/koko/pkg/logger"
"github.com/jumpserver/koko/pkg/model" "github.com/jumpserver/koko/pkg/model"
"github.com/jumpserver/koko/pkg/service"
) )
const ( const (
...@@ -167,6 +168,13 @@ func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error) { ...@@ -167,6 +168,13 @@ func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error) {
if err != nil { if err != nil {
return return
} }
if tc.SystemUser.Password == ""{
info := service.GetSystemUserAssetAuthInfo(tc.SystemUser.ID, asset.ID)
tc.SystemUser.Password = info.Password
tc.SystemUser.PrivateKey = info.PrivateKey
}
buf := make([]byte, 1024) buf := make([]byte, 1024)
tc.conn = conn tc.conn = conn
var nr int var nr int
......
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