}
if (m.allow != 0)
out << " " << m.allow;
+ if (m.network.size())
+ out << " network " << m.network;
return out;
}
(std::string, profile)
(std::string, command)
(kvmap, command_args)
- (mon_rwxa_t, allow))
+ (mon_rwxa_t, allow)
+ (std::string, network))
BOOST_FUSION_ADAPT_STRUCT(StringConstraint,
(StringConstraint::MatchType, match_type)
quoted_string %=
lexeme['"' >> +(char_ - '"') >> '"'] |
lexeme['\'' >> +(char_ - '\'') >> '\''];
- unquoted_word %= +char_("a-zA-Z0-9_.-");
+ unquoted_word %= +char_("a-zA-Z0-9_./-");
str %= quoted_string | unquoted_word;
+ network_str %= +char_("/.:a-fA-F0-9][");
spaces = +(lit(' ') | lit('\n') | lit('\t'));
>> qi::attr(string()) >> qi::attr(string())
>> str
>> -(spaces >> lit("with") >> spaces >> kv_map)
- >> qi::attr(0);
+ >> qi::attr(0)
+ >> -(spaces >> lit("network") >> spaces >> network_str);
// service foo rwxa
service_match %= -spaces >> lit("allow") >> spaces >> lit("service") >> (lit('=') | spaces)
>> str >> qi::attr(string()) >> qi::attr(string())
>> qi::attr(map<string,StringConstraint>())
- >> spaces >> rwxa;
+ >> spaces >> rwxa
+ >> -(spaces >> lit("network") >> spaces >> network_str);
// profile foo
profile_match %= -spaces >> -(lit("allow") >> spaces)
>> str
>> qi::attr(string())
>> qi::attr(map<string,StringConstraint>())
- >> qi::attr(0);
+ >> qi::attr(0)
+ >> -(spaces >> lit("network") >> spaces >> network_str);
// rwxa
rwxa_match %= -spaces >> lit("allow") >> spaces
>> qi::attr(string()) >> qi::attr(string()) >> qi::attr(string())
>> qi::attr(map<string,StringConstraint>())
- >> rwxa;
+ >> rwxa
+ >> -(spaces >> lit("network") >> spaces >> network_str);
// rwxa := * | [r][w][x]
rwxa =
qi::rule<Iterator, unsigned()> rwxa;
qi::rule<Iterator, string()> quoted_string;
qi::rule<Iterator, string()> unquoted_word;
- qi::rule<Iterator, string()> str;
+ qi::rule<Iterator, string()> str, network_str;
qi::rule<Iterator, StringConstraint()> str_match, str_prefix, str_regex;
qi::rule<Iterator, pair<string, StringConstraint>()> kv_pair;
"allow command \"foo bar\" with arg=\"baz.xx\"",
"profile osd",
"profile \"mds-bootstrap\", profile foo",
+ "allow * network 1.2.3.4/24",
+ "allow * network ::1/128",
+ "allow * network [aa:bb::1]/128",
+ "allow service=foo x network 1.2.3.4/16",
+ "allow command abc network 1.2.3.4/8",
+ "profile osd network 1.2.3.4/32",
+ "allow profile mon network 1.2.3.4/32",
0
};