]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use std::make_shared for AWSv4 completers creation.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 4 May 2017 15:50:04 +0000 (17:50 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 7 Jun 2017 10:43:19 +0000 (12:43 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_auth_s3.cc
src/rgw/rgw_auth_s3.h

index bb7b00428f2ee774a14630cf951e560f4c262ae1..79446fe82d523009340d027d8d2275d08a176868 100644 (file)
@@ -1062,12 +1062,11 @@ AWSv4ComplMulti::create(const req_state* const s,
   const auto signing_key = \
     rgw::auth::s3::get_v4_signing_key(s->cct, credential_scope, *secret_key);
 
-  return rgw::auth::Completer::cmplptr_t(
-    new AWSv4ComplMulti(s,
-                        std::move(date),
-                        std::move(credential_scope),
-                        std::move(seed_signature),
-                        signing_key));
+  return std::make_shared<AWSv4ComplMulti>(s,
+                                           std::move(date),
+                                           std::move(credential_scope),
+                                           std::move(seed_signature),
+                                           signing_key);
 }
 
 size_t AWSv4ComplSingle::recv_body(char* const buf, const size_t max)
@@ -1117,7 +1116,7 @@ rgw::auth::Completer::cmplptr_t
 AWSv4ComplSingle::create(const req_state* const s,
                          const boost::optional<std::string>&)
 {
-  return rgw::auth::Completer::cmplptr_t(new AWSv4ComplSingle(s));
+  return std::make_shared<AWSv4ComplSingle>(s);
 }
 
 } /* namespace s3 */
index 4ea23eb0748d30cc1234425919eb1967c3ac7cca..6b3b33bf2a57a6d5710499fbece144eaf18a0170 100644 (file)
@@ -203,6 +203,12 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
   SHA256* sha256_hash;
   std::string prev_chunk_signature;
 
+  bool is_signature_mismatched();
+  std::string calc_chunk_signature(const std::string& payload_hash) const;
+
+public:
+  /* We need the constructor to be public because of the std::make_shared that
+   * is employed by the create() method. */
   AWSv4ComplMulti(const req_state* const s,
                   std::string date,
                   std::string credential_scope,
@@ -221,10 +227,6 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
       prev_chunk_signature(std::move(seed_signature)) {
   }
 
-  bool is_signature_mismatched();
-  std::string calc_chunk_signature(const std::string& payload_hash) const;
-
-public:
   ~AWSv4ComplMulti() {
     if (sha256_hash) {
       calc_hash_sha256_close_stream(&sha256_hash);
@@ -256,10 +258,12 @@ class AWSv4ComplSingle : public rgw::auth::Completer,
   const char* const expected_request_payload_hash;
   ceph::crypto::SHA256* sha256_hash = nullptr;
 
-  /* Defined in rgw_auth_s3.cc because of get_v4_exp_payload_hash(). */
+public:
+  /* Defined in rgw_auth_s3.cc because of get_v4_exp_payload_hash(). We need
+   * the constructor to be public because of the std::make_shared employed by
+   * the create() method. */
   AWSv4ComplSingle(const req_state* const s);
 
-public:
   ~AWSv4ComplSingle() {
     if (sha256_hash) {
       calc_hash_sha256_close_stream(&sha256_hash);