]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: cloud sync: sign requests that read source objs
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 26 Aug 2022 13:56:38 +0000 (09:56 -0400)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 26 Aug 2022 13:56:38 +0000 (09:56 -0400)
Fixes: https://tracker.ceph.com/issues/57307
Requests that were sent to fetch the objects from the source zone weren't
being signed. Changing the interface to use rRGWRESTStreamRWRequest::send()
that signs the requests.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rest.cc
src/rgw/rgw_rest_client.cc
src/rgw/rgw_rest_client.h

index 0bd169f99e7d36b9c6e32c72f669d5046c40ce10..04920a1551b57a3c54c658167eb1807a90ebb648 100644 (file)
@@ -95,7 +95,7 @@ int RGWStreamReadHTTPResourceCRF::init(const DoutPrefixProvider *dpp)
 
   in_cb.emplace(env, caller, req);
 
-  int r = http_manager->add_request(req);
+  int r = req->send(http_manager);
   if (r < 0) {
     return r;
   }
@@ -109,7 +109,7 @@ int RGWStreamWriteHTTPResourceCRF::send()
 
   req->set_write_drain_cb(&write_drain_notify_cb);
 
-  int r = http_manager->add_request(req);
+  int r = req->send(http_manager);
   if (r < 0) {
     return r;
   }
index 68b40324ce268f5285b2ab3c300392472a831568..a2a97e94e0bcbf8cc3fa55f8857c6cc2732656ba 100644 (file)
@@ -906,15 +906,7 @@ int RGWRESTStreamRWRequest::send(RGWHTTPManager *mgr)
     headers.emplace_back(kv);
   }
 
-  if (!mgr) {
-    return RGWHTTP::send(this);
-  }
-
-  int r = mgr->add_request(this);
-  if (r < 0)
-    return r;
-
-  return 0;
+  return RGWHTTPStreamRWRequest::send(mgr);
 }
 
 int RGWHTTPStreamRWRequest::complete_request(optional_yield y,
@@ -1097,3 +1089,16 @@ int RGWHTTPStreamRWRequest::send_data(void *ptr, size_t len, bool *pause)
   }
   return send_size;
 }
+
+int RGWHTTPStreamRWRequest::send(RGWHTTPManager *mgr)
+{
+  if (!mgr) {
+    return RGWHTTP::send(this);
+  }
+
+  int r = mgr->add_request(this);
+  if (r < 0)
+    return r;
+
+  return 0;
+}
index caf6ffa35c80274391ec9a86a5da4e4895d039c2..4d72c614d26d709462df125bf215c25c1d052d85 100644 (file)
@@ -166,6 +166,8 @@ public:
   /* finish streaming writes */
   void finish_write();
 
+  virtual int send(RGWHTTPManager *mgr);
+
   int complete_request(optional_yield y,
                        std::string *etag = nullptr,
                        real_time *mtime = nullptr,
@@ -195,7 +197,7 @@ public:
 
   int send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey *key, std::map<std::string, std::string>& extra_headers, const std::string& resource, bufferlist *send_data = nullptr /* optional input data */);
   int send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey& key, std::map<std::string, std::string>& extra_headers, const rgw_obj& obj);
-  int send(RGWHTTPManager *mgr);
+  int send(RGWHTTPManager *mgr) override;
 
   int send_request(const DoutPrefixProvider *dpp, RGWAccessKey& key, std::map<std::string, std::string>& extra_headers, const rgw_obj& obj, RGWHTTPManager *mgr);
   int send_request(const DoutPrefixProvider *dpp, RGWAccessKey *key, std::map<std::string, std::string>& extra_headers, const std::string& resource, RGWHTTPManager *mgr, bufferlist *send_data = nullptr /* optional input data */);