rgw: calc md5 and compare if user provided appropriate header

Fixes: #8436
Backport: firefly

This was broken in ddc2e1a8e3. The fix
resurrects and old check that was dropped.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Yehuda Sadeh 2014-05-23 14:58:54 -07:00 committed by Sage Weil
parent 26cd37cf8e
commit 9c56c86bda

View File

@ -1585,6 +1585,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));
@ -1703,6 +1705,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);