From f82fa5f59a80851581573553be07e8f1620ee346 Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 12 Apr 2016 02:49:32 +0100 Subject: [PATCH] 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 --- src/mds/MDSAuthCaps.cc | 2 +- src/test/mds/TestMDSAuthCaps.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mds/MDSAuthCaps.cc b/src/mds/MDSAuthCaps.cc index c8887800bcc..c774d3f2473 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 0c821e81ed7..51ffd4688cb 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", -- 2.47.3