Commit 8384899f authored by Eric's avatar Eric

[Bugfix] manual input systemuser err

parent 2411936c
...@@ -129,14 +129,6 @@ func (p *ProxyServer) getTelnetConn() (srvConn *srvconn.ServerTelnetConnection, ...@@ -129,14 +129,6 @@ func (p *ProxyServer) getTelnetConn() (srvConn *srvconn.ServerTelnetConnection,
// getServerConn 获取获取server连接 // getServerConn 获取获取server连接
func (p *ProxyServer) getServerConn() (srvConn srvconn.ServerConnection, err error) { func (p *ProxyServer) getServerConn() (srvConn srvconn.ServerConnection, err error) {
err = p.getSystemUserUsernameIfNeed()
if err != nil {
return
}
err = p.getSystemUserAuthOrManualSet()
if err != nil {
return
}
done := make(chan struct{}) done := make(chan struct{})
defer func() { defer func() {
utils.IgnoreErrWriteString(p.UserConn, "\r\n") utils.IgnoreErrWriteString(p.UserConn, "\r\n")
...@@ -188,9 +180,26 @@ func (p *ProxyServer) preCheckRequisite() (ok bool) { ...@@ -188,9 +180,26 @@ func (p *ProxyServer) preCheckRequisite() (ok bool) {
utils.IgnoreErrWriteString(p.UserConn, msg) utils.IgnoreErrWriteString(p.UserConn, msg)
return return
} }
if err := p.checkRequiredSystemUserInfo(); err != nil {
msg := fmt.Sprintf("You get asset %s systemuser info err: %s", p.Asset.Hostname, err)
utils.IgnoreErrWriteString(p.UserConn, msg)
return
}
return true return true
} }
func (p *ProxyServer) checkRequiredSystemUserInfo() error {
if err := p.getSystemUserUsernameIfNeed(); err != nil {
logger.Errorf("Get asset %s systemuser username err: %s", p.Asset.Hostname, err)
return err
}
if err := p.getSystemUserAuthOrManualSet(); err != nil {
logger.Errorf("Get asset %s systemuser password/PrivateKey err: %s", p.Asset.Hostname, err)
return err
}
return nil
}
// sendConnectErrorMsg 发送连接错误消息 // sendConnectErrorMsg 发送连接错误消息
func (p *ProxyServer) sendConnectErrorMsg(err error) { func (p *ProxyServer) sendConnectErrorMsg(err error) {
msg := fmt.Sprintf("Connect asset %s error: %s\r\n", p.Asset.Hostname, err) msg := fmt.Sprintf("Connect asset %s error: %s\r\n", p.Asset.Hostname, err)
...@@ -215,7 +224,7 @@ func (p *ProxyServer) Proxy() { ...@@ -215,7 +224,7 @@ func (p *ProxyServer) Proxy() {
// 创建Session // 创建Session
sw, err := CreateSession(p) sw, err := CreateSession(p)
if err != nil { if err != nil {
logger.Errorf("Request %s: Create session failed: %s",p.UserConn.ID(), err.Error()) logger.Errorf("Request %s: Create session failed: %s", p.UserConn.ID(), err.Error())
return return
} }
defer RemoveSession(sw) defer RemoveSession(sw)
......
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