OSDCap: remove grants added during failed parsing

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>
This commit is contained in:
Josh Durgin 2012-09-26 13:44:02 -07:00
parent 0ee6a951dd
commit 42a63f34cc

View 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";