]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw:lc return error if expiration_date is not midnight in Lifecycleconfiguration xml
authorlu.shasha <lu.shasha@eisoo.com>
Wed, 20 Sep 2017 03:09:15 +0000 (11:09 +0800)
committerlu.shasha <lu.shasha@eisoo.com>
Wed, 20 Sep 2017 09:29:53 +0000 (17:29 +0800)
According to S3, expiration_date must be midnight.

Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
src/rgw/rgw_lc_s3.cc

index b03c4c32b9efa5d9b19397de49066a023a156750..ee19bff72a230ddf2352e55d140e4345ee011957 100644 (file)
@@ -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<ceph::real_time> 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;
     }
   }