diff --git a/etcdserver/auth/auth.go b/etcdserver/auth/auth.go index 6730aa6bd..e3ddd6593 100644 --- a/etcdserver/auth/auth.go +++ b/etcdserver/auth/auth.go @@ -95,8 +95,7 @@ type store struct { timeout time.Duration ensuredOnce bool - mu sync.Mutex // protect enabled - enabled *bool + mu sync.Mutex } type User struct { @@ -409,8 +408,6 @@ func (s *store) EnableAuth() error { } err = s.enableAuth() if err == nil { - b := true - s.enabled = &b plog.Noticef("auth: enabled auth") } else { plog.Errorf("error enabling auth (%v)", err) @@ -428,8 +425,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) diff --git a/etcdserver/auth/auth_requests.go b/etcdserver/auth/auth_requests.go index d621ed0ef..7103578c4 100644 --- a/etcdserver/auth/auth_requests.go +++ b/etcdserver/auth/auth_requests.go @@ -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 } } @@ -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 } diff --git a/etcdserver/auth/auth_test.go b/etcdserver/auth/auth_test.go index 1f4615af4..d9813c969 100644 --- a/etcdserver/auth/auth_test.go +++ b/etcdserver/auth/auth_test.go @@ -611,8 +611,6 @@ func TestDisableAuth(t *testing.T) { t.Error("Expected error; already disabled") } - // clear cache - s.enabled = nil err = s.DisableAuth() if err != nil { t.Error("Unexpected error", err)