]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/KeyRing: escape quotes around commands 28741/head
authorKefu Chai <kchai@redhat.com>
Tue, 18 Jun 2019 14:02:57 +0000 (22:02 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 25 Jun 2019 12:25:39 +0000 (14:25 +0200)
so the exported auth can be re-imported.

Fixes: http://tracker.ceph.com/issues/22227
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 1f9e54ea00d6e31136a8157b96bc0cbf70301961)

src/auth/KeyRing.cc

index 832cae0a346ba16add8ae2edc3057bfe0aeabb8e..3913a8cc65e61f3ee2fdcdad5a24646940290bbb 100644 (file)
@@ -17,6 +17,7 @@
 #include <memory>
 #include <sstream>
 #include <algorithm>
+#include <boost/algorithm/string/replace.hpp>
 #include "auth/KeyRing.h"
 #include "common/config.h"
 #include "common/debug.h"
@@ -256,6 +257,7 @@ void KeyRing::print(ostream& out)
       string caps;
       using ceph::decode;
       decode(caps, dataiter);
+      boost::replace_all(caps, "\"", "\\\"");
       out << "\tcaps " << q->first << " = \"" << caps << '"' << std::endl;
     }
   }