]> git-server-git.apps.pok.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>
Mon, 10 Oct 2016 08:34:37 +0000 (16:34 +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>
src/tools/ceph_monstore_tool.cc

index fc301aceabd7f2ba52813ebf9af9dadac62d768f..5198ebf5d358aaf4d591059511ee38caa70d35ae 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;