Allowed passing in of password hash and fixed config rewrite

This commit is contained in:
Madelyn Olson authored and antirez committed 2019-09-30 17:57:49 +02:00
1 parent eb2114b9cd
commit ea7c3fe7fd
3 files changed
+65 -6

No files matched your search

+6
View File
@@ -15,6 +15,12 @@ proc assert {condition} {
}
}
proc assert_no_match {pattern value} {
if {[string match $pattern $value]} {
error "assertion:Expected '$value' to not match '$pattern'"
}
}
proc assert_match {pattern value} {
if {![string match $pattern $value]} {
error "assertion:Expected '$value' to match '$pattern'"
+21 -1
View File
@@ -35,6 +35,26 @@ start_server {tags {"acl"}} {
set e
} {*WRONGPASS*}
test {Test password hashes can be added} {
r ACL setuser newuser #34344e4d60c2b6d639b7bd22e18f2b0b91bc34bf0ac5f9952744435093cfb4e6
catch {r AUTH newuser passwd4} e
assert {$e eq "OK"}
}
test {Test password hashes validate input} {
# Validate Length
catch {r ACL setuser newuser #34344e4d60c2b6d639b7bd22e18f2b0b91bc34bf0ac5f9952744435093cfb4e} e
# Validate character outside set
catch {r ACL setuser newuser #34344e4d60c2b6d639b7bd22e18f2b0b91bc34bf0ac5f9952744435093cfb4eq} e
set e
} {*Error in ACL SETUSER modifier*}
test {ACL GETUSER returns the password hash instead of the actual password} {
set passstr [dict get [r ACL getuser newuser] passwords]
assert_match {*34344e4d60c2b6d639b7bd22e18f2b0b91bc34bf0ac5f9952744435093cfb4e6*} $passstr
assert_no_match {*passwd4*} $passstr
}
test {By default users are not able to access any command} {
catch {r SET foo bar} e
set e
@@ -67,7 +87,7 @@ start_server {tags {"acl"}} {
set e
} {*NOPERM*}
test {ACLs can include or excluse whole classes of commands} {
test {ACLs can include or exclude whole classes of commands} {
r ACL setuser newuser -@all +@set +acl
r SADD myset a b c; # Should not raise an error
r ACL setuser newuser +@all -@string