-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
etcd/auth: fix range handling bugs. #6404
Conversation
3a9c2c7
to
fd1d20e
Compare
func isSubset(a, b *rangePerm) bool { | ||
switch { | ||
case len(a.end) == 0 && len(b.end) == 0: | ||
// a, b are both keys | ||
return bytes.Equal(a.begin, b.begin) | ||
case len(b.end) == 0: | ||
// b is a key, a is a range | ||
// b is a key, a is a range (even a prefix range has infinite membership) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the part (even a prefix range has infinite membership)
is outdated?
Thanks a lot! I commented on two points which would need to be fixed. |
Also, please update the commit log title to |
Test 15, counting from zero, in TestGetMergedPerms in etcd/auth/range_perm_cache_test.go, was trying incorrectly assert that [a, b) merged with [b, "") should be [a, b). Added a test specifically for this. This patch fixes the incorrect larger test and the bugs in the code that it was hiding. Fixes etcd-io#6359
fd1d20e
to
ef1ef0b
Compare
all requested updates done. |
lgtm |
@glycerine Thanks a lot! |
@glycerine thanks! |
As discussed in #6359, I found some range handling
bugs and fixed them while looking at how to add
prefix based auth. I had a few minutes and put
together this cherry picked pr that contains only
the bug fixes, and no prefix expansion.
Test 15, counting from zero, in TestGetMergedPerms
in etcd/auth/range_perm_cache_test.go, was trying
incorrectly assert that [a, b) merged with [b, "")
should be [a, b). Added a test specifically for
this. This patch also fixes the incorrect larger test
and the bugs in the code that it was hiding.
Fixes #6359