Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 71
View file
cyrus-imapd.spec
Changed
@@ -38,7 +38,7 @@ Name: cyrus-imapd Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support Version: 2.5 -Release: 0.1.dev20140724%{?dist} +Release: 0.1.dev%(date +%Y%m%d)%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.cyrusimap.org @@ -66,7 +66,7 @@ ## Patches ## -Patch9999: cyrus-imapd-mupdate-work.patch +Patch0001: cyrus-imapd-2.5-default-twoskip.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -250,7 +250,7 @@ %prep %setup -q -n %{_name}-%{real_version}%{?dot_snapshot_version} -#%patch9999 -p1 +#%patch0001 -p1 # only to update config.* files aclocal -I cmulocal
View file
cyrus-imapd-2.5-default-twoskip.patch
Added
@@ -0,0 +1,80 @@ +diff --git a/lib/imapoptions b/lib/imapoptions +index 2c477a6..78c5f46 100644 +--- a/lib/imapoptions ++++ b/lib/imapoptions +@@ -163,7 +163,7 @@ are listed with ``<none>''. + affect LMTP delivery of messages directly to mailboxes via + plus-addressing. */ + +-{ "annotation_db", "skiplist", STRINGLIST("berkeley", "berkeley-hash", "skiplist", "twoskip")} ++{ "annotation_db", "twoskip", STRINGLIST("berkeley", "berkeley-hash", "skiplist", "twoskip")} + /* The cyrusdb backend to use for mailbox annotations. */ + + { "annotation_db_path", NULL, STRING } +@@ -413,7 +413,7 @@ Blank lines and lines beginning with ``#'' are ignored. + session. Otherwise, the missing mailbox is treated as empty while + in use by the client.*/ + +-{ "duplicate_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} ++{ "duplicate_db", "twoskip", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} + /* The cyrusdb backend to use for the duplicate delivery suppression + and sieve. */ + +@@ -841,10 +841,10 @@ Blank lines and lines beginning with ``#'' are ignored. + { "maxword", 131072, INT } + /* Maximum size of a single word for the parser. Default 128k */ + +-{ "mboxkey_db", "skiplist", STRINGLIST("berkeley", "skiplist", "twoskip") } ++{ "mboxkey_db", "twoskip", STRINGLIST("berkeley", "skiplist", "twoskip") } + /* The cyrusdb backend to use for mailbox keys. */ + +-{ "mboxlist_db", "skiplist", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "sql", "twoskip")} ++{ "mboxlist_db", "twoskip", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "sql", "twoskip")} + /* The cyrusdb backend to use for the mailbox list. */ + + { "mboxlist_db_path", NULL, STRING } +@@ -1163,7 +1163,7 @@ And the notification message will be available on \fIstdin\fR. + /* Unix domain socket that ptloader listens on. + (defaults to configdir/ptclient/ptsock) */ + +-{ "ptscache_db", "skiplist", STRINGLIST("berkeley", "berkeley-hash", "skiplist", "twoskip")} ++{ "ptscache_db", "twoskip", STRINGLIST("berkeley", "berkeley-hash", "skiplist", "twoskip")} + /* The cyrusdb backend to use for the pts cache. */ + + { "ptscache_db_path", NULL, STRING } +@@ -1188,7 +1188,7 @@ And the notification message will be available on \fIstdin\fR. + /* This specifies the Class Selector or Differentiated Services Code Point + designation on IP headers (in the ToS field). */ + +-{ "quota_db", "quotalegacy", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "sql", "quotalegacy", "twoskip")} ++{ "quota_db", "twoskip", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "sql", "quotalegacy", "twoskip")} + /* The cyrusdb backend to use for quotas. */ + + { "quota_db_path", NULL, STRING } +@@ -1269,7 +1269,7 @@ And the notification message will be available on \fIstdin\fR. + recommended for most cases - it's a good compromise which + keeps words separate. */ + +-{ "seenstate_db", "skiplist", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "twoskip")} ++{ "seenstate_db", "twoskip", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "twoskip")} + /* The cyrusdb backend to use for the seen state. */ + + { "sendmail", "/usr/lib/sendmail", STRING } +@@ -1440,7 +1440,7 @@ product version in the capabilities */ + { "statuscache", 0, SWITCH } + /* Enable/disable the imap status cache. */ + +-{ "statuscache_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip") } ++{ "statuscache_db", "twoskip", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip") } + /* The cyrusdb backend to use for the imap status cache. */ + + { "statuscache_db_path", NULL, STRING } +@@ -1545,7 +1545,7 @@ product version in the capabilities */ + have filenames with the hashed value of the certificates (see + openssl(XXX)). */ + +-{ "tlscache_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} ++{ "tlscache_db", "twoskip", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} + /* The cyrusdb backend to use for the TLS cache. */ + + { "tlscache_db_path", NULL, STRING }
View file
cyrus-imapd-mupdate-work.patch
Deleted
@@ -1,1319 +0,0 @@ -diff --git a/imap/annotate.c b/imap/annotate.c -index 2dbac7a..a5c3a6d 100644 ---- a/imap/annotate.c -+++ b/imap/annotate.c -@@ -1183,6 +1183,7 @@ static int annotate_state_set_scope(annotate_state_t *state, - annotate_state_unset_scope(state); - - if (mbentry) { -+ assert(!uid); - if (!mailbox && !mbentry->server) { - /* local mailbox */ - r = mailbox_open_iwl(mbentry->name, &mailbox); -@@ -1190,11 +1191,21 @@ static int annotate_state_set_scope(annotate_state_t *state, - goto out; - state->mailbox_is_ours = 1; - } -- assert(mailbox); -+ -+ if (mailbox) { -+ syslog(LOG_DEBUG, "mailbox: %s (%s:%d)", mailbox->name, __FILE__, __LINE__); -+ } -+ -+ if (mbentry) { -+ syslog(LOG_DEBUG, "%s mbentry->server: %s (%s:%d)", mbentry->name, mbentry->server, __FILE__, __LINE__); -+ syslog(LOG_DEBUG, "%s mbentry->partition: %s (%s:%d)", mbentry->name, mbentry->partition, __FILE__, __LINE__); -+ } -+ -+ state->which = ANNOTATION_SCOPE_MAILBOX; - state->mbentry = mbentry; - } - -- if (uid) { -+ else if (uid) { - assert(mailbox); - state->which = ANNOTATION_SCOPE_MESSAGE; - } -@@ -1209,6 +1220,7 @@ static int annotate_state_set_scope(annotate_state_t *state, - } - assert(oldwhich == ANNOTATION_SCOPE_UNKNOWN || - oldwhich == state->which); -+ - state->mailbox = mailbox; - state->uid = uid; - -@@ -1431,6 +1443,8 @@ static void annotation_get_freespace(annotate_state_t *state, - static void annotation_get_server(annotate_state_t *state, - struct annotate_entry_list *entry) - { -+ syslog(LOG_DEBUG, "%s (%s:%d)", __func__, __FILE__, __LINE__); -+ - struct buf value = BUF_INITIALIZER; - int r; - -@@ -2024,14 +2038,20 @@ static void _annotate_fetch_entries(annotate_state_t *state, - for (ee = state->entry_list; ee; ee = ee->next) { - - if (proxy_check) { -- if (ee->desc->proxytype == BACKEND_ONLY && -- proxy_fetch_func && -- !config_getstring(IMAPOPT_PROXYSERVERS)) -+ if ( -+ ee->desc->proxytype == BACKEND_ONLY && -+ proxy_fetch_func && -+ !config_getstring(IMAPOPT_PROXYSERVERS) -+ ) { -+ syslog(LOG_DEBUG, "%s (%s:%d) backend only (skipping): %s", __func__, __FILE__, __LINE__, ee->desc->name); - continue; -+ } - } - -- if (!_annotate_may_fetch(state, ee->desc)) -+ if (!_annotate_may_fetch(state, ee->desc)) { -+ syslog(LOG_DEBUG, "%s (%s:%d) may not fetch (skipping): %s", __func__, __FILE__, __LINE__, ee->desc->name); - continue; -+ } - - ee->desc->get(state, ee); - } -@@ -2056,6 +2076,9 @@ EXPORTED int annotate_state_fetch(annotate_state_t *state, - state->sizeptr = maxsizeptr; /* pointer to push largest back */ - } - -+ syslog(LOG_DEBUG, "%s (%s:%d) entries: %s", __func__, __FILE__, __LINE__, strarray_join(entries, ",")); -+ syslog(LOG_DEBUG, "%s (%s:%d) attribs: %s", __func__, __FILE__, __LINE__, strarray_join(attribs, ",")); -+ - /* Build list of attributes to fetch */ - for (i = 0 ; i < attribs->count ; i++) - { -@@ -2091,15 +2114,20 @@ EXPORTED int annotate_state_fetch(annotate_state_t *state, - if (!state->attribs) - goto out; - -+ syslog(LOG_DEBUG, "%s (%s:%d) attribs: %s", __func__, __FILE__, __LINE__, strarray_join(attribs, ",")); -+ - if (state->which == ANNOTATION_SCOPE_SERVER) { -+ syslog(LOG_DEBUG, "%s (%s:%d) state->which == ANNOTATION_SCOPE_SERVER", __func__, __FILE__, __LINE__); - non_db_entries = &server_entries; - db_entry = &server_db_entry; - } - else if (state->which == ANNOTATION_SCOPE_MAILBOX) { -+ syslog(LOG_DEBUG, "%s (%s:%d) state->which == ANNOTATION_SCOPE_MAILBOX", __func__, __FILE__, __LINE__); - non_db_entries = &mailbox_entries; - db_entry = &mailbox_db_entry; - } - else if (state->which == ANNOTATION_SCOPE_MESSAGE) { -+ syslog(LOG_DEBUG, "%s (%s:%d) state->which == ANNOTATION_SCOPE_MESSAGE", __func__, __FILE__, __LINE__); - non_db_entries = &message_entries; - db_entry = &message_db_entry; - } -@@ -2109,6 +2137,11 @@ EXPORTED int annotate_state_fetch(annotate_state_t *state, - goto out; - } - -+ if (proxy_fetch_func) -+ syslog(LOG_DEBUG, "we have proxy_fetch_func"); -+ else -+ syslog(LOG_DEBUG, "we do not have proxy_fetch_func"); -+ - /* Build a list of callbacks for fetching the annotations */ - for (i = 0 ; i < entries->count ; i++) - { -@@ -2116,14 +2149,25 @@ EXPORTED int annotate_state_fetch(annotate_state_t *state, - int j; - int check_db = 0; /* should we check the db for this entry? */ - -+ syslog(LOG_DEBUG, "%s (%s:%d) char s: %s", __func__, __FILE__, __LINE__, s); -+ - g = glob_init(s, GLOB_HIERARCHY); - GLOB_SET_SEPARATOR(g, '/'); - - for (j = 0 ; j < non_db_entries->count ; j++) { - const annotate_entrydesc_t *desc = non_db_entries->data[j]; - -- if (!desc->get) -+ syslog(LOG_DEBUG, "%s (%s:%d) non_db_entry '%s'", __func__, __FILE__, __LINE__, desc->name); -+ -+ if (!desc->get) { -+ syslog(LOG_DEBUG, "%s (%s:%d) desc->get returns nothing for '%s'", __func__, __FILE__, __LINE__, desc->name); - continue; -+ } -+ -+ if (desc->proxytype == PROXY_ONLY) -+ syslog(LOG_DEBUG, "%s proxytype is proxy only (%s:%d)", desc->name, __FILE__, __LINE__); -+ else -+ syslog(LOG_DEBUG, "%s proxytype is NOT proxy only (%s:%d)", desc->name, __FILE__, __LINE__); - - if (GLOB_TEST(g, desc->name) != -1) { - /* Add this entry to our list only if it -@@ -2159,6 +2203,35 @@ EXPORTED int annotate_state_fetch(annotate_state_t *state, - glob_free(&g); - } - -+ struct annotate_entry_list *ee; -+ -+ for (ee = state->entry_list; ee; ee = ee->next) { -+ -+ syslog(LOG_DEBUG, "%s (%s:%d) state->entry_list: %s", __func__, __FILE__, __LINE__, ee->name); -+ -+ if ( -+ ee->desc->proxytype == BACKEND_ONLY && -+ !config_getstring(IMAPOPT_PROXYSERVERS) -+ ) { -+ -+ continue; -+ syslog(LOG_DEBUG, "%s (%s:%d) state->entry_list(backend): %s", __func__, __FILE__, __LINE__, ee->name); -+ } -+ -+ if (!_annotate_may_fetch(state, ee->desc)) { -+ syslog(LOG_DEBUG, "%s (%s:%d) may not fetch: %s", __func__, __FILE__, __LINE__, ee->name); -+ continue; -+ } -+ -+ ee->desc->get(state, ee); -+ -+ if (ee->have_shared) -+ syslog(LOG_DEBUG, "%s (%s:%d) entry shared: %s", __func__, __FILE__, __LINE__, ee->shared.s); -+ if (ee->have_priv) -+ syslog(LOG_DEBUG, "%s (%s:%d) entry private: %s", __func__, __FILE__, __LINE__, ee->priv.s); -+ } -+ -+ - if (state->which == ANNOTATION_SCOPE_SERVER) { - _annotate_fetch_entries(state, /*proxy_check*/1); - } -@@ -3313,16 +3386,22 @@ static void init_annotation_definitions(void) - ptrarray_t *entries = NULL; - - /* copy static entries into list */ -- for (i = 0 ; server_builtin_entries[i].name ; i++) -+ for (i = 0 ; server_builtin_entries[i].name ; i++) { -+ syslog(LOG_DEBUG, "appending %s to server_entries", server_builtin_entries[i].name); - ptrarray_append(&server_entries, (void *)&server_builtin_entries[i]); -+ } - - /* copy static entries into list */ -- for (i = 0 ; mailbox_builtin_entries[i].name ; i++) -+ for (i = 0 ; mailbox_builtin_entries[i].name ; i++) { -+ syslog(LOG_DEBUG, "appending %s to mailbox_entries", mailbox_builtin_entries[i].name); - ptrarray_append(&mailbox_entries, (void *)&mailbox_builtin_entries[i]);
View file
cyrus-imapd-2.5.tar.gz/configure.ac
Changed
@@ -1624,7 +1624,7 @@ event notification: $enable_event_notification idled: $enable_idled murder: $enable_murder - nttpd: $enable_nntp + nntpd: $enable_nntp replication: $enable_replication sieve: $enable_sieve
View file
cyrus-imapd-2.5.tar.gz/imap/annotate.c
Changed
@@ -1183,18 +1183,20 @@ annotate_state_unset_scope(state); if (mbentry) { - if (!mailbox && !mbentry->server) { + assert(!mailbox); + assert(!uid); + if (!mbentry->server) { /* local mailbox */ r = mailbox_open_iwl(mbentry->name, &mailbox); if (r) goto out; state->mailbox_is_ours = 1; } - assert(mailbox); state->mbentry = mbentry; + state->which = ANNOTATION_SCOPE_MAILBOX; } - if (uid) { + else if (uid) { assert(mailbox); state->which = ANNOTATION_SCOPE_MESSAGE; } @@ -1278,6 +1280,8 @@ if (state->mailbox) mboxname = state->mailbox->name; + else if (state->mbentry) + mboxname = state->mbentry->name; else mboxname = ""; /* @mboxname is now an internal mailbox name */ @@ -1367,13 +1371,14 @@ return 1; } else if (state->which == ANNOTATION_SCOPE_MAILBOX) { - assert(state->mailbox); + assert(state->mailbox || state->mbentry); /* Make sure its a local mailbox annotation */ if (state->mbentry && state->mbentry->server) return 0; - acl = state->mailbox->acl; + if (state->mailbox) acl = state->mailbox->acl; + else if (state->mbentry) acl = state->mbentry->acl; /* RFC5464 is a trifle vague about access control for mailbox * annotations but this seems to be compliant */ needed = ACL_LOOKUP|ACL_READ; @@ -1439,16 +1444,19 @@ r = annotate_state_need_mbentry(state); assert(r == 0); + /* Make sure its a remote mailbox */ + if (!state->mbentry->server) goto out; + /* Check ACL */ /* Note that we use a weaker form of access control than * normal - we only check for ACL_LOOKUP and we don't refuse * access if the mailbox is not local */ - if (!state->mbentry->acl || - !(cyrus_acl_myrights(state->auth_state, state->mbentry->acl) & ACL_LOOKUP)) + if (!state->isadmin && + (!state->mbentry->acl || + !(cyrus_acl_myrights(state->auth_state, state->mbentry->acl) & ACL_LOOKUP))) goto out; - if (state->mbentry->server) - buf_appendcstr(&value, state->mbentry->server); + buf_appendcstr(&value, state->mbentry->server); output_entryatt(state, entry->name, "", &value); out: @@ -1466,13 +1474,16 @@ r = annotate_state_need_mbentry(state); assert(r == 0); + /* Make sure its a local mailbox */ + if (state->mbentry->server) goto out; + /* Check ACL */ - if (!state->mbentry->acl || - !(cyrus_acl_myrights(state->auth_state, state->mbentry->acl) & ACL_LOOKUP)) + if (!state->isadmin && + (!state->mbentry->acl || + !(cyrus_acl_myrights(state->auth_state, state->mbentry->acl) & ACL_LOOKUP))) goto out; - if (!state->mbentry->server) - buf_appendcstr(&value, state->mbentry->partition); + buf_appendcstr(&value, state->mbentry->partition); output_entryatt(state, entry->name, "", &value); out: @@ -2177,12 +2188,12 @@ state->orig_attribute = attribs; } - _annotate_fetch_entries(state, /*proxy_check*/0); + _annotate_fetch_entries(state, /*proxy_check*/1); if (proxy_fetch_func && state->orig_entry && state->mbentry->server && !hash_lookup(state->mbentry->server, &state->server_table)) { /* xxx ignoring result */ - proxy_fetch_func(state->mbentry->server, state->orig_mailbox, + proxy_fetch_func(state->mbentry->server, state->mbentry->ext_name, state->orig_entry, state->orig_attribute); hash_insert(state->mbentry->server, (void *)0xDEADBEEF, &state->server_table); } @@ -2468,9 +2479,14 @@ struct annotate_entry_list *ee; int r; - /* Loop through the list of provided entries to get */ + /* Loop through the list of provided entries to set */ for (ee = state->entry_list ; ee ; ee = ee->next) { + /* Skip annotations that can't be stored on frontend */ + if ((ee->desc->proxytype == BACKEND_ONLY) && + (state->mbentry && state->mbentry->server)) + continue; + if (ee->have_shared && !_annotate_may_store(state, /*shared*/1, ee->desc)) return IMAP_PERMISSION_DENIED; @@ -2875,7 +2891,7 @@ goto cleanup; assert(state->mbentry); } - assert(state->mailbox); + else assert(state->mailbox); r = _annotate_store_entries(state); if (r) @@ -2894,7 +2910,7 @@ if (!r) { /* proxy command to backends */ struct proxy_rock prock = { NULL, NULL }; - prock.mbox_pat = state->mbentry->name; + prock.mbox_pat = state->mbentry->ext_name; prock.entryatts = l; hash_enumerate(&state->server_table, store_proxy, &prock); }
View file
cyrus-imapd-2.5.tar.gz/imap/ctl_mboxlist.c
Changed
@@ -214,10 +214,10 @@ } // if (r = dlist_getatom()) if (dl_ace->name && tmp) { - const char *ace = strconcat(xstrdup(dl_ace->name), " ", xstrdup(tmp)); + const char *ace = strconcat(xstrdup(dl_ace->name), "\t", xstrdup(tmp)); if (acl) { - acl = strconcat(xstrdup(acl), " ", ace); + acl = strconcat(xstrdup(acl), "\t", ace); } else { acl = xstrdup(ace); } @@ -242,13 +242,8 @@ r = dlist_getatom(dl, "T", (const char **)&mbtype_str); if (!r) { - syslog( - LOG_ERR, - "Failed to obtain (T)ype from dlist (%s:%d)", - __FILE__, - __LINE__ - ); - + // That's OK, the mailbox is local (0) + mbtype = 0; } mbtype = mboxlist_string_to_mbtype(mbtype_str); @@ -283,6 +278,10 @@ part = strconcat(server, "!", xstrdup(part)); } // (mbtype & MBTYPE_REMOTE) + + // Reset r **NOT** to the return value of ffin dlist functions + r = 0; + } // if (r = dlist_parsemap()) else { syslog(
View file
cyrus-imapd-2.5.tar.gz/imap/imapd.c
Changed
@@ -423,7 +423,7 @@ strarray_t *attribs); static int parse_metadata_string_or_list(const char *tag, strarray_t *sa, - int *was_singlep); + int *is_list); static int parse_annotate_store_data(const char *tag, int permessage_flag, struct entryattlist **entryatts); @@ -5363,200 +5363,300 @@ } } - if (partition && !imapd_userisadmin) { - r = IMAP_PERMISSION_DENIED; + // A non-admin is not allowed to specify the server nor partition on which + // to create the mailbox. + // + // However, this only applies to frontends. If we're a backend, a frontend will + // proxy the partition it wishes to create the mailbox on. + if ((server || partition) && !imapd_userisadmin) { + if ( + config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD || + config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED + ) { + + if (!config_getstring(IMAPOPT_PROXYSERVERS)) { + prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(IMAP_PERMISSION_DENIED)); + goto done; + } + } } + /* We don't care about trailing hierarchy delimiters. */ if (name[0] && name[strlen(name)-1] == imapd_namespace.hier_sep) { - /* We don't care about trailing hierarchy delimiters. */ name[strlen(name)-1] = '\0'; } - if (!r) { - r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name, - imapd_userid, mailboxname); + r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name, + imapd_userid, mailboxname); + + if (r) { + prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(r)); + goto done; } /* check for INBOX.INBOX creation by broken Apple clients */ - if (!r) { - char *copy = xstrdup(mailboxname); - lcase(copy); - if (strstr(copy, "inbox.inbox")) - r = IMAP_MAILBOX_BADNAME; - free(copy); + char *copy = xstrdup(mailboxname); + lcase(copy); + + if (strstr(copy, "inbox.inbox")) + r = IMAP_MAILBOX_BADNAME; + + free(copy); + + if (r) { + prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(r)); + goto done; } - if (!r && !localonly && config_mupdate_server) { - int guessedpart = 0; + // If the create command does not mandate the mailbox must be created + // locally, let's go and find the most appropriate location. + if (!localonly) { + + // If we're running in a Murder, things get more complicated. + if (config_mupdate_server) { + + // Consider your actions on a per type of topology basis. + // + // First up: Standard / discrete murder topology, with dedicated + // imap frontends, or unified -- both allow the IMAP server to either + // need to proxy through, or create locally. + if ( + config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD || + config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED + ) { + + // The way that we detect whether we're a frontend is by testing + // for the proxy servers setting ... :/ + if (!config_getstring(IMAPOPT_PROXYSERVERS)) { + // Find the parent mailbox, if any. + mbentry_t *parent = NULL; + + // mboxlist_findparent either supplies the parent + // or has a return code of IMAP_MAILBOX_NONEXISTENT. + r = mboxlist_findparent(mailboxname, &parent); + + if (r) { + if (r != IMAP_MAILBOX_NONEXISTENT) { + prot_printf(imapd_out, "%s NO %s (%s:%d)\r\n", tag, error_message(r), __FILE__, __LINE__); + goto done; + } + } - /* determine if we're creating locally or remotely */ - if (!partition && !server) { - char *foundpart = NULL; - guessedpart = 1; - r = mboxlist_createmailboxcheck(mailboxname, 0, 0, - imapd_userisadmin || imapd_userisproxyadmin, - imapd_userid, imapd_authstate, - NULL, &foundpart, 0); - partition = foundpart; + if (!server && !partition) { + if (!parent) { + server = find_free_server(); + + if (!server) { + prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(IMAP_SERVER_UNAVAILABLE)); + goto done; + } + + } else { + server = parent->server; + partition = parent->partition; + } + } - if (!r && !partition && - (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD) && - !config_getstring(IMAPOPT_PROXYSERVERS)) { - /* proxy-only server, and no parent mailbox */ - guessedpart = 0; + struct backend *s_conn = NULL; - /* use defaultserver if specified */ - partition = config_getstring(IMAPOPT_DEFAULTSERVER); + s_conn = proxy_findserver( + server, + &imap_protocol, + proxy_userid, + &backend_cached, + &backend_current, + &backend_inbox, + imapd_in + ); + + if (!s_conn) { + prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(IMAP_SERVER_UNAVAILABLE)); + goto done; + } - /* otherwise, find server with most available space */ - if (!partition) partition = find_free_server(); + // Huh? + if (imapd_userisadmin && supports_referrals) { + // "They are not an admin remotely, so let's refer them" -- + // - Who is they? + // - How did imapd_userisadmin get set all of a sudden? + imapd_refer(tag, server, name); + referral_kick = 1; + return; + } - if (!partition) r = IMAP_SERVER_UNAVAILABLE; - } - } + if (!CAPA(s_conn, CAPA_MUPDATE)) { + // Huh? + // "reserve mailbox on MUPDATE" + syslog(LOG_WARNING, "backend %s is not advertising any MUPDATE capability (%s:%d)", server, __FILE__, __LINE__); + } - if (!r && !config_partitiondir(partition)) { - /* invalid partition, assume its a server (remote mailbox) */ - struct backend *s = NULL; - char *p; - int res; - - /* check for a remote partition */ - server = partition; - p = strchr(server, '!'); - if (p) *p++ = '\0'; - partition = guessedpart ? NULL : p; + // why not send a LOCALCREATE to the backend? + prot_printf(s_conn->out, "%s CREATE ", tag); + prot_printastring(s_conn->out, name); + + // special use needs extended support, so pass through extargs + if (specialuse.len) { + prot_printf(s_conn->out, "(USE (%s)", buf_cstring(&specialuse)); + + if (partition) { + prot_printf(s_conn->out, " PARTITION "); + prot_printastring(s_conn->out, partition); + } - s = proxy_findserver(server, &imap_protocol,
View file
cyrus-imapd-2.5.tar.gz/imap/mboxlist.c
Changed
@@ -112,6 +112,7 @@ if (!mbentry) return; free(mbentry->name); + free(mbentry->ext_name); free(mbentry->partition); free(mbentry->server); @@ -544,7 +545,7 @@ return r; } -static int mboxlist_findparent(const char *mboxname, +EXPORTED int mboxlist_findparent(const char *mboxname, mbentry_t **mbentryp) { mbentry_t *mbentry = NULL;
View file
cyrus-imapd-2.5.tar.gz/imap/mboxlist.h
Changed
@@ -77,6 +77,7 @@ /* each mailbox has the following data */ struct mboxlist_entry { char *name; + char *ext_name; time_t mtime; uint32_t uidvalidity; int mbtype; @@ -193,6 +194,10 @@ struct auth_state *auth_state, int (*proc)(), void *rock); +/* Find a mailbox's parent (if any) */ +int mboxlist_findparent(const char *mboxname, + mbentry_t **mbentryp); + /* direct access to subs DB */ int mboxlist_allsubs(const char *userid, foreach_cb *proc, void *rock); int mboxlist_allmbox(const char *prefix, foreach_cb *proc, void *rock, int incdel);
View file
cyrus-imapd-2.5.tar.gz/imap/mupdate-client.c
Changed
@@ -183,8 +183,6 @@ if (!mailbox || !location || !acl) return MUPDATE_BADPARAM; if (!handle->saslcompleted) return MUPDATE_NOAUTH; - syslog(LOG_DEBUG, "mupdate_activate for mailbox: %s, location: %s, acl: %s", mailbox, location, acl); - /* make sure we don't have a double server!partition */ if ((p = strchr(location, '!')) && strchr(p+1, '!')) return MUPDATE_BADPARAM; @@ -193,8 +191,6 @@ if (p) location = p + 1; } - syslog(LOG_DEBUG, "mupdate_activate for mailbox: %s, location: %s, acl: %s", mailbox, location, acl); - prot_printf(handle->conn->out, "X%u ACTIVATE " "{" SIZE_T_FMT "+}\r\n%s " @@ -235,8 +231,6 @@ if (p) location = p + 1; } - syslog(LOG_DEBUG, "mupdate_reserve for mailbox: %s, location: %s", mailbox, location); - prot_printf(handle->conn->out, "X%u RESERVE " "{" SIZE_T_FMT "+}\r\n%s "
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.