Skip to content
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

[Backporting]Fix empty response for ACL CAT category subcommand for module defined… #1413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,6 @@ void aclCatWithFlags(client *c, dict *commands, uint64_t cflag, int *arraylen) {

while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = dictGetVal(de);
if (cmd->flags & CMD_MODULE) continue;
if (cmd->acl_categories & cflag) {
addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname));
(*arraylen)++;
Expand Down
14 changes: 13 additions & 1 deletion tests/unit/moduleapi/aclcheck.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,19 @@ start_server {tags {"modules acl"}} {
assert_equal {User j7 has no permissions to run the 'aclcheck.module.command.aclcategories.write.function.read.category' command} $e
}

test "Unload the module - aclcheck" {
test {test if foocategory acl categories is added} {
r acl SETUSER j8 on >password -@all +@foocategory
assert_equal [r acl DRYRUN j8 aclcheck.module.command.test.add.new.aclcategories] OK
}

test {test if ACL CAT output for the new category is correct} {
assert_equal [r ACL CAT foocategory] aclcheck.module.command.test.add.new.aclcategories
}

test {test permission compaction and simplification for categories added by a module} {
r acl SETUSER j9 on >password -@all +@foocategory -@foocategory
catch {r ACL GETUSER j9} res
assert_equal {-@all -@foocategory} [lindex $res 5]
Comment on lines +134 to +146
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these tests aren't part of the unstable merge changes? I don't think we should get change beyond the scope of the commit 9b8a061.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats true.

assert_equal {OK} [r module unload aclcheck]
}
}
Loading