From: David Zafman Date: Fri, 28 Jun 2013 21:20:23 +0000 (-0700) Subject: osd: Prepare for nspace match with simpler is_match_all() X-Git-Tag: v0.67-rc1~127^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=71295640ffe55b996aa5c59f6bb1184b6accde75;p=ceph.git osd: Prepare for nspace match with simpler is_match_all() Signed-off-by: David Zafman --- diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc index 87a1490d70d1..268b06d75254 100644 --- a/src/osd/OSDCap.cc +++ b/src/osd/OSDCap.cc @@ -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::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; } diff --git a/src/osd/OSDCap.h b/src/osd/OSDCap.h index a4ca09b0c4df..9b2ac8865ae2 100644 --- a/src/osd/OSDCap.h +++ b/src/osd/OSDCap.h @@ -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);