From 4c8a5cedcb7942e1e01ab4cedfbf03e4c56cc1e4 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 12 Dec 2014 05:24:01 -0800 Subject: [PATCH] rgw: change multipart upload id magic Fixes: #10271 Backport: firefly, giant Some clients can't sign requests correctly with the original magic prefix. Reported-by: Georgios Dimitrakakis Signed-off-by: Yehuda Sadeh (cherry picked from commit 5fc7a0be67a03ed63fcc8408f8d71a31a1841076) --- src/rgw/rgw_op.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 7522fc52a5324..2ada0e678663a 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -35,7 +35,8 @@ using ceph::crypto::MD5; static string mp_ns = RGW_OBJ_NS_MULTIPART; static string shadow_ns = RGW_OBJ_NS_SHADOW; -#define MULTIPART_UPLOAD_ID_PREFIX "2/" // must contain a unique char that may not come up in gen_rand_alpha() +#define MULTIPART_UPLOAD_ID_PREFIX_LEGACY "2/" +#define MULTIPART_UPLOAD_ID_PREFIX "2~" // must contain a unique char that may not come up in gen_rand_alpha() class MultipartMetaFilter : public RGWAccessListFilter { public: @@ -1447,7 +1448,8 @@ static bool is_v2_upload_id(const string& upload_id) { const char *uid = upload_id.c_str(); - return (strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX, sizeof(MULTIPART_UPLOAD_ID_PREFIX) - 1) == 0); + return (strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX, sizeof(MULTIPART_UPLOAD_ID_PREFIX) - 1) == 0) || + (strncmp(uid, MULTIPART_UPLOAD_ID_PREFIX_LEGACY, sizeof(MULTIPART_UPLOAD_ID_PREFIX_LEGACY) - 1) == 0); } int RGWPutObjProcessor_Multipart::do_complete(string& etag, time_t *mtime, time_t set_mtime, map& attrs) @@ -2539,7 +2541,7 @@ void RGWInitMultipart::execute() do { char buf[33]; gen_rand_alphanumeric(s->cct, buf, sizeof(buf) - 1); - upload_id = "2/"; /* v2 upload id */ + upload_id = MULTIPART_UPLOAD_ID_PREFIX; /* v2 upload id */ upload_id.append(buf); string tmp_obj_name; -- 2.39.5