std::set_intersection(i->match.gids.begin(), i->match.gids.end(),
caller_gid_list->begin(), caller_gid_list->end(),
std::back_inserter(gids));
+ std::sort(gids.begin(), gids.end());
}
+
// Spec is non-allowing if caller asked for set pool but spec forbids it
if (mask & MAY_SET_POOL) {
bool r = qi::phrase_parse(iter, end, g, ascii::space, *this);
cct = c; // set after parser self-assignment
if (r && iter == end) {
+ for (auto& grant : grants) {
+ std::sort(grant.match.gids.begin(), grant.match.gids.end());
+ }
return true;
} else {
// Make sure no grants are kept after parsing failed!
TEST(MDSAuthCaps, AllowUid) {
MDSAuthCaps cap(g_ceph_context);
- ASSERT_TRUE(cap.parse(g_ceph_context, "allow * uid=10 gids=10,11,12; allow * uid=12 gids=10,12", NULL));
+ ASSERT_TRUE(cap.parse(g_ceph_context, "allow * uid=10 gids=10,11,12; allow * uid=12 gids=12,10", NULL));
ASSERT_FALSE(cap.allow_all());
// uid/gid must be valid