]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Prepare for nspace match with simpler is_match_all()
authorDavid Zafman <david.zafman@inktank.com>
Fri, 28 Jun 2013 21:20:23 +0000 (14:20 -0700)
committerDavid Zafman <david.zafman@inktank.com>
Tue, 9 Jul 2013 21:09:24 +0000 (14:09 -0700)
Signed-off-by: David Zafman <david.zafman@inktank.com>
src/osd/OSDCap.cc
src/osd/OSDCap.h

index 87a1490d70d10838e3c79d608e54273f15d28ea6..268b06d75254dfa827f3a21aa4d95ee78a5f13b3 100644 (file)
@@ -84,6 +84,17 @@ bool OSDCapMatch::is_match(const string& pn, int64_t pool_auid, const string& ob
   return true;
 }
 
+bool OSDCapMatch::is_match_all() const
+{
+  if (auid >= 0)
+    return false;
+  if (pool_name.length())
+    return false;
+  if (object_prefix.length())
+    return false;
+  return true;
+}
+
 ostream& operator<<(ostream& out, const OSDCapGrant& g)
 {
   return out << "grant(" << g.match << g.spec << ")";
@@ -93,7 +104,7 @@ ostream& operator<<(ostream& out, const OSDCapGrant& g)
 bool OSDCap::allow_all() const
 {
   for (vector<OSDCapGrant>::const_iterator p = grants.begin(); p != grants.end(); ++p)
-    if (p->match.is_match(string(), CEPH_AUTH_UID_DEFAULT, string()) && p->spec.allow_all())
+    if (p->match.is_match_all() && p->spec.allow_all())
       return true;
   return false;
 }
index a4ca09b0c4dfadf4a6876714af33ea51314c0654..9b2ac8865ae2be37ff56d1dd5b3d3666423bcb88 100644 (file)
@@ -93,6 +93,7 @@ struct OSDCapMatch {
    * @return true if we match, false otherwise
    */
   bool is_match(const std::string& pool_name, int64_t pool_auid, const std::string& object) const;
+  bool is_match_all() const;
 };
 
 ostream& operator<<(ostream& out, const OSDCapMatch& m);