return RGWPostObj_ObjStore::init(store, s, dialect_handler);
}
+bool RGWFormPost::is_expired(const std::string& expires)
+{
+ string err;
+ const utime_t now = ceph_clock_now(g_ceph_context);
+ const uint64_t expiration = (uint64_t)strict_strtoll(expires.c_str(),
+ 10, &err);
+ if (!err.empty()) {
+ dout(5) << "failed to parse temp_url_expires: " << err << dendl;
+ return true;
+ }
+
+ if (expiration <= (uint64_t)now.sec()) {
+ dout(5) << "temp url expired: " << expiration << " <= " << now.sec() << dendl;
+ return true;
+ }
+
+ return false;
+}
+
int RGWFormPost::get_params()
{
/* The parentt class extracts boundary info from the Content-Type. */
}
} while (! stream_done);
+ std::string expires;
+ if (part_str("expires", &expires) && is_expired(expires)) {
+ err_msg = "FormPost: Form Expired";
+ return -EACCES;
+ }
+
return ! current_data_part ? -EINVAL : 0;
}
void RGWFormPost::send_response()
{
set_req_state_err(s, op_ret);
+ s->err.s3_code = err_msg;
dump_errno(s);
end_header(s, this);
}
class RGWFormPost : public RGWPostObj_ObjStore {
std::string get_current_filename() const override;
bool is_next_file_to_upload() override;
+ static bool is_expired(const std::string& expires);
boost::optional<post_form_part> current_data_part;
std::string prefix;