]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: verify Swift object lifetime at POST.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 13 May 2015 14:37:46 +0000 (16:37 +0200)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 27 Aug 2015 18:52:13 +0000 (11:52 -0700)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_swift.h

index 0c76f1581bb6bfc8b77d1e16d83a3e441ef0df5b..3078e4197904d951fc5732a64b263a8eca7e42eb 100644 (file)
@@ -2362,6 +2362,13 @@ void RGWPutMetadataObject::execute()
     return;
   }
 
+  /* Check whether the object has expired. Swift API documentation
+   * stands that we should return 404 Not Found in such case. */
+  if (need_object_expiration() && object_is_expired(orig_attrs)) {
+    ret = -ENOENT;
+    return;
+  }
+
   /* Filter currently existing attributes. */
   prepare_add_del_attrs(orig_attrs, attrs, rmattrs);
   populate_with_generic_attrs(s, attrs);
index 61d8c019fef5a21ec5ad20d5963118cb06a5225e..8781faeff46137b697c436462d9c81ba1dc06e0f 100644 (file)
@@ -599,6 +599,7 @@ public:
   virtual const string name() { return "put_obj_metadata"; }
   virtual RGWOpType get_type() { return RGW_OP_PUT_METADATA_OBJECT; }
   virtual uint32_t op_mask() { return RGW_OP_TYPE_WRITE; }
+  virtual bool need_object_expiration() { return false; }
 };
 
 class RGWDeleteObj : public RGWOp {
index a2838c7847170bb9cc69d798bc1e8e6fa28de47f..55b41bbc4e4a06d86d1ee25dab039110fd45b2a8 100644 (file)
@@ -115,6 +115,7 @@ public:
 
   int get_params();
   void send_response();
+  bool need_object_expiration() { return true; }
 };
 
 class RGWDeleteObj_ObjStore_SWIFT : public RGWDeleteObj_ObjStore {