Skip to content

Commit

Permalink
fix: allow parsing extra spaces on acl files (#3703)
Browse files Browse the repository at this point in the history
* allow parsing extra whitespace characters in acl files

Signed-off-by: kostas <[email protected]>
  • Loading branch information
kostasrim authored Sep 13, 2024
1 parent 35c70db commit b5929f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/acl/acl_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ MaterializedContents MaterializeFileContents(std::vector<std::string>* usernames
for (auto& command : commands) {
if (command.empty())
continue;
std::vector<std::string_view> cmds = absl::StrSplit(command, ' ');
std::vector<std::string_view> cmds = absl::StrSplit(command, ' ', absl::SkipEmpty());
if (!absl::EqualsIgnoreCase(cmds[0], "USER") || cmds.size() < 4) {
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion tests/dragonfly/acl_family_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ async def test_require_pass_with_acl_file_order(df_factory, tmp_dir):

@pytest.mark.asyncio
async def test_set_acl_file(async_client: aioredis.Redis, tmp_dir):
acl_file_content = "USER roy ON #ea71c25a7a602246b4c39824b855678894a96f43bb9b71319c39700a1e045222 +@string +@fast +hset\nUSER john on nopass +@string"
# Note the extra space below, it's intented to also check that we properly parse extra spaces
acl_file_content = "USER roy ON #ea71c25a7a602246b4c39824b855678894a96f43bb9b71319c39700a1e045222 +@string +@fast +hset\nUSER john on nopass +@string"

acl = create_temp_file(acl_file_content, tmp_dir)

Expand Down

0 comments on commit b5929f0

Please sign in to comment.