]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix auth caps with hyphen in path
authorJohn Spray <john.spray@redhat.com>
Tue, 12 Apr 2016 01:49:32 +0000 (02:49 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 12 Apr 2016 01:52:39 +0000 (02:52 +0100)
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>
src/mds/MDSAuthCaps.cc
src/test/mds/TestMDSAuthCaps.cc

index c8887800bcc52400ca7e4cc0e8382c6fa80a4c5a..c774d3f2473ea3bfad90cd4304e06bf51bfac761 100644 (file)
@@ -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));
index 0c821e81ed7c80cb4ef10d5fec02b9a4d3c18db9..51ffd4688cbd0b14f76c868ff70499e1a15852e3 100644 (file)
@@ -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",