]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdcap: drop unused 'auid' arg from get_cap(), is_match()
authorSage Weil <sage@inktank.com>
Wed, 13 Jun 2012 20:42:24 +0000 (13:42 -0700)
committerSage Weil <sage@inktank.com>
Wed, 13 Jun 2012 20:42:24 +0000 (13:42 -0700)
The intent was to do a cap like 'allow pools-that-i-own ...', but in
practice you just do 'allow pool <myuid> ...'.. the actual auid you
authenticate as is redundant, since the cap itself is authenticated.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc
src/osd/OSDCap.cc
src/osd/OSDCap.h

index 60596a793fd09350201df173d2dc586273a046f7..e1be9aaa2afc52b0a5534cdc669fc51b425b2fd9 100644 (file)
@@ -5383,7 +5383,7 @@ bool OSD::op_has_sufficient_caps(PG *pg, MOSDOp *op)
   if (key.length() == 0)
     key = op->get_oid().name;
 
-  const OSDCapSpec *spec = caps.get_cap(session->auid, pg->pool->name, pg->pool->auid, key);
+  const OSDCapSpec *spec = caps.get_cap(pg->pool->name, pg->pool->auid, key);
   // just do the rwx, for now!
   rwxa_t perm = spec ? spec->allow : 0;
 
index 19cf90b8537ed35f22b99ea5e96d80aaf26d50dd..51219d07fc1425b84f276f70369f10cdf45a38ee 100644 (file)
@@ -70,7 +70,7 @@ ostream& operator<<(ostream& out, const OSDCapMatch& m)
   return out;
 }
 
-bool OSDCapMatch::is_match(int64_t a, const string& pn, int64_t pool_auid, const string& object) const
+bool OSDCapMatch::is_match(const string& pn, int64_t pool_auid, const string& object) const
 {
   if (auid >= 0) {
     if (auid != pool_auid)
@@ -107,10 +107,10 @@ void OSDCap::set_allow_all()
   grants.push_back(OSDCapGrant(OSDCapMatch(), OSDCapSpec(OSD_CAP_ANY)));
 }
 
-const OSDCapSpec *OSDCap::get_cap(int64_t auid, const string& pool_name, int64_t pool_auid, const string& object) const
+const OSDCapSpec *OSDCap::get_cap(const string& pool_name, int64_t pool_auid, const string& object) const
 {
   for (vector<OSDCapGrant>::const_iterator p = grants.begin(); p != grants.end(); ++p) {
-    if (p->match.is_match(auid, pool_name, pool_auid, object))
+    if (p->match.is_match(pool_name, pool_auid, object))
       return &p->spec;
   }
   return NULL;
index b5c537411e28870630164dd17c1a6666a43d50db..4bb53fc8fcbae5a53227e2d34c647f1f9e63f543 100644 (file)
@@ -77,7 +77,7 @@ struct OSDCapMatch {
    * @param object object name
    * @return true if we match, false otherwise
    */
-  bool is_match(int64_t auid, const std::string& pool_name, int64_t pool_auid, const std::string& object) const;
+  bool is_match(const std::string& pool_name, int64_t pool_auid, const std::string& object) const;
 };
 
 ostream& operator<<(ostream& out, const OSDCapMatch& m);
@@ -104,7 +104,7 @@ struct OSDCap {
   void set_allow_all();
   bool parse(const std::string& str, ostream *err=NULL);
 
-  const OSDCapSpec *get_cap(int64_t auid, const std::string& pool_name, int64_t pool_auid, const std::string& object) const;
+  const OSDCapSpec *get_cap(const std::string& pool_name, int64_t pool_auid, const std::string& object) const;
 };
 
 static inline ostream& operator<<(ostream& out, const OSDCap& cap)