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

Merge pull request #114 from jumpserver/bugfix

[Bugfix] manual input systemuser err
parents 2411936c 8384899f
......@@ -129,14 +129,6 @@ func (p *ProxyServer) getTelnetConn() (srvConn *srvconn.ServerTelnetConnection,
// getServerConn 获取获取server连接
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{})
defer func() {
utils.IgnoreErrWriteString(p.UserConn, "\r\n")
......@@ -188,9 +180,26 @@ func (p *ProxyServer) preCheckRequisite() (ok bool) {
utils.IgnoreErrWriteString(p.UserConn, msg)
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
}
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 发送连接错误消息
func (p *ProxyServer) sendConnectErrorMsg(err error) {
msg := fmt.Sprintf("Connect asset %s error: %s\r\n", p.Asset.Hostname, err)
......@@ -215,7 +224,7 @@ func (p *ProxyServer) Proxy() {
// 创建Session
sw, err := CreateSession(p)
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
}
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