Skip to content
Permalink
Browse files

mboxname: crossdomains_onlyother config option - keep existing behaviour

  • Loading branch information
brong committed Feb 26, 2016
1 parent 2c932cc commit bcd8235a04687b099c2e299d822d6ed19e021fcc
Showing with 20 additions and 4 deletions.
  1. +16 −4 imap/mboxname.c
  2. +4 −0 lib/imapoptions
@@ -487,6 +487,7 @@ EXPORTED mbname_t *mbname_from_intname(const char *intname)
EXPORTED mbname_t *mbname_from_extname(const char *extname, const struct namespace *ns, const char *userid)
{
int crossdomains = config_getswitch(IMAPOPT_CROSSDOMAINS) && !ns->isadmin;
int cdother = config_getswitch(IMAPOPT_CROSSDOMAINS_ONLYOTHER);
/* old-school virtdomains requires admin to be a different domain than the userid */
int admindomains = config_virtdomains && ns->isadmin;

@@ -563,6 +564,9 @@ EXPORTED mbname_t *mbname_from_extname(const char *extname, const struct namespa
if (strcmpsafe(p+1, config_defdomain))
mbname->domain = xstrdup(p+1);
}
else if (cdother) {
mbname->domain = xstrdupnull(mbname_domain(userparts));
}
/* otherwise it must be in defdomain. Domains are
* always specified in crossdomains */
}
@@ -624,6 +628,9 @@ EXPORTED mbname_t *mbname_from_extname(const char *extname, const struct namespa
if (strcmpsafe(p+1, config_defdomain))
mbname->domain = xstrdup(p+1);
}
else if (cdother) {
mbname->domain = xstrdupnull(mbname_domain(userparts));
}
}
goto done;
}
@@ -841,6 +848,7 @@ static void _append_nodots(const struct namespace *ns, struct buf *buf, const ch
EXPORTED const char *mbname_extname(const mbname_t *mbname, const struct namespace *ns, const char *userid)
{
int crossdomains = config_getswitch(IMAPOPT_CROSSDOMAINS) && !ns->isadmin;
int cdother = config_getswitch(IMAPOPT_CROSSDOMAINS_ONLYOTHER);
/* old-school virtdomains requires admin to be a different domain than the userid */
int admindomains = config_virtdomains && ns->isadmin;

@@ -901,8 +909,10 @@ EXPORTED const char *mbname_extname(const mbname_t *mbname, const struct namespa
if (crossdomains) {
const char *domain = mbname_domain(mbname);
if (!domain) domain = config_defdomain;
buf_putc(&buf, '@');
_append_nodots(ns, &buf, domain);
if (!cdother || strcmpsafe(domain, mbname_domain(userparts))) {
buf_putc(&buf, '@');
_append_nodots(ns, &buf, domain);
}
}
int i;
for (i = 0; i < strarray_size(boxes); i++) {
@@ -975,8 +985,10 @@ EXPORTED const char *mbname_extname(const mbname_t *mbname, const struct namespa
if (crossdomains) {
const char *domain = mbname_domain(mbname);
if (!domain) domain = config_defdomain;
buf_putc(&buf, '@');
_append_nodots(ns, &buf, domain);
if (!cdother || strcmpsafe(domain, mbname_domain(userparts))) {
buf_putc(&buf, '@');
_append_nodots(ns, &buf, domain);
}
}
/* shared folders can ONLY be in the same domain except for admin */
else if (!admindomains && strcmpsafe(mbname_domain(mbname), mbname_domain(userparts)))
@@ -570,6 +570,10 @@ Blank lines and lines beginning with ``#'' are ignored.
/* Enable cross domain sharing. This works best with alt namespace and
unix hierarchy separators on, so you get Other Users/foo@example.com/... */

{ "crossdomains_onlyother", 0, SWITCH }
/* only show the domain for users in other domains than your own (for
backwards compatibility if you're already sharing */

{ "davdriveprefix", "#drive", STRING }
/* The prefix for the DAV storage mailboxes hierarchies. The hierarchy
delimiter will be automatically appended. The public storage

0 comments on commit bcd8235

Please sign in to comment.
You can’t perform that action at this time.