]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph_monstore_tool: bail out if no caps found for a key
authorKefu Chai <kchai@redhat.com>
Mon, 10 Oct 2016 08:32:27 +0000 (16:32 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 18 Oct 2016 02:49:43 +0000 (10:49 +0800)
we take it as an error if no caps is granted to an entity in the
specified keyring file when rebuilding the monitor db.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit b4bd4004a836121c11b0bb97d8123df54c271f04)

src/tools/ceph_monstore_tool.cc

index a3916408b617dcdb781af83d3a52b8923691c822..e2aec2ae95b8cf48efd02cb74488b4a8c98d62db 100644 (file)
@@ -532,6 +532,10 @@ static int update_auth(MonitorDBStore& st, const string& keyring_path)
     KeyServerData::Incremental auth_inc;
     auth_inc.name = k.first;
     auth_inc.auth = k.second;
+    if (auth_inc.auth.caps.empty()) {
+      cerr << "no caps granted to: " << auth_inc.name << std::endl;
+      return -EINVAL;
+    }
     auth_inc.op = KeyServerData::AUTH_INC_ADD;
 
     AuthMonitor::Incremental inc;