From: lu.shasha Date: Wed, 20 Sep 2017 03:09:15 +0000 (+0800) Subject: rgw:lc return error if expiration_date is not midnight in Lifecycleconfiguration xml X-Git-Tag: v13.0.1~598^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=45216cc64e8dc74974dfbd65bc710c99b564db4c;p=ceph.git rgw:lc return error if expiration_date is not midnight in Lifecycleconfiguration xml According to S3, expiration_date must be midnight. Signed-off-by: Shasha Lu --- diff --git a/src/rgw/rgw_lc_s3.cc b/src/rgw/rgw_lc_s3.cc index b03c4c32b9ef..ee19bff72a23 100644 --- a/src/rgw/rgw_lc_s3.cc +++ b/src/rgw/rgw_lc_s3.cc @@ -32,7 +32,12 @@ bool LCExpiration_S3::xml_end(const char * el) { } else { date = lc_date->get_data(); //We need return xml error according to S3 - if (boost::none == ceph::from_iso_8601(date)) { + boost::optional expiration_date = ceph::from_iso_8601(date); + if (boost::none == expiration_date) { + return false; + } + struct timespec expiration_time = ceph::real_clock::to_timespec(*expiration_date); + if (expiration_time.tv_sec % (24*60*60) || expiration_time.tv_nsec) { return false; } }