未验证 提交 c24c3017 编写于 作者: S SimFG 提交者: GitHub

Fix superusers' password verification problem (#23729)

Signed-off-by: NSimFG <bang.fu@zilliz.com>
上级 05d317fe
......@@ -4400,7 +4400,16 @@ func (node *Proxy) UpdateCredential(ctx context.Context, req *milvuspb.UpdateCre
}, nil
}
if !passwordVerify(ctx, req.Username, rawOldPassword, globalMetaCache) {
skipPasswordVerify := false
if currentUser, _ := GetCurUserFromContext(ctx); currentUser != "" {
for _, s := range Params.CommonCfg.SuperUsers {
if s == currentUser {
skipPasswordVerify = true
}
}
}
if !skipPasswordVerify && !passwordVerify(ctx, req.Username, rawOldPassword, globalMetaCache) {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UpdateCredentialFailure,
Reason: "old password is not correct:" + req.Username,
......
......@@ -758,14 +758,6 @@ func passwordVerify(ctx context.Context, username, rawPwd string, globalMetaCach
return false
}
if currentUser, _ := GetCurUserFromContext(ctx); currentUser != "" {
for _, s := range Params.CommonCfg.SuperUsers {
if s == currentUser {
return true
}
}
}
// hit cache
sha256Pwd := crypto.SHA256(rawPwd, credInfo.Username)
if credInfo.Sha256Password != "" {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册