Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
#include <errno.h>
#include <map>
+#include <sstream>
#include "common/config.h"
#include "common/debug.h"
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)
{
::encode(keys, bl);
}
void decode(bufferlist::iterator& bl);
+
+ void encode_plaintext(bufferlist& bl);
};
WRITE_CLASS_ENCODER(KeyRing)
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) {