Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 113
View file
cyrus-imapd.spec
Changed
@@ -38,13 +38,13 @@ Name: cyrus-imapd Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support Version: 2.5 -Release: 0.2.dev20141105.git2941de13%{?dist} +Release: 0.2.dev20141112.git58e1f4b2%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.cyrusimap.org # Upstream sources -# From 2941de1350adf7f0d99443ace884f40c754df193 +# From 58e1f4b277586e448f726bdafe6f2e250c9ea5f4 Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{_name}-%{real_version}%{?dot_snapshot_version}.tar.gz Source1: cyrus-imapd.imap-2.3.x-conf Source2: cyrus-imapd.cvt_cyrusdb_all @@ -67,8 +67,7 @@ ## Patches ## -Patch0001: cyrus-imapd-2.5-default-twoskip.patch -Patch0002: cyrus-imapd-2.5-ctl_mboxlist-mbtype.patch +Patch0001: cyrus-imapd-2.5-ctl_mboxlist-mbtype.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -259,8 +258,7 @@ %prep %setup -q -n %{_name}-%{real_version}%{?dot_snapshot_version} -#%patch0001 -p1 -%patch0002 -p1 +%patch0001 -p1 %if 0%{?with_bdb} < 1 sed -i -e 's/,berkeley//g' cunit/db.testc
View file
cyrus-imapd-2.5-default-twoskip.patch
Deleted
@@ -1,80 +0,0 @@ -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-2.5.tar.gz/imap/annotate.c
Changed
@@ -2302,10 +2302,14 @@ EXPORTED int annotatemore_msg_lookupmask(const char *mboxname, uint32_t uid, const char *entry, const char *userid, struct buf *value) { - int r = annotatemore_msg_lookup(mboxname, uid, entry, userid, value); - if (value->len == 0) { + int r; + value->len = 0; /* just in case! */ + /* only if the user isn't the owner, we look for a masking value */ + if (!mboxname_userownsmailbox(userid, mboxname)) + r = annotatemore_msg_lookup(mboxname, uid, entry, userid, value); + /* and if there isn't one, we fall through to the shared value */ + if (value->len == 0) r = annotatemore_msg_lookup(mboxname, uid, entry, NULL, value); - } return r; } @@ -2532,11 +2536,23 @@ entry, userid, value, /*ignorequota*/1); } +EXPORTED int annotate_state_writemask(annotate_state_t *state, + const char *entry, + const char *userid, + const struct buf *value) +{ + /* if the user is the owner, then write to the shared namespace */ + if (mboxname_userownsmailbox(userid, state->mailbox->name)) + return annotate_state_write(state, entry, NULL, value); + else + return annotate_state_write(state, entry, userid, value); +} + static int annotate_canon_value(struct buf *value, int type) { char *p = NULL; - unsigned long uwhatever; - long whatever; + unsigned long uwhatever = 0; + long whatever = 0; /* check for NIL */ if (value->s == NULL)
View file
cyrus-imapd-2.5.tar.gz/imap/annotate.h
Changed
@@ -182,6 +182,9 @@ * Requires an open transaction. */ int annotate_state_write(annotate_state_t *, const char *entry, const char *userid, const struct buf *value); +/* same but write to shared if the user owns the mailbox */ +int annotate_state_writemask(annotate_state_t *, const char *entry, + const char *userid, const struct buf *value); /* rename the annotations for 'oldmboxname' to 'newmboxname' * if 'olduserid' is non-NULL then the private annotations
View file
cyrus-imapd-2.5.tar.gz/imap/append.c
Changed
@@ -1012,7 +1012,7 @@ * present in body structure ? */ mboxevent_extract_record(mboxevent, mailbox, &record); mboxevent_extract_mailbox(mboxevent, mailbox); - mboxevent_set_access(mboxevent, NULL, NULL, as->userid, NULL); + mboxevent_set_access(mboxevent, NULL, NULL, as->userid, as->mailbox->name); mboxevent_set_numunseen(mboxevent, mailbox, -1); return 0; @@ -1124,6 +1124,7 @@ * present in body structure */ mboxevent_extract_record(mboxevent, mailbox, &record); mboxevent_extract_mailbox(mboxevent, mailbox); + mboxevent_set_access(mboxevent, NULL, NULL, as->userid, as->mailbox->name); mboxevent_set_numunseen(mboxevent, mailbox, -1); return 0; @@ -1326,6 +1327,7 @@ } mboxevent_extract_mailbox(mboxevent, as->mailbox); + mboxevent_set_access(mboxevent, NULL, NULL, as->userid, as->mailbox->name); mboxevent_set_numunseen(mboxevent, as->mailbox, -1); return 0;
View file
cyrus-imapd-2.5.tar.gz/imap/autocreate.c
Changed
@@ -699,7 +699,7 @@ } if (autocreatequota >= 0 || autocreatequotamessage >= 0) { - int newquotasQUOTA_NUMRESOURCES; + quota_t newquotasQUOTA_NUMRESOURCES; int res; for (res = 0 ; res < QUOTA_NUMRESOURCES ; res++)
View file
cyrus-imapd-2.5.tar.gz/imap/ctl_mboxlist.c
Changed
@@ -504,9 +504,9 @@ break; } - if (name) free(name); - if (part) free(part); - if (acl) free(acl); + free(name); + free(part); + free(acl); return r; }
View file
cyrus-imapd-2.5.tar.gz/imap/cyr_expire.c
Changed
@@ -214,8 +214,8 @@ * - build a hash table of mailboxes in which we expired messages, * - and perform a cleanup of expunged messages */ -static int expire(char *name, int matchlen __attribute__((unused)), - int maycreate __attribute__((unused)), void *rock) +static int expire(void *rock, const char *key, size_t keylen, + const char *data, size_t datalen) { mbentry_t *mbentry = NULL; struct expire_rock *erock = (struct expire_rock *) rock; @@ -228,30 +228,27 @@ int did_expunge = 0; if (sigquit) { + /* don't care if we leak some memory, we are shutting down */ return 1; } - r = mboxlist_lookup(name, &mbentry, NULL); - - /* Skip deleted mailboxes */ - if (r == IMAP_MAILBOX_NONEXISTENT) - return 0; + if (mboxlist_parse_entry(&mbentry, key, keylen, data, datalen)) + goto done; /* xxx - syslog? */ - if (r) { - if (verbose) { - printf("error looking up %s: %s\n", name, error_message(r)); + /* Skip remote mailboxes */ + if (mbentry->mbtype & MBTYPE_REMOTE) + goto done; + + /* clean up deleted entries after 7 days */ + if (mbentry->mbtype & MBTYPE_DELETED) { + if (time(0) - mbentry->mtime > 86400*7) { + syslog(LOG_NOTICE, "Removing stale tombstone for %s", mbentry->name); + cyrusdb_delete(mbdb, key, keylen, NULL, /*force*/1); } - syslog(LOG_ERR, "error looking up %s: %s\n", name, error_message(r)); - return 0; /* still keep going */ - } - /* Skip remote mailboxes */ - if (mbentry->mbtype & MBTYPE_REMOTE) { - mboxlist_entry_free(&mbentry); - return 0; + goto done; } - mboxlist_entry_free(&mbentry); - buf = xstrdup(name); + buf = xstrdup(mbentry->name); /* see if we need to expire messages. * since mailboxes inherit /vendor/cmu/cyrus-imapd/expire, @@ -273,19 +270,19 @@ memset(erock->userflags, 0, sizeof(erock->userflags)); - r = mailbox_open_iwl(name, &mailbox); + r = mailbox_open_iwl(mbentry->name, &mailbox); if (r) { /* mailbox corrupt/nonexistent -- skip it */ syslog(LOG_WARNING, "unable to open mailbox %s: %s", - name, error_message(r)); - return 0; + mbentry->name, error_message(r)); + goto done; } if (attrib.s && parse_duration(attrib.s, &expire_seconds)) { /* add mailbox to table */ erock->expire_mark = expire_seconds ? time(0) - expire_seconds : 0 /* never */ ; - hash_insert(name, + hash_insert(mbentry->name, xmemdup(&erock->expire_mark, sizeof(erock->expire_mark)), &erock->table); @@ -293,13 +290,13 @@ if (verbose) { fprintf(stderr, "expiring messages in %s older than %0.2f days\n", - name, ((double)expire_seconds/86400)); + mbentry->name, ((double)expire_seconds/86400)); } r = mailbox_expunge(mailbox, expire_cb, erock, NULL, EVENT_MESSAGE_EXPIRE); if (r) - syslog(LOG_ERR, "failed to expire old messages: %s", mailbox->name); + syslog(LOG_ERR, "failed to expire old messages: %s", mbentry->name); did_expunge = 1; } } @@ -310,7 +307,7 @@ EVENT_MESSAGE_EXPIRE); if (r) syslog(LOG_ERR, "failed to scan user flags for %s: %s", - mailbox->name, error_message(r)); + mbentry->name, error_message(r)); } erock->messages_seen += mailbox->i.num_records; @@ -324,12 +321,13 @@ erock->mailboxes_seen++; if (r) { - syslog(LOG_WARNING, "failure expiring %s: %s", name, error_message(r)); + syslog(LOG_WARNING, "failure expiring %s: %s", mbentry->name, error_message(r)); annotate_state_abort(&mailbox->annot_state); } +done: + mboxlist_entry_free(&mbentry); mailbox_close(&mailbox); - /* Even if we had a problem with one mailbox, continue with the others */ return 0; }
View file
cyrus-imapd-2.5.tar.gz/imap/http_caldav.c
Changed
@@ -1048,6 +1048,17 @@ return 0; } +static icalcomponent *record_to_ical(struct mailbox *mailbox, struct index_record *record) +{ + struct buf buf = BUF_INITIALIZER; + icalcomponent *ical = NULL;; + /* Load message containing the resource and parse iCal data */ + if (!mailbox_map_record(mailbox, record, &buf)) { + ical = icalparser_parse_string(buf_cstring(&buf) + record->header_size); + buf_free(&buf); + } + return ical; +} /* Perform a COPY/MOVE request * @@ -1075,14 +1086,8 @@ const char *organizer = NULL; icalcomponent *ical, *comp; icalproperty *prop; - const char *base; - size_t len; - /* Load message containing the resource and parse iCal data */ - r = mailbox_map_message(src_mbox, src_rec->uid, &base, &len); - if (r) return r; - ical = icalparser_parse_string(base + src_rec->header_size); - mailbox_unmap_message(src_mbox, src_rec->uid, &base, &len); + ical = record_to_ical(src_mbox, src_rec); if (!ical) { txn->error.precond = CALDAV_VALID_DATA; @@ -1131,14 +1136,9 @@ icalcomponent *ical, *comp; icalproperty *prop; struct sched_param sparam; - const char *base; - size_t len; /* Load message containing the resource and parse iCal data */ - r = mailbox_map_message(mailbox, record->uid, &base, &len); - if (r) return r; - ical = icalparser_parse_string(base + record->header_size); - mailbox_unmap_message(mailbox, record->uid, &base, &len); + ical = record_to_ical(mailbox, record); if (!ical) { syslog(LOG_ERR, @@ -1155,7 +1155,12 @@ prop = icalcomponent_get_first_property(comp, ICAL_ORGANIZER_PROPERTY); organizer = icalproperty_get_organizer(prop); - if (caladdress_lookup(organizer, &sparam)) { + r = caladdress_lookup(organizer, &sparam); + if (r == HTTP_NOT_FOUND) { + r = 0; + goto done; + } + if (r) { syslog(LOG_ERR, "meth_delete: failed to process scheduling message in %s" " (org=%s, att=%s)", @@ -1293,8 +1298,6 @@ write_body(HTTP_OK, txn, buf_cstring(buf), buf_len(buf)); for (r = 0, recno = 1; recno <= mailbox->i.num_records; recno++) { - const char *data; - size_t len; icalcomponent *ical; if (mailbox_read_index_record(mailbox, recno, &record)) continue; @@ -1302,9 +1305,7 @@ if (record.system_flags & (FLAG_EXPUNGED | FLAG_DELETED)) continue; /* Map and parse existing iCalendar resource */ - if (mailbox_map_message(mailbox, record.uid, &data, &len)) continue; - ical = icalparser_parse_string(data + record.header_size); - mailbox_unmap_message(mailbox, record.uid, &data, &len); + ical = record_to_ical(mailbox, &record); if (ical) { icalcomponent *comp; @@ -2634,6 +2635,7 @@ struct caldav_data *cdata; struct sched_param sparam; icalcomponent *oldical = NULL; + int r; /* Construct userid corresponding to mailbox */ userid = mboxname_to_userid(txn->req_tgt.mboxname); @@ -2656,7 +2658,10 @@ } /* Lookup the organizer */ - if (caladdress_lookup(organizer, &sparam)) { + r = caladdress_lookup(organizer, &sparam); + if (r == HTTP_NOT_FOUND) + break; /* not a local organiser? Just skip it */ + if (r) { syslog(LOG_ERR, "meth_put: failed to process scheduling message in %s" " (org=%s)", @@ -2669,20 +2674,15 @@ if (cdata->dav.imap_uid) { /* Update existing object */ struct index_record record; - const char *data; - size_t len; - int r; /* Load message containing the resource and parse iCal data */ r = mailbox_find_index_record(mailbox, cdata->dav.imap_uid, &record); - if (!r) r = mailbox_map_message(mailbox, record.uid, &data, &len); if (r) { txn->error.desc = "Failed to read record \r\n"; ret = HTTP_SERVER_ERROR; goto done; } - oldical = icalparser_parse_string(data + record.header_size); - mailbox_unmap_message(mailbox, record.uid, &data, &len); + oldical = record_to_ical(mailbox, &record); } if (cdata->organizer) { @@ -3076,18 +3076,9 @@ * Need to mmap() and parse iCalendar object * to perform complete check of each recurrence. */ - const char *data; - size_t len; - icalcomponent *ical; + icalcomponent *ical = record_to_ical(fctx->mailbox, fctx->record); icalcomponent_kind kind; - /* XXX - error */ - if (mailbox_map_message(fctx->mailbox, fctx->record->uid, &data, &len)) - return 0; - - ical = icalparser_parse_string(data + fctx->record->header_size); - mailbox_unmap_message(fctx->mailbox, fctx->record->uid, &data, &len); - kind = icalcomponent_isa(icalcomponent_get_first_real_component(ical)); @@ -3319,26 +3310,18 @@ void *rock) { xmlNodePtr prop = (xmlNodePtr) rock; - const char *data = NULL; - size_t datalen = 0; - const char *map = NULL; - size_t maplen = 0; - int r; + struct buf buf = BUF_INITIALIZER; + int r = 0; if (propstat) { if (!fctx->record) return HTTP_NOT_FOUND; - - mailbox_map_message(fctx->mailbox, fctx->record->uid, &map, &maplen); - - data = map + fctx->record->header_size; - datalen = maplen - fctx->record->header_size; + mailbox_map_record(fctx->mailbox, fctx->record, &buf); } r = propfind_getdata(name, ns, fctx, propstat, prop, caldav_mime_types, - CALDAV_SUPP_DATA, data, datalen); + CALDAV_SUPP_DATA, buf_cstring(&buf), buf_len(&buf)); - if (propstat) - mailbox_unmap_message(fctx->mailbox, fctx->record->uid, &map, &maplen); + buf_free(&buf); return r; } @@ -3512,17 +3495,13 @@ /* All component types are valid */ const char *prop_annot = ANNOT_NS "<" XML_NS_CALDAV ">supported-calendar-component-set"; - const char *userid = NULL; annotate_state_t *astate = NULL; buf_reset(&pctx->buf); buf_printf(&pctx->buf, "%lu", types); - if (!mboxname_userownsmailbox(httpd_userid, pctx->mailbox->name)) - userid = httpd_userid; - r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate); - if (!r) r = annotate_state_write(astate, prop_annot, userid, &pctx->buf); + if (!r) r = annotate_state_writemask(astate, prop_annot, httpd_userid, &pctx->buf); if (!r) { xml_add_prop(HTTP_OK, pctx->nsNS_DAV, &propstatPROPSTAT_OK, @@ -3745,7 +3724,6 @@ if (pctx->req_tgt->collection && !pctx->req_tgt->resource) { const char *prop_annot = ANNOT_NS "<" XML_NS_CALDAV ">schedule-calendar-transp"; - const char *userid = NULL; annotate_state_t *astate = NULL; buf_reset(&pctx->buf); @@ -3775,11 +3753,8 @@ } } - if (!mboxname_userownsmailbox(httpd_userid, pctx->mailbox->name)) - userid = httpd_userid; - r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate); - if (!r) r = annotate_state_write(astate, prop_annot, userid, &pctx->buf); + if (!r) r = annotate_state_writemask(astate, prop_annot, httpd_userid, &pctx->buf); if (!r) { xml_add_prop(HTTP_OK, pctx->nsNS_DAV, &propstatPROPSTAT_OK, prop->name, prop->ns, NULL, 0); @@ -3953,25 +3928,20 @@ /* Remove CALDAV:calendar-timezone-id */ const char *prop_annot = ANNOT_NS "<" XML_NS_CALDAV ">calendar-timezone-id"; - const char *userid = NULL; annotate_state_t *astate = NULL; - if (!mboxname_userownsmailbox(httpd_userid, pctx->mailbox->name)) - userid = httpd_userid; - r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate); - if (!r) r = annotate_state_write(astate, prop_annot, userid, &buf); - - if (r) { + if (!r) r = annotate_state_writemask(astate, prop_annot, httpd_userid, &buf); + if (!r) { + xml_add_prop(HTTP_OK, pctx->nsNS_DAV, &propstatPROPSTAT_OK, + prop->name, prop->ns, NULL, 0); + } + else { xml_add_prop(HTTP_SERVER_ERROR, pctx->nsNS_DAV, &propstatPROPSTAT_ERROR, prop->name, prop->ns, NULL, 0); *pctx->ret = HTTP_SERVER_ERROR; } - else { - /* Set CALDAV:calendar-timezone */ - proppatch_todb(prop, set, pctx, propstat, (void *) buf_cstring(&buf)); - } } if (freeme) xmlFree(freeme); @@ -5107,7 +5077,7 @@ const char *owner = mboxname_to_userid(cdata->dav.mailbox); txn->error.precond = CALDAV_UID_CONFLICT; - assert(!buf_len(&txn->buf)); + buf_reset(&txn->buf); buf_printf(&txn->buf, "%s/user/%s/%s/%s", namespace_calendar.prefix, owner, strrchr(cdata->dav.mailbox, '.')+1, cdata->dav.resource); @@ -5706,8 +5676,6 @@ /* Create hash table for any remote attendee servers */ construct_hash_table(&remote_table, 10, 1); - assert(!buf_len(&txn->buf)); - /* Process each attendee */ for (prop = icalcomponent_get_first_property(comp, ICAL_ATTENDEE_PROPERTY); prop; @@ -6776,18 +6744,10 @@ if (cdata->dav.imap_uid) { struct index_record record; - struct buf msg_buf = BUF_INITIALIZER; /* Load message containing the resource and parse iCal data */ r = mailbox_find_index_record(mailbox, cdata->dav.imap_uid, &record); - if (!r) r = mailbox_map_record(mailbox, &record, &msg_buf); - if (r) { - syslog(LOG_ERR, "mailbox_map_record(%s, %u) failed: %s", - mailbox->name, record.uid, error_message(r)); - goto done; - } - ical = icalparser_parse_string(buf_base(&msg_buf) + record.header_size); - buf_free(&msg_buf); + ical = record_to_ical(mailbox, &record); for (comp = icalcomponent_get_first_component(sched_data->itip, ICAL_ANY_COMPONENT);
View file
cyrus-imapd-2.5.tar.gz/imap/http_dav.c
Changed
@@ -97,6 +97,8 @@ { XML_NS_ISCHED, NULL }, { XML_NS_CS, "CS" }, { XML_NS_CYRUS, "CY" }, + { XML_NS_USERFLAG, "UF" }, + { XML_NS_SYSFLAG, "SF" }, }; /* PROPFIND modes */ @@ -1881,12 +1883,11 @@ xmlChar *freeme = NULL; annotate_state_t *astate = NULL; struct buf value = BUF_INITIALIZER; - const char *userid = NULL; int r = 1; /* default to error */ /* flags only store "exists" */ - if (!strcmp((const char *)prop->ns->href, XML_NS_CYRUS "sysflag/")) { + if (!strcmp((const char *)prop->ns->href, XML_NS_SYSFLAG)) { struct flaggedresources *frp; int isset; for (frp = fres; frp->name; frp++) { @@ -1907,7 +1908,7 @@ goto done; } - if (!strcmp((const char *)prop->ns->href, XML_NS_CYRUS "userflag/")) { + if (!strcmp((const char *)prop->ns->href, XML_NS_USERFLAG)) { int userflag = 0; int isset; r = mailbox_user_flag(pctx->mailbox, (const char *)prop->name, &userflag, 1); @@ -1936,11 +1937,8 @@ buf_init_ro_cstr(&value, (const char *)freeme); } - if (!mboxname_userownsmailbox(pctx->mailbox->name, httpd_userid)) - userid = httpd_userid; - r = mailbox_get_annotate_state(pctx->mailbox, pctx->record->uid, &astate); - if (!r) r = annotate_state_write(astate, buf_cstring(&pctx->buf), userid, &value); + if (!r) r = annotate_state_writemask(astate, buf_cstring(&pctx->buf), httpd_userid, &value); done: @@ -1970,7 +1968,7 @@ xmlNodePtr node; int r = 0; /* default no error */ - if (!strcmp((const char *)ns->href, XML_NS_CYRUS "sysflag/")) { + if (!strcmp((const char *)ns->href, XML_NS_SYSFLAG)) { struct flaggedresources *frp; int isset; for (frp = fres; frp->name; frp++) { @@ -1983,7 +1981,7 @@ goto done; } - if (!strcmp((const char *)ns->href, XML_NS_CYRUS "userflag/")) { + if (!strcmp((const char *)ns->href, XML_NS_USERFLAG)) { int userflag = 0; int isset; r = mailbox_user_flag(fctx->mailbox, (const char *)name, &userflag, 0); @@ -2064,7 +2062,6 @@ xmlChar *freeme = NULL; annotate_state_t *astate = NULL; struct buf value = BUF_INITIALIZER; - const char *userid = NULL; int r; if (pctx->req_tgt->resource) @@ -2084,11 +2081,8 @@ } } - if (!mboxname_userownsmailbox(pctx->mailbox->name, httpd_userid)) - userid = httpd_userid; - r = mailbox_get_annotate_state(pctx->mailbox, 0, &astate); - if (!r) r = annotate_state_write(astate, buf_cstring(&pctx->buf), userid, &value); + if (!r) r = annotate_state_writemask(astate, buf_cstring(&pctx->buf), httpd_userid, &value); if (!r) { xml_add_prop(HTTP_OK, pctx->nsNS_DAV, &propstatPROPSTAT_OK,
View file
cyrus-imapd-2.5.tar.gz/imap/http_dav.h
Changed
@@ -72,6 +72,8 @@ #define XML_NS_ISCHED "urn:ietf:params:xml:ns:ischedule" #define XML_NS_CS "http://calendarserver.org/ns/" #define XML_NS_CYRUS "http://cyrusimap.org/ns/" +#define XML_NS_USERFLAG "http://cyrusimap.org/ns/userflag/" +#define XML_NS_SYSFLAG "http://cyrusimap.org/ns/sysflag/" /* Index into known namespace array */ enum {
View file
cyrus-imapd-2.5.tar.gz/imap/httpd.c
Changed
@@ -75,6 +75,7 @@ #include "tls.h" #include "map.h" +#include "acl.h" #include "exitcodes.h" #include "imapd.h" #include "imap_err.h" @@ -3818,3 +3819,11 @@ return 0; } + +/* simple wrapper to implicity add READFB if we have the READ ACL */ +EXPORTED int httpd_myrights(struct auth_state *authstate, const char *acl) +{ + int rights = acl ? cyrus_acl_myrights(authstate, acl) : 0; + if ((rights & DACL_READ) == DACL_READ) rights |= DACL_READFB; + return rights; +}
View file
cyrus-imapd-2.5.tar.gz/imap/httpd.h
Changed
@@ -427,4 +427,6 @@ extern int check_precond(struct transaction_t *txn, const void *data, const char *etag, time_t lastmod); +extern int httpd_myrights(struct auth_state *authstate, const char *acl); + #endif /* HTTPD_H */
View file
cyrus-imapd-2.5.tar.gz/imap/mboxlist.c
Changed
@@ -355,7 +355,7 @@ * T: _t_ype * V: uid_v_alidity */ -static int mboxlist_parse_entry(mbentry_t **mbentryptr, +EXPORTED int mboxlist_parse_entry(mbentry_t **mbentryptr, const char *name, size_t namelen, const char *data, size_t datalen) {
View file
cyrus-imapd-2.5.tar.gz/imap/mboxlist.h
Changed
@@ -115,6 +115,11 @@ mbentry_t **mbentryptr, struct txn **tid); +int mboxlist_parse_entry(mbentry_t **mbentryptr, + const char *name, size_t namelen, + const char *data, size_t datalen); + + /* insert/delete stub entries */ int mboxlist_insertremote(mbentry_t *mbentry, struct txn **rettid); int mboxlist_deleteremote(const char *name, struct txn **in_tid);
View file
cyrus-imapd-2.5.tar.gz/imap/reconstruct.c
Changed
@@ -113,7 +113,8 @@ /* forward declarations */ static void do_mboxlist(void); -static int do_reconstruct(char *name, int matchlen, int maycreate, void *rock); +static int do_reconstruct(const char *name, int matchlen, int maycreate, void *rock); +static int do_reconstruct_p(void *rock, const char *key, size_t keylen, const char *data, size_t datalen); static void usage(void); extern cyrus_acl_canonproc_t mboxlist_ensureOwnerRights; @@ -124,6 +125,7 @@ int main(int argc, char **argv) { int opt, i, r; + int dousers = 0; int rflag = 0; int mflag = 0; int fflag = 0; @@ -140,7 +142,7 @@ construct_hash_table(&unqid_table, 2047, 1); - while ((opt = getopt(argc, argv, "C:kp:rmfsxgGqRUoOnV:")) != EOF) { + while ((opt = getopt(argc, argv, "C:kp:rmfsxgGqRUoOnV:u")) != EOF) { switch (opt) { case 'C': /* alt config file */ alt_config = optarg; @@ -154,6 +156,10 @@ rflag = 1; break; + case 'u': + dousers = 1; + break; + case 'm': mflag = 1; break; @@ -307,7 +313,7 @@ /* Normal Operation */ if (optind == argc) { - if (rflag) { + if (rflag || dousers) { fprintf(stderr, "please specify a mailbox to recurse from\n"); cyrus_done(); exit(EC_USAGE); @@ -319,6 +325,10 @@ } for (i = optind; i < argc; i++) { + if (dousers) { + mboxlist_allusermbox(argvi, do_reconstruct_p, NULL, /*include_deleted*/1); + continue; + } char *domain = NULL; /* save domain */ @@ -397,15 +407,34 @@ static void usage(void) { fprintf(stderr, - "usage: reconstruct -C <alt_config> -p partition -ksrfx mailbox...\n"); + "usage: reconstruct -C <alt_config> -p partition -ksrfxu mailbox...\n"); fprintf(stderr, " reconstruct -C <alt_config> -m\n"); exit(EC_USAGE); } /* + * + */ +static int do_reconstruct_p(void *rock, const char *key, size_t keylen, + const char *data, size_t datalen) +{ + mbentry_t *mbentry = NULL; + + if (mboxlist_parse_entry(&mbentry, key, keylen, data, datalen)) + return 0; + + if (!(mbentry->mbtype & MBTYPE_DELETED)) + do_reconstruct(mbentry->name, keylen, 0, rock); + + mboxlist_entry_free(&mbentry); + + return 0; +} + +/* * mboxlist_findall() callback function to reconstruct a mailbox */ -static int do_reconstruct(char *name, +static int do_reconstruct(const char *name, int matchlen, int maycreate __attribute__((unused)), void *rock)
View file
cyrus-imapd-2.5.tar.gz/imap/sync_client.c
Changed
@@ -2928,6 +2928,20 @@ } } +static int do_mailbox(const char *mboxname) +{ + struct sync_name_list *list = sync_name_list_create(); + int r; + + sync_name_list_add(list, mboxname); + + r = do_mailboxes(list); + + sync_name_list_free(&list); + + return r; +} + static int cb_allmbox(void *rock __attribute__((unused)), const char *key, size_t keylen, const char *val __attribute__((unused)), @@ -2937,22 +2951,38 @@ const char *userid; int r = 0; - if (mboxname_isdeletedmailbox(mboxname, NULL)) - goto done; - userid = mboxname_to_userid(mboxname); - if (userid && strcmpsafe(userid, prev_userid)) { - printf("%s\n", userid); - r = do_user(userid); + if (userid) { + /* skip deleted mailboxes only because the are out of order, and you would + * otherwise have to sync the user twice thanks to our naive logic */ + if (mboxname_isdeletedmailbox(mboxname, NULL)) + goto done; + + /* only sync if we haven't just done the user */ + if (strcmpsafe(userid, prev_userid)) { + printf("USER: %s\n", userid); + r = do_user(userid); + if (r) { + if (verbose) + fprintf(stderr, "Error from do_user(%s): bailing out!\n", userid); + syslog(LOG_ERR, "Error in do_user(%s): bailing out!", userid); + goto done; + } + free(prev_userid); + prev_userid = xstrdup(userid); + } + } + else { + /* all shared mailboxes, including DELETED ones, sync alone */ + /* XXX: batch in hundreds? */ + r = do_mailbox(mboxname); if (r) { if (verbose) - fprintf(stderr, "Error from do_user(%s): bailing out!\n", userid); - syslog(LOG_ERR, "Error in do_user(%s): bailing out!", userid); + fprintf(stderr, "Error from do_user(%s): bailing out!\n", mboxname); + syslog(LOG_ERR, "Error in do_user(%s): bailing out!", mboxname); goto done; } - free(prev_userid); - prev_userid = xstrdup(userid); } done:
View file
cyrus-imapd-2.5.tar.gz/lib/imapoptions
Changed
@@ -169,7 +169,7 @@ 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 } @@ -508,7 +508,7 @@ specifies the actual key used for iSchedule DKIM signing within the domain. */ -{ "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. */ @@ -1013,10 +1013,10 @@ { "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 } @@ -1376,7 +1376,7 @@ /* 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 } @@ -1401,7 +1401,7 @@ /* 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 } @@ -1521,7 +1521,7 @@ 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 } @@ -1715,7 +1715,7 @@ { "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 } @@ -1880,7 +1880,7 @@ /* File containing the private key belonging to the certificate in tls_server_cert. */ -{ "tls_sessions_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} +{ "tls_sessions_db", "twoskip", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql", "twoskip")} /* The cyrusdb backend to use for the TLS cache. */ { "tls_sessions_db_path", NULL, STRING }
View file
cyrus-imapd-2.5.tar.gz/man/reconstruct.8
Changed
@@ -195,6 +195,9 @@ Change the cyrus.index minor version to a specific version. This can be useful for upgrades or downgrades. .TP +.B -u +Instead of mailbox prefixes, give usernames on the command line +.TP .B \-m .B NOTE: CURRENTLY UNAVAILABLE .br
View file
cyrus-imapd-2.5.tar.gz/sieve/bc_dump.c
Changed
@@ -144,7 +144,6 @@ case BC_HEADER: has_index=1; - case BC_HEADER_PRE_INDEX: printf("%d: HEADER (\n",ip++); if (has_index) { @@ -188,7 +187,6 @@ case BC_ADDRESS: has_index = 1; - case BC_ADDRESS_PRE_INDEX: case BC_ENVELOPE: if (d->dataip.op == BC_ADDRESS) { printf("%d: ADDRESS (\n",ip++);
View file
cyrus-imapd-2.5.tar.gz/sieve/sieved.c
Changed
@@ -599,15 +599,7 @@ /* fall through */ case B_FILEINTO_ORIG: /*4*/ i = unwrap_string(d, i, &data, &len); - if(B_FILEINTO <= op) { - /* TODO: implement :flags parameter */ - printf("FILEINTO COPY(%d) FOLDER({%d}%s) FLAGS {%d}\n",copy,len,data,ntohl(di.listlen)); - i=write_list(ntohl(di.listlen), i+1, d); - } - else { printf("FILEINTO COPY(%d) FOLDER({%d}%s)\n",copy,len,data); - } - break; case B_REDIRECT: /*20*/
View file
cyrus-imapd-2.5.tar.gz/sieve/test.c
Changed
@@ -636,6 +636,9 @@ if (m) free_msg(m); + strarray_fini(&e_from); + strarray_fini(&e_to); + strarray_fini(&mark); return 0; }
View file
cyrus-imapd-2.5.tar.gz/sieve/varlist.c
Changed
@@ -6,7 +6,6 @@ */ #include "varlist.h" -#include <memory.h> #include "xmalloc.h" @@ -21,7 +20,7 @@ if (!vl) { return NULL; } - if ((!name && !vl->name) || (!(name && vl->name) && strcmp(name, vl->name))) { + if ((!name && !vl->name) || ((name && vl->name) && !strcasecmp(name, vl->name))) { return vl; } return varlist_select(vl->next, name);
View file
cyrus-imapd.dsc
Changed
@@ -2,7 +2,7 @@ Source: cyrus-imapd Binary: cyrus-imapd Architecture: any -Version: 2.5~dev2014110501-0~kolab1 +Version: 2.5~dev2014111201-0~kolab1 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.cyrusimap.org/
View file
debian.changelog
Changed
@@ -1,3 +1,10 @@ +cyrus-imapd (2.5~dev2014111201-0~kolab1) unstable; urgency=low + + * Ship a GIT development snapshot from git.cyrusimap.org + 58e1f4b277586e448f726bdafe6f2e250c9ea5f4 + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Wed, 11 Nov 2014 11:30:13 +0100 + cyrus-imapd (2.5~dev2014110501-0~kolab1) unstable; urgency=low * Ship a GIT development snapshot from git.cyrusimap.org
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
.