Skip to content

Commit

Permalink
rgw file: refuse to rename directories
Browse files Browse the repository at this point in the history
The representation of paths as an aggregate involving any
number of objects argues against ever permitting such
operations.

Signed-off-by: Matt Benjamin <[email protected]>
  • Loading branch information
mattbenjamin committed Aug 8, 2016
1 parent 34224ec commit 297220f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rgw/rgw_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 297220f

Please sign in to comment.