diff options
author | Harkrishn Patro <harkrisp@amazon.com> | 2022-03-01 05:26:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 20:26:58 -0800 |
commit | 21aabab4013a651420e954fe1ae6ad06cc6e5a15 (patch) | |
tree | 1d3290fc07991eae7c1e710c7a5c9730ab0838ca | |
parent | dff153ff247478015d0cf93f0f46a222169ac09c (diff) | |
download | redis-21aabab4013a651420e954fe1ae6ad06cc6e5a15.tar.gz |
Fix acl dryrun to return the tested common permission error. (#10359)
-rw-r--r-- | src/acl.c | 2 | ||||
-rw-r--r-- | tests/unit/acl-v2.tcl | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -2799,7 +2799,7 @@ setuser_cleanup: sds err = sdsempty(); if (result == ACL_DENIED_CMD) { err = sdscatfmt(err, "This user has no permissions to run " - "the '%s' command", c->cmd->fullname); + "the '%s' command", cmd->fullname); } else if (result == ACL_DENIED_KEY) { err = sdscatfmt(err, "This user has no permissions to access " "the '%s' key", c->argv[idx + 3]->ptr); diff --git a/tests/unit/acl-v2.tcl b/tests/unit/acl-v2.tcl index 72ea44c3a..7a8bb099a 100644 --- a/tests/unit/acl-v2.tcl +++ b/tests/unit/acl-v2.tcl @@ -305,6 +305,12 @@ start_server {tags {"acl external:skip"}} { assert_equal "ERR Command 'not-a-command' not found" $e } + test {Test various commands for command permissions} { + r ACL setuser command-test -@all + assert_equal "This user has no permissions to run the 'set' command" [r ACL DRYRUN command-test set somekey somevalue] + assert_equal "This user has no permissions to run the 'get' command" [r ACL DRYRUN command-test get somekey] + } + test {Test various odd commands for key permissions} { r ACL setuser command-test +@all %R~read* %W~write* %RW~rw* |