]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: object lock uses 64-bit encoding for RetainUntilDate
authorCasey Bodley <cbodley@redhat.com>
Wed, 15 Nov 2023 21:24:47 +0000 (16:24 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 24 Nov 2023 00:16:38 +0000 (19:16 -0500)
the default encoding of ceph::real_time truncates seconds to uint32_t,
so stores the wrong timestamp for object lock enforcement

Fixes: https://tracker.ceph.com/issues/63537
Signed-off-by: Casey Bodley <cbodley@redhat.com>
PendingReleaseNotes
src/rgw/rgw_object_lock.h

index 9acda3d64e14576f2a0234a98d496060301f2642..9b3dfede8bbd7cfef37a13d9a75138c353ea266a 100644 (file)
@@ -69,6 +69,14 @@ CephFS: Disallow delegating preallocated inode ranges to clients. Config
   in the kclient.
 * S3 Get/HeadObject now support query parameter `partNumber` to read a specific
   part of a completed multipart upload.
+* RGW: Fixed a S3 Object Lock bug with PutObjectRetention requests that specify
+  a RetainUntilDate after the year 2106. This date was truncated to 32 bits when
+  stored, so a much earlier date was used for object lock enforcement. This does
+  not effect PutBucketObjectLockConfiguration where a duration is given in Days.
+  The RetainUntilDate encoding is fixed for new PutObjectRetention requests, but
+  cannot repair the dates of existing object locks. Such objects can be identified
+  with a HeadObject request based on the x-amz-object-lock-retain-until-date
+  response header.
 
 >=18.0.0
 
index 022aef8d45ab37853091cae3fcbe3d6959032d60..7c6b9cf612bcc80f7933e12e29c82cfb78e03eec 100644 (file)
@@ -174,16 +174,20 @@ public:
   }
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(1, 1, bl);
+    ENCODE_START(2, 1, bl);
     encode(mode, bl);
     encode(retain_until_date, bl);
+    ceph::round_trip_encode(retain_until_date, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::const_iterator& bl) {
-    DECODE_START(1, bl);
+    DECODE_START(2, bl);
     decode(mode, bl);
     decode(retain_until_date, bl);
+    if (struct_v >= 2) {
+      ceph::round_trip_decode(retain_until_date, bl);
+    }
     DECODE_FINISH(bl);
   }