From: Matt Benjamin Date: Mon, 8 Aug 2016 14:18:35 +0000 (-0400) Subject: rgw file: refuse to rename directories X-Git-Tag: v10.2.4~98^2~20 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f16ac90f9c097352de2763215f0c83812503e815;p=ceph.git rgw file: refuse to rename directories The representation of paths as an aggregate involving any number of objects argues against ever permitting such operations. Signed-off-by: Matt Benjamin (cherry picked from commit 297220fd2a96c0cf34701127b8cf724e24e6865f) --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 525062cdb12a9..538b05f7842e7 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -298,6 +298,18 @@ namespace rgw { goto out; } + /* forbid renaming of directories (unreasonable at scale) */ + if (rgw_fh->is_dir()) { + ldout(get_context(), 12) << __func__ + << " rejecting attempt to rename directory path=" + << rgw_fh->full_object_name() + << dendl; + rgw_fh->mtx.unlock(); /* !LOCKED */ + unref(rgw_fh); /* -ref */ + rc = -EPERM; + goto out; + } + for (int ix : {0, 1}) { switch (ix) { case 0: