Skip to content

Commit

Permalink
Merge pull request #2997 from MichaelMenge/allow-special-use-subfolde…
Browse files Browse the repository at this point in the history
…r-master

Add option to allow special-use subfolders
  • Loading branch information
elliefm committed Aug 28, 2024
2 parents e5b73a5 + 066d52d commit 7f96c17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -7013,8 +7013,8 @@ static void cmd_create(char *tag, char *name, struct dlist *extargs, int localon
}
use = dlist_getchild(extargs, "USE");
if (use) {
/* only user mailboxes can have specialuse, and they must be user toplevel folders */
if (!mbname_userid(mbname) || strarray_size(mbname_boxes(mbname)) != 1) {
/* only user mailboxes can have specialuse, and if allowspecialusesubfolders is not enabled they must be user toplevel folders */
if (!mbname_userid(mbname) || (!config_getswitch(IMAPOPT_ALLOWSPECIALUSESUBFOLDER ) && strarray_size(mbname_boxes(mbname)) != 1)) {
r = IMAP_MAILBOX_SPECIALUSE;
goto err;
}
Expand Down
4 changes: 2 additions & 2 deletions imap/mboxlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2550,8 +2550,8 @@ static int _rename_check_specialuse(const char *oldname, const char *newname)
strarray_t *check = strarray_split(protect, NULL, STRARRAY_TRIM);
strarray_t *uses = strarray_split(buf_cstring(&attrib), NULL, 0);
if (strarray_intersect_case(uses, check)) {
/* then target must be a single-depth mailbox too */
if (strarray_size(mbname_boxes(new)) != 1)
/* then if allowspecialusesubfolders is not enabled the target must be a single-depth mailbox too */
if (!config_getswitch(IMAPOPT_ALLOWSPECIALUSESUBFOLDER) && strarray_size(mbname_boxes(new)) != 1)
r = IMAP_MAILBOX_SPECIALUSE;
/* and have a userid as well */
if (!mbname_userid(new))
Expand Down
8 changes: 8 additions & 0 deletions lib/imapoptions
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ are listed with ``<none>''.
/* Defaults to enabled. If disabled, disallows the use of the SETACL
command at all via IMAP. */

{ "allowspecialusesubfolder", 0, SWITCH, "UNRELEASED" }
/* If enabled, allows special-use folders to be moved into subfolders
.PP
By default, cyrus does not allow a special-use folder to be moved or
renamed if the new folder is not a direct folder of the users INBOX.
This was implemented to prevent clients renaming Sent to Trash/Sent,
which would confused other clients. */

{ "allowusermoves", 0, SWITCH, "2.3.17" }
/* Allow moving user accounts (with associated meta-data) via RENAME
or XFER.
Expand Down

0 comments on commit 7f96c17

Please sign in to comment.