Skip to content

Commit

Permalink
etcdserver, auth: not cache a flag of auth status
Browse files Browse the repository at this point in the history
This commit removes a flag that indicates auth is enabled or disabled
because it doesn't have an invalidation mechanism.

Fixes etcd-io#3601 and etcd-io#3964
  • Loading branch information
mitake committed Jan 26, 2016
1 parent b1a45fe commit 753b136
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
5 changes: 0 additions & 5 deletions etcdserver/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ type store struct {
ensuredOnce bool

mu sync.Mutex // protect enabled
enabled *bool

PasswordStore
}
Expand Down Expand Up @@ -440,8 +439,6 @@ func (s *store) EnableAuth() error {
return err
}

b := true
s.enabled = &b
plog.Noticef("auth: enabled auth")
return nil
}
Expand All @@ -456,8 +453,6 @@ func (s *store) DisableAuth() error {

err := s.disableAuth()
if err == nil {
b := false
s.enabled = &b
plog.Noticef("auth: disabled auth")
} else {
plog.Errorf("error disabling auth (%v)", err)
Expand Down
6 changes: 0 additions & 6 deletions etcdserver/auth/auth_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,10 @@ func (s *store) detectAuth() bool {
if s.server == nil {
return false
}
if s.enabled != nil {
return *s.enabled
}
value, err := s.requestResource("/enabled", false)
if err != nil {
if e, ok := err.(*etcderr.Error); ok {
if e.ErrorCode == etcderr.EcodeKeyNotFound {
b := false
s.enabled = &b
return false
}
}
Expand All @@ -107,7 +102,6 @@ func (s *store) detectAuth() bool {
plog.Errorf("internal bookkeeping value for enabled isn't valid JSON (%v)", err)
return false
}
s.enabled = &u
return u
}

Expand Down

0 comments on commit 753b136

Please sign in to comment.