From: Radoslaw Zarzynski Date: Wed, 13 May 2015 14:37:46 +0000 (+0200) Subject: rgw: verify Swift object lifetime at POST. X-Git-Tag: v9.1.0~229^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=478b14ee99cf560d71cc8e4baca831955f5b196a;p=ceph.git rgw: verify Swift object lifetime at POST. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 0c76f1581bb6..3078e4197904 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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); diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 61d8c019fef5..8781faeff461 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -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 { diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h index a2838c784717..55b41bbc4e4a 100644 --- a/src/rgw/rgw_rest_swift.h +++ b/src/rgw/rgw_rest_swift.h @@ -115,6 +115,7 @@ public: int get_params(); void send_response(); + bool need_object_expiration() { return true; } }; class RGWDeleteObj_ObjStore_SWIFT : public RGWDeleteObj_ObjStore {