From: Yehuda Sadeh Date: Fri, 23 May 2014 21:58:54 +0000 (-0700) Subject: rgw: calc md5 and compare if user provided appropriate header X-Git-Tag: v0.67.10~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=64d5c406995bedbb6a4bc9c851f5d25fe94749ee;p=ceph.git rgw: calc md5 and compare if user provided appropriate header Fixes: #8436 Backport: firefly This was broken in ddc2e1a8e39a5c6b9b224c3eebd1c0e762ca5782. The fix resurrects and old check that was dropped. Signed-off-by: Yehuda Sadeh Reviewed-by: Sage Weil (cherry picked from commit 9c56c86bdac6bcb8e76c3f04e7d393e4eaadd721) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 3c967664cca..5bdbb9d3177 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1436,6 +1436,8 @@ void RGWPutObj::execute() goto done; if (supplied_md5_b64) { + need_calc_md5 = true; + ldout(s->cct, 15) << "supplied_md5_b64=" << supplied_md5_b64 << dendl; ret = ceph_unarmor(supplied_md5_bin, &supplied_md5_bin[CEPH_CRYPTO_MD5_DIGESTSIZE + 1], supplied_md5_b64, supplied_md5_b64 + strlen(supplied_md5_b64)); @@ -1539,6 +1541,11 @@ void RGWPutObj::execute() buf_to_hex(m, CEPH_CRYPTO_MD5_DIGESTSIZE, calc_md5); etag = calc_md5; + + if (supplied_md5_b64 && strcmp(calc_md5, supplied_md5)) { + ret = -ERR_BAD_DIGEST; + goto done; + } } policy.encode(aclbl);