Browse Source

auth: reject empty user name when checking op permissions

Passing AuthInfo{} to permission checking was causing an infinite loop
because it would always return an old revision error.

Fixes #7124
Anthony Romano 9 years ago
parent
commit
c39a59c0be
1 changed files with 5 additions and 0 deletions
  1. 5 0
      auth/store.go

+ 5 - 0
auth/store.go

@@ -706,6 +706,11 @@ func (as *authStore) isOpPermitted(userName string, revision uint64, key, rangeE
 		return nil
 		return nil
 	}
 	}
 
 
+	// only gets rev == 0 when passed AuthInfo{}; no user given
+	if revision == 0 {
+		return ErrUserEmpty
+	}
+
 	if revision < as.revision {
 	if revision < as.revision {
 		return ErrAuthOldRevision
 		return ErrAuthOldRevision
 	}
 	}