Skip to content

Commit

Permalink
fix bug: systemuser
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Jul 10, 2019
1 parent 4ba0600 commit 24dd3c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/srvconn/connmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ func GetClientFromCache(user *model.User, asset *model.Asset, systemUser *model.
if !ok {
return
}

if systemUser.Username == ""{
systemUser.Username = client.Username
}
var u = user.Username
var ip = asset.IP
clientsRefCounter[client]++
Expand Down
4 changes: 1 addition & 3 deletions pkg/srvconn/sshconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ func (sc *ServerSSHConnection) TryConnectFromCache(h, w int, term string) (err e
if sc.client == nil {
return errors.New("no client in cache")
}
if sc.SystemUser.Username == "" {
sc.SystemUser.Username = sc.client.Username
}

err = sc.invokeShell(h, w, term)
if err != nil {
RecycleClient(sc.client)
Expand Down

0 comments on commit 24dd3c4

Please sign in to comment.