From: Casey Bodley Date: Wed, 28 Jun 2023 18:42:16 +0000 (-0400) Subject: rgw: rgwx-skip-decrypt also skips decompression of encrypted objects X-Git-Tag: v18.1.3~40^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0f395ac87a197dd15ad2bbe957c0288b5ca28244;p=ceph-ci.git rgw: rgwx-skip-decrypt also skips decompression of encrypted objects compression is applied before encryption. so if we skip decryption, we can't decompress either Fixes: https://tracker.ceph.com/issues/57905 Signed-off-by: Casey Bodley (cherry picked from commit 8d35759eb8edcc7cd15e6fd67b91da637fc477ae) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 68444bdb0c5..b9715e6b2bd 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2199,8 +2199,9 @@ void RGWGetObj::execute(optional_yield y) gc_invalidate_time = ceph_clock_now(); gc_invalidate_time += (s->cct->_conf->rgw_gc_obj_min_wait / 2); - bool need_decompress; - int64_t ofs_x, end_x; + bool need_decompress = false; + int64_t ofs_x = 0, end_x = 0; + bool encrypted = false; RGWGetObj_CB cb(this); RGWGetObj_Filter* filter = (RGWGetObj_Filter *)&cb; @@ -2303,11 +2304,17 @@ void RGWGetObj::execute(optional_yield y) ldpp_dout(this, 0) << "ERROR: failed to decode compression info, cannot decompress" << dendl; goto done_err; } - if (need_decompress) { - s->obj_size = cs_info.orig_size; - s->object->set_obj_size(cs_info.orig_size); - decompress.emplace(s->cct, &cs_info, partial_content, filter); - filter = &*decompress; + + // where encryption and compression are combined, compression was applied to + // the data before encryption. if the system header rgwx-skip-decrypt is + // present, we have to skip the decompression filter too + encrypted = attrs.count(RGW_ATTR_CRYPT_MODE); + + if (need_decompress && (!encrypted || !skip_decrypt)) { + s->obj_size = cs_info.orig_size; + s->object->set_obj_size(cs_info.orig_size); + decompress.emplace(s->cct, &cs_info, partial_content, filter); + filter = &*decompress; } attr_iter = attrs.find(RGW_ATTR_OBJ_REPLICATION_TRACE);