|
@@ -23,7 +23,6 @@ import (
|
|
|
"reflect"
|
|
"reflect"
|
|
|
"sort"
|
|
"sort"
|
|
|
"strings"
|
|
"strings"
|
|
|
- "sync"
|
|
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
|
|
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
|
|
@@ -102,8 +101,6 @@ type store struct {
|
|
|
timeout time.Duration
|
|
timeout time.Duration
|
|
|
ensuredOnce bool
|
|
ensuredOnce bool
|
|
|
|
|
|
|
|
- mu sync.Mutex // protect enabled
|
|
|
|
|
-
|
|
|
|
|
PasswordStore
|
|
PasswordStore
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -409,9 +406,6 @@ func (s *store) UpdateRole(role Role) (Role, error) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (s *store) AuthEnabled() bool {
|
|
func (s *store) AuthEnabled() bool {
|
|
|
- s.mu.Lock()
|
|
|
|
|
- defer s.mu.Unlock()
|
|
|
|
|
-
|
|
|
|
|
return s.detectAuth()
|
|
return s.detectAuth()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -420,9 +414,6 @@ func (s *store) EnableAuth() error {
|
|
|
return authErr(http.StatusConflict, "already enabled")
|
|
return authErr(http.StatusConflict, "already enabled")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s.mu.Lock()
|
|
|
|
|
- defer s.mu.Unlock()
|
|
|
|
|
-
|
|
|
|
|
if _, err := s.GetUser("root"); err != nil {
|
|
if _, err := s.GetUser("root"); err != nil {
|
|
|
return authErr(http.StatusConflict, "No root user available, please create one")
|
|
return authErr(http.StatusConflict, "No root user available, please create one")
|
|
|
}
|
|
}
|
|
@@ -448,9 +439,6 @@ func (s *store) DisableAuth() error {
|
|
|
return authErr(http.StatusConflict, "already disabled")
|
|
return authErr(http.StatusConflict, "already disabled")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s.mu.Lock()
|
|
|
|
|
- defer s.mu.Unlock()
|
|
|
|
|
-
|
|
|
|
|
err := s.disableAuth()
|
|
err := s.disableAuth()
|
|
|
if err == nil {
|
|
if err == nil {
|
|
|
plog.Noticef("auth: disabled auth")
|
|
plog.Noticef("auth: disabled auth")
|