dovecot-1.2: shared mailboxes: If only %%n is specified in prefi...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 20 21:32:33 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/518963e8a20d
changeset: 9233:518963e8a20d
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 20 14:32:25 2009 -0400
description:
shared mailboxes: If only %%n is specified in prefix, default to current user's domain.
diffstat:
1 file changed, 16 insertions(+), 11 deletions(-)
src/lib-storage/index/shared/shared-storage.c | 27 ++++++++++++++-----------
diffs (44 lines):
diff -r f57f9dab059b -r 518963e8a20d src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c Fri Jul 17 18:57:48 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c Mon Jul 20 14:32:25 2009 -0400
@@ -192,17 +192,8 @@ int shared_storage_get_namespace(struct
}
/* successfully matched the name. */
- if (userdomain == NULL) {
- if (username == NULL) {
- /* trying to open namespace "shared/domain"
- namespace prefix. */
- mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name));
- return -1;
- }
- userdomain = domain == NULL ? username :
- t_strconcat(username, "@", domain, NULL);
- } else {
+ if (userdomain != NULL) {
+ /* user at domain given */
domain = strchr(userdomain, '@');
if (domain == NULL)
username = userdomain;
@@ -210,6 +201,20 @@ int shared_storage_get_namespace(struct
username = t_strdup_until(userdomain, domain);
domain++;
}
+ } else if (username == NULL) {
+ /* trying to open namespace "shared/domain"
+ namespace prefix. */
+ mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name));
+ return -1;
+ } else {
+ if (domain == NULL) {
+ /* no domain given, use ours (if we have one) */
+ domain = strchr(user->username, '@');
+ if (domain != NULL) domain++;
+ }
+ userdomain = domain == NULL ? username :
+ t_strconcat(username, "@", domain, NULL);
}
if (*userdomain == '\0') {
mail_storage_set_error(_storage, MAIL_ERROR_PARAMS,
More information about the dovecot-cvs
mailing list