Browse Source

Merge pull request #3044 from xiang90/fix_auth_update_role

auth: do not allow update root role
Xiang Li 10 years ago
parent
commit
96c0c7a202
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 {