validate.set_url(url);
int ret = validate.process(y);
- if (ret < 0) {
- throw ret;
- }
/* NULL terminate for debug output. */
token_body_bl.append(static_cast<char>(0));
<< validate.get_http_status() << dendl;
return boost::none;
}
+ // throw any other http or connection errors
+ if (ret < 0) {
+ throw ret;
+ }
ldpp_dout(dpp, 20) << "received response status=" << validate.get_http_status()
<< ", body=" << token_body_bl.c_str() << dendl;
/* send request */
ret = validate.process(y);
- if (ret < 0) {
- ldpp_dout(dpp, 2) << "s3 keystone: token validation ERROR: "
- << token_body_bl.c_str() << dendl;
- throw ret;
- }
/* if the supplied signature is wrong, we will get 401 from Keystone */
if (validate.get_http_status() ==
decltype(validate)::HTTP_STATUS_NOTFOUND) {
return std::make_pair(boost::none, -ERR_INVALID_ACCESS_KEY);
}
+ // throw any other http or connection errors
+ if (ret < 0) {
+ ldpp_dout(dpp, 2) << "s3 keystone: token validation ERROR: "
+ << token_body_bl.c_str() << dendl;
+ throw ret;
+ }
/* now parse response */
rgw::keystone::TokenEnvelope token_envelope;
/* send request */
ret = secret.process(y);
+
+ /* if the supplied access key isn't found, we will get 404 from Keystone */
+ if (secret.get_http_status() ==
+ decltype(secret)::HTTP_STATUS_NOTFOUND) {
+ return make_pair(boost::none, -ERR_INVALID_ACCESS_KEY);
+ }
+ // return any other http or connection errors
if (ret < 0) {
ldpp_dout(dpp, 2) << "s3 keystone: secret fetching error: "
<< token_body_bl.c_str() << dendl;
return make_pair(boost::none, ret);
}
- /* if the supplied signature is wrong, we will get 401 from Keystone */
- if (secret.get_http_status() ==
- decltype(secret)::HTTP_STATUS_NOTFOUND) {
- return make_pair(boost::none, -EINVAL);
- }
-
/* now parse response */
JSONParser parser;
}
res = secret_req.process(y);
- if (res < 0) {
- ldpp_dout(dpp, 0) << "ERROR: Request to Vault failed with error " << res << dendl;
- return res;
- }
+ // map 401 to EACCES instead of EPERM
if (secret_req.get_http_status() ==
RGWHTTPTransceiver::HTTP_STATUS_UNAUTHORIZED) {
ldpp_dout(dpp, 0) << "ERROR: Vault request failed authorization" << dendl;
return -EACCES;
}
+ if (res < 0) {
+ ldpp_dout(dpp, 0) << "ERROR: Request to Vault failed with error " << res << dendl;
+ return res;
+ }
ldpp_dout(dpp, 20) << "Request to Vault returned " << res << " and HTTP status "
<< secret_req.get_http_status() << dendl;
secret_req.append_header("X-Auth-Token", barbican_token);
res = secret_req.process(y);
- if (res < 0) {
- return res;
- }
+ // map 401 to EACCES instead of EPERM
if (secret_req.get_http_status() ==
RGWHTTPTransceiver::HTTP_STATUS_UNAUTHORIZED) {
return -EACCES;
}
+ if (res < 0) {
+ return res;
+ }
if (secret_req.get_http_status() >=200 &&
secret_req.get_http_status() < 300 &&