]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
auth/KeyRing: escape quotes around commands
authorKefu Chai <kchai@redhat.com>
Tue, 18 Jun 2019 14:02:57 +0000 (22:02 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 25 Jun 2019 07:10:07 +0000 (15:10 +0800)
so the exported auth can be re-imported.

Fixes: http://tracker.ceph.com/issues/22227
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/auth/KeyRing.cc

index 816d53e35ee9340d9b24af880477abc6a21d7ddf..a2833183633a4c04050b3d76ae9e28dee9003608 100644 (file)
@@ -17,6 +17,7 @@
 #include <memory>
 #include <sstream>
 #include <algorithm>
+#include <boost/algorithm/string/replace.hpp>
 #include "auth/KeyRing.h"
 #include "common/ceph_context.h"
 #include "common/config.h"
@@ -246,6 +247,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;
     }
   }