Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/rgw/rgw_auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ rgw::auth::Strategy::apply(const DoutPrefixProvider *dpp, const rgw::auth::Strat
* nullptr inside. */
ldpp_dout(dpp, 5) << "Failed the auth strategy, reason="
<< result.get_reason() << dendl;
//Special handling for expired pre-signed URL
if (result.get_reason() == ERR_PRESIGNED_URL_EXPIRED) {
result = result_t::deny(-EPERM);
set_req_state_err(s, -EPERM, "The pre-signed URL has expired");
}
return result.get_reason();
}

Expand Down
6 changes: 3 additions & 3 deletions src/rgw/rgw_auth_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ static inline int parse_v4_query_string(const req_info& info, /* in
you can set is 1, and the maximum is 604800 (seven days) */
time_t exp = atoll(expires.data());
if ((exp < 1) || (exp > 7*24*60*60)) {
dout(10) << "NOTICE: exp out of range, exp = " << exp << dendl;
dout(10) << "ERROR: exp out of range, exp = " << exp << dendl;
return -EPERM;
}
/* handle expiration in epoch time */
uint64_t req_sec = (uint64_t)internal_timegm(&date_t);
uint64_t now = ceph_clock_now();
if (now >= req_sec + exp) {
dout(10) << "NOTICE: now = " << now << ", req_sec = " << req_sec << ", exp = " << exp << dendl;
return -EPERM;
dout(10) << "ERROR: presigned URL has expired, now = " << now << ", req_sec = " << req_sec << ", exp = " << exp << dendl;
return -ERR_PRESIGNED_URL_EXPIRED;
}

signedheaders = info.args.get("x-amz-signedheaders");
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ static inline const char* to_mime_type(const RGWFormat f)
#define ERR_OBJECT_NOT_APPENDABLE 2220
#define ERR_INVALID_BUCKET_STATE 2221
#define ERR_INVALID_OBJECT_STATE 2222
#define ERR_PRESIGNED_URL_EXPIRED 2223

#define ERR_BUSY_RESHARDING 2300
#define ERR_NO_SUCH_ENTITY 2301
Expand Down