From dovecot at dovecot.org Tue Aug 2 13:29:58 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Aug 2011 13:29:58 +0300 Subject: dovecot-2.0: i_getgr*(): OpenBSD workaround is now only used for... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d7f76c266657 changeset: 12874:d7f76c266657 user: Timo Sirainen date: Tue Aug 02 13:29:47 2011 +0300 description: i_getgr*(): OpenBSD workaround is now only used for <5.0. Patch by Brad. diffstat: src/lib/ipwd.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diffs (15 lines): diff -r f42aac06a3df -r d7f76c266657 src/lib/ipwd.c --- a/src/lib/ipwd.c Fri Jul 29 12:25:52 2011 +0300 +++ b/src/lib/ipwd.c Tue Aug 02 13:29:47 2011 +0300 @@ -31,9 +31,8 @@ long size; if (grbuf == NULL) { - /* OpenBSD (up to 4.8 at least) reports too low value in - sysconf() */ -#ifndef __OpenBSD__ + /* OpenBSD up to 4.9 reports too low value in sysconf() */ +#if !defined(__OpenBSD__) || OpenBSD >= 201111 size = sysconf(_SC_GETGR_R_SIZE_MAX); if (size < 0) #endif From pigeonhole at rename-it.nl Tue Aug 2 17:26:42 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Aug 2011 16:26:42 +0200 Subject: dovecot-2.0-pigeonhole: lib-sieve: added X-Sieve-Redirected-From... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/81b37c0055c3 changeset: 1515:81b37c0055c3 user: Stephan Bosch date: Tue Aug 02 16:25:04 2011 +0200 description: lib-sieve: added X-Sieve-Redirected-From header for people using SPF/SRS. diffstat: src/lib-sieve/cmd-redirect.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (29 lines): diff -r 08bbe5872576 -r 81b37c0055c3 src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Tue Jul 05 20:32:28 2011 +0200 +++ b/src/lib-sieve/cmd-redirect.c Tue Aug 02 16:25:04 2011 +0200 @@ -295,11 +295,13 @@ static bool act_redirect_send (const struct sieve_action_exec_env *aenv, struct act_redirect_context *ctx) { - static const char *hide_headers[] = { "Return-Path", "X-Sieve" }; + static const char *hide_headers[] = + { "Return-Path", "X-Sieve", "X-Sieve-Redirected-From" }; const struct sieve_message_data *msgdata = aenv->msgdata; const struct sieve_script_env *senv = aenv->scriptenv; const char *sender = sieve_message_get_sender(aenv->msgctx); + const char *recipient = sieve_message_get_final_recipient(aenv->msgctx); struct istream *input, *crlf_input; void *smtp_handle; FILE *f; @@ -328,8 +330,9 @@ /* Make sure the message contains CRLF consistently */ crlf_input = i_stream_create_crlf(input); - /* Prepend sieve version header (should not affect signatures) */ + /* Prepend sieve headers (should not affect signatures) */ rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION); + rfc2822_header_field_write(f, "X-Sieve-Redirected-From", recipient); /* Pipe the message to the outgoing SMTP transport */ while ((ret = i_stream_read_data(crlf_input, &data, &size, 0)) > 0) { From pigeonhole at rename-it.nl Tue Aug 2 17:36:11 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Aug 2011 16:36:11 +0200 Subject: dovecot-2.0-pigeonhole: lib-sieve: forgot to check for NULL reci... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/efad75f779de changeset: 1516:efad75f779de user: Stephan Bosch date: Tue Aug 02 16:36:06 2011 +0200 description: lib-sieve: forgot to check for NULL recipient in previous change. diffstat: src/lib-sieve/cmd-redirect.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 81b37c0055c3 -r efad75f779de src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Tue Aug 02 16:25:04 2011 +0200 +++ b/src/lib-sieve/cmd-redirect.c Tue Aug 02 16:36:06 2011 +0200 @@ -332,7 +332,8 @@ /* Prepend sieve headers (should not affect signatures) */ rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION); - rfc2822_header_field_write(f, "X-Sieve-Redirected-From", recipient); + if ( recipient != NULL ) + rfc2822_header_field_write(f, "X-Sieve-Redirected-From", recipient); /* Pipe the message to the outgoing SMTP transport */ while ((ret = i_stream_read_data(crlf_input, &data, &size, 0)) > 0) { From pigeonhole at rename-it.nl Tue Aug 2 18:56:01 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Aug 2011 17:56:01 +0200 Subject: dovecot-2.0-pigeonhole: lib-sieve: vacation extension: finally a... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/81f7acac82f2 changeset: 1517:81f7acac82f2 user: Stephan Bosch date: Tue Aug 02 17:50:15 2011 +0200 description: lib-sieve: vacation extension: finally added support for using the original recipient in vacation address check. diffstat: doc/vacation.txt | 27 ++++- src/lib-sieve/plugins/vacation/cmd-vacation.c | 124 +++++++++++++----------- src/lib-sieve/plugins/vacation/ext-vacation-common.c | 15 ++- src/lib-sieve/plugins/vacation/ext-vacation-common.h | 2 + src/testsuite/testsuite-message.c | 17 +++- src/testsuite/testsuite-message.h | 2 + src/testsuite/testsuite-objects.c | 8 + tests/extensions/vacation/reply.svtest | 98 +++++++++++++++++++ 8 files changed, 233 insertions(+), 60 deletions(-) diffs (truncated from 506 to 300 lines): diff -r efad75f779de -r 81f7acac82f2 doc/vacation.txt --- a/doc/vacation.txt Tue Aug 02 16:36:06 2011 +0200 +++ b/doc/vacation.txt Tue Aug 02 17:50:15 2011 +0200 @@ -31,9 +31,9 @@ day. The vacation and vacation-seconds extensions have their own specific -settings. The settings that specify a period (currently all of them) -are specified in s(econds), unless followed by a d(ay), h(our) or m(inute) -specifier character. +settings. The settings that specify a period are specified in +s(econds), unless followed by a d(ay), h(our) or m(inute) specifier +character. The following settings can be configured the vacation extension (default values are indicated): @@ -56,6 +56,27 @@ tag is specified. The configured value must lie between the sieve_vacation_min_period and sieve_vacation_max_period. +sieve_vacation_use_original_recipient = no + This specifies whether the original envelope recipient should be used in + the check for implicit delivery. The vacation command checks headers of + the incoming message, such as To: and Cc: for the address of the + recipient, to verify that the message is explicitly addressed at the + recipient. If the recipient address is not found, the vacation action + will not trigger a response to prevent sending a reply when it is not + appropriate. Normally only the final recipient address is used in this + check. This setting allows including the original recipient specified in + the SMTP session if available. This is useful to handle mail accounts + with aliases. Use this option with caution: if you are using aliases that + point to more than a single account, senders can get multiple vacation + responses for a single message. + +sieve_vacation_dont_check_recipient = no + This disables the checks for implicit delivery entirely. This means that + the vacation command does not verify that the message is explicitly + addressed at the recipient. Use this option with caution. Specifying + 'yes' will violate the Sieve standards and can cause vacation replies to + be sent for messages not directly addressed at the recipient. + Invalid values for the settings above will make the Sieve interpreter log a warning and revert to the default values. diff -r efad75f779de -r 81f7acac82f2 src/lib-sieve/plugins/vacation/cmd-vacation.c --- a/src/lib-sieve/plugins/vacation/cmd-vacation.c Tue Aug 02 16:36:06 2011 +0200 +++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c Tue Aug 02 17:50:15 2011 +0200 @@ -1017,11 +1017,11 @@ const struct sieve_script_env *senv = aenv->scriptenv; struct act_vacation_context *ctx = (struct act_vacation_context *) action->context; - const char *const *hdsp; unsigned char dupl_hash[MD5_RESULTLEN]; - const char *const *headers; const char *sender = sieve_message_get_sender(aenv->msgctx); const char *recipient = sieve_message_get_final_recipient(aenv->msgctx); + const char *const *hdsp; + const char *const *headers; const char *reply_from = NULL; /* Is the recipient unset? @@ -1037,14 +1037,14 @@ if ( sender == NULL ) { sieve_result_global_log(aenv, "discarded vacation reply to <>"); return TRUE; - } - - /* Are we perhaps trying to respond to ourselves ? + } + + /* Are we perhaps trying to respond to ourselves ? */ if ( sieve_address_compare(sender, recipient, TRUE) == 0 ) { sieve_result_global_log(aenv, "discarded vacation reply to own address <%s>", - str_sanitize(sender, 128)); + str_sanitize(sender, 128)); return TRUE; } @@ -1052,24 +1052,24 @@ */ if ( ctx->addresses != NULL ) { const char * const *alt_address = ctx->addresses; - + while ( *alt_address != NULL ) { if ( sieve_address_compare(sender, *alt_address, TRUE) == 0 ) { sieve_result_global_log(aenv, "discarded vacation reply to own address <%s> " "(as specified using :addresses argument)", - str_sanitize(sender, 128)); + str_sanitize(sender, 128)); return TRUE; } alt_address++; - } + } } - + /* Did whe respond to this user before? */ if ( sieve_action_duplicate_check_available(senv) ) { act_vacation_hash(ctx, sender, dupl_hash); - - if ( sieve_action_duplicate_check(senv, dupl_hash, sizeof(dupl_hash)) ) + + if ( sieve_action_duplicate_check(senv, dupl_hash, sizeof(dupl_hash)) ) { sieve_result_global_log(aenv, "discarded duplicate vacation response to <%s>", @@ -1077,7 +1077,7 @@ return TRUE; } } - + /* Are we trying to respond to a mailing list ? */ hdsp = _list_headers; while ( *hdsp != NULL ) { @@ -1101,7 +1101,7 @@ if ( strcasecmp(*hdsp, "no") != 0 ) { sieve_result_global_log(aenv, "discarding vacation response to auto-submitted message from <%s>", - str_sanitize(sender, 128)); + str_sanitize(sender, 128)); return TRUE; } hdsp++; @@ -1124,59 +1124,73 @@ hdsp++; } } - + /* Do not reply to system addresses */ if ( _is_system_address(sender) ) { - sieve_result_global_log(aenv, - "not sending vacation response to system address <%s>", - str_sanitize(sender, 128)); - return TRUE; - } - + sieve_result_global_log(aenv, + "not sending vacation response to system address <%s>", + str_sanitize(sender, 128)); + return TRUE; + } + /* Is the original message directly addressed to the user or the addresses - * specified using the :addresses tag? + * specified using the :addresses tag? */ - hdsp = _my_address_headers; - while ( *hdsp != NULL ) { - if ( mail_get_headers - (msgdata->mail, *hdsp, &headers) >= 0 && headers[0] != NULL ) { - - if ( _contains_my_address(headers, recipient) ) { - reply_from = recipient; - break; + if ( !config->dont_check_recipient ) { + const char *orig_recipient = NULL; + + if ( config->use_original_recipient ) + orig_recipient = sieve_message_get_orig_recipient(aenv->msgctx); + + hdsp = _my_address_headers; + while ( *hdsp != NULL ) { + if ( mail_get_headers + (msgdata->mail, *hdsp, &headers) >= 0 && headers[0] != NULL ) { + + if ( _contains_my_address(headers, recipient) ) { + reply_from = recipient; + break; + } + + if ( orig_recipient != NULL && _contains_my_address(headers, orig_recipient) ) { + reply_from = orig_recipient; + break; + } + + if ( ctx->addresses != NULL ) { + bool found = FALSE; + const char * const *my_address = ctx->addresses; + + while ( !found && *my_address != NULL ) { + if ( (found=_contains_my_address(headers, *my_address)) ) + reply_from = *my_address; + my_address++; + } + + if ( found ) break; + } } - - if ( ctx->addresses != NULL ) { - bool found = FALSE; - const char * const *my_address = ctx->addresses; - - while ( !found && *my_address != NULL ) { - found = _contains_my_address(headers, *my_address); - reply_from = *my_address; - my_address++; - } - - if ( found ) break; - } + hdsp++; } - hdsp++; - } - if ( *hdsp == NULL ) { - /* No, bail out */ - sieve_result_global_log(aenv, - "discarding vacation response for message implicitly delivered to <%s>", - recipient ); - return TRUE; - } - + + /* My address not found in the headers; we got an implicit delivery */ + if ( *hdsp == NULL ) { + /* No, bail out */ + sieve_result_global_log(aenv, + "discarding vacation response for message implicitly delivered to <%s>", + recipient ); + return TRUE; + } + } + /* Send the message */ - + if ( act_vacation_send(aenv, ctx, sender, reply_from) ) { sieve_number_t seconds; sieve_result_global_log(aenv, "sent vacation response to <%s>", - str_sanitize(sender, 128)); + str_sanitize(sender, 128)); /* Check period limits once more */ seconds = ctx->seconds; diff -r efad75f779de -r 81f7acac82f2 src/lib-sieve/plugins/vacation/ext-vacation-common.c --- a/src/lib-sieve/plugins/vacation/ext-vacation-common.c Tue Aug 02 16:36:06 2011 +0200 +++ b/src/lib-sieve/plugins/vacation/ext-vacation-common.c Tue Aug 02 17:50:15 2011 +0200 @@ -16,6 +16,7 @@ struct sieve_instance *svinst = ext->svinst; struct ext_vacation_config *config; sieve_number_t min_period, max_period, default_period; + bool use_original_recipient, dont_check_recipient; if ( *context != NULL ) { ext_vacation_unload(ext); @@ -48,11 +49,23 @@ "sieve_vacation_min_period < sieve_vacation_default_period < " "sieve_vacation_max_period"); } - + + if ( !sieve_setting_get_bool_value + (svinst, "sieve_vacation_use_original_recipient", &use_original_recipient) ) { + use_original_recipient = FALSE; + } + + if ( !sieve_setting_get_bool_value + (svinst, "sieve_vacation_dont_check_recipient", &dont_check_recipient) ) { + dont_check_recipient = FALSE; + } + config = i_new(struct ext_vacation_config, 1); config->min_period = min_period; config->max_period = max_period; config->default_period = default_period; + config->use_original_recipient = use_original_recipient; + config->dont_check_recipient = dont_check_recipient; *context = (void *) config; diff -r efad75f779de -r 81f7acac82f2 src/lib-sieve/plugins/vacation/ext-vacation-common.h --- a/src/lib-sieve/plugins/vacation/ext-vacation-common.h Tue Aug 02 16:36:06 2011 +0200 +++ b/src/lib-sieve/plugins/vacation/ext-vacation-common.h Tue Aug 02 17:50:15 2011 +0200 @@ -18,6 +18,8 @@ unsigned int min_period; unsigned int max_period; unsigned int default_period; + bool use_original_recipient; + bool dont_check_recipient; }; /* diff -r efad75f779de -r 81f7acac82f2 src/testsuite/testsuite-message.c --- a/src/testsuite/testsuite-message.c Tue Aug 02 16:36:06 2011 +0200 +++ b/src/testsuite/testsuite-message.c Tue Aug 02 17:50:15 2011 +0200 @@ -33,6 +33,7 @@ static string_t *envelope_from; static string_t *envelope_to; +static string_t *envelope_orig_to; From dovecot at dovecot.org Thu Aug 4 19:57:46 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Aug 2011 19:57:46 +0300 Subject: dovecot-2.0: mail_index_get_keywords() / status.keywords weren't... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/ba03935cc599 changeset: 12875:ba03935cc599 user: Timo Sirainen date: Thu Aug 04 19:57:35 2011 +0300 description: mail_index_get_keywords() / status.keywords weren't actually guaranteed to be NULL terminated This could have caused crashes or garbage keywords be presented to clients in some situations. diffstat: src/lib-index/mail-index.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diffs (14 lines): diff -r d7f76c266657 -r ba03935cc599 src/lib-index/mail-index.c --- a/src/lib-index/mail-index.c Tue Aug 02 13:29:47 2011 +0300 +++ b/src/lib-index/mail-index.c Thu Aug 04 19:57:35 2011 +0300 @@ -265,6 +265,10 @@ hash_table_insert(index->keywords_hash, keyword_dup, POINTER_CAST(*idx_r)); array_append(&index->keywords, &keyword, 1); + + /* keep the array NULL-terminated, but the NULL itself invisible */ + (void)array_append_space(&index->keywords); + array_delete(&index->keywords, array_count(&index->keywords)-1, 1); } const ARRAY_TYPE(keywords) *mail_index_get_keywords(struct mail_index *index) From dovecot at dovecot.org Tue Aug 16 22:27:30 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 16 Aug 2011 22:27:30 +0300 Subject: dovecot-2.0: lib-index: Optimized handling MAIL_TRANSACTION_EXPU... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/17d7aceda8ba changeset: 12876:17d7aceda8ba user: Timo Sirainen date: Tue Aug 16 22:27:18 2011 +0300 description: lib-index: Optimized handling MAIL_TRANSACTION_EXPUNGE_GUID records in large index. diffstat: src/lib-index/mail-index-sync-update.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diffs (34 lines): diff -r ba03935cc599 -r 17d7aceda8ba src/lib-index/mail-index-sync-update.c --- a/src/lib-index/mail-index-sync-update.c Thu Aug 04 19:57:35 2011 +0300 +++ b/src/lib-index/mail-index-sync-update.c Tue Aug 16 22:27:18 2011 +0300 @@ -552,11 +552,15 @@ case MAIL_TRANSACTION_EXPUNGE_GUID: case MAIL_TRANSACTION_EXPUNGE_GUID|MAIL_TRANSACTION_EXPUNGE_PROT: { const struct mail_transaction_expunge_guid *rec = data, *end; + ARRAY_TYPE(seq_range) uids; + const struct seq_range *range; + unsigned int i, count; if ((hdr->type & MAIL_TRANSACTION_EXTERNAL) == 0) { /* this is simply a request for expunge */ break; } + t_array_init(&uids, 64); end = CONST_PTR_OFFSET(data, hdr->size); for (; rec != end; rec++) { if (rec->uid == 0) { @@ -565,8 +569,13 @@ rec->uid); break; } - sync_expunge(ctx, rec->uid, rec->uid); + seq_range_array_add(&uids, 0, rec->uid); } + + /* do this in reverse so the memmove()s are smaller */ + range = array_get(&uids, &count); + for (i = count; i > 0; i--) + sync_expunge(ctx, range[i-1].seq1, range[i-1].seq2); break; } case MAIL_TRANSACTION_FLAG_UPDATE: { From dovecot at dovecot.org Tue Aug 16 22:36:31 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 16 Aug 2011 22:36:31 +0300 Subject: dovecot-2.0: lib-storage: Log alt path when mail_debug=yes Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/46bf11666cdd changeset: 12877:46bf11666cdd user: Timo Sirainen date: Tue Aug 16 22:36:23 2011 +0300 description: lib-storage: Log alt path when mail_debug=yes diffstat: src/lib-storage/mailbox-list.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 17d7aceda8ba -r 46bf11666cdd src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Tue Aug 16 22:27:18 2011 +0300 +++ b/src/lib-storage/mailbox-list.c Tue Aug 16 22:36:23 2011 +0300 @@ -183,14 +183,15 @@ } if (ns->mail_set->mail_debug) { - i_debug("%s: root=%s, index=%s, control=%s, inbox=%s", + i_debug("%s: root=%s, index=%s, control=%s, inbox=%s, alt=%s", list->name, list->set.root_dir == NULL ? "" : list->set.root_dir, list->set.index_dir == NULL ? "" : list->set.index_dir, list->set.control_dir == NULL ? "" : list->set.control_dir, list->set.inbox_path == NULL ? - "" : list->set.inbox_path); + "" : list->set.inbox_path, + list->set.alt_dir == NULL ? "" : list->set.alt_dir); } mail_namespace_finish_list_init(ns, list); From dovecot at dovecot.org Thu Aug 18 18:21:53 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 18 Aug 2011 18:21:53 +0300 Subject: dovecot-2.0: mdbox: Remove refcount=0 records from map index on ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/1449a2e2c1f5 changeset: 12878:1449a2e2c1f5 user: Timo Sirainen date: Thu Aug 18 18:21:33 2011 +0300 description: mdbox: Remove refcount=0 records from map index on the first purge (not second). diffstat: src/lib-storage/index/dbox-multi/mdbox-purge.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diffs (47 lines): diff -r 46bf11666cdd -r 1449a2e2c1f5 src/lib-storage/index/dbox-multi/mdbox-purge.c --- a/src/lib-storage/index/dbox-multi/mdbox-purge.c Tue Aug 16 22:36:23 2011 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c Thu Aug 18 18:21:33 2011 +0300 @@ -291,7 +291,8 @@ } static int -mdbox_file_purge(struct mdbox_purge_context *ctx, struct dbox_file *file) +mdbox_file_purge(struct mdbox_purge_context *ctx, struct dbox_file *file, + uint32_t file_id) { struct mdbox_storage *dstorage = (struct mdbox_storage *)file->storage; struct stat st; @@ -326,8 +327,7 @@ /* get list of map UIDs that exist in this file (again has to be done after locking) */ i_array_init(&msgs_arr, 128); - if (mdbox_map_get_file_msgs(dstorage->map, - ((struct mdbox_file *)file)->file_id, + if (mdbox_map_get_file_msgs(dstorage->map, file_id, &msgs_arr) < 0) { array_free(&msgs_arr); dbox_file_unlock(file); @@ -420,10 +420,12 @@ /* unlink only after unlocking map, so readers don't see it temporarily vanished */ - if (ret > 0) + if (ret > 0) { (void)dbox_file_unlink(file); - else + mdbox_map_remove_file_id(ctx->storage->map, file_id); + } else { dbox_file_unlock(file); + } array_free(&copied_map_uids); array_free(&expunged_map_uids); @@ -664,7 +666,7 @@ seq_range_array_iter_nth(&iter, i++, &file_id)) T_BEGIN { file = mdbox_file_init(storage, file_id); if (dbox_file_open(file, &deleted) > 0 && !deleted) { - if (mdbox_file_purge(ctx, file) < 0) + if (mdbox_file_purge(ctx, file, file_id) < 0) ret = -1; } else { mdbox_map_remove_file_id(storage->map, file_id); From dovecot at dovecot.org Tue Aug 23 20:43:55 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 20:43:55 +0300 Subject: dovecot-2.0: lib-lda: Don't crash if remote disconnects during s... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/2f988e370a41 changeset: 12879:2f988e370a41 user: Timo Sirainen date: Tue Aug 23 20:43:36 2011 +0300 description: lib-lda: Don't crash if remote disconnects during sending mail via LMTP. diffstat: src/lib-lda/lmtp-client.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diffs (41 lines): diff -r 1449a2e2c1f5 -r 2f988e370a41 src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Thu Aug 18 18:21:33 2011 +0300 +++ b/src/lib-lda/lmtp-client.c Tue Aug 23 20:43:36 2011 +0300 @@ -101,9 +101,9 @@ if (client->io != NULL) io_remove(&client->io); if (client->input != NULL) - i_stream_unref(&client->input); + i_stream_close(client->input); if (client->output != NULL) - o_stream_unref(&client->output); + o_stream_close(client->output); if (client->fd != -1) { net_disconnect(client->fd); client->fd = -1; @@ -120,7 +120,7 @@ static void lmtp_client_ref(struct lmtp_client *client) { - pool_ref(client->pool); + client->refcount++; } static void lmtp_client_unref(struct lmtp_client **_client) @@ -128,6 +128,16 @@ struct lmtp_client *client = *_client; *_client = NULL; + + i_assert(client->refcount > 0); + if (--client->refcount > 0) + return; + + i_assert(client->finish_called); + if (client->input != NULL) + i_stream_unref(&client->input); + if (client->output != NULL) + o_stream_unref(&client->output); pool_unref(&client->pool); } From dovecot at dovecot.org Tue Aug 23 21:20:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 21:20:24 +0300 Subject: dovecot-2.0: login proxy: Fixed assert-crash on io_add() when cl... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/39655869f2ee changeset: 12880:39655869f2ee user: Timo Sirainen date: Tue Aug 23 21:20:13 2011 +0300 description: login proxy: Fixed assert-crash on io_add() when client disconnects at a bad time. diffstat: src/login-common/client-common-auth.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 2f988e370a41 -r 39655869f2ee src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Tue Aug 23 20:43:36 2011 +0300 +++ b/src/login-common/client-common-auth.c Tue Aug 23 21:20:13 2011 +0300 @@ -127,6 +127,15 @@ { string_t *str = t_str_new(128); + if (client->input->closed) { + /* input stream got closed in client_send_raw_data(). + In most places we don't have to check for this explicitly, + but login_proxy_detach() attempts to get and use the + istream's fd, which is now -1. */ + client_destroy(client, "Disconnected"); + return; + } + str_printfa(str, "proxy(%s): started proxying to %s:%u", client->virtual_user, login_proxy_get_host(client->login_proxy), From dovecot at dovecot.org Tue Aug 23 21:41:36 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 21:41:36 +0300 Subject: dovecot-2.0: zlib: Fixed reading concatenated .gz files. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/35e4a547231c changeset: 12881:35e4a547231c user: Timo Sirainen date: Tue Aug 23 21:41:24 2011 +0300 description: zlib: Fixed reading concatenated .gz files. diffstat: src/plugins/zlib/istream-zlib.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diffs (45 lines): diff -r 39655869f2ee -r 35e4a547231c src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Tue Aug 23 21:20:13 2011 +0300 +++ b/src/plugins/zlib/istream-zlib.c Tue Aug 23 21:41:24 2011 +0300 @@ -38,6 +38,8 @@ unsigned int zs_closed:1; }; +static void i_stream_zlib_init(struct zlib_istream *zstream); + static void i_stream_zlib_close(struct iostream_private *stream) { struct zlib_istream *zstream = (struct zlib_istream *)stream; @@ -157,6 +159,7 @@ return -1; } i_stream_skip(stream->parent, GZ_TRAILER_SIZE); + zstream->prev_size = 0; zstream->trailer_read = TRUE; return 1; } @@ -180,12 +183,21 @@ if (ret <= 0) return ret; } - stream->istream.eof = TRUE; - return -1; + if (!zstream->gz || i_stream_is_eof(stream->parent)) { + stream->istream.eof = TRUE; + return -1; + } + /* gzip file with concatenated content */ + zstream->eof_offset = (uoff_t)-1; + zstream->header_read = FALSE; + zstream->trailer_read = FALSE; + zstream->crc32 = 0; + + (void)inflateEnd(&zstream->zs); + i_stream_zlib_init(zstream); } if (!zstream->header_read) { - i_assert(zstream->high_pos == 0); do { ret = i_stream_zlib_read_header(stream); } while (ret == 0 && stream->istream.blocking); From dovecot at dovecot.org Tue Aug 23 22:14:53 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 22:14:53 +0300 Subject: dovecot-2.0: mbox: Avoid crashing when getting GUID or header-md... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/030394c74f54 changeset: 12882:030394c74f54 user: Timo Sirainen date: Tue Aug 23 22:14:38 2011 +0300 description: mbox: Avoid crashing when getting GUID or header-md5 in some conditions. mbox file can be opened and locked (especially with pop3_lock_session=yes) without actually creating a stream for it. diffstat: src/lib-storage/index/mbox/mbox-mail.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diffs (34 lines): diff -r 35e4a547231c -r 030394c74f54 src/lib-storage/index/mbox/mbox-mail.c --- a/src/lib-storage/index/mbox/mbox-mail.c Tue Aug 23 21:41:24 2011 +0300 +++ b/src/lib-storage/index/mbox/mbox-mail.c Tue Aug 23 22:14:38 2011 +0300 @@ -179,6 +179,7 @@ struct index_mail *mail = (struct index_mail *)_mail; struct mbox_mailbox *mbox = (struct mbox_mailbox *)_mail->box; uoff_t offset; + bool move_offset; switch (field) { case MAIL_FETCH_FROM_ENVELOPE: @@ -195,13 +196,19 @@ /* i guess in theory the empty_md5 is valid and can happen, but it's almost guaranteed that it means the MD5 sum is missing. recalculate it. */ - offset = mbox->mbox_lock_type == F_UNLCK ? 0 : - istream_raw_mbox_get_start_offset(mbox->mbox_stream); + if (mbox->mbox_lock_type == F_UNLCK || + mbox->mbox_stream == NULL) { + offset = 0; + move_offset = FALSE; + } else { + offset = istream_raw_mbox_get_start_offset(mbox->mbox_stream); + move_offset = TRUE; + } mbox->mbox_save_md5 = TRUE; if (mbox_sync(mbox, MBOX_SYNC_FORCE_SYNC | MBOX_SYNC_READONLY) < 0) return -1; - if (mbox->mbox_lock_type != F_UNLCK) { + if (move_offset) { if (istream_raw_mbox_seek(mbox->mbox_stream, offset) < 0) { i_error("mbox %s sync lost during MD5 syncing", From dovecot at dovecot.org Tue Aug 23 22:38:34 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 22:38:34 +0300 Subject: dovecot-2.0: rawlog: Use the lib-master API calls. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d4effbfae49c changeset: 12883:d4effbfae49c user: Timo Sirainen date: Tue Aug 23 22:38:24 2011 +0300 description: rawlog: Use the lib-master API calls. diffstat: src/util/rawlog.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diffs (53 lines): diff -r 030394c74f54 -r d4effbfae49c src/util/rawlog.c --- a/src/util/rawlog.c Tue Aug 23 22:14:38 2011 +0300 +++ b/src/util/rawlog.c Tue Aug 23 22:38:24 2011 +0300 @@ -11,6 +11,7 @@ #include "ostream.h" #include "process-title.h" #include "restrict-access.h" +#include "master-service.h" #include #include @@ -361,16 +362,13 @@ int main(int argc, char *argv[]) { char *executable, *p; - enum rawlog_flags flags; + enum rawlog_flags flags = + RAWLOG_FLAG_LOG_INPUT | RAWLOG_FLAG_LOG_OUTPUT; int c; - flags = RAWLOG_FLAG_LOG_INPUT | RAWLOG_FLAG_LOG_OUTPUT; - - lib_init(); - i_set_failure_internal(); - process_title_init(&argv); - - while ((c = getopt(argc, argv, "+iobt")) > 0) { + master_service = master_service_init("rawlog", 0, + &argc, &argv, "+iobt"); + while ((c = master_getopt(master_service)) > 0) { switch (c) { case 'i': flags &= ~RAWLOG_FLAG_LOG_OUTPUT; @@ -385,8 +383,7 @@ flags |= RAWLOG_FLAG_LOG_TIMESTAMPS; break; default: - argc = 0; - break; + return FATAL_DEFAULT; } } argc -= optind; @@ -395,6 +392,9 @@ if (argc < 1) i_fatal("Usage: rawlog [-i | -o] [-b] [-t] "); + master_service_init_log(master_service, "rawlog: "); + master_service_init_finish(master_service); + executable = argv[0]; rawlog_open(flags); From dovecot at dovecot.org Tue Aug 23 22:39:34 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 22:39:34 +0300 Subject: dovecot-2.0: lib-master: Make sure ipc server fd isn't tried to ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/eaeb7bcfb51e changeset: 12884:eaeb7bcfb51e user: Timo Sirainen date: Tue Aug 23 22:39:26 2011 +0300 description: lib-master: Make sure ipc server fd isn't tried to be accessed after it's closed. diffstat: src/lib-master/ipc-server.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r d4effbfae49c -r eaeb7bcfb51e src/lib-master/ipc-server.c --- a/src/lib-master/ipc-server.c Tue Aug 23 22:38:24 2011 +0300 +++ b/src/lib-master/ipc-server.c Tue Aug 23 22:39:26 2011 +0300 @@ -126,6 +126,7 @@ o_stream_destroy(&server->output); if (close(server->fd) < 0) i_error("close(%s) failed: %m", server->path); + server->fd = -1; } struct ipc_server * From dovecot at dovecot.org Tue Aug 23 23:03:51 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 23:03:51 +0300 Subject: dovecot-2.0: sdbox: Avoid assert-crashing if mail being saved su... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/de0ea56932e5 changeset: 12885:de0ea56932e5 user: Timo Sirainen date: Tue Aug 23 23:03:41 2011 +0300 description: sdbox: Avoid assert-crashing if mail being saved suddenly became corrupted. diffstat: src/lib-storage/index/dbox-single/sdbox-mail.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diffs (61 lines): diff -r eaeb7bcfb51e -r de0ea56932e5 src/lib-storage/index/dbox-single/sdbox-mail.c --- a/src/lib-storage/index/dbox-single/sdbox-mail.c Tue Aug 23 22:39:26 2011 +0300 +++ b/src/lib-storage/index/dbox-single/sdbox-mail.c Tue Aug 23 23:03:41 2011 +0300 @@ -28,7 +28,7 @@ sdbox_set_mailbox_corrupted(_mail->box); } -static bool sdbox_mail_file_set(struct dbox_mail *mail) +static int sdbox_mail_file_set(struct dbox_mail *mail) { struct mail *_mail = &mail->imail.mail.mail; struct sdbox_mailbox *mbox = (struct sdbox_mailbox *)_mail->box; @@ -37,10 +37,10 @@ if (mail->open_file != NULL) { /* already set */ - return FALSE; + return 0; } else if (!_mail->saving) { mail->open_file = sdbox_file_init(mbox, _mail->uid); - return FALSE; + return 0; } else { /* mail is being saved in this transaction */ mail->open_file = @@ -50,8 +50,14 @@ /* it doesn't have input stream yet */ ret = dbox_file_open(mail->open_file, &deleted); - i_assert(ret > 0); - return TRUE; + if (ret <= 0) { + mail_storage_set_critical(_mail->box->storage, + "dbox %s: Unexpectedly lost mail being saved", + _mail->box->path); + sdbox_set_mailbox_corrupted(_mail->box); + return -1; + } + return 1; } } @@ -60,13 +66,17 @@ { struct mail *_mail = &mail->imail.mail.mail; bool deleted; + int ret; if (_mail->lookup_abort != MAIL_LOOKUP_ABORT_NEVER) { mail_set_aborted(_mail); return -1; } - if (!sdbox_mail_file_set(mail)) { + ret = sdbox_mail_file_set(mail); + if (ret < 0) + return -1; + if (ret == 0) { if (!dbox_file_is_open(mail->open_file)) mail->imail.mail.stats_open_lookup_count++; if (dbox_file_open(mail->open_file, &deleted) <= 0) From dovecot at dovecot.org Tue Aug 23 23:25:26 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Aug 2011 23:25:26 +0300 Subject: dovecot-2.0: lib-index: When creating dovecot.index.backup files... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/f08bf97278ac changeset: 12886:f08bf97278ac user: Timo Sirainen date: Tue Aug 23 23:25:14 2011 +0300 description: lib-index: When creating dovecot.index.backup files, fdatasync() them first. Otherwise if the dovecot.index file had been written to recently, it could lose both the new and the old backup data. diffstat: src/lib-index/mail-index-write.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diffs (20 lines): diff -r de0ea56932e5 -r f08bf97278ac src/lib-index/mail-index-write.c --- a/src/lib-index/mail-index-write.c Tue Aug 23 23:03:41 2011 +0300 +++ b/src/lib-index/mail-index-write.c Tue Aug 23 23:25:14 2011 +0300 @@ -18,6 +18,16 @@ const char *backup_path, *tmp_backup_path; int ret; + if (index->fd != -1) { + /* we very much want to avoid creating a backup file that + hasn't been written to disk yet */ + if (fdatasync(index->fd) < 0) { + mail_index_set_error(index, "fdatasync(%s) failed: %m", + tmp_backup_path); + return -1; + } + } + backup_path = t_strconcat(index->filepath, ".backup", NULL); tmp_backup_path = t_strconcat(backup_path, ".tmp", NULL); ret = link(index->filepath, tmp_backup_path); From dovecot at dovecot.org Mon Aug 29 05:31:13 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 05:31:13 +0300 Subject: dovecot-2.0: lib-index: Error logging fix to previous commit. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/32eb50cc35d4 changeset: 12887:32eb50cc35d4 user: Timo Sirainen date: Mon Aug 29 05:30:58 2011 +0300 description: lib-index: Error logging fix to previous commit. diffstat: src/lib-index/mail-index-write.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r f08bf97278ac -r 32eb50cc35d4 src/lib-index/mail-index-write.c --- a/src/lib-index/mail-index-write.c Tue Aug 23 23:25:14 2011 +0300 +++ b/src/lib-index/mail-index-write.c Mon Aug 29 05:30:58 2011 +0300 @@ -23,7 +23,7 @@ hasn't been written to disk yet */ if (fdatasync(index->fd) < 0) { mail_index_set_error(index, "fdatasync(%s) failed: %m", - tmp_backup_path); + index->filepath); return -1; } } From dovecot at dovecot.org Mon Aug 29 05:36:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 05:36:21 +0300 Subject: dovecot-2.0: doveadm: Skip mailbox optimizations under OR search... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/24516f31a75d changeset: 12888:24516f31a75d user: Timo Sirainen date: Mon Aug 29 05:36:04 2011 +0300 description: doveadm: Skip mailbox optimizations under OR search terms. This fixes problem with e.g. "mailbox foo or seen". diffstat: src/doveadm/doveadm-mail-list-iter.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 32eb50cc35d4 -r 24516f31a75d src/doveadm/doveadm-mail-list-iter.c --- a/src/doveadm/doveadm-mail-list-iter.c Mon Aug 29 05:30:58 2011 +0300 +++ b/src/doveadm/doveadm-mail-list-iter.c Mon Aug 29 05:36:04 2011 +0300 @@ -26,6 +26,8 @@ for (; args != NULL; args = args->next) { switch (args->type) { case SEARCH_OR: + /* we don't currently try to optimize OR. */ + break; case SEARCH_SUB: case SEARCH_INTHREAD: subargs = args->value.subargs; From dovecot at dovecot.org Mon Aug 29 06:18:43 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 06:18:43 +0300 Subject: dovecot-2.0: director: Updated DIRECTOR-LIST doveadm command. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/63680f6e21a2 changeset: 12889:63680f6e21a2 user: Timo Sirainen date: Mon Aug 29 06:18:16 2011 +0300 description: director: Updated DIRECTOR-LIST doveadm command. diffstat: src/director/doveadm-connection.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diffs (46 lines): diff -r 24516f31a75d -r 63680f6e21a2 src/director/doveadm-connection.c --- a/src/director/doveadm-connection.c Mon Aug 29 05:36:04 2011 +0300 +++ b/src/director/doveadm-connection.c Mon Aug 29 06:18:16 2011 +0300 @@ -14,6 +14,7 @@ #include "director.h" #include "director-host.h" #include "director-request.h" +#include "director-connection.h" #include "doveadm-connection.h" #include @@ -93,12 +94,31 @@ static void doveadm_cmd_director_list(struct doveadm_connection *conn) { + struct director *dir = conn->dir; struct director_host *const *hostp; string_t *str = t_str_new(1024); + const char *type; + bool left, right; - array_foreach(&conn->dir->dir_hosts, hostp) { - str_printfa(str, "%s\t%u\n", - net_ip2addr(&(*hostp)->ip), (*hostp)->port); + array_foreach(&dir->dir_hosts, hostp) { + const struct director_host *host = *hostp; + + left = dir->left != NULL && + director_connection_get_host(dir->left) == host; + right = dir->right != NULL && + director_connection_get_host(dir->right) == host; + + if (dir->self_host == host) + type = "self"; + else if (left) + type = right ? "l+r" : "left"; + else if (right) + type = "right"; + else + type = ""; + str_printfa(str, "%s\t%u\t%s\t%lu\n", + net_ip2addr(&host->ip), host->port, type, + (unsigned long)host->last_failed); } str_append_c(str, '\n'); o_stream_send(conn->output, str_data(str), str_len(str)); From dovecot at dovecot.org Mon Aug 29 06:18:43 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 06:18:43 +0300 Subject: dovecot-2.0: doveadm: Added "director ring status" command. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/00f9dd706a90 changeset: 12890:00f9dd706a90 user: Timo Sirainen date: Mon Aug 29 06:18:26 2011 +0300 description: doveadm: Added "director ring status" command. diffstat: src/doveadm/doveadm-director.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diffs (54 lines): diff -r 63680f6e21a2 -r 00f9dd706a90 src/doveadm/doveadm-director.c --- a/src/doveadm/doveadm-director.c Mon Aug 29 06:18:16 2011 +0300 +++ b/src/doveadm/doveadm-director.c Mon Aug 29 06:18:26 2011 +0300 @@ -547,6 +547,41 @@ director_disconnect(ctx); } +static void cmd_director_ring_status(int argc, char *argv[]) +{ + struct director_context *ctx; + const char *line, *const *args; + unsigned long l; + + ctx = cmd_director_init(argc, argv, "a:", cmd_director_status); + + doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE); + doveadm_print_header_simple("director ip"); + doveadm_print_header_simple("port"); + doveadm_print_header_simple("type"); + doveadm_print_header_simple("last failed"); + + director_send(ctx, "DIRECTOR-LIST\n"); + while ((line = i_stream_read_next_line(ctx->input)) != NULL) { + if (*line == '\0') + break; + T_BEGIN { + args = t_strsplit(line, "\t"); + if (str_array_length(args) >= 4 && + str_to_ulong(args[3], &l) == 0) { + doveadm_print(args[0]); + doveadm_print(args[1]); + doveadm_print(args[2]); + if (l == 0) + doveadm_print("never"); + else + doveadm_print(unixdate2str(l)); + } + } T_END; + } + director_disconnect(ctx); +} + struct doveadm_cmd doveadm_cmd_director[] = { { cmd_director_status, "director status", "[-a ] []" }, @@ -561,6 +596,8 @@ { cmd_director_flush, "director flush", "[-a ] |all" }, { cmd_director_dump, "director dump", + "[-a ]" }, + { cmd_director_ring_status, "director ring status", "[-a ]" } }; From dovecot at dovecot.org Mon Aug 29 06:47:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 06:47:24 +0300 Subject: dovecot-1.2: imap: FETCH BODY[HEADER.FIELDS (..)] may have tried... Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/02c2ac9ddf8c changeset: 9649:02c2ac9ddf8c user: Timo Sirainen date: Mon Aug 29 06:46:53 2011 +0300 description: imap: FETCH BODY[HEADER.FIELDS (..)] may have tried to fetch garbage field names. Such situations were quite likely to cause a crash though. diffstat: src/imap/imap-fetch-body.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 32fe996d3c99 -r 02c2ac9ddf8c src/imap/imap-fetch-body.c --- a/src/imap/imap-fetch-body.c Wed Mar 09 20:22:52 2011 +0200 +++ b/src/imap/imap-fetch-body.c Mon Aug 29 06:46:53 2011 +0300 @@ -781,7 +781,8 @@ if (i != 0) str_append_c(str, ' '); - arr[i] = t_str_ucase(IMAP_ARG_STR(&args[i])); + arr[i] = p_strdup(ctx->cmd->pool, + t_str_ucase(IMAP_ARG_STR(&args[i]))); if (args[i].type == IMAP_ARG_ATOM) str_append(str, arr[i]); From dovecot at dovecot.org Mon Aug 29 06:48:07 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 06:48:07 +0300 Subject: dovecot-1.1: autogen.sh updated to use wiki1-export.tar.gz Message-ID: details: http://hg.dovecot.org/dovecot-1.1/rev/d9f9ca8c7fe2 changeset: 8372:d9f9ca8c7fe2 user: Timo Sirainen date: Wed May 11 18:03:31 2011 +0300 description: autogen.sh updated to use wiki1-export.tar.gz diffstat: autogen.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diffs (18 lines): diff -r 3698dfe0f21c -r d9f9ca8c7fe2 autogen.sh --- a/autogen.sh Wed May 11 15:17:02 2011 +0300 +++ b/autogen.sh Wed May 11 18:03:31 2011 +0300 @@ -18,10 +18,10 @@ if test ! -f doc/wiki/Authentication.txt; then cd doc - wget http://www.dovecot.org/tmp/wiki-export.tar.gz - tar xzf wiki-export.tar.gz - mv wiki-export/*.txt wiki/ - rm -rf wiki-export wiki-export.tar.gz + wget http://www.dovecot.org/tmp/wiki1-export.tar.gz + tar xzf wiki1-export.tar.gz + mv wiki1-export/*.txt wiki/ + rm -rf wiki1-export wiki1-export.tar.gz cd .. fi From dovecot at dovecot.org Mon Aug 29 06:48:07 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 06:48:07 +0300 Subject: dovecot-1.1: imap: FETCH BODY[HEADER.FIELDS (..)] may have tried... Message-ID: details: http://hg.dovecot.org/dovecot-1.1/rev/eb03f8c375fa changeset: 8373:eb03f8c375fa user: Timo Sirainen date: Mon Aug 29 06:46:53 2011 +0300 description: imap: FETCH BODY[HEADER.FIELDS (..)] may have tried to fetch garbage field names. Such situations were quite likely to cause a crash though. diffstat: src/imap/imap-fetch-body.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r d9f9ca8c7fe2 -r eb03f8c375fa src/imap/imap-fetch-body.c --- a/src/imap/imap-fetch-body.c Wed May 11 18:03:31 2011 +0300 +++ b/src/imap/imap-fetch-body.c Mon Aug 29 06:46:53 2011 +0300 @@ -777,7 +777,8 @@ if (i != 0) str_append_c(str, ' '); - arr[i] = t_str_ucase(IMAP_ARG_STR(&args[i])); + arr[i] = p_strdup(ctx->cmd->pool, + t_str_ucase(IMAP_ARG_STR(&args[i]))); if (args[i].type == IMAP_ARG_ATOM) str_append(str, arr[i]); From dovecot at dovecot.org Mon Aug 29 07:03:49 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 07:03:49 +0300 Subject: dovecot-2.0: doveadm: Fixed authentication with remote doveadm s... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c7dccec3eaa4 changeset: 12891:c7dccec3eaa4 user: Timo Sirainen date: Mon Aug 29 07:03:26 2011 +0300 description: doveadm: Fixed authentication with remote doveadm server. diffstat: src/doveadm/server-connection.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 00f9dd706a90 -r c7dccec3eaa4 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Mon Aug 29 06:18:26 2011 +0300 +++ b/src/doveadm/server-connection.c Mon Aug 29 07:03:26 2011 +0300 @@ -214,7 +214,7 @@ return; if (!conn->authenticated) { - if ((line = i_stream_next_line(conn->input)) != NULL) + if ((line = i_stream_next_line(conn->input)) == NULL) return; if (strcmp(line, "+") == 0) conn->authenticated = TRUE; From dovecot at dovecot.org Mon Aug 29 07:05:08 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 07:05:08 +0300 Subject: dovecot-2.0: doveadm: Proxying fix Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/3b7ef442595d changeset: 12892:3b7ef442595d user: Timo Sirainen date: Mon Aug 29 07:04:49 2011 +0300 description: doveadm: Proxying fix diffstat: src/doveadm/doveadm-mail-server.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c7dccec3eaa4 -r 3b7ef442595d src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Mon Aug 29 07:03:26 2011 +0300 +++ b/src/doveadm/doveadm-mail-server.c Mon Aug 29 07:04:49 2011 +0300 @@ -179,7 +179,7 @@ /* user not found from passdb. it could be in userdb though, so just continue with the default host */ } else { - proxy_host = NULL; + proxy_host = NULL; proxying = FALSE; for (i = 0; fields[i] != NULL; i++) { if (strncmp(fields[i], "proxy", 5) == 0 && (fields[i][5] == '\0' || fields[i][5] == '=')) From dovecot at dovecot.org Mon Aug 29 07:18:43 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 07:18:43 +0300 Subject: dovecot-2.0: Added tag 2.0.14 for changeset aa68f38c04f0 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d30a79f4b5a4 changeset: 12894:d30a79f4b5a4 user: Timo Sirainen date: Mon Aug 29 07:08:02 2011 +0300 description: Added tag 2.0.14 for changeset aa68f38c04f0 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r aa68f38c04f0 -r d30a79f4b5a4 .hgtags --- a/.hgtags Mon Aug 29 07:08:02 2011 +0300 +++ b/.hgtags Mon Aug 29 07:08:02 2011 +0300 @@ -64,3 +64,4 @@ 3355b4bbd4acf5eb004cacbaa3bcc873ad818b80 2.0.11 606faab2b896295b7dae7941b47e9374dbf90a66 2.0.12 aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 2.0.13 +aa68f38c04f080fe4d3142fb3f73425b78ef98bd 2.0.14 From dovecot at dovecot.org Mon Aug 29 07:18:43 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 07:18:43 +0300 Subject: dovecot-2.0: Released v2.0.14. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/aa68f38c04f0 changeset: 12893:aa68f38c04f0 user: Timo Sirainen date: Mon Aug 29 07:08:02 2011 +0300 description: Released v2.0.14. diffstat: NEWS | 23 +++++++++++++++++++++++ TODO | 2 +- configure.in | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diffs (59 lines): diff -r 3b7ef442595d -r aa68f38c04f0 NEWS --- a/NEWS Mon Aug 29 07:04:49 2011 +0300 +++ b/NEWS Mon Aug 29 07:08:02 2011 +0300 @@ -1,3 +1,26 @@ +v2.0.14 2011-08-29 Timo Sirainen + + + doveadm: Added support for running mail commands by proxying to + another doveadm server. + + Added "doveadm proxy list" and "doveadm proxy kick" commands to + list/kick proxy connections (via a new "ipc" service). + + Added "doveadm director move" to assign user from one server to + another, killing any existing connections. + + Added "doveadm director ring status" command. + + userdb extra fields can now return name+=value to append to an + existing name, e.g. "mail_plugins+= quota". + - script-login attempted an unnecessary config lookup, which usually + failed with "Permission denied". + - lmtp: Fixed parsing quoted strings with spaces as local-part for + MAIL FROM and RCPT TO. + - imap: FETCH BODY[HEADER.FIELDS (..)] may have crashed or not + returned all data sometimes. + - ldap: Fixed random assert-crashing with with sasl_bind=yes. + - Fixes to handling mail chroots + - Fixed renaming mailboxes under different parent with FS layout when + using separate ALT, INDEX or CONTROL paths. + - zlib: Fixed reading concatenated .gz files. + v2.0.13 2011-05-11 Timo Sirainen + Added "doveadm index" command to add unindexed messages into diff -r 3b7ef442595d -r aa68f38c04f0 TODO --- a/TODO Mon Aug 29 07:04:49 2011 +0300 +++ b/TODO Mon Aug 29 07:08:02 2011 +0300 @@ -18,7 +18,6 @@ from lib-index - dsync: if mailbox is renamed due to it being invalid, its subscription isn't renamed - - doveadm director assign - do it permanently in memory - LSUB shows subscribed namespace prefix as prefix/, also SUBSCRIBE adds the / - sql pool: if async query is pending and sync query is sent and there are no more empty connections, it should flush the async query first @@ -145,6 +144,7 @@ - DEBUG: buffer overflow checking code probably doesn't handle a successful t_try_realloc() or pool_alloconly_realloc() properly - ldap: + - sasl bind + auth_bind=yes should probably be doing only sasl binds.. - support multiple connections for doing auth binds - domain lookups which set the base for user lookup - same attribute can't be used for multiple values. diff -r 3b7ef442595d -r aa68f38c04f0 configure.in --- a/configure.in Mon Aug 29 07:04:49 2011 +0300 +++ b/configure.in Mon Aug 29 07:08:02 2011 +0300 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.0.13],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.0.14],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Mon Aug 29 07:18:43 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 29 Aug 2011 07:18:43 +0300 Subject: dovecot-2.0: Added signature for changeset aa68f38c04f0 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/e01c9f89b0b0 changeset: 12895:e01c9f89b0b0 user: Timo Sirainen date: Mon Aug 29 07:08:04 2011 +0300 description: Added signature for changeset aa68f38c04f0 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r d30a79f4b5a4 -r e01c9f89b0b0 .hgsigs --- a/.hgsigs Mon Aug 29 07:08:02 2011 +0300 +++ b/.hgsigs Mon Aug 29 07:08:04 2011 +0300 @@ -27,3 +27,4 @@ 3355b4bbd4acf5eb004cacbaa3bcc873ad818b80 0 iEYEABECAAYFAk10DCoACgkQyUhSUUBVislFAwCfUyZb1gwaGuSweAs1eUwIpIAAWTkAn2M2MDMIjmZduTZgcmbQPlWScNGP 606faab2b896295b7dae7941b47e9374dbf90a66 0 iEYEABECAAYFAk2kh3YACgkQyUhSUUBViskrNgCfdmuKZ1/9HDFOvBuBnTCw6lUuiaEAn207VAo55MOIb1RwAQgaP8wNC7YS aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 0 iEYEABECAAYFAk3KpGwACgkQyUhSUUBVismbmQCfTKfNrQnIy2cIQCYUE7zFrRl6nvgAnAu5W0iAfzKwFEAGtnGj1h+D+tY0 +aa68f38c04f080fe4d3142fb3f73425b78ef98bd 0 iEYEABECAAYFAk5bEKIACgkQyUhSUUBVislRhwCePWvqh3c+EitvNe1XlMqxpwWvDDgAoJKjDnmLwk0U62IhIQ+x90DEIgl6 From pigeonhole at rename-it.nl Mon Aug 29 17:14:35 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 29 Aug 2011 16:14:35 +0200 Subject: dovecot-2.0-pigeonhole: sievec: forgot to enable -D (debug) para... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/04b4edd4bf6e changeset: 1518:04b4edd4bf6e user: Stephan Bosch date: Mon Aug 29 16:14:26 2011 +0200 description: sievec: forgot to enable -D (debug) parameter. diffstat: src/sieve-tools/sievec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (16 lines): diff -r 81f7acac82f2 -r 04b4edd4bf6e src/sieve-tools/sievec.c --- a/src/sieve-tools/sievec.c Tue Aug 02 17:50:15 2011 +0200 +++ b/src/sieve-tools/sievec.c Mon Aug 29 16:14:26 2011 +0200 @@ -48,9 +48,9 @@ const char *scriptfile, *outfile; int exit_status = EXIT_SUCCESS; int c; - - sieve_tool = sieve_tool_init("sievec", &argc, &argv, "dP:x:u:", FALSE); - + + sieve_tool = sieve_tool_init("sievec", &argc, &argv, "DdP:x:u:", FALSE); + scriptfile = outfile = NULL; while ((c = sieve_tool_getopt(sieve_tool)) > 0) { switch (c) { From pigeonhole at rename-it.nl Mon Aug 29 17:55:10 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 29 Aug 2011 16:55:10 +0200 Subject: dovecot-2.0-pigeonhole: sieve: fixed debug mode; no messages wer... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/db043c016009 changeset: 1519:db043c016009 user: Stephan Bosch date: Mon Aug 29 16:55:06 2011 +0200 description: sieve: fixed debug mode; no messages were logged in some situations. diffstat: src/lib-sieve-tool/sieve-tool.c | 1 + src/lib-sieve/sieve-error.c | 14 ++++++++------ src/lib-sieve/sieve-script.c | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diffs (77 lines): diff -r 04b4edd4bf6e -r db043c016009 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Mon Aug 29 16:14:26 2011 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Mon Aug 29 16:55:06 2011 +0200 @@ -517,6 +517,7 @@ ehandler = sieve_stderr_ehandler_create(svinst, 0); sieve_error_handler_accept_infolog(ehandler, TRUE); + sieve_error_handler_accept_debuglog(ehandler, svinst->debug); if ( (sbin = sieve_compile(svinst, filename, name, ehandler, NULL)) == NULL ) i_error("failed to compile sieve script '%s'", filename); diff -r 04b4edd4bf6e -r db043c016009 src/lib-sieve/sieve-error.c --- a/src/lib-sieve/sieve-error.c Mon Aug 29 16:14:26 2011 +0200 +++ b/src/lib-sieve/sieve-error.c Mon Aug 29 16:55:06 2011 +0200 @@ -144,13 +144,13 @@ void sieve_direct_vdebug (struct sieve_instance *svinst, struct sieve_error_handler *ehandler, unsigned int flags, const char *location, const char *fmt, va_list args) -{ +{ if ( (flags & SIEVE_ERROR_FLAG_GLOBAL) != 0 && - (ehandler == NULL || ehandler->parent == NULL) && + (ehandler == NULL || ehandler->parent == NULL) && svinst->system_ehandler != ehandler && svinst->system_ehandler->vdebug != NULL ) { va_list args_copy; - + VA_COPY(args_copy, args); svinst->system_ehandler->vdebug @@ -159,8 +159,8 @@ if ( ehandler == NULL ) return; - if ( ehandler->parent != NULL || ehandler->log_info ) { - if ( ehandler->vdebug != NULL ) + if ( ehandler->parent != NULL || ehandler->log_debug ) { + if ( ehandler->vdebug != NULL ) ehandler->vdebug(ehandler, flags, location, fmt, args); } } @@ -527,7 +527,7 @@ ehandler->svinst = svinst; ehandler->refcount = 1; ehandler->max_errors = max_errors; - + ehandler->errors = 0; ehandler->warnings = 0; } @@ -667,6 +667,8 @@ if ( prefix != NULL ) ehandler->prefix = p_strdup(pool, prefix); + ehandler->handler.log_debug = svinst->debug; + return &ehandler->handler; } diff -r 04b4edd4bf6e -r db043c016009 src/lib-sieve/sieve-script.c --- a/src/lib-sieve/sieve-script.c Mon Aug 29 16:14:26 2011 +0200 +++ b/src/lib-sieve/sieve-script.c Mon Aug 29 16:55:06 2011 +0200 @@ -138,11 +138,11 @@ { switch ( errno ) { case ENOENT: + if ( svinst->debug ) + sieve_sys_debug(svinst, "script file %s not found", t_abspath(path)); if ( error_r == NULL ) sieve_error(ehandler, name, "sieve script does not exist"); else { - if ( svinst->debug ) - sieve_sys_debug(svinst, "script file %s not found", t_abspath(path)); *error_r = SIEVE_ERROR_NOT_FOUND; } break; From pigeonhole at rename-it.nl Mon Aug 29 18:33:04 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 29 Aug 2011 17:33:04 +0200 Subject: dovecot-2.0-pigeonhole: Updated TODO. Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/3901d10186e0 changeset: 1520:3901d10186e0 user: Stephan Bosch date: Mon Aug 29 17:01:44 2011 +0200 description: Updated TODO. diffstat: TODO | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (22 lines): diff -r db043c016009 -r 3901d10186e0 TODO --- a/TODO Mon Aug 29 16:55:06 2011 +0200 +++ b/TODO Mon Aug 29 17:01:44 2011 +0200 @@ -19,6 +19,9 @@ Next (mostly in order of descending priority/precedence): +* Update include extension to latest draft (v10 currently): + - Implement :optional tag. + - Implement required ManageSieve behavior * Add normalize() method to comparators to normalize the string before matching (for efficiency). * Improve error handling. @@ -36,8 +39,6 @@ * Cleanup the test suite - Restructure test scripts - Add more comment on purpose of tests -* Update include extension to latest draft (v05 currently): - - Implement required ManageSieve behavior (pending IETF discussion) * Finish the ereject extension * Vacation extension improvements: - Implement configurable sender exclusion list. From pigeonhole at rename-it.nl Mon Aug 29 18:33:04 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 29 Aug 2011 17:33:04 +0200 Subject: dovecot-2.0-pigeonhole: Updated NEWS and README for next release. Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/2b7f00ea1062 changeset: 1521:2b7f00ea1062 user: Stephan Bosch date: Mon Aug 29 17:33:00 2011 +0200 description: Updated NEWS and README for next release. diffstat: NEWS | 31 +++++++++++++++++++++++++++++++ README | 6 +++--- 2 files changed, 34 insertions(+), 3 deletions(-) diffs (54 lines): diff -r 3901d10186e0 -r 2b7f00ea1062 NEWS --- a/NEWS Mon Aug 29 17:01:44 2011 +0200 +++ b/NEWS Mon Aug 29 17:33:00 2011 +0200 @@ -1,3 +1,34 @@ +v0.2.4 29-08-2011 Stephan Bosch + + + Vacation extension: finally added support for using the original recipient + in vacation address check. It is also possible to disable the recipient + address check entirely. Check doc/vacation.txt for configuration + information. + + Implemented ihave extension. This allows checking for the availability + of Sieve language extensions at 'runtime'. Actually, this is checked + at compile time. At runtime the interpreter checks whether extensions + that were not previously available are still unavailable. If the situation + changed, the script is re-compiled and the ihave tests are evaluated again. + + Sieve: optimized compilation of tests that yield constant results (i.e. + known at compile tme), such as 'true' and 'false'. No code is produced + anymore for script sections that are never executed. Also, semantics + are not verified anymore in uncompiled script sections. + + Made vnd.dovecot.debug extension available to the LDA plugin instead of + only the command line tools. + + Sieve: redirect action now adds X-Sieve-Redirected-From header (mainly for + people using SPF/SRS). + - Sieve: fixed bug in handling flags and keywords; in case of error an + assertion was triggered. + - Script storage: improved handling of unconfigured user home directory. + Originally this would produce an unhelpful error message. + - Imap4flags extension: prevent forcibly enabling imap4flags when imapflags + is enabled. + - Fixed various -Wunused-but-set-variable compiler warnings. + - Include extension: forgot to check variable identifier syntax for 'global' + command. + - Sieve: fixed debug mode; no messages were logged in some situations. + - sievec tool: forgot to enable -D (debug) parameter. + v0.2.3 14-04-2011 Stephan Bosch * Sieve filter tool: finished implementing basic functionality. It is not diff -r 3901d10186e0 -r 2b7f00ea1062 README --- a/README Mon Aug 29 17:01:44 2011 +0200 +++ b/README Mon Aug 29 17:33:00 2011 +0200 @@ -120,9 +120,9 @@ ihave (RFC 5463): fully supported (v0.2.4+). mailbox (RFC 5490; Section 3): fully supported (v0.1.10+), but ACL permissions are not verified for mailboxexists. - include (draft v05): almost fully supported, but interaction with - ManageSieve is not in accordance with specification. - regex (draft v08; not latest ietf version): almost fully supported, but + include (draft v05; not latest version): almost fully supported, but + interaction with ManageSieve is not in accordance with specification. + regex (draft v08; not latest version): almost fully supported, but UTF-8 is not supported. The following deprecated extensions are supported for backwards From dovecot at dovecot.org Tue Aug 30 04:33:13 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 30 Aug 2011 04:33:13 +0300 Subject: dovecot-2.0: lib-index: Added mail_cache_view_update_cache_decis... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/efedf0644da8 changeset: 12896:efedf0644da8 user: Timo Sirainen date: Tue Aug 30 04:31:00 2011 +0300 description: lib-index: Added mail_cache_view_update_cache_decisions() diffstat: src/lib-index/mail-cache-decisions.c | 5 ++++- src/lib-index/mail-cache-private.h | 2 ++ src/lib-index/mail-cache.c | 6 ++++++ src/lib-index/mail-cache.h | 5 +++++ 4 files changed, 17 insertions(+), 1 deletions(-) diffs (65 lines): diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache-decisions.c --- a/src/lib-index/mail-cache-decisions.c Mon Aug 29 07:08:04 2011 +0300 +++ b/src/lib-index/mail-cache-decisions.c Tue Aug 30 04:31:00 2011 +0300 @@ -79,6 +79,9 @@ i_assert(field < cache->fields_count); + if (view->no_decision_updates) + return; + mail_index_lookup_uid(view->view, seq, &uid); hdr = mail_index_get_header(view->view); @@ -124,7 +127,7 @@ i_assert(field < cache->fields_count); - if (MAIL_CACHE_IS_UNUSABLE(cache)) + if (MAIL_CACHE_IS_UNUSABLE(cache) || view->no_decision_updates) return; if (cache->fields[field].field.decision != MAIL_CACHE_DECISION_NO) { diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache-private.h --- a/src/lib-index/mail-cache-private.h Mon Aug 29 07:08:04 2011 +0300 +++ b/src/lib-index/mail-cache-private.h Tue Aug 30 04:31:00 2011 +0300 @@ -198,6 +198,8 @@ buffer_t *cached_exists_buf; uint8_t cached_exists_value; uint32_t cached_exists_seq; + + unsigned int no_decision_updates:1; }; struct mail_cache_iterate_field { diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache.c --- a/src/lib-index/mail-cache.c Mon Aug 29 07:08:04 2011 +0300 +++ b/src/lib-index/mail-cache.c Tue Aug 30 04:31:00 2011 +0300 @@ -714,6 +714,12 @@ i_free(view); } +void mail_cache_view_update_cache_decisions(struct mail_cache_view *view, + bool update) +{ + view->no_decision_updates = !update; +} + uint32_t mail_cache_get_first_new_seq(struct mail_index_view *view) { const struct mail_index_header *idx_hdr; diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache.h --- a/src/lib-index/mail-cache.h Mon Aug 29 07:08:04 2011 +0300 +++ b/src/lib-index/mail-cache.h Tue Aug 30 04:31:00 2011 +0300 @@ -71,6 +71,11 @@ mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview); void mail_cache_view_close(struct mail_cache_view *view); +/* Normally cache decisions are updated on lookup/add. Use this function to + enable/disable this (useful for precaching data). */ +void mail_cache_view_update_cache_decisions(struct mail_cache_view *view, + bool update); + /* Get index transaction specific cache transaction. */ struct mail_cache_transaction_ctx * mail_cache_get_transaction(struct mail_cache_view *view, From dovecot at dovecot.org Tue Aug 30 04:33:13 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 30 Aug 2011 04:33:13 +0300 Subject: dovecot-2.0: lib-storage: Added MAILBOX_TRANSACTION_FLAG_NO_CACH... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5320315600a4 changeset: 12897:5320315600a4 user: Timo Sirainen date: Tue Aug 30 04:32:55 2011 +0300 description: lib-storage: Added MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC and use it when precaching. The result is that "doveadm index" no longer changes caching decisions. diffstat: src/lib-storage/index/index-sync.c | 2 +- src/lib-storage/index/index-transaction.c | 3 +++ src/lib-storage/mail-storage.h | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diffs (40 lines): diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/index/index-sync.c --- a/src/lib-storage/index/index-sync.c Tue Aug 30 04:31:00 2011 +0300 +++ b/src/lib-storage/index/index-sync.c Tue Aug 30 04:32:55 2011 +0300 @@ -392,7 +392,7 @@ } /* find the first message we need to index */ - trans = mailbox_transaction_begin(box, 0); + trans = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC); mail = mail_alloc(trans, 0, NULL); for (seq = status->messages; seq > 0; seq--) { mail_set_seq(mail, seq); diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/index/index-transaction.c --- a/src/lib-storage/index/index-transaction.c Tue Aug 30 04:31:00 2011 +0300 +++ b/src/lib-storage/index/index-transaction.c Tue Aug 30 04:32:55 2011 +0300 @@ -91,6 +91,9 @@ t->cache_view = it->cache_view; t->cache_trans = it->cache_trans; + if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0) + mail_cache_view_update_cache_decisions(t->cache_view, FALSE); + /* set up after mail_cache_get_transaction(), so that we'll still have the cache_trans available in _index_commit() */ it->super = t->itrans->v; diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Tue Aug 30 04:31:00 2011 +0300 +++ b/src/lib-storage/mail-storage.h Tue Aug 30 04:32:55 2011 +0300 @@ -140,7 +140,10 @@ is done only if it can be done easily. */ MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS = 0x04, /* Refresh the index so lookups return latest flags/modseqs */ - MAILBOX_TRANSACTION_FLAG_REFRESH = 0x08 + MAILBOX_TRANSACTION_FLAG_REFRESH = 0x08, + /* Don't update caching decisions no matter what we do in this + transaction (useful for e.g. precaching) */ + MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC = 0x10 }; enum mailbox_sync_flags {