]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fixed regex match on RBD profile blacklist add command
authorJason Dillaman <dillaman@redhat.com>
Thu, 27 Jul 2017 16:56:18 +0000 (12:56 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 27 Jul 2017 16:56:18 +0000 (12:56 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/mon/MonCap.cc

index f6f2b74f4ea1f89c1e6c52d987c6ce69ef91d99e..5eaa6a30e2adc993bf8df1707d0218ab42d15c52 100644 (file)
@@ -279,7 +279,7 @@ void MonCapGrant::expand_profile_mon(const EntityName& name) const
     profile_grants.back().command_args["blacklistop"] = StringConstraint(
       StringConstraint::MATCH_TYPE_EQUAL, "add");
     profile_grants.back().command_args["addr"] = StringConstraint(
-      StringConstraint::MATCH_TYPE_REGEX, "^[^/]/[0-9]*$");
+      StringConstraint::MATCH_TYPE_REGEX, "^[^/]+/[0-9]+$");
   }
 
   if (profile == "role-definer") {
@@ -328,8 +328,8 @@ mon_rwxa_t MonCapGrant::get_allowed(CephContext *cct,
         break;
       case StringConstraint::MATCH_TYPE_REGEX:
         {
-         boost::regex pattern(p->second.value,
-                               boost::regex::basic | boost::regex::no_except);
+         boost::regex pattern(
+            p->second.value, boost::regex::extended | boost::regex::no_except);
           if (pattern.empty() || !boost::regex_match(q->second, pattern))
            return 0;
         }