]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/auth: do_aws4_auth_completion() catches exceptions
authorCasey Bodley <cbodley@redhat.com>
Fri, 23 Feb 2024 14:02:29 +0000 (09:02 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 1 Mar 2024 13:49:04 +0000 (08:49 -0500)
AWSv4ComplMulti::complete() throws exceptions on errors, but nothing
catches these

Fixes: https://tracker.ceph.com/issues/64549
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f953c419d6992c8124f3e123ae8030d6a45ffd1a)

src/rgw/rgw_op.cc

index f6011dbe5c9dd309e98b63ba0ece6115adae4edb..721c0e17936fcf0f8b409437a49c01f11a62de50 100644 (file)
@@ -1407,16 +1407,20 @@ int RGWOp::do_aws4_auth_completion()
 {
   ldpp_dout(this, 5) << "NOTICE: call to do_aws4_auth_completion"  << dendl;
   if (s->auth.completer) {
-    if (!s->auth.completer->complete()) {
-      return -ERR_AMZ_CONTENT_SHA256_MISMATCH;
-    } else {
-      ldpp_dout(this, 10) << "v4 auth ok -- do_aws4_auth_completion" << dendl;
-    }
-
     /* TODO(rzarzynski): yes, we're really called twice on PUTs. Only first
      * call passes, so we disable second one. This is old behaviour, sorry!
      * Plan for tomorrow: seek and destroy. */
-    s->auth.completer = nullptr;
+    auto completer = std::move(s->auth.completer);
+
+    try {
+      if (!completer->complete()) {
+        return -ERR_AMZ_CONTENT_SHA256_MISMATCH;
+      }
+    } catch (const rgw::io::Exception& e) {
+      return -e.code().value();
+    }
+
+    ldpp_dout(this, 10) << "v4 auth ok -- do_aws4_auth_completion" << dendl;
   }
 
   return 0;