From: Casey Bodley Date: Fri, 23 Feb 2024 14:02:29 +0000 (-0500) Subject: rgw/auth: do_aws4_auth_completion() catches exceptions X-Git-Tag: testing/wip-batrick-testing-20240411.154038~328^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f953c419d6992c8124f3e123ae8030d6a45ffd1a;p=ceph-ci.git rgw/auth: do_aws4_auth_completion() catches exceptions AWSv4ComplMulti::complete() throws exceptions on errors, but nothing catches these Fixes: https://tracker.ceph.com/issues/64549 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index b7e50e3421f..64f6f3aaa33 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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;