]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix crash in swift CORS preflight request
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 29 Jul 2014 22:25:47 +0000 (15:25 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Sat, 2 Aug 2014 20:20:27 +0000 (13:20 -0700)
Fixes: #8586
This fixes error handling, in accordance with commit 6af5a537 that fixed
the same issue for the S3 case.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 18ea2a869791b4894f93fdafde140285f2e4fb65)

src/rgw/rgw_rest_swift.cc

index 507a7ffc3ea1427ff95f98c9ae2e1dba42d0f23b..b56207934f69cae50b1a075bfec4d9e4cb6d80da 100644 (file)
@@ -627,18 +627,16 @@ void RGWOptionsCORS_ObjStore_SWIFT::send_response()
   uint32_t max_age = CORS_MAX_AGE_INVALID;
   /*EACCES means, there is no CORS registered yet for the bucket
    *ENOENT means, there is no match of the Origin in the list of CORSRule
-   *ENOTSUPP means, the HTTP_METHOD is not supported
    */
   if (ret == -ENOENT)
     ret = -EACCES;
-  if (ret != -EACCES) {
-    get_response_params(hdrs, exp_hdrs, &max_age);
-  } else {
+  if (ret < 0) {
     set_req_state_err(s, ret);
     dump_errno(s);
     end_header(s, NULL);
     return;
   }
+  get_response_params(hdrs, exp_hdrs, &max_age);
   dump_errno(s);
   dump_access_control(s, origin, req_meth, hdrs.c_str(), exp_hdrs.c_str(), max_age); 
   end_header(s, NULL);