]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/cephx: process formatter dump more tenderly
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 6 Jun 2016 11:39:54 +0000 (19:39 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 7 Jun 2016 02:19:01 +0000 (10:19 +0800)
E.g., if there is no secrets, we don't open a session and
leave it haning after returning.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/auth/cephx/CephxKeyServer.cc

index 28b143753958648406c6815aa0516a080360563e..8aafe07ce625ed0a667834a3a11ee910ffe4b046 100644 (file)
@@ -296,15 +296,14 @@ bool KeyServer::contains(const EntityName& name) const
 int KeyServer::encode_secrets(Formatter *f, stringstream *ds) const
 {
   Mutex::Locker l(lock);
-
-  if (f)
-    f->open_array_section("auth_dump");
-
   map<EntityName, EntityAuth>::const_iterator mapiter = data.secrets_begin();
 
   if (mapiter == data.secrets_end())
     return -ENOENT;
 
+  if (f)
+    f->open_array_section("auth_dump");
+
   while (mapiter != data.secrets_end()) {
     const EntityName& name = mapiter->first;
     if (ds) {