From e28043f7af1b116c2d6b1f577033ba3b4a744f1d Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 26 Aug 2022 09:56:38 -0400 Subject: [PATCH] rgw: cloud sync: sign requests that read source objs 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 --- src/rgw/rgw_cr_rest.cc | 4 ++-- src/rgw/rgw_rest_client.cc | 23 ++++++++++++++--------- src/rgw/rgw_rest_client.h | 4 +++- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/rgw/rgw_cr_rest.cc b/src/rgw/rgw_cr_rest.cc index 0bd169f99e7..04920a1551b 100644 --- a/src/rgw/rgw_cr_rest.cc +++ b/src/rgw/rgw_cr_rest.cc @@ -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; } diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 68b40324ce2..a2a97e94e0b 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -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; +} diff --git a/src/rgw/rgw_rest_client.h b/src/rgw/rgw_rest_client.h index caf6ffa35c8..4d72c614d26 100644 --- a/src/rgw/rgw_rest_client.h +++ b/src/rgw/rgw_rest_client.h @@ -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& extra_headers, const std::string& resource, bufferlist *send_data = nullptr /* optional input data */); int send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey& key, std::map& 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& extra_headers, const rgw_obj& obj, RGWHTTPManager *mgr); int send_request(const DoutPrefixProvider *dpp, RGWAccessKey *key, std::map& extra_headers, const std::string& resource, RGWHTTPManager *mgr, bufferlist *send_data = nullptr /* optional input data */); -- 2.39.5