From: John Spray Date: Tue, 12 Apr 2016 01:49:32 +0000 (+0100) Subject: mds: fix auth caps with hyphen in path X-Git-Tag: v11.0.0~727^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f82fa5f59a80851581573553be07e8f1620ee346;p=ceph.git mds: fix auth caps with hyphen in path 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 --- diff --git a/src/mds/MDSAuthCaps.cc b/src/mds/MDSAuthCaps.cc index c8887800bcc5..c774d3f2473e 100644 --- a/src/mds/MDSAuthCaps.cc +++ b/src/mds/MDSAuthCaps.cc @@ -56,7 +56,7 @@ struct MDSCapParser : qi::grammar quoted_path %= lexeme[lit("\"") >> *(char_ - '"') >> '"'] | lexeme[lit("'") >> *(char_ - '\'') >> '\'']; - unquoted_path %= +char_("a-zA-Z0-9_.-/"); + unquoted_path %= +char_("a-zA-Z0-9_./-"); // match := [path=] [uid= [gids=[,...]] path %= (spaces >> lit("path") >> lit('=') >> (quoted_path | unquoted_path)); diff --git a/src/test/mds/TestMDSAuthCaps.cc b/src/test/mds/TestMDSAuthCaps.cc index 0c821e81ed7c..51ffd4688cbd 100644 --- a/src/test/mds/TestMDSAuthCaps.cc +++ b/src/test/mds/TestMDSAuthCaps.cc @@ -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",