mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: fix panic when getting header of raft request
This commit is contained in:
parent
9c78cda088
commit
adff458895
@ -30,7 +30,12 @@ func newAuthApplierV3(as auth.AuthStore, base applierV3) *authApplierV3 {
|
||||
}
|
||||
|
||||
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) {
|
||||
return &applyResult{err: auth.ErrPermissionDenied}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user