Skip to content

Commit

Permalink
mds: fix auth caps with hyphen in path
Browse files Browse the repository at this point in the history
Quirk of the boost spirit char() fn, hyphens
are treated as range delimiters unless they're
the last character in the set.

Fixes: #15465
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit f82fa5f)
  • Loading branch information
John Spray authored and Abhishek Varshney committed May 6, 2016
1 parent 791eba8 commit af3a4e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mds/MDSAuthCaps.cc
Expand Up @@ -56,7 +56,7 @@ struct MDSCapParser : qi::grammar<Iterator, MDSAuthCaps()>
quoted_path %=
lexeme[lit("\"") >> *(char_ - '"') >> '"'] |
lexeme[lit("'") >> *(char_ - '\'') >> '\''];
unquoted_path %= +char_("a-zA-Z0-9_.-/");
unquoted_path %= +char_("a-zA-Z0-9_./-");

// match := [path=<path>] [uid=<uid> [gids=<gid>[,<gid>...]]
path %= (spaces >> lit("path") >> lit('=') >> (quoted_path | unquoted_path));
Expand Down
1 change: 1 addition & 0 deletions src/test/mds/TestMDSAuthCaps.cc
Expand Up @@ -29,6 +29,7 @@ const char *parse_good[] = {
"allow rw uid=1 gids=1",
"allow * path=\"/foo\"",
"allow * path=/foo",
"allow * path=/foo-bar_baz",
"allow * path=\"/foo bar/baz\"",
"allow * uid=1",
"allow * path=\"/foo\" uid=1",
Expand Down

0 comments on commit af3a4e4

Please sign in to comment.