]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: change multipart upload id magic
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Dec 2014 13:24:01 +0000 (05:24 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Fri, 16 Jan 2015 22:42:52 +0000 (14:42 -0800)
Fixes: #10271
Backport: firefly, giant

Some clients can't sign requests correctly with the original magic
prefix.

Reported-by: Georgios Dimitrakakis <giorgis@acmac.uoc.gr>
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 5fc7a0be67a03ed63fcc8408f8d71a31a1841076)

src/rgw/rgw_op.cc

index 7522fc52a5324790ba190ac739c6ff21183af359..2ada0e678663ae4a2b377598c06428beb0f26b00 100644 (file)
@@ -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<string, bufferlist>& 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;