From: Sage Weil Date: Thu, 14 Jun 2012 23:35:02 +0000 (-0700) Subject: osdcap: make caps additive X-Git-Tag: v0.49~83^2~31^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f916168880ee0f74d1e50ef5226ca88a82da7673;p=ceph.git osdcap: make caps additive Make 'allow pool foo r, allow pool foo w, allow x' sufficient when you require rwx for pool foo. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc index 547150776214..fb30c31ecbb1 100644 --- a/src/osd/OSDCap.cc +++ b/src/osd/OSDCap.cc @@ -110,13 +110,15 @@ void OSDCap::set_allow_all() bool OSDCap::is_capable(const string& pool_name, int64_t pool_auid, const string& object, bool op_may_read, bool op_may_write, bool op_may_exec) const { + rwxa_t allow = 0; for (vector::const_iterator p = grants.begin(); p != grants.end(); ++p) { if (p->match.is_match(pool_name, pool_auid, object)) { - if (op_may_read && !(p->spec.allow & OSD_CAP_R)) + allow |= p->spec.allow; + if (op_may_read && !(allow & OSD_CAP_R)) continue; - if (op_may_write && !(p->spec.allow & OSD_CAP_W)) + if (op_may_write && !(allow & OSD_CAP_W)) continue; - if (op_may_exec && !(p->spec.allow & OSD_CAP_X)) + if (op_may_exec && !(allow & OSD_CAP_X)) continue; return true; }