]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
keyring: make encode_plaintext method
authorSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 14:25:16 +0000 (07:25 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 14:25:16 +0000 (07:25 -0700)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/auth/KeyRing.cc
src/auth/KeyRing.h
src/cauthtool.cc

index c1bbe5ee3bf3c2c69e6b7071cd9e1903470f8a83..51367495fd5581d8bcaeb6bb96292f0b5e9b920f 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <errno.h>
 #include <map>
+#include <sstream>
 
 #include "common/config.h"
 #include "common/debug.h"
@@ -64,6 +65,13 @@ int KeyRing::set_modifier(const char *type, const char *val, EntityName& name, m
   return 0;
 }
 
+void KeyRing::encode_plaintext(bufferlist& bl)
+{
+  std::ostringstream os;
+  print(os);
+  string str = os.str();
+  bl.append(str);
+}
 
 void KeyRing::decode_plaintext(bufferlist::iterator& bli)
 {
index 2d092de43da2f1ab08abe1ea0278f4fb69c9f0d3..220bdd620b7957297580da87c96c6afa5bfba95d 100644 (file)
@@ -72,6 +72,8 @@ public:
     ::encode(keys, bl);
   }
   void decode(bufferlist::iterator& bl);
+
+  void encode_plaintext(bufferlist& bl);
 };
 WRITE_CLASS_ENCODER(KeyRing)
 
index b7ed26d6defcd0028d958ce86a9dc38c8b26e6d3..31b64b49c3dd72766af520aab1ef24c5b43f6b72 100644 (file)
@@ -251,10 +251,7 @@ int main(int argc, const char **argv)
     if (bin_keyring) {
       ::encode(keyring, bl);
     } else {
-      std::ostringstream os;
-      keyring.print(os);
-      string str = os.str();
-      bl.append(str);
+      keyring.encode_plaintext(bl);
     }
     r = bl.write_file(fn, 0600);
     if (r < 0) {