Skip to content

Commit

Permalink
perf: 用户名为 null 则特殊处理
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc authored and BaiJiangJie committed Jun 14, 2023
1 parent 893e610 commit e6fdbc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/jms-sdk-go/model/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ func (a *BaseAccount) IsSSHKey() bool {
return a.SecretType.Value == "ssh_key"
}

// 如果是 null,表示这个账号是一个空用户名

func (a *BaseAccount) IsNull() bool {
return a.Username == "null"
}

type Account struct {
BaseAccount
SuFrom *BaseAccount `json:"su_from"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (s *Server) getRedisConn(localTunnelAddr *net.TCPAddr) (srvConn *srvconn.Re
}
username := s.account.Username
protocolSetting := platform.GetProtocol("redis")
if !protocolSetting.Setting.AuthUsername {
if s.account.IsNull() || !protocolSetting.Setting.AuthUsername {
username = ""
}
srvConn, err = srvconn.NewRedisConnection(
Expand Down

0 comments on commit e6fdbc2

Please sign in to comment.