]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDCap: remove grants added during failed parsing
authorJosh Durgin <josh.durgin@inktank.com>
Wed, 26 Sep 2012 20:44:02 +0000 (13:44 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 27 Sep 2012 17:50:10 +0000 (10:50 -0700)
Parsing has side effects that must be undone if it fails.  A
capability string like 'allow rwx pool=bar' will add the grant for
'allow rwx' and then fail on the 'pool=bar'. Thus, the client will
effectively have 'rwx' permissions on all pools.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/osd/OSDCap.cc

index 0687a3c0aab057983c6c9c08c7410255906d584f..c1a9e9e3370201a88a216dfae8f8ed3fa719b954 100644 (file)
@@ -206,6 +206,9 @@ bool OSDCap::parse(const string& str, ostream *err)
   if (r && iter == end)
     return true;
 
+  // Make sure no grants are kept after parsing failed!
+  grants.clear();
+
   if (err)
     *err << "osdcap parse failed, stopped at '" << std::string(iter, end)
         << "' of '" << str << "'\n";