]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDCap: remove auid from grammar
authorSage Weil <sage@redhat.com>
Sun, 12 Aug 2018 18:29:00 +0000 (13:29 -0500)
committerSage Weil <sage@redhat.com>
Fri, 31 Aug 2018 20:54:58 +0000 (15:54 -0500)
This is an incompatible change: old caps that include auid will no longer
parse.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc
src/osd/OSDCap.cc
src/osd/OSDCap.h
src/test/osd/osdcap.cc

index 250e9cc7c19c53d63f9b6c4889f529ad2285df92..ea333b62ec926568243b322feaf7be4852fad2ea 100644 (file)
@@ -100,7 +100,7 @@ bool is_osd_writable(const OSDCapGrant& grant, const std::string* pool_name) {
     auto& match = grant.match;
     if (match.is_match_all()) {
       return true;
-    } else if (pool_name != nullptr && match.auid < 0 &&
+    } else if (pool_name != nullptr &&
                !match.pool_namespace.pool_name.empty() &&
                match.pool_namespace.pool_name == *pool_name) {
       return true;
index d482da727f0e1af7429389f3eb52d5ae6f56a673..ee1e947b088c3309297b201a90b637914860775e 100644 (file)
@@ -85,10 +85,6 @@ ostream& operator<<(ostream &out, const OSDCapPoolTag &pt)
 
 ostream& operator<<(ostream& out, const OSDCapMatch& m)
 {
-  if (m.auid != -1LL) {
-    out << "auid " << m.auid << " ";
-  }
-
   if (!m.pool_namespace.pool_name.empty() || m.pool_namespace.nspace) {
     out << m.pool_namespace;
   }
@@ -193,9 +189,7 @@ bool OSDCapMatch::is_match(const string& pn, const string& ns,
 
 bool OSDCapMatch::is_match_all() const
 {
-  if (auid >= 0) {
-    return false;
-  } else if (!pool_namespace.is_match_all()) {
+if (!pool_namespace.is_match_all()) {
     return false;
   } else if (!pool_tag.is_match_all()) {
     return false;
@@ -338,9 +332,9 @@ void OSDCapGrant::expand_profile()
 
   if (profile.name == "rbd") {
     // RBD read-write grant
-    profile_grants.emplace_back(OSDCapMatch({}, "rbd_children"),
+    profile_grants.emplace_back(OSDCapMatch(string(), "rbd_children"),
                                 OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
-    profile_grants.emplace_back(OSDCapMatch({}, "rbd_mirroring"),
+    profile_grants.emplace_back(OSDCapMatch(string(), "rbd_mirroring"),
                                 OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
     profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace),
                                 OSDCapSpec(osd_rwxa_t(OSD_CAP_R |
@@ -437,8 +431,7 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
               >> (lit('=') | spaces)
               >> estr >> -char_('*'));
 
-    // match := [pool[=]<poolname> [namespace[=]<namespace>] | auid <123>] [object_prefix <prefix>]
-    auid %= (spaces >> lit("auid") >> spaces >> int_);
+    // match := [pool[=]<poolname> [namespace[=]<namespace>]] [object_prefix <prefix>]
     object_prefix %= -(spaces >> lit("object_prefix") >> spaces >> str);
     pooltag %= (spaces >> lit("tag")
                >> spaces >> str // application
@@ -448,7 +441,6 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
     match = (
       pooltag                                 [_val = phoenix::construct<OSDCapMatch>(_1)] |
       (nspace >> pooltag)                     [_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
-      (auid >> object_prefix)                 [_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
       (pool_name >> nspace >> object_prefix)  [_val = phoenix::construct<OSDCapMatch>(_1, _2, _3)] |
       (pool_name >> object_prefix)            [_val = phoenix::construct<OSDCapMatch>(_1, _2)]
     );
@@ -499,7 +491,6 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
   qi::rule<Iterator, string()> unquoted_word;
   qi::rule<Iterator, string()> str, estr, network_str;
   qi::rule<Iterator, string()> wildcard;
-  qi::rule<Iterator, int()> auid;
   qi::rule<Iterator, string()> class_name;
   qi::rule<Iterator, string()> method_name;
   qi::rule<Iterator, OSDCapSpec()> capspec;
index 7f4bc0ff03088b96ecb6b77c7cbdfd6e16441b94..2bb4e21ca1a4618f9a221659f5669e5f823d34e2 100644 (file)
@@ -119,8 +119,6 @@ ostream& operator<<(ostream& out, const OSDCapPoolTag& pt);
 
 struct OSDCapMatch {
   typedef std::map<std::string, std::map<std::string, std::string> > app_map_t;
-  // auid and pool_name/nspace are mutually exclusive
-  int64_t auid = CEPH_AUTH_UID_DEFAULT;
   OSDCapPoolNamespace pool_namespace;
   OSDCapPoolTag pool_tag;
   std::string object_prefix;
@@ -135,8 +133,6 @@ struct OSDCapMatch {
   OSDCapMatch(const std::string& pl, const std::string& ns,
               const std::string& pre)
     : pool_namespace(pl, ns), object_prefix(pre) {}
-  OSDCapMatch(uint64_t auid, const std::string& pre)
-    : auid(auid), object_prefix(pre) {}
   OSDCapMatch(const std::string& dummy, const std::string& app,
              const std::string& key, const std::string& val)
     : pool_tag(app, key, val) {}
@@ -148,7 +144,6 @@ struct OSDCapMatch {
    *
    * @param pool_name pool name
    * @param nspace_name namespace name
-   * @param pool_auid pool's auid
    * @param object object name
    * @return true if we match, false otherwise
    */
index f87234f37c80ded5f47aa07efe58bced1e942cbf..55dd0e526e3882e4a913b50f288c476bd97450c1 100644 (file)
@@ -34,12 +34,10 @@ const char *parse_good[] = {
   "allow pool taco object_prefix obj_with_underscores_and_no_quotes wx",
   "allow rwx pool 'weird name'",
   "allow rwx pool \"weird name with ''s\"",
-  "allow rwx auid 123",
   "allow rwx pool foo, allow r pool bar",
   "allow rwx pool foo ; allow r pool bar",
   "allow rwx pool foo ;allow r pool bar",
   "allow rwx pool foo; allow r pool bar",
-  "allow auid 123 rwx",
   "allow pool foo rwx, allow pool bar r",
   "allow pool foo.froo.foo rwx, allow pool bar r",
   "allow pool foo rwx ; allow pool bar r",
@@ -61,7 +59,6 @@ const char *parse_good[] = {
   "  allow     pool foo rwx; allow pool bar r  ",
   " allow wx pool taco",
   "\tallow\nwx\tpool \n taco\t",
-  "allow r   pool    foo    object_prefix   blah   ;   allow   w   auid  5",
   "allow class-read object_prefix rbd_children, allow pool libvirt-pool-test rwx",
   "allow class-read object_prefix rbd-children, allow pool libvirt_pool_test rwx",
   "allow pool foo namespace nfoo rwx, allow pool bar namespace=nbar r",
@@ -122,6 +119,9 @@ const char *parse_bad[] = {
   "allow rwx auid 123 namespace asdf",
   "allow wwx pool ''",
   "allow rwx tag application key value",
+  "allow rwx auid 123",
+  "allow auid 123 rwx",
+  "allow r   pool    foo    object_prefix   blah   ;   allow   w   auid  5",
   0
 };