Skip to content

Commit

Permalink
rgw: calc md5 and compare if user provided appropriate header
Browse files Browse the repository at this point in the history
Fixes: ceph#8436
Backport: firefly

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

Signed-off-by: Yehuda Sadeh <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
yehudasa authored and Sage Weil committed May 30, 2014
1 parent 26cd37c commit 9c56c86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9c56c86

Please sign in to comment.