mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #5696 from xiang90/fix_panic
etcdserver: fix panic when getting header of raft request
This commit is contained in:
commit
2d08e093c1
@ -30,7 +30,12 @@ func newAuthApplierV3(as auth.AuthStore, base applierV3) *authApplierV3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (aa *authApplierV3) Apply(r *pb.InternalRaftRequest) *applyResult {
|
func (aa *authApplierV3) Apply(r *pb.InternalRaftRequest) *applyResult {
|
||||||
user := r.Header.Username
|
var user string
|
||||||
|
if r.Header != nil {
|
||||||
|
// backward-compatible with pre-3.0 releases when internalRaftRequest
|
||||||
|
// does not have header field
|
||||||
|
user = r.Header.Username
|
||||||
|
}
|
||||||
if needAdminPermission(r) && !aa.as.IsAdminPermitted(user) {
|
if needAdminPermission(r) && !aa.as.IsAdminPermitted(user) {
|
||||||
return &applyResult{err: auth.ErrPermissionDenied}
|
return &applyResult{err: auth.ErrPermissionDenied}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user