From 7edfa3f2fb145253a49c155847212097b3bfb9da Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Thu, 18 Jan 2024 08:15:51 +0000 Subject: [PATCH] rgw: fix http error check in keystone issue_admin_token_request This changes so that we don't return before even checking if the request failed by checking the response code like was done for other methods in [1]. [1] https://github.com/ceph/ceph/pull/53846 Signed-off-by: Tobias Urdin --- src/rgw/rgw_keystone.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_keystone.cc b/src/rgw/rgw_keystone.cc index 7d5264f980ee..e6fbeea71b46 100644 --- a/src/rgw/rgw_keystone.cc +++ b/src/rgw/rgw_keystone.cc @@ -211,9 +211,6 @@ int Service::issue_admin_token_request(const DoutPrefixProvider *dpp, token_req.set_url(token_url); const int ret = token_req.process(y); - if (ret < 0) { - return ret; - } /* Detect rejection earlier than during the token parsing step. */ if (token_req.get_http_status() == @@ -221,6 +218,11 @@ int Service::issue_admin_token_request(const DoutPrefixProvider *dpp, return -EACCES; } + // throw any other http or connection errors + if (ret < 0) { + return ret; + } + if (t.parse(dpp, token_req.get_subject_token(), token_bl, keystone_version) != 0) { return -EINVAL; -- 2.47.3