From 61d4f73bf643c8a211350ab74dfbf74e92861931 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 18 Apr 2017 21:45:03 +0200 Subject: [PATCH] rgw: switch to the Completer interface for the AWSv4 payload check. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_op.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 59c8eb46cb9a..046dd6c07542 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -690,15 +690,18 @@ int RGWOp::verify_op_mask() int RGWOp::do_aws4_auth_completion() { - if (s->aws4_auth_needs_complete) { - /* complete */ - int ret = RGW_Auth_S3::authorize_aws4_auth_complete(store, s); - s->aws4_auth_needs_complete = false; - if (ret) { - return ret; + ldout(s->cct, 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 { + dout(10) << "v4 auth ok -- do_aws4_auth_completion" << dendl; } - /* authorization ok */ - dout(10) << "v4 auth ok" << 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; } return 0; -- 2.47.3