]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make RGWToken string ctor explicit 35886/head
authorYuval Lifshitz <ylifshit@redhat.com>
Thu, 2 Jul 2020 05:47:22 +0000 (08:47 +0300)
committerYuval Lifshitz <ylifshit@redhat.com>
Thu, 2 Jul 2020 05:47:22 +0000 (08:47 +0300)
Fixes: https://tracker.ceph.com/issues/46316
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_token.h

index 6f8d81c76f993ed4cf62068038d0dfa381a79e50..d9673f158d18b5a88ec1f1f0e97961230d18956b 100644 (file)
@@ -84,12 +84,19 @@ namespace rgw {
             const std::string& _key)
       : type(_type), id(_id), key(_key) {};
 
-    RGWToken(const string& json) {
+    explicit RGWToken(const string& json) {
       JSONParser p;
       p.parse(json.c_str(), json.length());
       JSONDecoder::decode_json(RGWToken::type_name, *this, &p);
     }
 
+    RGWToken& operator=(const std::string& json) {
+      JSONParser p;
+      p.parse(json.c_str(), json.length());
+      JSONDecoder::decode_json(RGWToken::type_name, *this, &p);
+      return *this;
+    }
+
     void encode(bufferlist& bl) const {
       uint32_t ver = version();
       string typestr{from_type(type)};