]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_cksum: treat mpu checksums w/o part count as valid in CompleteMultipart 60309/head
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 14 Oct 2024 20:30:18 +0000 (16:30 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 14 Oct 2024 20:58:31 +0000 (16:58 -0400)
Apparently, AWS accepts this and Minio's current golang SDK relies
on it.

Fixes: https://tracker.ceph.com/issues/68537
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_op.cc

index 67829e6320a6ea73fd4689ab01c6fba42c41b47d..0dcf1e0f7d5486568195a8da8a2925226fccdbfd 100644 (file)
@@ -6811,6 +6811,8 @@ void RGWCompleteMultipart::execute(optional_yield y)
   if (upload->cksum_type != rgw::cksum::Type::none) {
     op_ret = try_sum_part_cksums(this, s->cct, upload.get(), parts, cksum, y);
     if (op_ret < 0) {
+      ldpp_dout(this, 16) << "ERROR: try_sum_part_cksums failed, obj="
+                         << meta_obj << " ret=" << op_ret << dendl;
       return;
     }
   }
@@ -6835,13 +6837,23 @@ void RGWCompleteMultipart::execute(optional_yield y)
       rgw::putobj::find_hdr_cksum(*(s->info.env));
 
       ldpp_dout_fmt(this, 10,
-                   "INFO: client supplied checksum {}: {}",
+                   "INFO: client supplied checksum {}: {} ",
                    hdr_cksum.header_name(), supplied_cksum);
 
     if (! (supplied_cksum.empty()) &&
        (supplied_cksum != armored_cksum)) {
-      op_ret = -ERR_INVALID_REQUEST;
-      return;
+      /* some minio SDK clients assert a checksum that is cryptographically
+       * valid but omits the part count */
+      auto parts_suffix = fmt::format("-{}", parts->parts.size());
+      auto suffix_len = armored_cksum->size() - parts_suffix.size();
+      if (armored_cksum->compare(0, suffix_len, supplied_cksum) != 0) {
+       ldpp_dout_fmt(this, 4,
+                     "{} content checksum mismatch"
+                     "\n\tcalculated={} != \n\texpected={}",
+                     hdr_cksum.header_name(), armored_cksum, supplied_cksum);
+       op_ret = -ERR_INVALID_REQUEST;
+       return;
+      }
     }
 
     buffer::list cksum_bl;