Merge pull request #28172 from joke-lee/rgw-sts-bad-token

rgw: fix rgw crash and set correct error code

Reviewed-by: Matt Benjamin <mbenjamin@redhat.com>
Reviewed-by: Pritha Srivastava <prsrivas@redhat.com>
This commit is contained in:
Casey Bodley 2019-06-20 13:10:31 -04:00 committed by GitHub
commit 891fc11670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4614,9 +4614,14 @@ rgw::auth::s3::STSEngine::get_session_token(const DoutPrefixProvider* dpp, const
ldpp_dout(dpp, 0) << "ERROR: Decryption failed: " << error << dendl;
return -EPERM;
} else {
dec_output.append('\0');
auto iter = dec_output.cbegin();
decode(token, iter);
try {
dec_output.append('\0');
auto iter = dec_output.cbegin();
decode(token, iter);
} catch (const buffer::error& e) {
ldout(cct, 0) << "ERROR: decode SessionToken failed: " << error << dendl;
return -EINVAL;
}
}
return 0;
}