]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_lc_s3.cc
update sources to v12.1.1
[ceph.git] / ceph / src / rgw / rgw_lc_s3.cc
index eb58a0c9f4108c5c76e59f76a901d681f0d8b66f..ea64847a0c733af1ca0eef4583cce7a3812fdc95 100644 (file)
@@ -16,8 +16,10 @@ using namespace std;
 bool LCExpiration_S3::xml_end(const char * el) {
   LCDays_S3 *lc_days = static_cast<LCDays_S3 *>(find_first("Days"));
   LCDeleteMarker_S3 *lc_dm = static_cast<LCDeleteMarker_S3 *>(find_first("ExpiredObjectDeleteMarker"));
+  LCDate_S3 *lc_date = static_cast<LCDate_S3 *>(find_first("Date"));
 
-  if ((!lc_days && !lc_dm) || (lc_days && lc_dm)) {
+  if ((!lc_days && !lc_dm && !lc_date) || (lc_days && lc_dm) 
+      || (lc_days && lc_date) || (lc_dm && lc_date)) {
     return false;
   }
   if (lc_days) {
@@ -27,6 +29,12 @@ bool LCExpiration_S3::xml_end(const char * el) {
     if (!dm_expiration) {
       return false;
     }
+  } else {
+    date = lc_date->get_data();
+    //We need return xml error according to S3
+    if (boost::none == ceph::from_iso_8601(date)) {
+      return false;
+    }
   }
   return true;
 }
@@ -96,8 +104,10 @@ bool LCRule_S3::xml_end(const char *el) {
     return false;
   } else {
     if (lc_expiration) {
-      if (!lc_expiration->empty()) {
+      if (lc_expiration->has_days()) {
         expiration.set_days(lc_expiration->get_days_str());
+      } else if (lc_expiration->has_date()) {
+        expiration.set_date(lc_expiration->get_date());
       } else {
         dm_expiration = lc_expiration->get_dm_expiration();
       }
@@ -119,7 +129,7 @@ void LCRule_S3::to_xml(CephContext *cct, ostream& out) {
   out << "<Prefix>" << prefix << "</Prefix>";
   out << "<Status>" << status << "</Status>";
   if (!expiration.empty() || dm_expiration) {
-    LCExpiration_S3 expir(expiration.get_days_str(), dm_expiration);
+    LCExpiration_S3 expir(expiration.get_days_str(), expiration.get_date(), dm_expiration);
     expir.to_xml(out);
   }
   if (!noncur_expiration.empty()) {
@@ -143,7 +153,7 @@ int RGWLifecycleConfiguration_S3::rebuild(RGWRados *store, RGWLifecycleConfigura
     if (ret < 0)
       return ret;
   }
-  if (!dest.validate()) {
+  if (!dest.valid()) {
     ret = -ERR_INVALID_REQUEST;
   }
   return ret;
@@ -178,6 +188,8 @@ XMLObj *RGWLCXMLParser_S3::alloc_obj(const char *el)
     obj = new LCExpiration_S3();
   } else if (strcmp(el, "Days") == 0) {
     obj = new LCDays_S3();
+  } else if (strcmp(el, "Date") == 0) {
+    obj = new LCDate_S3();
   } else if (strcmp(el, "ExpiredObjectDeleteMarker") == 0) {
     obj = new LCDeleteMarker_S3();
   } else if (strcmp(el, "NoncurrentVersionExpiration") == 0) {