Browse Source

auth: do not allow update root role

Xiang Li 10 years ago
parent
commit
030d1bbf2d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      etcdserver/auth/auth.go

+ 3 - 0
etcdserver/auth/auth.go

@@ -338,6 +338,9 @@ func (s *Store) DeleteRole(name string) error {
 }
 
 func (s *Store) UpdateRole(role Role) (Role, error) {
+	if role.Role == RootRoleName {
+		return Role{}, authErr(http.StatusForbidden, "Cannot modify role %s: is root role.", role.Role)
+	}
 	old, err := s.GetRole(role.Role)
 	if err != nil {
 		if e, ok := err.(*etcderr.Error); ok {