From dovecot at dovecot.org Thu May 2 16:20:07 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 02 May 2013 16:20:07 +0300 Subject: dovecot-2.2: example-config: Typofix Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/73d67860db85 changeset: 16321:73d67860db85 user: Timo Sirainen date: Thu May 02 16:20:02 2013 +0300 description: example-config: Typofix diffstat: doc/example-config/dovecot.conf | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 83d83f55e5c2 -r 73d67860db85 doc/example-config/dovecot.conf --- a/doc/example-config/dovecot.conf Tue Apr 23 21:32:24 2013 +0300 +++ b/doc/example-config/dovecot.conf Thu May 02 16:20:02 2013 +0300 @@ -47,7 +47,7 @@ # these networks. Typically you'd specify your IMAP proxy servers here. #login_trusted_networks = -# Sepace separated list of login access check sockets (e.g. tcpwrap) +# Space separated list of login access check sockets (e.g. tcpwrap) #login_access_sockets = # With proxy_maybe=yes if proxy destination matches any of these IPs, don't do From dovecot at dovecot.org Thu May 2 18:12:12 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 02 May 2013 18:12:12 +0300 Subject: dovecot-2.2: imap: Fixed using literals for URLs in CATENATE. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8e5ff6809d75 changeset: 16322:8e5ff6809d75 user: Timo Sirainen date: Thu May 02 18:11:56 2013 +0300 description: imap: Fixed using literals for URLs in CATENATE. diffstat: src/imap/cmd-append.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 8 deletions(-) diffs (84 lines): diff -r 73d67860db85 -r 8e5ff6809d75 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Thu May 02 16:20:02 2013 +0300 +++ b/src/imap/cmd-append.c Thu May 02 18:11:56 2013 +0300 @@ -349,6 +349,30 @@ } } +static bool catenate_args_can_stop(struct cmd_append_context *ctx, + const struct imap_arg *args) +{ + /* eat away literal_sizes from URLs */ + while (args->type != IMAP_ARG_EOL) { + if (imap_arg_atom_equals(args, "TEXT")) + return TRUE; + if (!imap_arg_atom_equals(args, "URL")) { + /* error - handle it later */ + return TRUE; + } + args++; + if (args->type == IMAP_ARG_LITERAL_SIZE || + args->type == IMAP_ARG_LITERAL_SIZE_NONSYNC) { + if (args->type == IMAP_ARG_LITERAL_SIZE) + cmd_append_send_literal_continue(ctx->client); + imap_parser_read_last_literal(ctx->save_parser); + return FALSE; + } + args++; + } + return TRUE; +} + static bool cmd_append_continue_catenate(struct client_command_context *cmd) { struct client *client = cmd->client; @@ -368,10 +392,12 @@ it's fine that this would need to fully fit into input buffer (although clients attempting to DoS could simply insert an extra {1+} between the URLs) */ - ret = imap_parser_read_args(ctx->save_parser, 0, - IMAP_PARSE_FLAG_LITERAL_SIZE | - IMAP_PARSE_FLAG_LITERAL8 | - IMAP_PARSE_FLAG_INSIDE_LIST, &args); + do { + ret = imap_parser_read_args(ctx->save_parser, 0, + IMAP_PARSE_FLAG_LITERAL_SIZE | + IMAP_PARSE_FLAG_LITERAL8 | + IMAP_PARSE_FLAG_INSIDE_LIST, &args); + } while (ret > 0 && !catenate_args_can_stop(ctx, args)); if (ret == -1) { msg = imap_parser_get_error(ctx->save_parser, &fatal); if (fatal) @@ -630,8 +656,11 @@ return cmd_sync(cmd, sync_flags, imap_flags, str_c(msg)); } -static bool cmd_append_args_can_stop(const struct imap_arg *args) +static bool cmd_append_args_can_stop(struct cmd_append_context *ctx, + const struct imap_arg *args) { + const struct imap_arg *cat_list; + if (args->type == IMAP_ARG_EOL) return TRUE; @@ -645,8 +674,8 @@ args->type == IMAP_ARG_LITERAL_SIZE_NONSYNC) return TRUE; if (imap_arg_atom_equals(args, "CATENATE") && - args[1].type == IMAP_ARG_LIST) - return TRUE; + imap_arg_get_list(&args[1], &cat_list)) + return catenate_args_can_stop(ctx, cat_list); return FALSE; } @@ -680,7 +709,7 @@ ret = imap_parser_read_args(ctx->save_parser, arg_min_count++, IMAP_PARSE_FLAG_LITERAL_SIZE | IMAP_PARSE_FLAG_LITERAL8, &args); - } while (ret > 0 && !cmd_append_args_can_stop(args)); + } while (ret > 0 && !cmd_append_args_can_stop(ctx, args)); if (ret == -1) { if (!ctx->failed) { msg = imap_parser_get_error(ctx->save_parser, &fatal); From dovecot at dovecot.org Thu May 2 18:18:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 02 May 2013 18:18:38 +0300 Subject: dovecot-2.2: imap: Don't allow empty CATENATE () list. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5e2fa592c268 changeset: 16323:5e2fa592c268 user: Timo Sirainen date: Thu May 02 18:18:26 2013 +0300 description: imap: Don't allow empty CATENATE () list. diffstat: src/imap/cmd-append.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (23 lines): diff -r 8e5ff6809d75 -r 5e2fa592c268 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Thu May 02 18:11:56 2013 +0300 +++ b/src/imap/cmd-append.c Thu May 02 18:18:26 2013 +0300 @@ -586,6 +586,10 @@ if (cat_list == NULL) { /* normal APPEND */ return 1; + } else if (cat_list->type == IMAP_ARG_EOL) { + /* zero parts */ + client_send_command_error(cmd, "Empty CATENATE list."); + return -1; } else if ((ret = cmd_append_catenate(cmd, cat_list, nonsync_r)) < 0) { /* invalid parameters, abort immediately */ return -1; @@ -734,6 +738,8 @@ ret = cmd_append_handle_args(cmd, args, &nonsync); if (ret < 0) { /* invalid parameters, abort immediately */ + if (ctx->catenate) + client->input_skip_line = TRUE; cmd_append_finish(ctx); return TRUE; } From dovecot at dovecot.org Thu May 2 18:30:00 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 02 May 2013 18:30:00 +0300 Subject: dovecot-2.2: imap-urlauth-worker: Fixed a crash (by removing unn... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2a3134b0c25d changeset: 16324:2a3134b0c25d user: Timo Sirainen date: Thu May 02 18:29:50 2013 +0300 description: imap-urlauth-worker: Fixed a crash (by removing unnecessary code) diffstat: src/imap-urlauth/imap-urlauth-worker.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diffs (38 lines): diff -r 5e2fa592c268 -r 2a3134b0c25d src/imap-urlauth/imap-urlauth-worker.c --- a/src/imap-urlauth/imap-urlauth-worker.c Thu May 02 18:18:26 2013 +0300 +++ b/src/imap-urlauth/imap-urlauth-worker.c Thu May 02 18:29:50 2013 +0300 @@ -54,7 +54,7 @@ struct io *io, *ctrl_io; struct istream *input, *ctrl_input; struct ostream *output, *ctrl_output; - struct timeout *to_idle, *to_delay; + struct timeout *to_idle; char *access_user; ARRAY_TYPE(string) access_apps; @@ -245,8 +245,6 @@ io_remove(&client->ctrl_io); if (client->to_idle != NULL) timeout_remove(&client->to_idle); - if (client->to_delay != NULL) - timeout_remove(&client->to_delay); if (client->input != NULL) i_stream_destroy(&client->input); @@ -605,7 +603,6 @@ i_debug("User %s doesn't exist", input.username); client_send_line(client, "NO"); - timeout_remove(&client->to_delay); return 1; } @@ -669,7 +666,7 @@ const char *line, *cmd, *error; int ret; - if (client->url != NULL || client->to_delay != NULL) { + if (client->url != NULL) { /* we're still processing a URL. wait until it's finished. */ io_remove(&client->io); From dovecot at dovecot.org Thu May 2 18:32:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 02 May 2013 18:32:52 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Don't try to access garbage memor... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/24aa10efe132 changeset: 16325:24aa10efe132 user: Timo Sirainen date: Thu May 02 18:32:47 2013 +0300 description: lib-imap-urlauth: Don't try to access garbage memory on error handling path. diffstat: src/lib-imap-urlauth/imap-urlauth.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 2a3134b0c25d -r 24aa10efe132 src/lib-imap-urlauth/imap-urlauth.c --- a/src/lib-imap-urlauth/imap-urlauth.c Thu May 02 18:29:50 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth.c Thu May 02 18:32:47 2013 +0300 @@ -362,6 +362,7 @@ unsigned char mailbox_key[IMAP_URLAUTH_KEY_LEN]; int ret; + *mpurl_r = NULL; *error_r = NULL; *error_code_r = MAIL_ERROR_NONE; From pigeonhole at rename-it.nl Thu May 2 22:37:43 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 02 May 2013 21:37:43 +0200 Subject: dovecot-2.1-pigeonhole: lib-sieve: editheader extension: Fixed i... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/0163c45094a3 changeset: 1686:0163c45094a3 user: Stephan Bosch date: Thu May 02 21:37:36 2013 +0200 description: lib-sieve: editheader extension: Fixed interaction with body extension. Forgot to rewind mail stream before header parsing. Wrapped mail stream is obtained long before parsing, so if it is used in the mean time, it must be rewound to the beginning. diffstat: src/lib-sieve/edit-mail.c | 4 +++ src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 10 ++++++- tests/extensions/editheader/deleteheader.svtest | 26 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diffs (75 lines): diff -r bc2126771d00 -r 0163c45094a3 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Sun Apr 07 05:12:57 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Thu May 02 21:37:36 2013 +0200 @@ -559,6 +559,7 @@ if ( edmail->headers_parsed ) return 1; + i_stream_seek(edmail->wrapped_stream, 0); hparser = message_parse_header_init (edmail->wrapped_stream, NULL, hparser_flags); @@ -643,6 +644,9 @@ message_parse_header_deinit(&hparser); if ( ret <= 0 ) { + /* blocking i/o required */ + i_assert( ret != 0 ); + /* Error; clean up */ current = head; while ( current != NULL ) { diff -r bc2126771d00 -r 0163c45094a3 src/lib-sieve/plugins/editheader/cmd-deleteheader.c --- a/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Sun Apr 07 05:12:57 2013 +0200 +++ b/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Thu May 02 21:37:36 2013 +0200 @@ -531,9 +531,15 @@ /* Delete all occurences of header */ ret = edit_mail_header_delete(edmail, str_c(field_name), index); - if ( trace ) { - sieve_runtime_trace(renv, 0, "deleted %d headers", ret); + if ( ret < 0 ) { + sieve_runtime_warning(renv, NULL, "deleteheader action: " + "failed to delete occurences of header `%s' (this should not happen!)", + str_c(field_name)); + } else if ( trace ) { + sieve_runtime_trace(renv, 0, "deleted %d occurences of header `%s'", + ret, str_c(field_name)); } + } return SIEVE_EXEC_OK; diff -r bc2126771d00 -r 0163c45094a3 tests/extensions/editheader/deleteheader.svtest --- a/tests/extensions/editheader/deleteheader.svtest Sun Apr 07 05:12:57 2013 +0200 +++ b/tests/extensions/editheader/deleteheader.svtest Thu May 02 21:37:36 2013 +0200 @@ -962,3 +962,29 @@ test_fail "x-b header not deleted"; } } + +/* + * TEST: Interaction with body test + */ + +test_set "message" text: +From: stephan at example.org +To: nico at frop.example.com +Subject: Hoppa + +Text +. +; + +test "Interaction with body test" { + addheader "X-Frop" "frop"; + + if body "!TEST!" {} + + deleteheader "subject"; + + if exists "subject" { + test_fail "subject header not deleted"; + } +} + From dovecot at dovecot.org Fri May 3 17:17:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 03 May 2013 17:17:23 +0300 Subject: dovecot-2.2: quota-status: Return 554 instead of 552 on quota fa... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/aefdf65442cc changeset: 16326:aefdf65442cc user: Timo Sirainen date: Fri May 03 17:17:15 2013 +0300 description: quota-status: Return 554 instead of 552 on quota failures. This is because RFC 5321/2821 recommends that 552 is treated the same as 452. diffstat: src/plugins/quota/quota-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 24aa10efe132 -r aefdf65442cc src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Thu May 02 18:32:47 2013 +0300 +++ b/src/plugins/quota/quota-status.c Fri May 03 17:17:15 2013 +0300 @@ -107,7 +107,7 @@ /* over quota */ value = mail_user_plugin_getenv(user, "quota_status_overquota"); if (value == NULL) - value = t_strdup_printf("552 5.2.2 %s\n\n", error); + value = t_strdup_printf("554 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); From dovecot at dovecot.org Fri May 3 17:17:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 03 May 2013 17:17:33 +0300 Subject: dovecot-2.1: quota-status: Return 554 instead of 552 on quota fa... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/0fa68f3a8f6c changeset: 14960:0fa68f3a8f6c user: Timo Sirainen date: Fri May 03 17:17:15 2013 +0300 description: quota-status: Return 554 instead of 552 on quota failures. This is because RFC 5321/2821 recommends that 552 is treated the same as 452. diffstat: src/plugins/quota/quota-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c3e487d82df7 -r 0fa68f3a8f6c src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Tue Apr 23 13:46:29 2013 +0300 +++ b/src/plugins/quota/quota-status.c Fri May 03 17:17:15 2013 +0300 @@ -111,7 +111,7 @@ /* over quota */ value = mail_user_plugin_getenv(user, "quota_status_overquota"); if (value == NULL) - value = t_strdup_printf("552 5.2.2 %s\n\n", error); + value = t_strdup_printf("554 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); From dovecot at dovecot.org Mon May 6 14:36:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 14:36:23 +0300 Subject: dovecot-2.1: acl: Optionally get default ACL's for private/share... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/23f7cabad194 changeset: 14961:23f7cabad194 user: Timo Sirainen date: Mon May 06 14:33:05 2013 +0300 description: acl: Optionally get default ACL's for private/shared namespaces from user's INBOX. This probably should be the default always, but better not break anyone's existing setup until v2.3.0. So for now there's a setting for this: plugin { acl_defaults_from_inbox = yes } diffstat: src/plugins/acl/acl-backend-vfile.c | 2 +- src/plugins/acl/acl-backend.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diffs (58 lines): diff -r 0fa68f3a8f6c -r 23f7cabad194 src/plugins/acl/acl-backend-vfile.c --- a/src/plugins/acl/acl-backend-vfile.c Fri May 03 17:17:15 2013 +0300 +++ b/src/plugins/acl/acl-backend-vfile.c Mon May 06 14:33:05 2013 +0300 @@ -274,7 +274,7 @@ } if (parent == NULL) { /* use the root */ - parent = ""; + parent = backend->default_aclobj->name; } return acl_backend_vfile_object_init(backend, parent); } diff -r 0fa68f3a8f6c -r 23f7cabad194 src/plugins/acl/acl-backend.c --- a/src/plugins/acl/acl-backend.c Fri May 03 17:17:15 2013 +0300 +++ b/src/plugins/acl/acl-backend.c Mon May 06 14:33:05 2013 +0300 @@ -4,6 +4,7 @@ #include "hash.h" #include "mail-storage-settings.h" #include "mailbox-list.h" +#include "mail-namespace.h" #include "mail-user.h" #include "acl-cache.h" #include "acl-api-private.h" @@ -36,7 +37,9 @@ bool owner) { struct mail_user *user = mailbox_list_get_user(list); + struct mail_namespace *ns = mailbox_list_get_namespace(list); struct acl_backend *backend; + const char *default_name = ""; unsigned int i, group_count; if (user->mail_debug) { @@ -83,7 +86,14 @@ acl_cache_mask_init(backend->cache, backend->pool, backend->default_rights); - backend->default_aclobj = acl_object_init_from_name(backend, ""); + /* FIXME: this should probably be made default in v2.3 */ + if (mail_user_plugin_getenv(user, "acl_defaults_from_inbox") != NULL) { + if (ns->type == NAMESPACE_PRIVATE || + ns->type == NAMESPACE_SHARED) + default_name = "INBOX"; + } + backend->default_aclobj = + acl_object_init_from_name(backend, default_name); return backend; } @@ -164,7 +174,7 @@ if (backend->v.object_refresh_cache(backend->default_aclobj) < 0) return -1; - *mask_r = acl_cache_get_my_rights(backend->cache, ""); + *mask_r = acl_cache_get_my_rights(backend->cache, backend->default_aclobj->name); if (*mask_r == NULL) *mask_r = backend->default_aclmask; return 0; From dovecot at dovecot.org Mon May 6 14:59:08 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 14:59:08 +0300 Subject: dovecot-2.2: acl: Mailbox creation ignored ACLs (due to API chan... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/11712979c8ab changeset: 16327:11712979c8ab user: Timo Sirainen date: Mon May 06 14:58:55 2013 +0300 description: acl: Mailbox creation ignored ACLs (due to API changes in v2.2). The created mailbox couldn't have been accessed however. diffstat: src/plugins/acl/acl-mailbox.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diffs (29 lines): diff -r aefdf65442cc -r 11712979c8ab src/plugins/acl/acl-mailbox.c --- a/src/plugins/acl/acl-mailbox.c Fri May 03 17:17:15 2013 +0300 +++ b/src/plugins/acl/acl-mailbox.c Mon May 06 14:58:55 2013 +0300 @@ -118,8 +118,23 @@ struct acl_mailbox *abox = ACL_CONTEXT(box); int ret; - /* we already checked permissions in list.mailbox_create_dir(). - ignore ACLs in this mailbox until creation is complete, because + /* we're looking up CREATE permission from our parent's rights */ + ret = acl_mailbox_list_have_right(box->list, box->name, TRUE, + ACL_STORAGE_RIGHT_CREATE, NULL); + if (ret <= 0) { + if (ret < 0) { + mail_storage_set_internal_error(box->storage); + return -1; + } + /* Note that if user didn't have LOOKUP permission to parent + mailbox, this may reveal the mailbox's existence to user. + Can't help it. */ + mail_storage_set_error(box->storage, MAIL_ERROR_PERM, + MAIL_ERRSTR_NO_PERMISSION); + return -1; + } + + /* ignore ACLs in this mailbox until creation is complete, because super.create() may call e.g. mailbox_open() which will fail since we haven't yet copied ACLs to this mailbox. */ abox->skip_acl_checks = TRUE; From dovecot at dovecot.org Mon May 6 14:59:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 14:59:37 +0300 Subject: dovecot-2.2: acl: Optionally get default ACL's for private/share... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/714dfc072d60 changeset: 16328:714dfc072d60 user: Timo Sirainen date: Mon May 06 14:59:27 2013 +0300 description: acl: Optionally get default ACL's for private/shared namespaces from user's INBOX. This probably should be the default always, but better not break anyone's existing setup until v2.3.0. So for now there's a setting for this: plugin { acl_defaults_from_inbox = yes } diffstat: src/plugins/acl/acl-api-private.h | 1 + src/plugins/acl/acl-backend-vfile.c | 2 +- src/plugins/acl/acl-backend.c | 31 +++++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diffs (76 lines): diff -r 11712979c8ab -r 714dfc072d60 src/plugins/acl/acl-api-private.h --- a/src/plugins/acl/acl-api-private.h Mon May 06 14:58:55 2013 +0300 +++ b/src/plugins/acl/acl-api-private.h Mon May 06 14:59:27 2013 +0300 @@ -81,6 +81,7 @@ const char *const * acl_backend_mask_get_names(struct acl_backend *backend, const struct acl_mask *mask, pool_t pool); +struct acl_object *acl_backend_get_default_object(struct acl_backend *backend); int acl_backend_get_default_rights(struct acl_backend *backend, const struct acl_mask **mask_r); void acl_rights_write_id(string_t *dest, const struct acl_rights *right); diff -r 11712979c8ab -r 714dfc072d60 src/plugins/acl/acl-backend-vfile.c --- a/src/plugins/acl/acl-backend-vfile.c Mon May 06 14:58:55 2013 +0300 +++ b/src/plugins/acl/acl-backend-vfile.c Mon May 06 14:59:27 2013 +0300 @@ -284,7 +284,7 @@ } if (parent == NULL) { /* use the root */ - parent = ""; + parent = acl_backend_get_default_object(backend)->name; } return acl_backend_vfile_object_init(backend, parent); } diff -r 11712979c8ab -r 714dfc072d60 src/plugins/acl/acl-backend.c --- a/src/plugins/acl/acl-backend.c Mon May 06 14:58:55 2013 +0300 +++ b/src/plugins/acl/acl-backend.c Mon May 06 14:59:27 2013 +0300 @@ -4,6 +4,7 @@ #include "hash.h" #include "mail-storage-settings.h" #include "mailbox-list.h" +#include "mail-namespace.h" #include "mail-user.h" #include "acl-cache.h" #include "acl-api-private.h" @@ -157,17 +158,35 @@ return acl_cache_right_lookup(backend->cache, right); } +struct acl_object *acl_backend_get_default_object(struct acl_backend *backend) +{ + struct mail_user *user = mailbox_list_get_user(backend->list); + struct mail_namespace *ns = mailbox_list_get_namespace(backend->list); + const char *default_name = ""; + + if (backend->default_aclobj != NULL) + return backend->default_aclobj; + + /* FIXME: this should probably be made default in v2.3 */ + if (mail_user_plugin_getenv(user, "acl_defaults_from_inbox") != NULL) { + if (ns->type == MAIL_NAMESPACE_TYPE_PRIVATE || + ns->type == MAIL_NAMESPACE_TYPE_SHARED) + default_name = "INBOX"; + } + backend->default_aclobj = + acl_object_init_from_name(backend, default_name); + return backend->default_aclobj; +} + int acl_backend_get_default_rights(struct acl_backend *backend, const struct acl_mask **mask_r) { - if (backend->default_aclobj == NULL) { - backend->default_aclobj = - acl_object_init_from_name(backend, ""); - } - if (backend->v.object_refresh_cache(backend->default_aclobj) < 0) + struct acl_object *aclobj = acl_backend_get_default_object(backend); + + if (backend->v.object_refresh_cache(aclobj) < 0) return -1; - *mask_r = acl_cache_get_my_rights(backend->cache, ""); + *mask_r = acl_cache_get_my_rights(backend->cache, aclobj->name); if (*mask_r == NULL) *mask_r = backend->default_aclmask; return 0; From dovecot at dovecot.org Mon May 6 15:05:09 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 15:05:09 +0300 Subject: dovecot-2.2: namespace { prefix="" list=no } should never be lis... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e45bb6b86e3c changeset: 16329:e45bb6b86e3c user: Timo Sirainen date: Mon May 06 15:04:57 2013 +0300 description: namespace { prefix="" list=no } should never be listed. diffstat: src/lib-storage/list/mailbox-list-iter.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 714dfc072d60 -r e45bb6b86e3c src/lib-storage/list/mailbox-list-iter.c --- a/src/lib-storage/list/mailbox-list-iter.c Mon May 06 14:59:27 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-iter.c Mon May 06 15:04:57 2013 +0300 @@ -256,6 +256,9 @@ /* non-listable namespace matches only with exact prefix */ if (strncmp(ns->prefix, pattern, ns->prefix_len) != 0) return FALSE; + /* prefix="" list=no is never listed */ + if (ns->prefix_len == 0) + return FALSE; } prefix_without_sep = t_strndup(ns->prefix, len); From dovecot at dovecot.org Mon May 6 15:17:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 15:17:54 +0300 Subject: dovecot-2.2: maildir++: Fixed mail_shared_explicit_inbox=no Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3de486622779 changeset: 16330:3de486622779 user: Timo Sirainen date: Mon May 06 15:17:49 2013 +0300 description: maildir++: Fixed mail_shared_explicit_inbox=no diffstat: src/lib-storage/list/mailbox-list-maildir-iter.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (22 lines): diff -r e45bb6b86e3c -r 3de486622779 src/lib-storage/list/mailbox-list-maildir-iter.c --- a/src/lib-storage/list/mailbox-list-maildir-iter.c Mon May 06 15:04:57 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-maildir-iter.c Mon May 06 15:17:49 2013 +0300 @@ -372,6 +372,7 @@ struct mail_namespace *ns = list->ns; DIR *dirp; struct dirent *d; + const char *vname; int ret = 0; dirp = opendir(ctx->dir); @@ -409,8 +410,8 @@ return maildir_fill_inbox(ctx, glob, "INBOX", update_only); } else if ((ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0) { /* show shared INBOX. */ - return maildir_fill_inbox(ctx, glob, - t_strconcat(ns->prefix, "INBOX", NULL), update_only); + vname = mailbox_list_get_vname(ns->list, "INBOX"); + return maildir_fill_inbox(ctx, glob, vname, update_only); } else { return 0; } From dovecot at dovecot.org Mon May 6 16:43:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 16:43:36 +0300 Subject: dovecot-2.2: lib-index: The previous assert-crashfix didn't actu... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/664ec741de8c changeset: 16331:664ec741de8c user: Timo Sirainen date: Mon May 06 16:43:29 2013 +0300 description: lib-index: The previous assert-crashfix didn't actually fix the problem. diffstat: src/lib-index/mail-transaction-log-view.c | 44 +++++++++++++++--------------- 1 files changed, 22 insertions(+), 22 deletions(-) diffs (75 lines): diff -r 3de486622779 -r 664ec741de8c src/lib-index/mail-transaction-log-view.c --- a/src/lib-index/mail-transaction-log-view.c Mon May 06 15:17:49 2013 +0300 +++ b/src/lib-index/mail-transaction-log-view.c Mon May 06 16:43:29 2013 +0300 @@ -95,24 +95,18 @@ } for (file = view->log->files; file != NULL; file = file->next) { - if (file->hdr.prev_file_seq == min_file_seq) + if (file->hdr.prev_file_seq == max_file_seq) break; } - if (file != NULL && min_file_offset == file->hdr.prev_file_offset) { + if (file != NULL && max_file_offset == file->hdr.prev_file_offset) { /* we can skip to the next file. we've delayed checking for min_file_seq <= max_file_seq until now, because it's not really an error to specify the same position twice (even if in "wrong" order) */ i_assert(min_file_seq <= max_file_seq || - file->hdr.file_seq <= max_file_seq); - min_file_seq = file->hdr.file_seq; - min_file_offset = 0; - - if (min_file_seq > max_file_seq) { - /* empty view */ - max_file_seq = min_file_seq; - max_file_offset = min_file_offset; - } + min_file_seq <= file->hdr.file_seq); + max_file_seq = file->hdr.file_seq; + max_file_offset = file->hdr.hdr_size; } else { i_assert(min_file_seq <= max_file_seq); } @@ -126,16 +120,6 @@ return -1; } - if (min_file_offset > 0 && file != NULL && - min_file_offset < file->hdr.hdr_size) { - /* log file offset is probably corrupted in the index file. */ - mail_transaction_log_view_set_corrupted(view, - "file_seq=%u, min_file_offset (%"PRIuUOFF_T - ") < hdr_size (%u)", - min_file_seq, min_file_offset, file->hdr.hdr_size); - return -1; - } - view->tail = view->head = file = NULL; for (seq = min_file_seq; seq <= max_file_seq; seq++) { if (file == NULL || file->hdr.file_seq != seq) { @@ -200,7 +184,23 @@ max_file_offset = min_file_offset; } } - i_assert(min_file_offset >= view->tail->hdr.hdr_size); + + if (min_file_offset < view->tail->hdr.hdr_size) { + /* log file offset is probably corrupted in the index file. */ + mail_transaction_log_view_set_corrupted(view, + "file_seq=%u, min_file_offset (%"PRIuUOFF_T + ") < hdr_size (%u)", + min_file_seq, min_file_offset, view->tail->hdr.hdr_size); + return -1; + } + if (max_file_offset < view->head->hdr.hdr_size) { + /* log file offset is probably corrupted in the index file. */ + mail_transaction_log_view_set_corrupted(view, + "file_seq=%u, min_file_offset (%"PRIuUOFF_T + ") < hdr_size (%u)", + max_file_seq, max_file_offset, view->head->hdr.hdr_size); + return -1; + } /* we have all of them. update refcounts. */ mail_transaction_log_view_unref_all(view); From dovecot at dovecot.org Mon May 6 17:27:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 17:27:51 +0300 Subject: dovecot-2.2: doveadm_mail_iter_init(): Removed unnecessarily ret... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7808096bb674 changeset: 16332:7808096bb674 user: Timo Sirainen date: Mon May 06 17:27:36 2013 +0300 description: doveadm_mail_iter_init(): Removed unnecessarily returning transaction. If it's needed in future just add a new doveadm_mail_iter_get_transaction(). diffstat: src/doveadm/doveadm-mail-altmove.c | 3 +-- src/doveadm/doveadm-mail-copymove.c | 3 +-- src/doveadm/doveadm-mail-expunge.c | 3 +-- src/doveadm/doveadm-mail-fetch.c | 3 +-- src/doveadm/doveadm-mail-import.c | 3 +-- src/doveadm/doveadm-mail-iter.c | 8 +++++--- src/doveadm/doveadm-mail-iter.h | 2 +- src/doveadm/doveadm-mail-search.c | 5 ++--- 8 files changed, 13 insertions(+), 17 deletions(-) diffs (160 lines): diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-altmove.c --- a/src/doveadm/doveadm-mail-altmove.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-altmove.c Mon May 06 17:27:36 2013 +0300 @@ -20,13 +20,12 @@ struct mail_search_args *search_args, bool reverse) { struct doveadm_mail_iter *iter; - struct mailbox_transaction_context *trans; struct mail *mail; enum modify_type modify_type = !reverse ? MODIFY_ADD : MODIFY_REMOVE; if (doveadm_mail_iter_init(ctx, info, search_args, 0, NULL, - &trans, &iter) < 0) + &iter) < 0) return -1; while (doveadm_mail_iter_next(iter, &mail)) { diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-copymove.c --- a/src/doveadm/doveadm-mail-copymove.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-copymove.c Mon May 06 17:27:36 2013 +0300 @@ -25,14 +25,13 @@ const struct mailbox_info *info) { struct doveadm_mail_iter *iter; - struct mailbox_transaction_context *trans; struct mailbox_transaction_context *desttrans; struct mail_save_context *save_ctx; struct mail *mail; int ret = 0; if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args, 0, - NULL, &trans, &iter) < 0) + NULL, &iter) < 0) return -1; /* use a separately committed transaction for each mailbox. diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-expunge.c --- a/src/doveadm/doveadm-mail-expunge.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-expunge.c Mon May 06 17:27:36 2013 +0300 @@ -22,13 +22,12 @@ struct expunge_cmd_context *ctx = (struct expunge_cmd_context *)_ctx; struct doveadm_mail_iter *iter; struct mailbox *box; - struct mailbox_transaction_context *trans; struct mail *mail; enum mail_error error; int ret = 0; if (doveadm_mail_iter_init(_ctx, info, search_args, 0, NULL, - &trans, &iter) < 0) + &iter) < 0) return -1; while (doveadm_mail_iter_next(iter, &mail)) { diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-fetch.c --- a/src/doveadm/doveadm-mail-fetch.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-fetch.c Mon May 06 17:27:36 2013 +0300 @@ -507,13 +507,12 @@ cmd_fetch_box(struct fetch_cmd_context *ctx, const struct mailbox_info *info) { struct doveadm_mail_iter *iter; - struct mailbox_transaction_context *trans; int ret = 0; if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args, ctx->wanted_fields, array_idx(&ctx->header_fields, 0), - &trans, &iter) < 0) + &iter) < 0) return -1; while (doveadm_mail_iter_next(iter, &ctx->mail)) { diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-import.c --- a/src/doveadm/doveadm-mail-import.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-import.c Mon May 06 17:27:36 2013 +0300 @@ -103,13 +103,12 @@ struct mail_search_args *search_args) { struct doveadm_mail_iter *iter; - struct mailbox_transaction_context *trans; struct mailbox *box; struct mail *mail; int ret = 0; if (doveadm_mail_iter_init(&ctx->ctx, info, search_args, 0, NULL, - &trans, &iter) < 0) + &iter) < 0) return -1; if (doveadm_mail_iter_next(iter, &mail)) { diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-iter.c --- a/src/doveadm/doveadm-mail-iter.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-iter.c Mon May 06 17:27:36 2013 +0300 @@ -21,7 +21,6 @@ struct mail_search_args *search_args, enum mail_fetch_field wanted_fields, const char *const *wanted_headers, - struct mailbox_transaction_context **trans_r, struct doveadm_mail_iter **iter_r) { struct doveadm_mail_iter *iter; @@ -49,8 +48,6 @@ iter->t = mailbox_transaction_begin(iter->box, 0); iter->search_ctx = mailbox_search_init(iter->t, search_args, NULL, wanted_fields, headers_ctx); - - *trans_r = iter->t; *iter_r = iter; return 0; } @@ -128,3 +125,8 @@ { return mailbox_search_next(iter->search_ctx, mail_r); } + +struct mailbox *doveadm_mail_iter_get_mailbox(struct doveadm_mail_iter *iter) +{ + return iter->box; +} diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-iter.h --- a/src/doveadm/doveadm-mail-iter.h Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-iter.h Mon May 06 17:27:36 2013 +0300 @@ -11,13 +11,13 @@ struct mail_search_args *search_args, enum mail_fetch_field wanted_fields, const char *const *wanted_headers, - struct mailbox_transaction_context **trans_r, struct doveadm_mail_iter **iter_r) ATTR_NULL(5); int doveadm_mail_iter_deinit(struct doveadm_mail_iter **iter); int doveadm_mail_iter_deinit_sync(struct doveadm_mail_iter **iter); int doveadm_mail_iter_deinit_keep_box(struct doveadm_mail_iter **iter, struct mailbox **box_r); void doveadm_mail_iter_deinit_rollback(struct doveadm_mail_iter **iter); +struct mailbox *doveadm_mail_iter_get_mailbox(struct doveadm_mail_iter *iter); bool doveadm_mail_iter_next(struct doveadm_mail_iter *iter, struct mail **mail_r); diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-search.c --- a/src/doveadm/doveadm-mail-search.c Mon May 06 16:43:29 2013 +0300 +++ b/src/doveadm/doveadm-mail-search.c Mon May 06 17:27:36 2013 +0300 @@ -15,16 +15,15 @@ { struct doveadm_mail_iter *iter; struct mailbox *box; - struct mailbox_transaction_context *trans; struct mail *mail; struct mailbox_metadata metadata; const char *guid_str; int ret = 0; if (doveadm_mail_iter_init(ctx, info, ctx->search_args, 0, NULL, - &trans, &iter) < 0) + &iter) < 0) return -1; - box = mailbox_transaction_get_mailbox(trans); + box = doveadm_mail_iter_get_mailbox(iter); if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0) { ret = -1; From dovecot at dovecot.org Mon May 6 17:30:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 17:30:17 +0300 Subject: dovecot-2.2: doveadm: If search query attempts to access nonexis... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/63555663efbc changeset: 16333:63555663efbc user: Timo Sirainen date: Mon May 06 17:30:07 2013 +0300 description: doveadm: If search query attempts to access nonexistent mailbox, just ignore it. Most importantly running a query for multiple users wouldn't be an error if the mailbox existed only for some users. It's probably cleaner to then always just ignore the nonexistent mailboxes. diffstat: src/doveadm/doveadm-mail-iter.c | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diffs (61 lines): diff -r 7808096bb674 -r 63555663efbc src/doveadm/doveadm-mail-iter.c --- a/src/doveadm/doveadm-mail-iter.c Mon May 06 17:27:36 2013 +0300 +++ b/src/doveadm/doveadm-mail-iter.c Mon May 06 17:30:07 2013 +0300 @@ -25,6 +25,8 @@ { struct doveadm_mail_iter *iter; struct mailbox_header_lookup_ctx *headers_ctx; + const char *errstr; + enum mail_error error; iter = i_new(struct doveadm_mail_iter, 1); iter->ctx = ctx; @@ -33,8 +35,13 @@ iter->search_args = search_args; if (mailbox_sync(iter->box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) { - i_error("Syncing mailbox %s failed: %s", info->vname, - mailbox_get_last_error(iter->box, NULL)); + errstr = mailbox_get_last_error(iter->box, &error); + if (error == MAIL_ERROR_NOTFOUND) { + /* just ignore this mailbox */ + *iter_r = iter; + return 0; + } + i_error("Syncing mailbox %s failed: %s", info->vname, errstr); doveadm_mail_failed_mailbox(ctx, iter->box); mailbox_free(&iter->box); i_free(iter); @@ -58,13 +65,17 @@ { int ret = 0; - if (mailbox_search_deinit(&iter->search_ctx) < 0) { - i_error("Searching mailbox %s failed: %s", - mailbox_get_vname(iter->box), - mailbox_get_last_error(iter->box, NULL)); - ret = -1; + if (iter->search_ctx != NULL) { + if (mailbox_search_deinit(&iter->search_ctx) < 0) { + i_error("Searching mailbox %s failed: %s", + mailbox_get_vname(iter->box), + mailbox_get_last_error(iter->box, NULL)); + ret = -1; + } } - if (commit) { + if (iter->t == NULL) + ; + else if (commit) { if (mailbox_transaction_commit(&iter->t) < 0) { i_error("Committing mailbox %s failed: %s", mailbox_get_vname(iter->box), @@ -123,6 +134,8 @@ bool doveadm_mail_iter_next(struct doveadm_mail_iter *iter, struct mail **mail_r) { + if (iter->search_ctx == NULL) + return FALSE; return mailbox_search_next(iter->search_ctx, mail_r); } From dovecot at dovecot.org Mon May 6 18:36:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 18:36:10 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Don't try to access garbage memor... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a45bfb4c7d66 changeset: 16334:a45bfb4c7d66 user: Timo Sirainen date: Mon May 06 18:35:36 2013 +0300 description: lib-imap-urlauth: Don't try to access garbage memory on error handling paths. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 2 +- src/lib-imap-urlauth/imap-urlauth.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diffs (34 lines): diff -r 63555663efbc -r a45bfb4c7d66 src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Mon May 06 17:30:07 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Mon May 06 18:35:36 2013 +0300 @@ -150,7 +150,7 @@ const char *error, *errormsg = NULL, *bpstruct = NULL; bool debug = ufetch->uctx->user->mail_debug, success; enum mail_error error_code; - struct imap_msgpart_url *mpurl; + struct imap_msgpart_url *mpurl = NULL; int ret; ufetch->pending_requests--; diff -r 63555663efbc -r a45bfb4c7d66 src/lib-imap-urlauth/imap-urlauth.c --- a/src/lib-imap-urlauth/imap-urlauth.c Mon May 06 17:30:07 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth.c Mon May 06 18:35:36 2013 +0300 @@ -227,7 +227,7 @@ enum imap_url_parse_flags url_flags = IMAP_URL_PARSE_ALLOW_URLAUTH; struct imap_url *url; - struct imap_msgpart_url *mpurl; + struct imap_msgpart_url *mpurl = NULL; struct mailbox *box; const char *error; enum mail_error error_code; @@ -284,7 +284,8 @@ if ((ret = imap_msgpart_url_create(user, url, &mpurl, &error)) < 0 || imap_msgpart_url_verify(mpurl, &error) <= 0) { *error_r = t_strdup_printf("Invalid URL: %s", error); - imap_msgpart_url_free(&mpurl); + if (mpurl != NULL) + imap_msgpart_url_free(&mpurl); return ret; } box = imap_msgpart_url_get_mailbox(mpurl); From dovecot at dovecot.org Mon May 6 19:51:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 19:51:28 +0300 Subject: dovecot-2.2: lib-imap: imap_parser_read_args() shouldn't append ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/67ec8bb5c27a changeset: 16335:67ec8bb5c27a user: Timo Sirainen date: Mon May 06 19:48:32 2013 +0300 description: lib-imap: imap_parser_read_args() shouldn't append multiple EOLs when calling multiple times. diffstat: src/lib-imap/imap-parser.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diffs (16 lines): diff -r a45bfb4c7d66 -r 67ec8bb5c27a src/lib-imap/imap-parser.c --- a/src/lib-imap/imap-parser.c Mon May 06 18:35:36 2013 +0300 +++ b/src/lib-imap/imap-parser.c Mon May 06 19:48:32 2013 +0300 @@ -711,11 +711,7 @@ arg = array_append_space(&parser->root_list); arg->type = IMAP_ARG_EOL; - - if (!parser->eol) - parser->args_added_extra_eol = TRUE; - else - i_assert(!parser->literal_size_return); + parser->args_added_extra_eol = TRUE; *args_r = array_get(&parser->root_list, &count); return ret; From dovecot at dovecot.org Mon May 6 19:51:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 19:51:28 +0300 Subject: dovecot-2.2: imap: Don't hang in APPEND when giving it invalid p... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ea0390e1789f changeset: 16336:ea0390e1789f user: Timo Sirainen date: Mon May 06 19:49:18 2013 +0300 description: imap: Don't hang in APPEND when giving it invalid parameters. diffstat: src/imap/cmd-append.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diffs (20 lines): diff -r 67ec8bb5c27a -r ea0390e1789f src/imap/cmd-append.c --- a/src/imap/cmd-append.c Mon May 06 19:48:32 2013 +0300 +++ b/src/imap/cmd-append.c Mon May 06 19:49:18 2013 +0300 @@ -708,12 +708,13 @@ /* parse the entire line up to the first message literal, or in case the input buffer is full of MULTIAPPEND CATENATE URLs, parse at least until the beginning of the next message */ - arg_min_count = 1; + arg_min_count = 0; do { - ret = imap_parser_read_args(ctx->save_parser, arg_min_count++, + ret = imap_parser_read_args(ctx->save_parser, ++arg_min_count, IMAP_PARSE_FLAG_LITERAL_SIZE | IMAP_PARSE_FLAG_LITERAL8, &args); - } while (ret > 0 && !cmd_append_args_can_stop(ctx, args)); + } while (ret >= (int)arg_min_count && + !cmd_append_args_can_stop(ctx, args)); if (ret == -1) { if (!ctx->failed) { msg = imap_parser_get_error(ctx->save_parser, &fatal); From dovecot at dovecot.org Mon May 6 19:51:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 19:51:28 +0300 Subject: dovecot-2.2: imap: Fixed assert-crash on invalid APPEND parameters. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0b7039a614f7 changeset: 16337:0b7039a614f7 user: Timo Sirainen date: Mon May 06 19:49:55 2013 +0300 description: imap: Fixed assert-crash on invalid APPEND parameters. diffstat: src/imap/cmd-append.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diffs (15 lines): diff -r ea0390e1789f -r 0b7039a614f7 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Mon May 06 19:49:18 2013 +0300 +++ b/src/imap/cmd-append.c Mon May 06 19:49:55 2013 +0300 @@ -501,9 +501,8 @@ ctx->binary_input = args->literal8; valid = TRUE; } - /* we parsed the args only up to here. */ - i_assert(IMAP_ARG_IS_EOL(&args[1])); - + if (!IMAP_ARG_IS_EOL(&args[1])) + valid = FALSE; if (!valid) { client->input_skip_line = TRUE; if (!ctx->failed) From dovecot at dovecot.org Mon May 6 19:51:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 19:51:28 +0300 Subject: dovecot-2.2: imap: Don't eat away the next command if CATENATE f... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/113cb77256a7 changeset: 16338:113cb77256a7 user: Timo Sirainen date: Mon May 06 19:51:07 2013 +0300 description: imap: Don't eat away the next command if CATENATE fails. diffstat: src/imap/cmd-append.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diffs (30 lines): diff -r 0b7039a614f7 -r 113cb77256a7 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Mon May 06 19:49:55 2013 +0300 +++ b/src/imap/cmd-append.c Mon May 06 19:51:07 2013 +0300 @@ -324,7 +324,6 @@ } if (!ctx->failed) client_send_command_error(cmd, "Invalid arguments."); - cmd->client->input_skip_line = TRUE; return -1; } @@ -431,9 +430,6 @@ /* TEXT */ - /* after literal comes CRLF, if we fail make sure we eat it away */ - client->input_skip_line = TRUE; - if (!nonsync) { if (ctx->failed) { /* tagline was already sent, we can abort here */ @@ -738,8 +734,6 @@ ret = cmd_append_handle_args(cmd, args, &nonsync); if (ret < 0) { /* invalid parameters, abort immediately */ - if (ctx->catenate) - client->input_skip_line = TRUE; cmd_append_finish(ctx); return TRUE; } From dovecot at dovecot.org Mon May 6 20:21:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 20:21:38 +0300 Subject: dovecot-2.2: imap: Fixed URLFETCH assert-crashes due to output_c... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/01560ee1a4b8 changeset: 16339:01560ee1a4b8 user: Timo Sirainen date: Mon May 06 20:15:58 2013 +0300 description: imap: Fixed URLFETCH assert-crashes due to output_cmd_lock not being cleared. diffstat: src/imap/cmd-urlfetch.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diffs (33 lines): diff -r 113cb77256a7 -r 01560ee1a4b8 src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Mon May 06 19:51:07 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Mon May 06 20:15:58 2013 +0300 @@ -43,7 +43,14 @@ imap_urlauth_fetch_deinit(&ctx->ufetch); if (ctx->failed) { - client_send_internal_error(cmd); + if (cmd->client->output_cmd_lock == cmd) { + /* failed in the middle of a literal. + we need to disconnect. */ + cmd->client->output_cmd_lock = NULL; + client_disconnect(cmd->client, "URLFETCH failed"); + } else { + client_send_internal_error(cmd); + } return; } @@ -147,12 +154,12 @@ client_send_line(client, ")"); else client_send_line(client, ""); + client->output_cmd_lock = NULL; if (imap_urlauth_fetch_continue(ctx->ufetch)) { /* waiting for imap urlauth service */ cmd->state = CLIENT_COMMAND_STATE_WAIT_EXTERNAL; cmd->func = cmd_urlfetch_cancel; - client->output_cmd_lock = NULL; /* retrieve next url */ return FALSE; From dovecot at dovecot.org Mon May 6 20:21:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 20:21:38 +0300 Subject: dovecot-2.2: imap: URLFETCH leaked istream on failures. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bed8c39349fa changeset: 16340:bed8c39349fa user: Timo Sirainen date: Mon May 06 20:20:43 2013 +0300 description: imap: URLFETCH leaked istream on failures. diffstat: src/imap/cmd-urlfetch.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (21 lines): diff -r 01560ee1a4b8 -r bed8c39349fa src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Mon May 06 20:15:58 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Mon May 06 20:20:43 2013 +0300 @@ -39,6 +39,8 @@ return; ctx->finished = TRUE; + if (ctx->input != NULL) + i_stream_unref(&ctx->input); if (ctx->ufetch != NULL) imap_urlauth_fetch_deinit(&ctx->ufetch); @@ -225,7 +227,7 @@ if (reply->input != NULL) { ctx->input = reply->input; ctx->size = reply->size; - i_stream_ref(reply->input); + i_stream_ref(ctx->input); ret = cmd_urlfetch_transfer_literal(cmd); if (ret < 0) { From dovecot at dovecot.org Mon May 6 20:21:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 20:21:38 +0300 Subject: dovecot-2.2: imap: URLFETCH sometimes failed thinking it didn't ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0a97502855df changeset: 16341:0a97502855df user: Timo Sirainen date: Mon May 06 20:21:27 2013 +0300 description: imap: URLFETCH sometimes failed thinking it didn't receive all of the message data. diffstat: src/imap/cmd-urlfetch.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r bed8c39349fa -r 0a97502855df src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Mon May 06 20:20:43 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Mon May 06 20:21:27 2013 +0300 @@ -116,7 +116,7 @@ client_disconnect(client, "URLFETCH failed"); return -1; } - if (!ctx->input->eof) { + if (i_stream_have_bytes_left(ctx->input)) { o_stream_set_flush_pending(client->output, TRUE); return 0; } From pigeonhole at rename-it.nl Mon May 6 23:49:03 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 06 May 2013 22:49:03 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Fix ping-pong problem in ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/e2e1ecc75a72 changeset: 1759:e2e1ecc75a72 user: Stephan Bosch date: Mon May 06 22:48:59 2013 +0200 description: doveadm-sieve: Fix ping-pong problem in active Sieve script synchronization. Patch by Timo Sirainen. diffstat: src/lib-sievestorage/sieve-storage.c | 6 +- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 122 ++++++++++++++++------ 2 files changed, 91 insertions(+), 37 deletions(-) diffs (252 lines): diff -r 5892c2ab9b0d -r e2e1ecc75a72 src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Tue Apr 23 22:55:03 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Mon May 06 22:48:59 2013 +0200 @@ -504,15 +504,19 @@ void sieve_storage_set_modified (struct sieve_storage *storage, time_t mtime) { - struct utimbuf times = { .actime = mtime, .modtime = mtime }; + struct utimbuf times; time_t cur_mtime; if ( mtime != (time_t)-1 ) { if ( sieve_storage_get_last_change(storage, &cur_mtime) >= 0 && cur_mtime > mtime ) return; + } else { + mtime = ioloop_time; } + times.actime = mtime; + times.modtime = mtime; if ( utime(storage->dir, ×) < 0 ) { switch ( errno ) { case ENOENT: diff -r 5892c2ab9b0d -r e2e1ecc75a72 src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Tue Apr 23 22:55:03 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Mon May 06 22:48:59 2013 +0200 @@ -4,6 +4,7 @@ #include "lib.h" #include "ioloop.h" #include "istream.h" +#include "istream-concat.h" #include "sieve-script.h" #include "sieve-script-file.h" #include "sieve-storage.h" @@ -21,10 +22,11 @@ MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT"sieve/" #define MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES \ MAILBOX_ATTRIBUTE_PREFIX_SIEVE"files/" -#define MAILBOX_ATTRIBUTE_SIEVE_ACTIVE \ - MAILBOX_ATTRIBUTE_PREFIX_SIEVE"active" -#define MAILBOX_ATTRIBUTE_SIEVE_SCRIPT \ - MAILBOX_ATTRIBUTE_PREFIX_SIEVE"script" +#define MAILBOX_ATTRIBUTE_SIEVE_DEFAULT \ + MAILBOX_ATTRIBUTE_PREFIX_SIEVE"default" + +#define MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_LINK 'L' +#define MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_SCRIPT 'S' struct sieve_mail_user { union mail_user_module_context module_ctx; @@ -153,6 +155,9 @@ if (mailbox_attribute_value_to_string(storage, value, &scriptname) < 0) return -1; + i_assert(scriptname[0] == MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_LINK); + scriptname++; + if (scriptname == NULL) { /* don't affect non-link active script */ if ((ret=sieve_storage_active_script_is_no_link(svstorage)) != 0) { @@ -224,6 +229,8 @@ } else { return sieve_attribute_unset_active_script(storage, svstorage, value->last_change); } + /* skip over the 'S' type */ + i_stream_skip(input, 1); if (sieve_storage_save_as_active_script (svstorage, input, value->last_change) < 0) { @@ -240,6 +247,37 @@ } static int +sieve_attribute_set_default(struct mail_storage *storage, + struct sieve_storage *svstorage, + const struct mail_attribute_value *value) +{ + const unsigned char *data; + size_t size; + ssize_t ret; + char type; + + if (value->value != NULL) { + type = value->value[0]; + } else { + ret = i_stream_read_data(value->value_stream, &data, &size, 0); + if (ret == -1) { + mail_storage_set_critical(storage, "read(%s) failed: %m", + i_stream_get_name(value->value_stream)); + return -1; + } + i_assert(ret > 0); + type = data[0]; + } + if (type == MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_LINK) + return sieve_attribute_set_active(storage, svstorage, value); + if (type == MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_SCRIPT) + return sieve_attribute_set_active_script(storage, svstorage, value); + mail_storage_set_error(storage, MAIL_ERROR_PARAMS, + "Invalid value for default sieve attribute"); + return -1; +} + +static int sieve_attribute_set_sieve(struct mail_storage *storage, const char *key, const struct mail_attribute_value *value) @@ -253,10 +291,8 @@ if (mail_sieve_user_init(storage->user, &svstorage) < 0) return -1; - if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_ACTIVE) == 0) - return sieve_attribute_set_active(storage, svstorage, value); - if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_SCRIPT) == 0) - return sieve_attribute_set_active_script(storage, svstorage, value); + if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_DEFAULT) == 0) + return sieve_attribute_set_default(storage, svstorage, value); if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES)) != 0) { mail_storage_set_error(storage, MAIL_ERROR_NOTFOUND, @@ -349,28 +385,13 @@ } static int -sieve_attribute_get_active(struct mail_storage *storage, - struct sieve_storage *svstorage, - struct mail_attribute_value *value_r) -{ - int ret; - - ret = sieve_storage_active_script_get_name(svstorage, &value_r->value); - if (ret >= 0 && sieve_storage_active_script_get_last_change - (svstorage, &value_r->last_change) < 0) { - ret = -1; - } - if (ret < 0) - mail_storage_set_internal_error(storage); - return ret; -} - -static int sieve_attribute_retrieve_script(struct mail_storage *storage, struct sieve_storage *svstorage, struct sieve_script *script, + bool add_type_prefix, struct mail_attribute_value *value_r, const char **errorstr_r) { - struct istream *input; + char type = MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_SCRIPT; + struct istream *input, *inputs[3]; const struct stat *st; enum sieve_error error; @@ -389,14 +410,21 @@ *errorstr_r = sieve_storage_get_last_error(svstorage, &error); return -1; } - i_stream_ref(input); - value_r->value_stream = input; if (i_stream_stat(input, FALSE, &st) < 0) { mail_storage_set_critical(storage, "stat(%s) failed: %m", i_stream_get_name(input)); } else { value_r->last_change = st->st_mtime; } + if (!add_type_prefix) { + i_stream_ref(input); + value_r->value_stream = input; + } else { + inputs[0] = i_stream_create_from_data(&type, 1); + inputs[1] = input; + inputs[2] = NULL; + value_r->value_stream = i_stream_create_concat(inputs); + } sieve_script_unref(&script); return 1; } @@ -423,7 +451,7 @@ if ((script=sieve_storage_active_script_get(svstorage)) == NULL) return 0; if ((ret=sieve_attribute_retrieve_script - (storage, svstorage, script, value_r, &errstr)) < 0) { + (storage, svstorage, script, TRUE, value_r, &errstr)) < 0) { mail_storage_set_critical(storage, "Failed to access active sieve script: %s", errstr); } @@ -431,6 +459,30 @@ } static int +sieve_attribute_get_default(struct mail_storage *storage, + struct sieve_storage *svstorage, + struct mail_attribute_value *value_r) +{ + const char *scriptname; + int ret; + + ret = sieve_storage_active_script_get_name(svstorage, &scriptname); + if (ret == 0) + return sieve_attribute_get_active_script(storage, svstorage, value_r); + + if (ret > 0) { + value_r->value = t_strdup_printf("%c%s", + MAILBOX_ATTRIBUTE_SIEVE_DEFAULT_LINK, scriptname); + if (sieve_storage_active_script_get_last_change + (svstorage, &value_r->last_change) < 0) + ret = -1; + } + if (ret < 0) + mail_storage_set_internal_error(storage); + return ret; +} + +static int sieve_attribute_get_sieve(struct mail_storage *storage, const char *key, struct mail_attribute_value *value_r) { @@ -442,10 +494,8 @@ if (mail_sieve_user_init(storage->user, &svstorage) < 0) return -1; - if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_ACTIVE) == 0) - return sieve_attribute_get_active(storage, svstorage, value_r); - if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_SCRIPT) == 0) - return sieve_attribute_get_active_script(storage, svstorage, value_r); + if (strcmp(key, MAILBOX_ATTRIBUTE_SIEVE_DEFAULT) == 0) + return sieve_attribute_get_default(storage, svstorage, value_r); if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES)) != 0) return 0; @@ -457,7 +507,7 @@ scriptname = key + strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES); script = sieve_storage_script_init(svstorage, scriptname); if ((ret=sieve_attribute_retrieve_script - (storage, svstorage, script, value_r, &errstr)) < 0) { + (storage, svstorage, script, FALSE, value_r, &errstr)) < 0) { mail_storage_set_critical(storage, "Failed to access sieve script '%s': %s", scriptname, errstr); @@ -584,10 +634,10 @@ /* Regular file */ if (ret > 0) - return MAILBOX_ATTRIBUTE_SIEVE_SCRIPT ; + return MAILBOX_ATTRIBUTE_SIEVE_DEFAULT; /* Symlink or none active */ - return siter->have_active ? MAILBOX_ATTRIBUTE_SIEVE_ACTIVE : NULL; + return siter->have_active ? MAILBOX_ATTRIBUTE_SIEVE_DEFAULT : NULL; } static const char * From dovecot at dovecot.org Mon May 6 23:59:50 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 06 May 2013 23:59:50 +0300 Subject: dovecot-2.2: lib-index: Previous commit sometimes broke scanning... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/62874b472dc6 changeset: 16342:62874b472dc6 user: Timo Sirainen date: Mon May 06 23:59:41 2013 +0300 description: lib-index: Previous commit sometimes broke scanning transaction log view. If min_file_seq+offset pointed to the end of the previous file that no longer existed, we didn't just skip over it. diffstat: src/lib-index/mail-transaction-log-view.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (21 lines): diff -r 0a97502855df -r 62874b472dc6 src/lib-index/mail-transaction-log-view.c --- a/src/lib-index/mail-transaction-log-view.c Mon May 06 20:21:27 2013 +0300 +++ b/src/lib-index/mail-transaction-log-view.c Mon May 06 23:59:41 2013 +0300 @@ -95,6 +95,17 @@ } for (file = view->log->files; file != NULL; file = file->next) { + if (file->hdr.prev_file_seq == min_file_seq) + break; + } + + if (file != NULL && min_file_offset == file->hdr.prev_file_offset) { + /* we can (and sometimes must) skip to the next file */ + min_file_seq = file->hdr.file_seq; + min_file_offset = file->hdr.hdr_size; + } + + for (file = view->log->files; file != NULL; file = file->next) { if (file->hdr.prev_file_seq == max_file_seq) break; } From pigeonhole at rename-it.nl Thu May 9 12:29:05 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 11:29:05 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Fixed synchronization of ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/676ca33ea4f6 changeset: 1760:676ca33ea4f6 user: Stephan Bosch date: Thu May 09 11:28:44 2013 +0200 description: doveadm-sieve: Fixed synchronization of script deletions. Sieve storage now updates sieve attributes in the user's INBOX if used by ManageSieve. diffstat: src/lib-sievestorage/sieve-storage-private.h | 12 ++- src/lib-sievestorage/sieve-storage-save.c | 26 +++-- src/lib-sievestorage/sieve-storage-script.c | 10 +- src/lib-sievestorage/sieve-storage.c | 113 +++++++++++++++++++++- src/lib-sievestorage/sieve-storage.h | 22 +++- src/managesieve/managesieve-client.c | 2 +- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 12 +-- 7 files changed, 162 insertions(+), 35 deletions(-) diffs (truncated from 386 to 300 lines): diff -r e2e1ecc75a72 -r 676ca33ea4f6 src/lib-sievestorage/sieve-storage-private.h --- a/src/lib-sievestorage/sieve-storage-private.h Mon May 06 22:48:59 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-private.h Thu May 09 11:28:44 2013 +0200 @@ -36,12 +36,14 @@ char *active_fname; char *link_path; char *error; - char *user; /* name of user accessing the storage */ + char *username; /* name of user accessing the storage */ mode_t dir_create_mode; mode_t file_create_mode; gid_t file_create_gid; + struct mailbox *inbox; + uint64_t max_scripts; uint64_t max_storage; @@ -55,5 +57,13 @@ struct sieve_script *sieve_storage_script_init_from_path (struct sieve_storage *storage, const char *path, const char *scriptname); +void sieve_storage_inbox_script_attribute_set + (struct sieve_storage *storage, const char *name); +void sieve_storage_inbox_script_attribute_rename + (struct sieve_storage *storage, const char *oldname, const char *newname); +void sieve_storage_inbox_script_attribute_unset + (struct sieve_storage *storage, const char *name); + + #endif diff -r e2e1ecc75a72 -r 676ca33ea4f6 src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Mon May 06 22:48:59 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.c Thu May 09 11:28:44 2013 +0200 @@ -361,25 +361,31 @@ } } -int sieve_storage_save_commit(struct sieve_save_context **ctx) +int sieve_storage_save_commit(struct sieve_save_context **_ctx) { + struct sieve_save_context *ctx = *_ctx; + struct sieve_storage *storage = ctx->storage; const char *dest_path; bool failed = FALSE; - i_assert((*ctx)->output == NULL); - i_assert((*ctx)->finished); - i_assert((*ctx)->scriptname != NULL); + i_assert(ctx->output == NULL); + i_assert(ctx->finished); + i_assert(ctx->scriptname != NULL); T_BEGIN { - dest_path = t_strconcat((*ctx)->storage->dir, "/", - sieve_scriptfile_from_name((*ctx)->scriptname), NULL); + dest_path = t_strconcat(storage->dir, "/", + sieve_scriptfile_from_name(ctx->scriptname), NULL); - failed = !sieve_storage_script_move((*ctx), dest_path); - if ( (*ctx)->mtime != (time_t)-1 ) - sieve_storage_update_mtime(dest_path, (*ctx)->mtime); + failed = !sieve_storage_script_move(ctx, dest_path); + if ( ctx->mtime != (time_t)-1 ) + sieve_storage_update_mtime(dest_path, ctx->mtime); } T_END; - sieve_storage_save_destroy(ctx); + /* set INBOX mailbox attribute */ + if ( !failed ) + sieve_storage_inbox_script_attribute_set(storage, ctx->scriptname); + + sieve_storage_save_destroy(_ctx); return ( failed ? -1 : 0 ); } diff -r e2e1ecc75a72 -r 676ca33ea4f6 src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Mon May 06 22:48:59 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.c Thu May 09 11:28:44 2013 +0200 @@ -391,6 +391,10 @@ } } + /* unset INBOX mailbox attribute */ + if ( ret >= 0 ) + sieve_storage_inbox_script_attribute_unset(storage, (*script)->name); + /* Always deinitialize the script object */ sieve_script_unref(script); return ret; @@ -609,7 +613,7 @@ struct sieve_storage_script *st_script = (struct sieve_storage_script *) script; struct sieve_storage *storage = st_script->storage; - const char *newpath, *newfile, *link_path; + const char *oldname = script->name, *newpath, *newfile, *link_path; int ret = 0; /* Check script name */ @@ -680,6 +684,10 @@ } } T_END; + /* rename INBOX mailbox attribute */ + if ( ret >= 0 && oldname != NULL ) + sieve_storage_inbox_script_attribute_rename(storage, oldname, newname); + return ret; } diff -r e2e1ecc75a72 -r 676ca33ea4f6 src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Mon May 06 22:48:59 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Thu May 09 11:28:44 2013 +0200 @@ -7,6 +7,7 @@ #include "mkdir-parents.h" #include "eacces-error.h" #include "unlink-old-files.h" +#include "mail-storage-private.h" #include "sieve.h" #include "sieve-common.h" @@ -202,15 +203,36 @@ return 1; } +static int _sieve_storage_open_inbox +(struct mail_user *user, struct mailbox **box_r) +{ + struct mail_namespace *ns; + struct mailbox *box; + enum mailbox_flags flags = MAILBOX_FLAG_IGNORE_ACLS; + enum mail_error error; + + ns = mail_namespace_find_inbox(user->namespaces); + *box_r = box = mailbox_alloc(ns->list, "INBOX", flags); + if (mailbox_open(box) == 0) + return 0; + + i_warning("sieve-storage: " + "Failed to open user INBOX for attribute modifications: %s", + mailbox_get_last_error(box, &error)); + return -1; +} + static struct sieve_storage *_sieve_storage_create -(struct sieve_instance *svinst, const char *user, const char *home, +(struct sieve_instance *svinst, struct mail_user *user, const char *home, enum sieve_storage_flags flags) { pool_t pool; struct sieve_storage *storage; + struct mailbox *inbox = NULL; bool debug = ( (flags & SIEVE_STORAGE_FLAG_DEBUG) != 0 ); const char *tmp_dir, *link_path, *path; const char *sieve_data, *active_path, *active_fname, *storage_dir; + const char *username = user->username; mode_t dir_create_mode, file_create_mode; gid_t file_create_gid; const char *file_create_gid_origin; @@ -265,7 +287,8 @@ path = home_expand_tilde(active_path, home); if ( path == NULL ) { i_error("sieve-storage: userdb(%s) didn't return a home directory " - "for substitition in active script path (sieve=%s)", user, active_path); + "for substitition in active script path (sieve=%s)", + username, active_path); return NULL; } @@ -368,7 +391,7 @@ if ( path == NULL ) { i_error("sieve-storage: userdb(%s) didn't return a home directory " "for substitition in storage root directory (sieve_dir=%s)", - user, storage_dir); + username, storage_dir); return NULL; } @@ -414,6 +437,10 @@ file_create_gid_origin, debug) < 0 ) return NULL; + /* Open user's INBOX for attribute updates if necessary */ + if ( (flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) == 0 ) + (void)_sieve_storage_open_inbox(user, &inbox); + /* * Create storage object */ @@ -424,7 +451,7 @@ storage->flags = flags; storage->pool = pool; storage->dir = p_strdup(pool, storage_dir); - storage->user = p_strdup(pool, user); + storage->username = p_strdup(pool, username); storage->active_path = p_strdup(pool, active_path); storage->active_fname = p_strdup(pool, active_fname); storage->prev_mtime = st.st_mtime; @@ -433,6 +460,8 @@ storage->file_create_mode = file_create_mode; storage->file_create_gid = file_create_gid; + storage->inbox = inbox; + /* Get the path to be prefixed to the script name in the symlink pointing * to the active script. */ @@ -474,7 +503,7 @@ } struct sieve_storage *sieve_storage_create -(struct sieve_instance *svinst, const char *user, const char *home, +(struct sieve_instance *svinst, struct mail_user *user, const char *home, enum sieve_storage_flags flags) { struct sieve_storage *storage; @@ -486,9 +515,10 @@ return storage; } - void sieve_storage_free(struct sieve_storage *storage) { + if (storage->inbox != NULL) + mailbox_free(&storage->inbox); sieve_error_handler_unref(&storage->ehandler); pool_unref(&storage->pool); @@ -641,3 +671,74 @@ return storage->error != NULL ? storage->error : "Unknown error"; } + +/* + * INBOX attributes + */ + +static void sieve_storage_inbox_transaction_finish +(struct sieve_storage *storage, struct mailbox_transaction_context **t) +{ + struct mailbox *inbox = storage->inbox; + + if (mailbox_transaction_commit(t) < 0) { + enum mail_error error; + + i_warning("sieve-storage: Failed to update INBOX attributes: %s", + mail_storage_get_last_error(mailbox_get_storage(inbox), &error)); + } +} + +void sieve_storage_inbox_script_attribute_set +(struct sieve_storage *storage, const char *name) +{ + struct mailbox_transaction_context *t; + const char *key; + + if (storage->inbox == NULL) + return; + + key = t_strconcat + (MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, name, NULL); + t = mailbox_transaction_begin(storage->inbox, 0); + mail_index_attribute_set(t->itrans, TRUE, key, ioloop_time, 0); + sieve_storage_inbox_transaction_finish(storage, &t); +} + +void sieve_storage_inbox_script_attribute_rename +(struct sieve_storage *storage, const char *oldname, const char *newname) +{ + struct mailbox_transaction_context *t; + const char *oldkey, *newkey; + + if (storage->inbox == NULL) + return; + + oldkey = t_strconcat + (MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, oldname, NULL); + newkey = t_strconcat + (MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, newname, NULL); + + t = mailbox_transaction_begin(storage->inbox, 0); + mail_index_attribute_unset(t->itrans, TRUE, oldkey, ioloop_time); + mail_index_attribute_set(t->itrans, TRUE, newkey, ioloop_time, 0); + sieve_storage_inbox_transaction_finish(storage, &t); +} + +void sieve_storage_inbox_script_attribute_unset +(struct sieve_storage *storage, const char *name) +{ + struct mailbox_transaction_context *t; + const char *key; + + if (storage->inbox == NULL) + return; + + key = t_strconcat + (MAILBOX_ATTRIBUTE_PREFIX_SIEVE_FILES, name, NULL); + From dovecot at dovecot.org Thu May 9 12:31:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 09 May 2013 12:31:58 +0300 Subject: dovecot-2.1: istream-seekable: Don't crash when seeking forwards... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/48199b8e99cc changeset: 14962:48199b8e99cc user: Timo Sirainen date: Thu May 09 12:30:53 2013 +0300 description: istream-seekable: Don't crash when seeking forwards past the data we haven't read yet. diffstat: src/lib/istream-seekable.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diffs (46 lines): diff -r 23f7cabad194 -r 48199b8e99cc src/lib/istream-seekable.c --- a/src/lib/istream-seekable.c Mon May 06 14:33:05 2013 +0300 +++ b/src/lib/istream-seekable.c Thu May 09 12:30:53 2013 +0300 @@ -290,13 +290,6 @@ return ret; } -static void i_stream_seekable_seek(struct istream_private *stream, - uoff_t v_offset, bool mark ATTR_UNUSED) -{ - stream->istream.v_offset = v_offset; - stream->skip = stream->pos = 0; -} - static const struct stat * i_stream_seekable_stat(struct istream_private *stream, bool exact) { @@ -341,6 +334,20 @@ } } +static void i_stream_seekable_seek(struct istream_private *stream, + uoff_t v_offset, bool mark) +{ + if (v_offset <= stream->istream.v_offset) { + /* seeking backwards */ + stream->istream.v_offset = v_offset; + stream->skip = stream->pos = 0; + } else { + /* we can't skip over data we haven't yet read and written to + our buffer/temp file */ + i_stream_default_seek(stream, v_offset, mark); + } +} + struct istream * i_stream_create_seekable(struct istream *input[], size_t max_buffer_size, @@ -394,6 +401,7 @@ sstream->istream.read = i_stream_seekable_read; sstream->istream.seek = i_stream_seekable_seek; sstream->istream.stat = i_stream_seekable_stat; + sstream->istream.seek = i_stream_seekable_seek; sstream->istream.istream.readable_fd = FALSE; sstream->istream.istream.blocking = blocking; From dovecot at dovecot.org Thu May 9 12:37:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 09 May 2013 12:37:38 +0300 Subject: dovecot-2.1: istream-[b]zlib: Don't break if parent stream gets ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4e633c2f9738 changeset: 14963:4e633c2f9738 user: Timo Sirainen date: Thu May 09 12:32:38 2013 +0300 description: istream-[b]zlib: Don't break if parent stream gets seeked in the middle of reads. diffstat: src/plugins/zlib/istream-bzlib.c | 65 +++++++++++++++++--------------------- src/plugins/zlib/istream-zlib.c | 68 +++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 74 deletions(-) diffs (243 lines): diff -r 48199b8e99cc -r 4e633c2f9738 src/plugins/zlib/istream-bzlib.c --- a/src/plugins/zlib/istream-bzlib.c Thu May 09 12:30:53 2013 +0300 +++ b/src/plugins/zlib/istream-bzlib.c Thu May 09 12:32:38 2013 +0300 @@ -15,7 +15,7 @@ bz_stream zs; uoff_t eof_offset, stream_size; - size_t prev_size, high_pos; + size_t high_pos; struct stat last_parent_statbuf; unsigned int log_errors:1; @@ -46,7 +46,7 @@ struct bzlib_istream *zstream = (struct bzlib_istream *)stream; const unsigned char *data; uoff_t high_offset; - size_t size; + size_t size, out_size; int ret; high_offset = stream->istream.v_offset + (stream->pos - stream->skip); @@ -95,42 +95,36 @@ } } - if (zstream->zs.avail_in == 0) { - /* need to read more data. try to read a full CHUNK_SIZE */ - i_stream_skip(stream->parent, zstream->prev_size); - if (i_stream_read_data(stream->parent, &data, &size, - CHUNK_SIZE-1) == -1 && size == 0) { - if (stream->parent->stream_errno != 0) { - stream->istream.stream_errno = - stream->parent->stream_errno; - } else { - i_assert(stream->parent->eof); - if (zstream->log_errors) { - bzlib_read_error(zstream, - "unexpected EOF"); - } - stream->istream.stream_errno = EINVAL; - } - return -1; + if (i_stream_read_data(stream->parent, &data, &size, 0) < 0) { + if (stream->parent->stream_errno != 0) { + stream->istream.stream_errno = + stream->parent->stream_errno; + } else { + i_assert(stream->parent->eof); + if (zstream->log_errors) + bzlib_read_error(zstream, "unexpected EOF"); + stream->istream.stream_errno = EINVAL; } - zstream->prev_size = size; - if (size == 0) { - /* no more input */ - i_assert(!stream->istream.blocking); - return 0; - } - - zstream->zs.next_in = (char *)data; - zstream->zs.avail_in = size; + return -1; + } + if (size == 0) { + /* no more input */ + i_assert(!stream->istream.blocking); + return 0; } - size = stream->buffer_size - stream->pos; + zstream->zs.next_in = (char *)data; + zstream->zs.avail_in = size; + + out_size = stream->buffer_size - stream->pos; zstream->zs.next_out = (char *)stream->w_buffer + stream->pos; - zstream->zs.avail_out = size; + zstream->zs.avail_out = out_size; ret = BZ2_bzDecompress(&zstream->zs); - size -= zstream->zs.avail_out; - stream->pos += size; + out_size -= zstream->zs.avail_out; + stream->pos += out_size; + + i_stream_skip(stream->parent, size - zstream->zs.avail_in); switch (ret) { case BZ_OK: @@ -156,7 +150,7 @@ zstream->eof_offset = stream->istream.v_offset + (stream->pos - stream->skip); zstream->stream_size = zstream->eof_offset; - if (size == 0) { + if (out_size == 0) { stream->istream.eof = TRUE; return -1; } @@ -164,11 +158,11 @@ default: i_fatal("BZ2_bzDecompress() failed with %d", ret); } - if (size == 0) { + if (out_size == 0) { /* read more input */ return i_stream_bzlib_read(stream); } - return size; + return out_size; } static void i_stream_bzlib_init(struct bzlib_istream *zstream) @@ -203,7 +197,6 @@ stream->skip = stream->pos = 0; stream->istream.v_offset = 0; zstream->high_pos = 0; - zstream->prev_size = 0; (void)BZ2_bzDecompressEnd(&zstream->zs); i_stream_bzlib_init(zstream); diff -r 48199b8e99cc -r 4e633c2f9738 src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Thu May 09 12:30:53 2013 +0300 +++ b/src/plugins/zlib/istream-zlib.c Thu May 09 12:32:38 2013 +0300 @@ -119,6 +119,7 @@ pos += 2; } i_stream_skip(stream->parent, pos); + zstream->prev_size = 0; return 1; } @@ -169,7 +170,7 @@ struct zlib_istream *zstream = (struct zlib_istream *)stream; const unsigned char *data; uoff_t high_offset; - size_t size; + size_t size, out_size; int ret; high_offset = stream->istream.v_offset + (stream->pos - stream->skip); @@ -205,7 +206,6 @@ if (ret <= 0) return ret; zstream->header_read = TRUE; - zstream->prev_size = 0; } if (stream->pos < zstream->high_pos) { @@ -245,44 +245,39 @@ } } - if (zstream->zs.avail_in == 0) { - /* need to read more data. try to read a full CHUNK_SIZE */ - i_stream_skip(stream->parent, zstream->prev_size); - if (i_stream_read_data(stream->parent, &data, &size, - CHUNK_SIZE-1) == -1 && size == 0) { - if (stream->parent->stream_errno != 0) { - stream->istream.stream_errno = - stream->parent->stream_errno; - } else { - i_assert(stream->parent->eof); - if (zstream->log_errors) { - zlib_read_error(zstream, - "unexpected EOF"); - } - stream->istream.stream_errno = EPIPE; - } - return -1; + if (i_stream_read_data(stream->parent, &data, &size, 0) < 0) { + if (stream->parent->stream_errno != 0) { + stream->istream.stream_errno = + stream->parent->stream_errno; + } else { + i_assert(stream->parent->eof); + if (zstream->log_errors) + zlib_read_error(zstream, "unexpected EOF"); + stream->istream.stream_errno = EPIPE; } - zstream->prev_size = size; - if (size == 0) { - /* no more input */ - i_assert(!stream->istream.blocking); - return 0; - } - - zstream->zs.next_in = (void *)data; - zstream->zs.avail_in = size; + return -1; + } + if (size == 0) { + /* no more input */ + i_assert(!stream->istream.blocking); + return 0; } - size = stream->buffer_size - stream->pos; + zstream->zs.next_in = (void *)data; + zstream->zs.avail_in = size; + + out_size = stream->buffer_size - stream->pos; zstream->zs.next_out = stream->w_buffer + stream->pos; - zstream->zs.avail_out = size; + zstream->zs.avail_out = out_size; ret = inflate(&zstream->zs, Z_SYNC_FLUSH); - size -= zstream->zs.avail_out; + out_size -= zstream->zs.avail_out; zstream->crc32 = crc32_data_more(zstream->crc32, - stream->w_buffer + stream->pos, size); - stream->pos += size; + stream->w_buffer + stream->pos, + out_size); + stream->pos += out_size; + + i_stream_skip(stream->parent, size - zstream->zs.avail_in); switch (ret) { case Z_OK: @@ -304,10 +299,7 @@ zstream->eof_offset = stream->istream.v_offset + (stream->pos - stream->skip); zstream->stream_size = zstream->eof_offset; - i_stream_skip(stream->parent, - zstream->prev_size - zstream->zs.avail_in); zstream->zs.avail_in = 0; - zstream->prev_size = 0; if (!zstream->trailer_read) { /* try to read and verify the trailer, we might not @@ -319,11 +311,11 @@ default: i_fatal("inflate() failed with %d", ret); } - if (size == 0) { + if (out_size == 0) { /* read more input */ return i_stream_zlib_read(stream); } - return size; + return out_size; } static void i_stream_zlib_init(struct zlib_istream *zstream) From pigeonhole at rename-it.nl Thu May 9 16:12:09 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:12:09 +0200 Subject: dovecot-2.1-pigeonhole: Fixed problem in `make distcheck`. Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/9d76d51685e1 changeset: 1687:9d76d51685e1 user: Stephan Bosch date: Thu May 09 15:11:13 2013 +0200 description: Fixed problem in `make distcheck`. Added --disable-shared to DISTCHECK_CONFIGURE_FLAGS (in dovecot.m4) to prevent libtool from relinking the libraries. diffstat: m4/dovecot.m4 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 0163c45094a3 -r 9d76d51685e1 m4/dovecot.m4 --- a/m4/dovecot.m4 Thu May 02 21:37:36 2013 +0200 +++ b/m4/dovecot.m4 Thu May 09 15:11:13 2013 +0200 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 5 +# serial 6 AC_DEFUN([DC_DOVECOT_MODULEDIR],[ AC_ARG_WITH(moduledir, @@ -70,7 +70,7 @@ cd $dovecotdir abs_dovecotdir=`pwd` cd $old - DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs" + DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs --disable-shared" eval `grep -i '^dovecot_[[a-z_]]*=' "$dovecotdir"/dovecot-config` eval `grep '^LIBDOVECOT[[A-Z_]]*=' "$dovecotdir"/dovecot-config` From pigeonhole at rename-it.nl Thu May 9 16:18:26 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:18:26 +0200 Subject: dovecot-2.1-pigeonhole: Added tag 0.3.5 for changeset 374ec9399958 Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/59c48b78f3aa changeset: 1689:59c48b78f3aa user: Stephan Bosch date: Thu May 09 15:18:13 2013 +0200 description: Added tag 0.3.5 for changeset 374ec9399958 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 374ec9399958 -r 59c48b78f3aa .hgtags --- a/.hgtags Thu May 09 15:18:05 2013 +0200 +++ b/.hgtags Thu May 09 15:18:13 2013 +0200 @@ -14,3 +14,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 4932026768454443d87d2e6445552b331589dbb1 0.3.4 +374ec93999588b1acc554f81f61c93bf9fad7037 0.3.5 From pigeonhole at rename-it.nl Thu May 9 16:18:25 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:18:25 +0200 Subject: dovecot-2.1-pigeonhole: Released v0.3.5 for Dovecot v2.1.16. Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/374ec9399958 changeset: 1688:374ec9399958 user: Stephan Bosch date: Thu May 09 15:18:05 2013 +0200 description: Released v0.3.5 for Dovecot v2.1.16. diffstat: NEWS | 7 +++++++ configure.in | 2 +- 2 files changed, 8 insertions(+), 1 deletions(-) diffs (23 lines): diff -r 9d76d51685e1 -r 374ec9399958 NEWS --- a/NEWS Thu May 09 15:11:13 2013 +0200 +++ b/NEWS Thu May 09 15:18:05 2013 +0200 @@ -1,3 +1,10 @@ +v0.3.5 09-05-2013 Stephan Bosch + + - Sieve editheader extension: fixed interaction with the Sieve body extension. + If used together, the deleteheader action could fail after a body test was + performed. + - Test suite: fixed a time zone dependency in the Sieve date extension tests. + v0.3.4 06-04-2013 Stephan Bosch * Changed error handling to be less of a nuisance for administrators. Strictly diff -r 9d76d51685e1 -r 374ec9399958 configure.in --- a/configure.in Thu May 09 15:11:13 2013 +0200 +++ b/configure.in Thu May 09 15:18:05 2013 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Pigeonhole], [0.3.4], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) +AC_INIT([Pigeonhole], [0.3.5], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR([src]) AC_CONFIG_MACRO_DIR([m4]) From pigeonhole at rename-it.nl Thu May 9 16:21:56 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:21:56 +0200 Subject: dovecot-2.1-pigeonhole: Added signature for changeset 374ec9399958 Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/34cb3668f86d changeset: 1690:34cb3668f86d user: Stephan Bosch date: Thu May 09 15:21:43 2013 +0200 description: Added signature for changeset 374ec9399958 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 59c48b78f3aa -r 34cb3668f86d .hgsigs --- a/.hgsigs Thu May 09 15:18:13 2013 +0200 +++ b/.hgsigs Thu May 09 15:21:43 2013 +0200 @@ -8,3 +8,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0 iQEcBAABAgAGBQJQWIMhAAoJEATWKx49+7T0g/IH/3qqQemBP62Y+Wzo67DruphrJ5HSlIX4Uw/O4rOjrk8dWSMrsui5jFy4LXig+CR1dfY4RS0izTxsAiNhTACuavMfGHiYBKQW6UwIDlKECVBxbQyjB7v2C3FKPj9K9QReiYACSeB1RhQBnpbcvioif9H62VI5SKE6rjXyky6fDAxtbjhySb+nPDtV4HmV7ukcfDc3bxwcZkz9XXKoNmPWw8r34Z/RwxWbbWr8xUwW3+9LDB2Oz6PRyYP5S8EcNNYjk3ai2Llh0xuJGLQbpulhmjYDJmk20TkpLCFAfsYq1qW3yed9lL88CcFH4LDb9WA0LNs+7PfbmY/m8CX7JwUmHB8= 64474c35967852bc452f71bc099ec3f8ded0369a 0 iQEcBAABAgAGBQJQWMvhAAoJEATWKx49+7T0NrYH/2PQuuFqzlku+NG8Iw0UN2yeDEML+2n1xG31ud7m3sNWw8lX+03gEd+LU8+LygHJJ0IAde/jBYRBbC8zj9UXDl3v5FIRwhcvGnllBCMMH7motfg+aLrCR/xs+0jV/AqpRin1VILHYFaB9UFP5PUgvJJiCUniQWoe+r41gra1hRA7OK3923YOOi9t4zJxoat7e0OMhc0IcdB7n3iQmyicbb8izKw/UvR2tR3T7fVcEl6u1LlbGaojtJA03V1L+a8QkmltiurD9VNmiHz++bGGJlA7LSmVYBq7BeC1lDnXUGO9ryZgln6aXRwUS0VaTI51F9gSMw+0UDJCwA5yBKqYyR8= 4932026768454443d87d2e6445552b331589dbb1 0 iQEcBAABAgAGBQJRYIePAAoJEATWKx49+7T0p2oH/ROhjt/m+wZmT9+2NxEDwnaOoQ8m9TxkZiZ50mmi/k4L7OQe/xffxM2T3NTTgRkaLCK2+MEz0pSLJXL+n/AjTBtiynwSxYY+W0wtYKBIs0tcQHaSafN2u5LjtQZ2RHg+Fi1szhJQu/jy31w12KGTqdyVw05JuEPgyfM7fKpqKh8CQZJucEyn9Vf8boGPQMFJ7N6o4wpOeW8RuVcBAEToHMpkDI1OQmB22cEQJfZrdOMPaucUOG6Abfw0FDwwV4bHa1nmxiPZXF8DpW31SVDoZgyvi08TSWFHS9t8Pij+XyWIdXhbCzqdpkvLGEsvMJjhiro9agf2tSj9jP+D4xiFRe8= +374ec93999588b1acc554f81f61c93bf9fad7037 0 iQEcBAABAgAGBQJRi6LgAAoJEATWKx49+7T0OPgH+gPOOYqdODGONhZTwxjKmvbVNzb428t/fS/pi2bSIeOXVzLone/P7NYstdM67eQsfxY4Kn8qN/eFkjdkozbc+3xx0VFvptFTd9NXGM57O84umgrvKXQDQM333TVMxMG5u6TPPkCmFcWmggcc1IdQxZ66dpgfETdh+IgJXdLQg4oc0IqHtqx19dVyYXRbtgY+GfA9ovFqOkzcWoXgSHRMmUf2gCGWPc3jSZPVHd3ObRvrwn3NcWULK4WCt5QPc6fU53eDrEvkSu6C5U0IV5G3jakrUK0PYtQ3jvxXGm8J3XQ+ea79Bp+mG/21Woz30Ey6AlFbuAHobGesGafjPLDLSNs= From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Updated dovecot.m4 to latest version. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/01ac5c3f5b07 changeset: 1765:01ac5c3f5b07 user: Stephan Bosch date: Thu May 09 15:19:32 2013 +0200 description: Updated dovecot.m4 to latest version. diffstat: m4/dovecot.m4 | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diffs (36 lines): diff -r 26c30ba221d0 -r 01ac5c3f5b07 m4/dovecot.m4 --- a/m4/dovecot.m4 Thu May 09 12:22:39 2013 +0200 +++ b/m4/dovecot.m4 Thu May 09 15:19:32 2013 +0200 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 5 +# serial 11 AC_DEFUN([DC_DOVECOT_MODULEDIR],[ AC_ARG_WITH(moduledir, @@ -76,6 +76,8 @@ eval `grep '^LIBDOVECOT[[A-Z_]]*=' "$dovecotdir"/dovecot-config` if test "$use_install_dirs" = "no"; then + # the main purpose of these is to fix make distcheck for plugins + # other than that, they don't really make much sense dovecot_pkgincludedir='$(pkgincludedir)' dovecot_pkglibdir='$(pkglibdir)' dovecot_pkglibexecdir='$(libexecdir)/dovecot' @@ -84,10 +86,10 @@ fi AX_SUBST_L([DISTCHECK_CONFIGURE_FLAGS], [dovecotdir], [dovecot_moduledir], [dovecot_pkgincludedir], [dovecot_pkglibexecdir], [dovecot_pkglibdir], [dovecot_docdir]) - AX_SUBST_L([DOVECOT_CFLAGS], [DOVECOT_LIBS], [DOVECOT_SSL_LIBS], [DOVECOT_SQL_LIBS]) - AX_SUBST_L([LIBDOVECOT], [LIBDOVECOT_LOGIN], [LIBDOVECOT_SQL], [LIBDOVECOT_LDA], [LIBDOVECOT_STORAGE]) - AX_SUBST_L([LIBDOVECOT_DEPS], [LIBDOVECOT_LOGIN_DEPS], [LIBDOVECOT_SQL_DEPS], [LIBDOVECOT_LDA_DEPS], [LIBDOVECOT_STORAGE_DEPS]) - AX_SUBST_L([LIBDOVECOT_INCLUDE], [LIBDOVECOT_LDA_INCLUDE], [LIBDOVECOT_SERVICE_INCLUDE], [LIBDOVECOT_STORAGE_INCLUDE], [LIBDOVECOT_LOGIN_INCLUDE], [LIBDOVECOT_CONFIG_INCLUDE]) + AX_SUBST_L([DOVECOT_CFLAGS], [DOVECOT_LIBS], [DOVECOT_SSL_LIBS], [DOVECOT_SQL_LIBS], [DOVECOT_COMPRESS_LIBS]) + AX_SUBST_L([LIBDOVECOT], [LIBDOVECOT_LOGIN], [LIBDOVECOT_SQL], [LIBDOVECOT_SSL], [LIBDOVECOT_COMPRESS], [LIBDOVECOT_LDA], [LIBDOVECOT_STORAGE]) + AX_SUBST_L([LIBDOVECOT_DEPS], [LIBDOVECOT_LOGIN_DEPS], [LIBDOVECOT_SQL_DEPS], [LIBDOVECOT_SSL_DEPS], [LIBDOVECOT_COMPRESS_DEPS], [LIBDOVECOT_LDA_DEPS], [LIBDOVECOT_STORAGE_DEPS]) + AX_SUBST_L([LIBDOVECOT_INCLUDE], [LIBDOVECOT_LDA_INCLUDE], [LIBDOVECOT_DOVEADM_INCLUDE], [LIBDOVECOT_SERVICE_INCLUDE], [LIBDOVECOT_STORAGE_INCLUDE], [LIBDOVECOT_LOGIN_INCLUDE], [LIBDOVECOT_CONFIG_INCLUDE], [LIBDOVECOT_IMAP_INCLUDE]) DC_PLUGIN_DEPS ]) From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Merged changed from Pigeonhole v0.3. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/39848c052666 changeset: 1763:39848c052666 user: Stephan Bosch date: Thu May 09 12:21:31 2013 +0200 description: Merged changed from Pigeonhole v0.3. diffstat: src/lib-sieve/edit-mail.c | 4 +++ src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 10 ++++++- tests/extensions/date/basic.svtest | 21 ++++++++-------- tests/extensions/editheader/deleteheader.svtest | 26 +++++++++++++++++++++ 4 files changed, 48 insertions(+), 13 deletions(-) diffs (123 lines): diff -r 676ca33ea4f6 -r 39848c052666 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Thu May 09 11:28:44 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Thu May 09 12:21:31 2013 +0200 @@ -558,6 +558,7 @@ if ( edmail->headers_parsed ) return 1; + i_stream_seek(edmail->wrapped_stream, 0); hparser = message_parse_header_init (edmail->wrapped_stream, NULL, hparser_flags); @@ -642,6 +643,9 @@ message_parse_header_deinit(&hparser); if ( ret <= 0 ) { + /* blocking i/o required */ + i_assert( ret != 0 ); + /* Error; clean up */ current = head; while ( current != NULL ) { diff -r 676ca33ea4f6 -r 39848c052666 src/lib-sieve/plugins/editheader/cmd-deleteheader.c --- a/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Thu May 09 11:28:44 2013 +0200 +++ b/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Thu May 09 12:21:31 2013 +0200 @@ -531,9 +531,15 @@ /* Delete all occurences of header */ ret = edit_mail_header_delete(edmail, str_c(field_name), index); - if ( trace ) { - sieve_runtime_trace(renv, 0, "deleted %d headers", ret); + if ( ret < 0 ) { + sieve_runtime_warning(renv, NULL, "deleteheader action: " + "failed to delete occurences of header `%s' (this should not happen!)", + str_c(field_name)); + } else if ( trace ) { + sieve_runtime_trace(renv, 0, "deleted %d occurences of header `%s'", + ret, str_c(field_name)); } + } return SIEVE_EXEC_OK; diff -r 676ca33ea4f6 -r 39848c052666 tests/extensions/date/basic.svtest --- a/tests/extensions/date/basic.svtest Thu May 09 11:28:44 2013 +0200 +++ b/tests/extensions/date/basic.svtest Thu May 09 12:21:31 2013 +0200 @@ -41,34 +41,33 @@ } test "Comparison" { - if not date :is "delivery-date" "date" "2009-07-22" { - if date :matches "delivery-date" "date" "*" { set "date" "${1}"; } + if not date :originalzone :is "delivery-date" "date" "2009-07-22" { + if date :originalzone :matches "delivery-date" "date" "*" { set "date" "${1}"; } test_fail "date is invalid: ${date}"; } - - if not date :value "ge" "delivery-date" "date" "2009-07-22" { + if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-22" { test_fail "date comparison ge failed equal"; } - if not date :value "ge" "delivery-date" "date" "2009-07-21" { + if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-21" { test_fail "date comparison ge failed greater"; } - if anyof (not date :value "ge" "delivery-date" "date" "2009-06-22", - not date :value "ge" "date" "date" "2006-07-22" ) { + if anyof (not date :originalzone :value "ge" "delivery-date" "date" "2009-06-22", + not date :originalzone :value "ge" "date" "date" "2006-07-22" ) { test_fail "date comparison ge failed much greater"; } - if not date :value "le" "delivery-date" "date" "2009-07-22" { + if not date :originalzone :value "le" "delivery-date" "date" "2009-07-22" { test_fail "date comparison le failed equal"; } - if not date :value "le" "delivery-date" "date" "2009-07-23" { + if not date :originalzone :value "le" "delivery-date" "date" "2009-07-23" { test_fail "date comparison le failed less"; } - if anyof (not date :value "le" "delivery-date" "date" "2009-09-22", - not date :value "le" "date" "date" "2012-07-22" ) { + if anyof (not date :originalzone :value "le" "delivery-date" "date" "2009-09-22", + not date :originalzone :value "le" "date" "date" "2012-07-22" ) { test_fail "date comparison ge failed much less"; } } diff -r 676ca33ea4f6 -r 39848c052666 tests/extensions/editheader/deleteheader.svtest --- a/tests/extensions/editheader/deleteheader.svtest Thu May 09 11:28:44 2013 +0200 +++ b/tests/extensions/editheader/deleteheader.svtest Thu May 09 12:21:31 2013 +0200 @@ -962,3 +962,29 @@ test_fail "x-b header not deleted"; } } + +/* + * TEST: Interaction with body test + */ + +test_set "message" text: +From: stephan at example.org +To: nico at frop.example.com +Subject: Hoppa + +Text +. +; + +test "Interaction with body test" { + addheader "X-Frop" "frop"; + + if body "!TEST!" {} + + deleteheader "subject"; + + if exists "subject" { + test_fail "subject header not deleted"; + } +} + From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: lib-sieve: editheader extension: Fixed i... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/0163c45094a3 changeset: 1762:0163c45094a3 user: Stephan Bosch date: Thu May 02 21:37:36 2013 +0200 description: lib-sieve: editheader extension: Fixed interaction with body extension. Forgot to rewind mail stream before header parsing. Wrapped mail stream is obtained long before parsing, so if it is used in the mean time, it must be rewound to the beginning. diffstat: src/lib-sieve/edit-mail.c | 4 +++ src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 10 ++++++- tests/extensions/editheader/deleteheader.svtest | 26 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diffs (75 lines): diff -r bc2126771d00 -r 0163c45094a3 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Sun Apr 07 05:12:57 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Thu May 02 21:37:36 2013 +0200 @@ -559,6 +559,7 @@ if ( edmail->headers_parsed ) return 1; + i_stream_seek(edmail->wrapped_stream, 0); hparser = message_parse_header_init (edmail->wrapped_stream, NULL, hparser_flags); @@ -643,6 +644,9 @@ message_parse_header_deinit(&hparser); if ( ret <= 0 ) { + /* blocking i/o required */ + i_assert( ret != 0 ); + /* Error; clean up */ current = head; while ( current != NULL ) { diff -r bc2126771d00 -r 0163c45094a3 src/lib-sieve/plugins/editheader/cmd-deleteheader.c --- a/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Sun Apr 07 05:12:57 2013 +0200 +++ b/src/lib-sieve/plugins/editheader/cmd-deleteheader.c Thu May 02 21:37:36 2013 +0200 @@ -531,9 +531,15 @@ /* Delete all occurences of header */ ret = edit_mail_header_delete(edmail, str_c(field_name), index); - if ( trace ) { - sieve_runtime_trace(renv, 0, "deleted %d headers", ret); + if ( ret < 0 ) { + sieve_runtime_warning(renv, NULL, "deleteheader action: " + "failed to delete occurences of header `%s' (this should not happen!)", + str_c(field_name)); + } else if ( trace ) { + sieve_runtime_trace(renv, 0, "deleted %d occurences of header `%s'", + ret, str_c(field_name)); } + } return SIEVE_EXEC_OK; diff -r bc2126771d00 -r 0163c45094a3 tests/extensions/editheader/deleteheader.svtest --- a/tests/extensions/editheader/deleteheader.svtest Sun Apr 07 05:12:57 2013 +0200 +++ b/tests/extensions/editheader/deleteheader.svtest Thu May 02 21:37:36 2013 +0200 @@ -962,3 +962,29 @@ test_fail "x-b header not deleted"; } } + +/* + * TEST: Interaction with body test + */ + +test_set "message" text: +From: stephan at example.org +To: nico at frop.example.com +Subject: Hoppa + +Text +. +; + +test "Interaction with body test" { + addheader "X-Frop" "frop"; + + if body "!TEST!" {} + + deleteheader "subject"; + + if exists "subject" { + test_fail "subject header not deleted"; + } +} + From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Removed UNSTABLE notice from configure. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/26c30ba221d0 changeset: 1764:26c30ba221d0 user: Stephan Bosch date: Thu May 09 12:22:39 2013 +0200 description: Removed UNSTABLE notice from configure. diffstat: configure.ac | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diffs (10 lines): diff -r 39848c052666 -r 26c30ba221d0 configure.ac --- a/configure.ac Thu May 09 12:21:31 2013 +0200 +++ b/configure.ac Thu May 09 12:22:39 2013 +0200 @@ -137,6 +137,3 @@ stamp.h]) AC_OUTPUT - -echo -echo "NOTE: This is the UNSTABLE development branch of Pigeonhole for Dovecot v2.2." From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Released v0.3.5 for Dovecot v2.1.16. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/374ec9399958 changeset: 1767:374ec9399958 user: Stephan Bosch date: Thu May 09 15:18:05 2013 +0200 description: Released v0.3.5 for Dovecot v2.1.16. diffstat: NEWS | 7 +++++++ configure.in | 2 +- 2 files changed, 8 insertions(+), 1 deletions(-) diffs (23 lines): diff -r 9d76d51685e1 -r 374ec9399958 NEWS --- a/NEWS Thu May 09 15:11:13 2013 +0200 +++ b/NEWS Thu May 09 15:18:05 2013 +0200 @@ -1,3 +1,10 @@ +v0.3.5 09-05-2013 Stephan Bosch + + - Sieve editheader extension: fixed interaction with the Sieve body extension. + If used together, the deleteheader action could fail after a body test was + performed. + - Test suite: fixed a time zone dependency in the Sieve date extension tests. + v0.3.4 06-04-2013 Stephan Bosch * Changed error handling to be less of a nuisance for administrators. Strictly diff -r 9d76d51685e1 -r 374ec9399958 configure.in --- a/configure.in Thu May 09 15:11:13 2013 +0200 +++ b/configure.in Thu May 09 15:18:05 2013 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Pigeonhole], [0.3.4], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) +AC_INIT([Pigeonhole], [0.3.5], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR([src]) AC_CONFIG_MACRO_DIR([m4]) From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Added tag 0.3.5 for changeset 374ec9399958 Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/59c48b78f3aa changeset: 1768:59c48b78f3aa user: Stephan Bosch date: Thu May 09 15:18:13 2013 +0200 description: Added tag 0.3.5 for changeset 374ec9399958 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 374ec9399958 -r 59c48b78f3aa .hgtags --- a/.hgtags Thu May 09 15:18:05 2013 +0200 +++ b/.hgtags Thu May 09 15:18:13 2013 +0200 @@ -14,3 +14,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 4932026768454443d87d2e6445552b331589dbb1 0.3.4 +374ec93999588b1acc554f81f61c93bf9fad7037 0.3.5 From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: testsuite: fixed local timezone dependen... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/bc2126771d00 changeset: 1761:bc2126771d00 user: Stephan Bosch date: Sun Apr 07 05:12:57 2013 +0200 description: testsuite: fixed local timezone dependency in date extension tests. diffstat: tests/extensions/date/basic.svtest | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diffs (48 lines): diff -r e3700924ac8c -r bc2126771d00 tests/extensions/date/basic.svtest --- a/tests/extensions/date/basic.svtest Sat Apr 06 22:37:46 2013 +0200 +++ b/tests/extensions/date/basic.svtest Sun Apr 07 05:12:57 2013 +0200 @@ -41,34 +41,33 @@ } test "Comparison" { - if not date :is "delivery-date" "date" "2009-07-22" { - if date :matches "delivery-date" "date" "*" { set "date" "${1}"; } + if not date :originalzone :is "delivery-date" "date" "2009-07-22" { + if date :originalzone :matches "delivery-date" "date" "*" { set "date" "${1}"; } test_fail "date is invalid: ${date}"; } - - if not date :value "ge" "delivery-date" "date" "2009-07-22" { + if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-22" { test_fail "date comparison ge failed equal"; } - if not date :value "ge" "delivery-date" "date" "2009-07-21" { + if not date :originalzone :value "ge" "delivery-date" "date" "2009-07-21" { test_fail "date comparison ge failed greater"; } - if anyof (not date :value "ge" "delivery-date" "date" "2009-06-22", - not date :value "ge" "date" "date" "2006-07-22" ) { + if anyof (not date :originalzone :value "ge" "delivery-date" "date" "2009-06-22", + not date :originalzone :value "ge" "date" "date" "2006-07-22" ) { test_fail "date comparison ge failed much greater"; } - if not date :value "le" "delivery-date" "date" "2009-07-22" { + if not date :originalzone :value "le" "delivery-date" "date" "2009-07-22" { test_fail "date comparison le failed equal"; } - if not date :value "le" "delivery-date" "date" "2009-07-23" { + if not date :originalzone :value "le" "delivery-date" "date" "2009-07-23" { test_fail "date comparison le failed less"; } - if anyof (not date :value "le" "delivery-date" "date" "2009-09-22", - not date :value "le" "date" "date" "2012-07-22" ) { + if anyof (not date :originalzone :value "le" "delivery-date" "date" "2009-09-22", + not date :originalzone :value "le" "date" "date" "2012-07-22" ) { test_fail "date comparison ge failed much less"; } } From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Released v0.4.0 for Dovecot v2.2.1. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/3a8dc1250e9b changeset: 1770:3a8dc1250e9b user: Stephan Bosch date: Thu May 09 15:39:17 2013 +0200 description: Released v0.4.0 for Dovecot v2.2.1. diffstat: .hgsigs | 1 + .hgtags | 1 + INSTALL | 2 +- Makefile.am | 2 +- NEWS | 9 ++++++++- m4/dovecot.m4 | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) diffs (72 lines): diff -r 01ac5c3f5b07 -r 3a8dc1250e9b .hgsigs --- a/.hgsigs Thu May 09 15:19:32 2013 +0200 +++ b/.hgsigs Thu May 09 15:39:17 2013 +0200 @@ -8,3 +8,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0 iQEcBAABAgAGBQJQWIMhAAoJEATWKx49+7T0g/IH/3qqQemBP62Y+Wzo67DruphrJ5HSlIX4Uw/O4rOjrk8dWSMrsui5jFy4LXig+CR1dfY4RS0izTxsAiNhTACuavMfGHiYBKQW6UwIDlKECVBxbQyjB7v2C3FKPj9K9QReiYACSeB1RhQBnpbcvioif9H62VI5SKE6rjXyky6fDAxtbjhySb+nPDtV4HmV7ukcfDc3bxwcZkz9XXKoNmPWw8r34Z/RwxWbbWr8xUwW3+9LDB2Oz6PRyYP5S8EcNNYjk3ai2Llh0xuJGLQbpulhmjYDJmk20TkpLCFAfsYq1qW3yed9lL88CcFH4LDb9WA0LNs+7PfbmY/m8CX7JwUmHB8= 64474c35967852bc452f71bc099ec3f8ded0369a 0 iQEcBAABAgAGBQJQWMvhAAoJEATWKx49+7T0NrYH/2PQuuFqzlku+NG8Iw0UN2yeDEML+2n1xG31ud7m3sNWw8lX+03gEd+LU8+LygHJJ0IAde/jBYRBbC8zj9UXDl3v5FIRwhcvGnllBCMMH7motfg+aLrCR/xs+0jV/AqpRin1VILHYFaB9UFP5PUgvJJiCUniQWoe+r41gra1hRA7OK3923YOOi9t4zJxoat7e0OMhc0IcdB7n3iQmyicbb8izKw/UvR2tR3T7fVcEl6u1LlbGaojtJA03V1L+a8QkmltiurD9VNmiHz++bGGJlA7LSmVYBq7BeC1lDnXUGO9ryZgln6aXRwUS0VaTI51F9gSMw+0UDJCwA5yBKqYyR8= 4932026768454443d87d2e6445552b331589dbb1 0 iQEcBAABAgAGBQJRYIePAAoJEATWKx49+7T0p2oH/ROhjt/m+wZmT9+2NxEDwnaOoQ8m9TxkZiZ50mmi/k4L7OQe/xffxM2T3NTTgRkaLCK2+MEz0pSLJXL+n/AjTBtiynwSxYY+W0wtYKBIs0tcQHaSafN2u5LjtQZ2RHg+Fi1szhJQu/jy31w12KGTqdyVw05JuEPgyfM7fKpqKh8CQZJucEyn9Vf8boGPQMFJ7N6o4wpOeW8RuVcBAEToHMpkDI1OQmB22cEQJfZrdOMPaucUOG6Abfw0FDwwV4bHa1nmxiPZXF8DpW31SVDoZgyvi08TSWFHS9t8Pij+XyWIdXhbCzqdpkvLGEsvMJjhiro9agf2tSj9jP+D4xiFRe8= +374ec93999588b1acc554f81f61c93bf9fad7037 0 iQEcBAABAgAGBQJRi6LgAAoJEATWKx49+7T0OPgH+gPOOYqdODGONhZTwxjKmvbVNzb428t/fS/pi2bSIeOXVzLone/P7NYstdM67eQsfxY4Kn8qN/eFkjdkozbc+3xx0VFvptFTd9NXGM57O84umgrvKXQDQM333TVMxMG5u6TPPkCmFcWmggcc1IdQxZ66dpgfETdh+IgJXdLQg4oc0IqHtqx19dVyYXRbtgY+GfA9ovFqOkzcWoXgSHRMmUf2gCGWPc3jSZPVHd3ObRvrwn3NcWULK4WCt5QPc6fU53eDrEvkSu6C5U0IV5G3jakrUK0PYtQ3jvxXGm8J3XQ+ea79Bp+mG/21Woz30Ey6AlFbuAHobGesGafjPLDLSNs= diff -r 01ac5c3f5b07 -r 3a8dc1250e9b .hgtags --- a/.hgtags Thu May 09 15:19:32 2013 +0200 +++ b/.hgtags Thu May 09 15:39:17 2013 +0200 @@ -14,3 +14,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 4932026768454443d87d2e6445552b331589dbb1 0.3.4 +374ec93999588b1acc554f81f61c93bf9fad7037 0.3.5 diff -r 01ac5c3f5b07 -r 3a8dc1250e9b INSTALL --- a/INSTALL Thu May 09 15:19:32 2013 +0200 +++ b/INSTALL Thu May 09 15:39:17 2013 +0200 @@ -646,7 +646,7 @@ test suite executes a list of test cases and halts when one of them fails. If it executes all test cases successfully, the test suite finishes. You can execute the basic test suite using `make test`, which does not include the plugins. You -can execute the full test suite using `make check`. +can test the plugins using `make test-plugins`. A failing test case is always a bug and a report is greatly appreciated. diff -r 01ac5c3f5b07 -r 3a8dc1250e9b Makefile.am --- a/Makefile.am Thu May 09 15:19:32 2013 +0200 +++ b/Makefile.am Thu May 09 15:39:17 2013 +0200 @@ -170,4 +170,4 @@ test: $(test_cases) test-plugins: $(extprograms_test_cases) -check: check-am test test-plugins all-am +check: check-am test all-am diff -r 01ac5c3f5b07 -r 3a8dc1250e9b NEWS --- a/NEWS Thu May 09 15:19:32 2013 +0200 +++ b/NEWS Thu May 09 15:39:17 2013 +0200 @@ -1,4 +1,4 @@ -v0.4.0 UNRELEASED Stephan Bosch +v0.4.0 09-05-2013 Stephan Bosch + Added doveadm-sieve plugin that provides the possibility to synch Sieve scripts using doveadm sync along with the user's mailboxes. @@ -18,6 +18,13 @@ possible. Environment items "location", "phase" and "domain" now also return a usable value. +v0.3.5 09-05-2013 Stephan Bosch + + - Sieve editheader extension: fixed interaction with the Sieve body extension. + If used together, the deleteheader action could fail after a body test was + performed. + - Test suite: fixed a time zone dependency in the Sieve date extension tests. + v0.3.4 06-04-2013 Stephan Bosch * Changed error handling to be less of a nuisance for administrators. Strictly diff -r 01ac5c3f5b07 -r 3a8dc1250e9b m4/dovecot.m4 --- a/m4/dovecot.m4 Thu May 09 15:19:32 2013 +0200 +++ b/m4/dovecot.m4 Thu May 09 15:39:17 2013 +0200 @@ -70,7 +70,7 @@ cd $dovecotdir abs_dovecotdir=`pwd` cd $old - DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs" + DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs --disable-shared" eval `grep -i '^dovecot_[[a-z_]]*=' "$dovecotdir"/dovecot-config` eval `grep '^LIBDOVECOT[[A-Z_]]*=' "$dovecotdir"/dovecot-config` From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Added signature for changeset 374ec9399958 Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/34cb3668f86d changeset: 1769:34cb3668f86d user: Stephan Bosch date: Thu May 09 15:21:43 2013 +0200 description: Added signature for changeset 374ec9399958 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 59c48b78f3aa -r 34cb3668f86d .hgsigs --- a/.hgsigs Thu May 09 15:18:13 2013 +0200 +++ b/.hgsigs Thu May 09 15:21:43 2013 +0200 @@ -8,3 +8,4 @@ 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0 iQEcBAABAgAGBQJQWIMhAAoJEATWKx49+7T0g/IH/3qqQemBP62Y+Wzo67DruphrJ5HSlIX4Uw/O4rOjrk8dWSMrsui5jFy4LXig+CR1dfY4RS0izTxsAiNhTACuavMfGHiYBKQW6UwIDlKECVBxbQyjB7v2C3FKPj9K9QReiYACSeB1RhQBnpbcvioif9H62VI5SKE6rjXyky6fDAxtbjhySb+nPDtV4HmV7ukcfDc3bxwcZkz9XXKoNmPWw8r34Z/RwxWbbWr8xUwW3+9LDB2Oz6PRyYP5S8EcNNYjk3ai2Llh0xuJGLQbpulhmjYDJmk20TkpLCFAfsYq1qW3yed9lL88CcFH4LDb9WA0LNs+7PfbmY/m8CX7JwUmHB8= 64474c35967852bc452f71bc099ec3f8ded0369a 0 iQEcBAABAgAGBQJQWMvhAAoJEATWKx49+7T0NrYH/2PQuuFqzlku+NG8Iw0UN2yeDEML+2n1xG31ud7m3sNWw8lX+03gEd+LU8+LygHJJ0IAde/jBYRBbC8zj9UXDl3v5FIRwhcvGnllBCMMH7motfg+aLrCR/xs+0jV/AqpRin1VILHYFaB9UFP5PUgvJJiCUniQWoe+r41gra1hRA7OK3923YOOi9t4zJxoat7e0OMhc0IcdB7n3iQmyicbb8izKw/UvR2tR3T7fVcEl6u1LlbGaojtJA03V1L+a8QkmltiurD9VNmiHz++bGGJlA7LSmVYBq7BeC1lDnXUGO9ryZgln6aXRwUS0VaTI51F9gSMw+0UDJCwA5yBKqYyR8= 4932026768454443d87d2e6445552b331589dbb1 0 iQEcBAABAgAGBQJRYIePAAoJEATWKx49+7T0p2oH/ROhjt/m+wZmT9+2NxEDwnaOoQ8m9TxkZiZ50mmi/k4L7OQe/xffxM2T3NTTgRkaLCK2+MEz0pSLJXL+n/AjTBtiynwSxYY+W0wtYKBIs0tcQHaSafN2u5LjtQZ2RHg+Fi1szhJQu/jy31w12KGTqdyVw05JuEPgyfM7fKpqKh8CQZJucEyn9Vf8boGPQMFJ7N6o4wpOeW8RuVcBAEToHMpkDI1OQmB22cEQJfZrdOMPaucUOG6Abfw0FDwwV4bHa1nmxiPZXF8DpW31SVDoZgyvi08TSWFHS9t8Pij+XyWIdXhbCzqdpkvLGEsvMJjhiro9agf2tSj9jP+D4xiFRe8= +374ec93999588b1acc554f81f61c93bf9fad7037 0 iQEcBAABAgAGBQJRi6LgAAoJEATWKx49+7T0OPgH+gPOOYqdODGONhZTwxjKmvbVNzb428t/fS/pi2bSIeOXVzLone/P7NYstdM67eQsfxY4Kn8qN/eFkjdkozbc+3xx0VFvptFTd9NXGM57O84umgrvKXQDQM333TVMxMG5u6TPPkCmFcWmggcc1IdQxZ66dpgfETdh+IgJXdLQg4oc0IqHtqx19dVyYXRbtgY+GfA9ovFqOkzcWoXgSHRMmUf2gCGWPc3jSZPVHd3ObRvrwn3NcWULK4WCt5QPc6fU53eDrEvkSu6C5U0IV5G3jakrUK0PYtQ3jvxXGm8J3XQ+ea79Bp+mG/21Woz30Ey6AlFbuAHobGesGafjPLDLSNs= From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Added tag 0.4.0 for changeset 3a8dc1250e9b Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/b41f5cf04b8f changeset: 1771:b41f5cf04b8f user: Stephan Bosch date: Thu May 09 15:40:25 2013 +0200 description: Added tag 0.4.0 for changeset 3a8dc1250e9b diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 3a8dc1250e9b -r b41f5cf04b8f .hgtags --- a/.hgtags Thu May 09 15:39:17 2013 +0200 +++ b/.hgtags Thu May 09 15:40:25 2013 +0200 @@ -15,3 +15,4 @@ 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 4932026768454443d87d2e6445552b331589dbb1 0.3.4 374ec93999588b1acc554f81f61c93bf9fad7037 0.3.5 +3a8dc1250e9b850044acbcd9d63d63597e67c7cb 0.4.0 From pigeonhole at rename-it.nl Thu May 9 16:40:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:40:31 +0200 Subject: dovecot-2.2-pigeonhole: Fixed problem in `make distcheck`. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/9d76d51685e1 changeset: 1766:9d76d51685e1 user: Stephan Bosch date: Thu May 09 15:11:13 2013 +0200 description: Fixed problem in `make distcheck`. Added --disable-shared to DISTCHECK_CONFIGURE_FLAGS (in dovecot.m4) to prevent libtool from relinking the libraries. diffstat: m4/dovecot.m4 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 0163c45094a3 -r 9d76d51685e1 m4/dovecot.m4 --- a/m4/dovecot.m4 Thu May 02 21:37:36 2013 +0200 +++ b/m4/dovecot.m4 Thu May 09 15:11:13 2013 +0200 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 5 +# serial 6 AC_DEFUN([DC_DOVECOT_MODULEDIR],[ AC_ARG_WITH(moduledir, @@ -70,7 +70,7 @@ cd $dovecotdir abs_dovecotdir=`pwd` cd $old - DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs" + DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs --disable-shared" eval `grep -i '^dovecot_[[a-z_]]*=' "$dovecotdir"/dovecot-config` eval `grep '^LIBDOVECOT[[A-Z_]]*=' "$dovecotdir"/dovecot-config` From pigeonhole at rename-it.nl Thu May 9 16:42:47 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 15:42:47 +0200 Subject: dovecot-2.2-pigeonhole: Added signature for changeset 3a8dc1250e9b Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1e0a6a4f4634 changeset: 1772:1e0a6a4f4634 user: Stephan Bosch date: Thu May 09 15:41:42 2013 +0200 description: Added signature for changeset 3a8dc1250e9b diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r b41f5cf04b8f -r 1e0a6a4f4634 .hgsigs --- a/.hgsigs Thu May 09 15:40:25 2013 +0200 +++ b/.hgsigs Thu May 09 15:41:42 2013 +0200 @@ -9,3 +9,4 @@ 64474c35967852bc452f71bc099ec3f8ded0369a 0 iQEcBAABAgAGBQJQWMvhAAoJEATWKx49+7T0NrYH/2PQuuFqzlku+NG8Iw0UN2yeDEML+2n1xG31ud7m3sNWw8lX+03gEd+LU8+LygHJJ0IAde/jBYRBbC8zj9UXDl3v5FIRwhcvGnllBCMMH7motfg+aLrCR/xs+0jV/AqpRin1VILHYFaB9UFP5PUgvJJiCUniQWoe+r41gra1hRA7OK3923YOOi9t4zJxoat7e0OMhc0IcdB7n3iQmyicbb8izKw/UvR2tR3T7fVcEl6u1LlbGaojtJA03V1L+a8QkmltiurD9VNmiHz++bGGJlA7LSmVYBq7BeC1lDnXUGO9ryZgln6aXRwUS0VaTI51F9gSMw+0UDJCwA5yBKqYyR8= 4932026768454443d87d2e6445552b331589dbb1 0 iQEcBAABAgAGBQJRYIePAAoJEATWKx49+7T0p2oH/ROhjt/m+wZmT9+2NxEDwnaOoQ8m9TxkZiZ50mmi/k4L7OQe/xffxM2T3NTTgRkaLCK2+MEz0pSLJXL+n/AjTBtiynwSxYY+W0wtYKBIs0tcQHaSafN2u5LjtQZ2RHg+Fi1szhJQu/jy31w12KGTqdyVw05JuEPgyfM7fKpqKh8CQZJucEyn9Vf8boGPQMFJ7N6o4wpOeW8RuVcBAEToHMpkDI1OQmB22cEQJfZrdOMPaucUOG6Abfw0FDwwV4bHa1nmxiPZXF8DpW31SVDoZgyvi08TSWFHS9t8Pij+XyWIdXhbCzqdpkvLGEsvMJjhiro9agf2tSj9jP+D4xiFRe8= 374ec93999588b1acc554f81f61c93bf9fad7037 0 iQEcBAABAgAGBQJRi6LgAAoJEATWKx49+7T0OPgH+gPOOYqdODGONhZTwxjKmvbVNzb428t/fS/pi2bSIeOXVzLone/P7NYstdM67eQsfxY4Kn8qN/eFkjdkozbc+3xx0VFvptFTd9NXGM57O84umgrvKXQDQM333TVMxMG5u6TPPkCmFcWmggcc1IdQxZ66dpgfETdh+IgJXdLQg4oc0IqHtqx19dVyYXRbtgY+GfA9ovFqOkzcWoXgSHRMmUf2gCGWPc3jSZPVHd3ObRvrwn3NcWULK4WCt5QPc6fU53eDrEvkSu6C5U0IV5G3jakrUK0PYtQ3jvxXGm8J3XQ+ea79Bp+mG/21Woz30Ey6AlFbuAHobGesGafjPLDLSNs= +3a8dc1250e9b850044acbcd9d63d63597e67c7cb 0 iQEcBAABAgAGBQJRi6eKAAoJEATWKx49+7T0+3sIAKj87rGC9kakJPL4RyFDc762HueCez8mUTRhe62K9+2LzVJL+2inGPY33PL5F7xZd0H/pxIfNfk/WGA78q6BkOaJSlGtz+wb5H/iZzSc+6GRfzPavlXlENgOKtnmzf3AoEKc0iNnieB5oYJTkJ2GtbPv2GD4u/Y6w7eTISfh/HlJeGvybR3L4XT6scNCr90/iQWjoZMNZSbYvKInSmrN9SGgtg0exqFfdkFmMahhSO/PGBq4hi5ZyFKqsnYEZpkLOduKW86nsn1GZiPD5/bEUD7lxJeeoRk3aobZoMQUlz4VRma6ag0MPRLpmzqUQFhpvDzpdg3dZSw/8NUQBa78w1M= From pigeonhole at rename-it.nl Thu May 9 17:39:47 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 09 May 2013 16:39:47 +0200 Subject: dovecot-2.2-pigeonhole: Forgot to update Dovecot version in READ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/a32b12ab5ea6 changeset: 1773:a32b12ab5ea6 user: Stephan Bosch date: Thu May 09 16:39:41 2013 +0200 description: Forgot to update Dovecot version in README and man pages. diffstat: README | 5 ++--- doc/man/pigeonhole.7.in | 4 ++-- doc/man/sieve-dump.1.in | 4 ++-- doc/man/sieve-filter.1.in | 4 ++-- doc/man/sieve-test.1.in | 4 ++-- doc/man/sievec.1.in | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diffs (74 lines): diff -r 1e0a6a4f4634 -r a32b12ab5ea6 README --- a/README Thu May 09 15:41:42 2013 +0200 +++ b/README Thu May 09 16:39:41 2013 +0200 @@ -1,4 +1,4 @@ -Pigeonhole for Dovecot v2.1 +Pigeonhole for Dovecot v2.2 Introduction ============ @@ -100,8 +100,7 @@ copy (RFC 3894): fully supported. body (RFC 5173): almost fully supported, but the text body-transform - implementation is simple and some issues make it still not completely - RFC compliant. + implementation is simple. environment (RFC 5183): fully supported (v0.4.0+). variables (RFC 5229): fully supported. vacation (RFC 5230): fully supported. diff -r 1e0a6a4f4634 -r a32b12ab5ea6 doc/man/pigeonhole.7.in --- a/doc/man/pigeonhole.7.in Thu May 09 15:41:42 2013 +0200 +++ b/doc/man/pigeonhole.7.in Thu May 09 16:39:41 2013 +0200 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file -.TH "PIGEONHOLE" 7 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2013 Pigeonhole authors, see the included COPYING file +.TH "PIGEONHOLE" 7 "2013-05-09" "Pigeonhole for Dovecot v2.2" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME pigeonhole \- Overview of the Pigeonhole project\(aqs Sieve support for the diff -r 1e0a6a4f4634 -r a32b12ab5ea6 doc/man/sieve-dump.1.in --- a/doc/man/sieve-dump.1.in Thu May 09 15:41:42 2013 +0200 +++ b/doc/man/sieve-dump.1.in Thu May 09 16:39:41 2013 +0200 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-DUMP" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2013 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-DUMP" 1 "2013-05-09" "Pigeonhole for Dovecot v2.2" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sieve\-dump \- Pigeonhole\(aqs Sieve script binary dump tool diff -r 1e0a6a4f4634 -r a32b12ab5ea6 doc/man/sieve-filter.1.in --- a/doc/man/sieve-filter.1.in Thu May 09 15:41:42 2013 +0200 +++ b/doc/man/sieve-filter.1.in Thu May 09 16:39:41 2013 +0200 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-FILTER" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2013 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-FILTER" 1 "2013-05-09" "Pigeonhole for Dovecot v2.2" "Pigeonhole" .SH NAME sieve\-filter \- Pigeonhole\(aqs Sieve mailbox filter tool diff -r 1e0a6a4f4634 -r a32b12ab5ea6 doc/man/sieve-test.1.in --- a/doc/man/sieve-test.1.in Thu May 09 15:41:42 2013 +0200 +++ b/doc/man/sieve-test.1.in Thu May 09 16:39:41 2013 +0200 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-TEST" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2013 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-TEST" 1 "2013-05-09" "Pigeonhole for Dovecot v2.2" "Pigeonhole" .SH NAME sieve\-test \- Pigeonhole\(aqs Sieve script tester .\"------------------------------------------------------------------------ diff -r 1e0a6a4f4634 -r a32b12ab5ea6 doc/man/sievec.1.in --- a/doc/man/sievec.1.in Thu May 09 15:41:42 2013 +0200 +++ b/doc/man/sievec.1.in Thu May 09 16:39:41 2013 +0200 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file -.TH "SIEVEC" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2013 Pigeonhole authors, see the included COPYING file +.TH "SIEVEC" 1 "2013-05-09" "Pigeonhole for Dovecot v2.2" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sievec \- Pigeonhole\(aqs Sieve script compiler From dovecot at dovecot.org Sun May 12 17:09:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 12 May 2013 17:09:17 +0300 Subject: dovecot-2.1: istream-seekable: If underlying stream gives an err... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4de62bda5244 changeset: 14964:4de62bda5244 user: Timo Sirainen date: Sun May 12 17:09:10 2013 +0300 description: istream-seekable: If underlying stream gives an error at EOF, don't hide it. diffstat: src/lib/istream-seekable.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (18 lines): diff -r 4e633c2f9738 -r 4de62bda5244 src/lib/istream-seekable.c --- a/src/lib/istream-seekable.c Thu May 09 12:32:38 2013 +0300 +++ b/src/lib/istream-seekable.c Sun May 12 17:09:10 2013 +0300 @@ -130,12 +130,12 @@ } while ((ret = i_stream_read(sstream->cur_input)) < 0) { - if (!sstream->cur_input->eof) { - /* full / error */ + if (sstream->cur_input->stream_errno != 0) { sstream->istream.istream.stream_errno = sstream->cur_input->stream_errno; return -1; } + i_assert(sstream->cur_input->eof); /* go to next stream */ sstream->cur_input = sstream->input[sstream->cur_idx++]; From pigeonhole at rename-it.nl Sun May 12 20:14:29 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 12 May 2013 19:14:29 +0200 Subject: dovecot-2.1-pigeonhole: Fixed setting name in example-config/con... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/7319f0becc98 changeset: 1691:7319f0becc98 user: Stephan Bosch date: Sun May 12 19:14:18 2013 +0200 description: Fixed setting name in example-config/conf.d/20-managesieve.conf. diffstat: doc/example-config/conf.d/20-managesieve.conf | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 34cb3668f86d -r 7319f0becc98 doc/example-config/conf.d/20-managesieve.conf --- a/doc/example-config/conf.d/20-managesieve.conf Thu May 09 15:21:43 2013 +0200 +++ b/doc/example-config/conf.d/20-managesieve.conf Sun May 12 19:14:18 2013 +0200 @@ -30,7 +30,7 @@ #service managesieve { # Max. number of ManageSieve processes (connections) - #process_count = 1024 + #process_limit = 1024 #} # Service configuration From dovecot at dovecot.org Tue May 14 13:52:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 13:52:36 +0300 Subject: dovecot-2.2: Fix out of source build of manpages Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8d7d2564dbc9 changeset: 16343:8d7d2564dbc9 user: Dennis Schridde date: Mon May 13 23:06:31 2013 +0200 description: Fix out of source build of manpages diffstat: doc/man/Makefile.am | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (9 lines): diff -r 62874b472dc6 -r 8d7d2564dbc9 doc/man/Makefile.am --- a/doc/man/Makefile.am Mon May 06 23:59:41 2013 +0300 +++ b/doc/man/Makefile.am Mon May 13 23:06:31 2013 +0200 @@ -85,4 +85,4 @@ .1.in.1: $(man_includefiles) Makefile $(SHELL) $(srcdir)/sed.sh $(srcdir) $(rundir) $(pkgsysconfdir) \ - < $(srcdir)/$< > $@ + < $< > $@ From dovecot at dovecot.org Tue May 14 14:00:31 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 14:00:31 +0300 Subject: dovecot-2.2: login-proxy: Don't crash if connect() succeeds but ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cda830ebf6ee changeset: 16344:cda830ebf6ee user: Timo Sirainen date: Tue May 14 14:00:21 2013 +0300 description: login-proxy: Don't crash if connect() succeeds but login fails with timeout. diffstat: src/login-common/login-proxy-state.h | 3 ++- src/login-common/login-proxy.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diffs (27 lines): diff -r 8d7d2564dbc9 -r cda830ebf6ee src/login-common/login-proxy-state.h --- a/src/login-common/login-proxy-state.h Mon May 13 23:06:31 2013 +0200 +++ b/src/login-common/login-proxy-state.h Tue May 14 14:00:21 2013 +0300 @@ -6,8 +6,9 @@ struct login_proxy_record { struct ip_addr ip; unsigned int port; + + /* these are tracking connect()s, not necessarily logins: */ unsigned int num_waiting_connections; - struct timeval last_failure; struct timeval last_success; }; diff -r 8d7d2564dbc9 -r cda830ebf6ee src/login-common/login-proxy.c --- a/src/login-common/login-proxy.c Mon May 13 23:06:31 2013 +0200 +++ b/src/login-common/login-proxy.c Tue May 14 14:00:21 2013 +0300 @@ -254,7 +254,8 @@ { errno = ETIMEDOUT; proxy_log_connect_error(proxy); - proxy_fail_connect(proxy); + if (!proxy->connected) + proxy_fail_connect(proxy); login_proxy_free(&proxy); } From dovecot at dovecot.org Tue May 14 14:02:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 14:02:43 +0300 Subject: dovecot-2.2: login-proxy: If login fails with timeout, log what ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8a0abbf545ce changeset: 16345:8a0abbf545ce user: Timo Sirainen date: Tue May 14 14:02:36 2013 +0300 description: login-proxy: If login fails with timeout, log what the proxying state was. diffstat: src/login-common/login-proxy.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (15 lines): diff -r cda830ebf6ee -r 8a0abbf545ce src/login-common/login-proxy.c --- a/src/login-common/login-proxy.c Tue May 14 14:00:21 2013 +0300 +++ b/src/login-common/login-proxy.c Tue May 14 14:02:36 2013 +0300 @@ -208,8 +208,9 @@ str_printfa(str, "connect(%s, %u) failed: %m", proxy->host, proxy->port); } else { - str_printfa(str, "Login for %s:%u timed out", - proxy->host, proxy->port); + str_printfa(str, "Login for %s:%u timed out in state=%u", + proxy->host, proxy->port, + proxy->client->proxy_state); } str_printfa(str, " (after %u secs", (unsigned int)(ioloop_time - proxy->created.tv_sec)); From dovecot at dovecot.org Tue May 14 14:14:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 14:14:27 +0300 Subject: dovecot-2.2: configure: Fixed checking for struct sockpeercred w... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/139ab37f69df changeset: 16346:139ab37f69df user: Timo Sirainen date: Tue May 14 14:14:16 2013 +0300 description: configure: Fixed checking for struct sockpeercred with OpenBSD <5.3 diffstat: configure.ac | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r 8a0abbf545ce -r 139ab37f69df configure.ac --- a/configure.ac Tue May 14 14:02:36 2013 +0300 +++ b/configure.ac Tue May 14 14:14:16 2013 +0300 @@ -433,7 +433,10 @@ walkcontext dirfd clearenv malloc_usable_size glob fallocate \ posix_fadvise getpeereid getpeerucred) -AC_CHECK_TYPES([struct sockpeercred],,,[#include ]) +AC_CHECK_TYPES([struct sockpeercred],,,[ +#include +#include +]) AC_SEARCH_LIBS(clock_gettime, rt, [ AC_DEFINE(HAVE_CLOCK_GETTIME,, Define if you have the clock_gettime function) From dovecot at dovecot.org Tue May 14 16:32:39 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 16:32:39 +0300 Subject: dovecot-2.2: pop3: Added pop3_deleted_flag setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5984de096e3e changeset: 16347:5984de096e3e user: Timo Sirainen date: Tue May 14 16:32:30 2013 +0300 description: pop3: Added pop3_deleted_flag setting. diffstat: doc/example-config/conf.d/20-pop3.conf | 7 ++++ src/pop3/pop3-client.c | 49 +++++++++++++++++++++++++++++++-- src/pop3/pop3-client.h | 6 ++++ src/pop3/pop3-commands.c | 17 +++++++++-- src/pop3/pop3-settings.c | 4 ++- src/pop3/pop3-settings.h | 1 + 6 files changed, 76 insertions(+), 8 deletions(-) diffs (224 lines): diff -r 139ab37f69df -r 5984de096e3e doc/example-config/conf.d/20-pop3.conf --- a/doc/example-config/conf.d/20-pop3.conf Tue May 14 14:14:16 2013 +0300 +++ b/doc/example-config/conf.d/20-pop3.conf Tue May 14 16:32:30 2013 +0300 @@ -59,6 +59,13 @@ # rename: Append a temporary -2, -3, etc. counter after the UIDL. #pop3_uidl_duplicates = allow + # This option changes POP3 behavior so that it's not possible to actually + # delete mails via POP3, only hide them from future POP3 sessions. The mails + # will still be counted towards user's quota until actually deleted via IMAP. + # Use e.g. "$POP3Deleted" as the value (it will be visible as IMAP keyword). + # Make sure you can legally archive mails before enabling this setting. + #pop3_deleted_flag = + # POP3 logout format string: # %i - total number of bytes read from client # %o - total number of bytes sent to client diff -r 139ab37f69df -r 5984de096e3e src/pop3/pop3-client.c --- a/src/pop3/pop3-client.c Tue May 14 14:14:16 2013 +0300 +++ b/src/pop3/pop3-client.c Tue May 14 16:32:30 2013 +0300 @@ -141,6 +141,7 @@ struct mailbox_status status; struct mailbox_transaction_context *t; struct mail_search_args *search_args; + struct mail_search_arg *sarg; struct mail_search_context *ctx; struct mail *mail; uoff_t size; @@ -158,7 +159,17 @@ t = mailbox_transaction_begin(client->mailbox, 0); search_args = mail_search_build_init(); - mail_search_build_add_all(search_args); + if (client->deleted_kw != NULL) { + sarg = mail_search_build_add(search_args, SEARCH_KEYWORDS); + sarg->match_not = TRUE; + sarg->value.str = p_strdup(search_args->pool, + client->set->pop3_deleted_flag); + i_array_init(&client->all_seqs, 32); + } else { + mail_search_build_add_all(search_args); + } + mail_search_args_init(search_args, client->mailbox, TRUE, NULL); + ctx = mailbox_search_init(t, search_args, pop3_sort_program, client->set->pop3_fast_size_lookups ? 0 : MAIL_FETCH_VIRTUAL_SIZE, NULL); @@ -175,6 +186,8 @@ *failed_uid_r = mail->uid; break; } + if (array_is_created(&client->all_seqs)) + seq_range_array_add(&client->all_seqs, mail->seq); msgnum_to_seq_map_add(&msgnum_to_seq_map, client, mail, msgnum); if ((mail_get_flags(mail) & MAIL_SEEN) != 0) @@ -197,7 +210,13 @@ array_free(&msgnum_to_seq_map); return ret; } - i_assert(msgnum == client->messages_count); + i_assert(msgnum <= client->messages_count); + client->messages_count = msgnum; + + if (!array_is_created(&client->all_seqs)) { + i_array_init(&client->all_seqs, 1); + seq_range_array_add_range(&client->all_seqs, 1, msgnum); + } client->trans = t; client->message_sizes = @@ -211,6 +230,26 @@ return 1; } +static int init_pop3_deleted_flag(struct client *client, const char **error_r) +{ + const char *deleted_keywords[2]; + + if (client->set->pop3_deleted_flag[0] == '\0') + return 0; + + deleted_keywords[0] = client->set->pop3_deleted_flag; + deleted_keywords[1] = NULL; + if (mailbox_keywords_create(client->mailbox, deleted_keywords, + &client->deleted_kw) < 0) { + *error_r = t_strdup_printf( + "pop3_deleted_flags: Invalid keyword '%s': %s", + client->set->pop3_deleted_flag, + mailbox_get_last_error(client->mailbox, NULL)); + return -1; + } + return 0; +} + static int init_mailbox(struct client *client, const char **error_r) { uint32_t failed_uid = 0, last_failed_uid = 0; @@ -392,7 +431,8 @@ } client->mail_set = mail_storage_get_settings(storage); - if (init_mailbox(client, &errmsg) < 0) { + if (init_pop3_deleted_flag(client, &errmsg) < 0 || + init_mailbox(client, &errmsg) < 0) { i_error("Couldn't init INBOX: %s", errmsg); client_destroy(client, "Mailbox init failed"); return -1; @@ -553,6 +593,9 @@ message sizes. */ (void)mailbox_transaction_commit(&client->trans); } + array_free(&client->all_seqs); + if (client->deleted_kw != NULL) + mailbox_keywords_unref(&client->deleted_kw); if (client->mailbox != NULL) mailbox_free(&client->mailbox); if (client->anvil_sent) { diff -r 139ab37f69df -r 5984de096e3e src/pop3/pop3-client.h --- a/src/pop3/pop3-client.h Tue May 14 14:14:16 2013 +0300 +++ b/src/pop3/pop3-client.h Tue May 14 16:32:30 2013 +0300 @@ -1,6 +1,8 @@ #ifndef POP3_CLIENT_H #define POP3_CLIENT_H +#include "seq-range-array.h" + struct client; struct mail_storage; @@ -48,6 +50,7 @@ struct mail_namespace *inbox_ns; struct mailbox *mailbox; struct mailbox_transaction_context *trans; + struct mail_keywords *deleted_kw; struct timeout *to_session_dotlock_refresh; struct dotlock *session_dotlock; @@ -63,6 +66,9 @@ uoff_t deleted_size; uint32_t last_seen_pop3_msn, lowest_retr_pop3_msn; + /* All sequences currently visible in the mailbox. */ + ARRAY_TYPE(seq_range) all_seqs; + /* [msgnum] contains mail seq. anything after it has seq = msgnum+1 */ uint32_t *msgnum_to_seq_map; uint32_t msgnum_to_seq_map_count; diff -r 139ab37f69df -r 5984de096e3e src/pop3/pop3-commands.c --- a/src/pop3/pop3-commands.c Tue May 14 14:14:16 2013 +0300 +++ b/src/pop3/pop3-commands.c Tue May 14 16:32:30 2013 +0300 @@ -196,11 +196,12 @@ pop3_search_build(struct client *client, uint32_t seq) { struct mail_search_args *search_args; + struct mail_search_arg *sarg; search_args = mail_search_build_init(); if (seq == 0) { - mail_search_build_add_seqset(search_args, - 1, client->messages_count); + sarg = mail_search_build_add(search_args, SEARCH_SEQSET); + sarg->value.seqset = client->all_seqs; } else { mail_search_build_add_seqset(search_args, seq, seq); } @@ -222,6 +223,15 @@ return 0; } +static void client_expunge(struct client *client, struct mail *mail) +{ + if (client->deleted_kw != NULL) + mail_update_keywords(mail, MODIFY_ADD, client->deleted_kw); + else + mail_expunge(mail); + client->expunged_count++; +} + bool client_update_mails(struct client *client) { struct mail_search_args *search_args; @@ -250,8 +260,7 @@ bit = 1 << (msgnum % CHAR_BIT); if (client->deleted_bitmask != NULL && (client->deleted_bitmask[msgnum / CHAR_BIT] & bit) != 0) { - mail_expunge(mail); - client->expunged_count++; + client_expunge(client, mail); } else if (client->seen_bitmask != NULL && (client->seen_bitmask[msgnum / CHAR_BIT] & bit) != 0) { mail_update_flags(mail, MODIFY_ADD, MAIL_SEEN); diff -r 139ab37f69df -r 5984de096e3e src/pop3/pop3-settings.c --- a/src/pop3/pop3-settings.c Tue May 14 14:14:16 2013 +0300 +++ b/src/pop3/pop3-settings.c Tue May 14 16:32:30 2013 +0300 @@ -71,6 +71,7 @@ DEF(SET_STR, pop3_client_workarounds), DEF(SET_STR, pop3_logout_format), DEF(SET_ENUM, pop3_uidl_duplicates), + DEF(SET_STR, pop3_deleted_flag), SETTING_DEFINE_LIST_END }; @@ -86,7 +87,8 @@ .pop3_fast_size_lookups = FALSE, .pop3_client_workarounds = "", .pop3_logout_format = "top=%t/%p, retr=%r/%b, del=%d/%m, size=%s", - .pop3_uidl_duplicates = "allow:rename" + .pop3_uidl_duplicates = "allow:rename", + .pop3_deleted_flag = "" }; static const struct setting_parser_info *pop3_setting_dependencies[] = { diff -r 139ab37f69df -r 5984de096e3e src/pop3/pop3-settings.h --- a/src/pop3/pop3-settings.h Tue May 14 14:14:16 2013 +0300 +++ b/src/pop3/pop3-settings.h Tue May 14 16:32:30 2013 +0300 @@ -23,6 +23,7 @@ const char *pop3_client_workarounds; const char *pop3_logout_format; const char *pop3_uidl_duplicates; + const char *pop3_deleted_flag; enum pop3_client_workarounds parsed_workarounds; }; From dovecot at dovecot.org Tue May 14 16:46:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 16:46:15 +0300 Subject: dovecot-2.2: example-config: Moved imap_* and pop3_* settings ou... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0e3c924ff5b4 changeset: 16348:0e3c924ff5b4 user: Timo Sirainen date: Tue May 14 16:46:08 2013 +0300 description: example-config: Moved imap_* and pop3_* settings outside protocol section. There's no need to keep them inside protocol {}, and in case of pop3_uidl_format=%m setting it's actually harmful. diffstat: doc/example-config/conf.d/20-imap.conf | 102 +++++++++--------- doc/example-config/conf.d/20-pop3.conf | 176 ++++++++++++++++---------------- 2 files changed, 139 insertions(+), 139 deletions(-) diffs (truncated from 304 to 300 lines): diff -r 5984de096e3e -r 0e3c924ff5b4 doc/example-config/conf.d/20-imap.conf --- a/doc/example-config/conf.d/20-imap.conf Tue May 14 16:32:30 2013 +0300 +++ b/doc/example-config/conf.d/20-imap.conf Tue May 14 16:46:08 2013 +0300 @@ -2,60 +2,60 @@ ## IMAP specific settings ## +# Maximum IMAP command line length. Some clients generate very long command +# lines with huge mailboxes, so you may need to raise this if you get +# "Too long argument" or "IMAP command line too large" errors often. +#imap_max_line_length = 64k + +# IMAP logout format string: +# %i - total number of bytes read from client +# %o - total number of bytes sent to client +#imap_logout_format = in=%i out=%o + +# Override the IMAP CAPABILITY response. If the value begins with '+', +# add the given capabilities on top of the defaults (e.g. +XFOO XBAR). +#imap_capability = + +# How long to wait between "OK Still here" notifications when client is +# IDLEing. +#imap_idle_notify_interval = 2 mins + +# ID field names and values to send to clients. Using * as the value makes +# Dovecot use the default value. The following fields have default values +# currently: name, version, os, os-version, support-url, support-email. +#imap_id_send = + +# ID fields sent by client to log. * means everything. +#imap_id_log = + +# Workarounds for various client bugs: +# delay-newmail: +# Send EXISTS/RECENT new mail notifications only when replying to NOOP +# and CHECK commands. Some clients ignore them otherwise, for example OSX +# Mail (= 2.1.4) : %v.%u +# Dovecot v0.99.x : %v.%u +# tpop3d : %Mf +# +# Note that Outlook 2003 seems to have problems with %v.%u format which was +# Dovecot's default, so if you're building a new server it would be a good +# idea to change this. %08Xu%08Xv should be pretty fail-safe. +# +#pop3_uidl_format = %08Xu%08Xv + +# Permanently save UIDLs sent to POP3 clients, so pop3_uidl_format changes +# won't change those UIDLs. Currently this works only with Maildir. +#pop3_save_uidl = no + +# What to do about duplicate UIDLs if they exist? +# allow: Show duplicates to clients. +# rename: Append a temporary -2, -3, etc. counter after the UIDL. +#pop3_uidl_duplicates = allow + +# This option changes POP3 behavior so that it's not possible to actually +# delete mails via POP3, only hide them from future POP3 sessions. The mails +# will still be counted towards user's quota until actually deleted via IMAP. +# Use e.g. "$POP3Deleted" as the value (it will be visible as IMAP keyword). +# Make sure you can legally archive mails before enabling this setting. +#pop3_deleted_flag = + +# POP3 logout format string: +# %i - total number of bytes read from client +# %o - total number of bytes sent to client +# %t - number of TOP commands +# %p - number of bytes sent to client as a result of TOP command +# %r - number of RETR commands +# %b - number of bytes sent to client as a result of RETR command +# %d - number of deleted messages +# %m - number of messages (before deletion) +# %s - mailbox size in bytes (before deletion) +# %u - old/new UIDL hash. may help finding out if UIDLs changed unexpectedly +#pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s + +# Workarounds for various client bugs: +# outlook-no-nuls: +# Outlook and Outlook Express hang if mails contain NUL characters. +# This setting replaces them with 0x80 character. +# oe-ns-eoh: +# Outlook Express and Netscape Mail breaks if end of headers-line is +# missing. This option simply sends it if it's missing. +# The list is space-separated. +#pop3_client_workarounds = + protocol pop3 { - # Don't try to set mails non-recent or seen with POP3 sessions. This is - # mostly intended to reduce disk I/O. With maildir it doesn't move files - # from new/ to cur/, with mbox it doesn't write Status-header. - #pop3_no_flag_updates = no - - # Support LAST command which exists in old POP3 specs, but has been removed - # from new ones. Some clients still wish to use this though. Enabling this - # makes RSET command clear all \Seen flags from messages. - #pop3_enable_last = no - - # If mail has X-UIDL header, use it as the mail's UIDL. - #pop3_reuse_xuidl = no - - # Allow only one POP3 session to run simultaneously for the same user. - #pop3_lock_session = no - - # POP3 requires message sizes to be listed as if they had CR+LF linefeeds. - # Many POP3 servers violate this by returning the sizes with LF linefeeds, - # because it's faster to get. When this setting is enabled, Dovecot still - # tries to do the right thing first, but if that requires opening the - # message, it fallbacks to the easier (but incorrect) size. - #pop3_fast_size_lookups = no - - # POP3 UIDL (unique mail identifier) format to use. You can use following - # variables, along with the variable modifiers described in - # doc/wiki/Variables.txt (e.g. %Uf for the filename in uppercase) - # - # %v - Mailbox's IMAP UIDVALIDITY - # %u - Mail's IMAP UID - # %m - MD5 sum of the mailbox headers in hex (mbox only) - # %f - filename (maildir only) - # %g - Mail's GUID - # - # If you want UIDL compatibility with other POP3 servers, use: - # UW's ipop3d : %08Xv%08Xu - # Courier : %f or %v-%u (both might be used simultaneosly) - # Cyrus (<= 2.1.3) : %u - # Cyrus (>= 2.1.4) : %v.%u - # Dovecot v0.99.x : %v.%u - # tpop3d : %Mf - # - # Note that Outlook 2003 seems to have problems with %v.%u format which was - # Dovecot's default, so if you're building a new server it would be a good - # idea to change this. %08Xu%08Xv should be pretty fail-safe. - # - #pop3_uidl_format = %08Xu%08Xv - - # Permanently save UIDLs sent to POP3 clients, so pop3_uidl_format changes - # won't change those UIDLs. Currently this works only with Maildir. - #pop3_save_uidl = no - - # What to do about duplicate UIDLs if they exist? - # allow: Show duplicates to clients. - # rename: Append a temporary -2, -3, etc. counter after the UIDL. - #pop3_uidl_duplicates = allow - - # This option changes POP3 behavior so that it's not possible to actually - # delete mails via POP3, only hide them from future POP3 sessions. The mails - # will still be counted towards user's quota until actually deleted via IMAP. - # Use e.g. "$POP3Deleted" as the value (it will be visible as IMAP keyword). - # Make sure you can legally archive mails before enabling this setting. - #pop3_deleted_flag = - - # POP3 logout format string: - # %i - total number of bytes read from client - # %o - total number of bytes sent to client - # %t - number of TOP commands - # %p - number of bytes sent to client as a result of TOP command - # %r - number of RETR commands - # %b - number of bytes sent to client as a result of RETR command - # %d - number of deleted messages - # %m - number of messages (before deletion) - # %s - mailbox size in bytes (before deletion) - # %u - old/new UIDL hash. may help finding out if UIDLs changed unexpectedly - #pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s + # Space separated list of plugins to load (default is global mail_plugins). + #mail_plugins = $mail_plugins # Maximum number of POP3 connections allowed for a user from each IP address. # NOTE: The username is compared case-sensitively. #mail_max_userip_connections = 10 - - # Space separated list of plugins to load (default is global mail_plugins). - #mail_plugins = $mail_plugins - - # Workarounds for various client bugs: - # outlook-no-nuls: - # Outlook and Outlook Express hang if mails contain NUL characters. - # This setting replaces them with 0x80 character. - # oe-ns-eoh: - # Outlook Express and Netscape Mail breaks if end of headers-line is From dovecot at dovecot.org Tue May 14 22:23:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 22:23:40 +0300 Subject: dovecot-2.2: Avoid strict aliasing warnings. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bf98dc25e3e4 changeset: 16349:bf98dc25e3e4 user: Timo Sirainen date: Tue May 14 22:23:27 2013 +0300 description: Avoid strict aliasing warnings. diffstat: src/lib/hash.h | 27 +++++++++++++++++++++------ src/plugins/fts-lucene/lucene-wrapper.cc | 5 ++--- 2 files changed, 23 insertions(+), 9 deletions(-) diffs (68 lines): diff -r 0e3c924ff5b4 -r bf98dc25e3e4 src/lib/hash.h --- a/src/lib/hash.h Tue May 14 16:46:08 2013 +0300 +++ b/src/lib/hash.h Tue May 14 22:23:27 2013 +0300 @@ -82,13 +82,20 @@ bool hash_table_lookup_full(const struct hash_table *table, const void *lookup_key, void **orig_key_r, void **value_r); -#define hash_table_lookup_full(table, lookup_key, orig_key_r, value_r) \ +#ifndef __cplusplus +# define hash_table_lookup_full(table, lookup_key, orig_key_r, value_r) \ hash_table_lookup_full((table)._table, \ (void *)((const char *)(lookup_key) + COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, lookup_key)), \ - (void **)(void *)((orig_key_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._keyp, orig_key_r) + \ + (void *)((orig_key_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._keyp, orig_key_r) + \ COMPILE_ERROR_IF_TRUE(sizeof(*orig_key_r) != sizeof(void *))), \ - (void **)(void *)((value_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._valuep, value_r) + \ + (void *)((value_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._valuep, value_r) + \ COMPILE_ERROR_IF_TRUE(sizeof(*value_r) != sizeof(void *)))) +#else +/* C++ requires (void **) casting, but that's not possible with strict + aliasing, so .. we'll just disable the type checks */ +# define hash_table_lookup_full(table, lookup_key, orig_key_r, value_r) \ + hash_table_lookup_full((table)._table, lookup_key, orig_key_r, value_r) +#endif /* Insert/update node in hash table. The difference is that hash_table_insert() replaces the key in table to given one, while hash_table_update() doesnt. */ @@ -119,12 +126,20 @@ hash_table_iterate_init((table)._table) bool hash_table_iterate(struct hash_iterate_context *ctx, void **key_r, void **value_r); -#define hash_table_iterate(ctx, table, key_r, value_r) \ +#ifndef __cplusplus +# define hash_table_iterate(ctx, table, key_r, value_r) \ hash_table_iterate(ctx, \ - (void **)(void *)((key_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._keyp, key_r) + \ + (void *)((key_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._keyp, key_r) + \ COMPILE_ERROR_IF_TRUE(sizeof(*key_r) != sizeof(void *)) + \ COMPILE_ERROR_IF_TRUE(sizeof(*value_r) != sizeof(void *))), \ - (void **)(void *)((value_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._valuep, value_r))) + (void *)((value_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._valuep, value_r))) +#else +/* C++ requires (void **) casting, but that's not possible with strict + aliasing, so .. we'll just disable the type checks */ +# define hash_table_iterate(ctx, table, key_r, value_r) \ + hash_table_iterate(ctx, key_r, value_r) +#endif + void hash_table_iterate_deinit(struct hash_iterate_context **ctx); /* Hash table isn't resized, and removed nodes aren't removed from diff -r 0e3c924ff5b4 -r bf98dc25e3e4 src/plugins/fts-lucene/lucene-wrapper.cc --- a/src/plugins/fts-lucene/lucene-wrapper.cc Tue May 14 16:46:08 2013 +0300 +++ b/src/plugins/fts-lucene/lucene-wrapper.cc Tue May 14 22:23:27 2013 +0300 @@ -1322,11 +1322,10 @@ BooleanQuery mailbox_query; struct hash_iterate_context *iter; - wchar_t *key; - struct fts_result *value; + void *key, *value; iter = hash_table_iterate_init(guids); while (hash_table_iterate(iter, guids, &key, &value)) { - Term *term = _CLNEW Term(_T("box"), key); + Term *term = _CLNEW Term(_T("box"), (wchar_t *)key); TermQuery *q = _CLNEW TermQuery(term); mailbox_query.add(q, true, BooleanClause::SHOULD); } From dovecot at dovecot.org Tue May 14 23:34:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 14 May 2013 23:34:54 +0300 Subject: dovecot-2.2: auth passwd-file: If we fail to open passwd-file, l... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/df20af39dc51 changeset: 16350:df20af39dc51 user: Timo Sirainen date: Tue May 14 23:34:38 2013 +0300 description: auth passwd-file: If we fail to open passwd-file, log a request error directly. Instead of one error message and another info message. diffstat: src/auth/db-passwd-file.c | 57 ++++++++++++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 25 deletions(-) diffs (133 lines): diff -r bf98dc25e3e4 -r df20af39dc51 src/auth/db-passwd-file.c --- a/src/auth/db-passwd-file.c Tue May 14 22:23:27 2013 +0300 +++ b/src/auth/db-passwd-file.c Tue May 14 23:34:38 2013 +0300 @@ -164,7 +164,8 @@ return pw; } -static bool passwd_file_open(struct passwd_file *pw, bool startup) +static int passwd_file_open(struct passwd_file *pw, bool startup, + const char **error_r) { const char *no_args = NULL; struct istream *input; @@ -176,20 +177,20 @@ fd = open(pw->path, O_RDONLY); if (fd == -1) { - if (errno == EACCES) { - i_error("passwd-file %s: %s", pw->path, - eacces_error_get("open", pw->path)); - } else { - i_error("passwd-file %s: Can't open file: %m", - pw->path); + if (errno == EACCES) + *error_r = eacces_error_get("open", pw->path); + else { + *error_r = t_strdup_printf("open(%s) failed: %m", + pw->path); } - return FALSE; + return -1; } if (fstat(fd, &st) != 0) { - i_error("passwd-file %s: fstat() failed: %m", pw->path); + *error_r = t_strdup_printf("fstat(%s) failed: %m", + pw->path); i_close_fd(&fd); - return FALSE; + return -1; } pw->fd = fd; @@ -229,7 +230,7 @@ i_debug("passwd-file %s: Read %u users in %u secs", pw->path, hash_table_count(pw->users), time_secs); } - return TRUE; + return 0; } static void passwd_file_close(struct passwd_file *pw) @@ -256,30 +257,37 @@ i_free(pw); } -static bool passwd_file_sync(struct passwd_file *pw) +static int passwd_file_sync(struct auth_request *request, + struct passwd_file *pw) { struct stat st; + const char *error; if (stat(pw->path, &st) < 0) { /* with variables don't give hard errors, or errors about nonexistent files */ if (errno == EACCES) { - i_error("passwd-file %s: %s", pw->path, - eacces_error_get("stat", pw->path)); - } else if (errno != ENOENT) { - i_error("passwd-file %s: stat() failed: %m", pw->path); + auth_request_log_error(request, "passwd-file", + "%s", eacces_error_get("stat", pw->path)); + } else { + auth_request_log_error(request, "passwd-file", + "stat(%s) failed: %m", pw->path); } if (pw->db->default_file != pw) passwd_file_free(pw); - return FALSE; + return -1; } if (st.st_mtime != pw->stamp || st.st_size != pw->size) { passwd_file_close(pw); - return passwd_file_open(pw, FALSE); + if (passwd_file_open(pw, FALSE, &error) < 0) { + auth_request_log_error(request, "passwd-file", + "%s", error); + return -1; + } } - return TRUE; + return 0; } static struct db_passwd_file *db_passwd_file_find(const char *path) @@ -359,9 +367,12 @@ void db_passwd_file_parse(struct db_passwd_file *db) { + const char *error; + if (db->default_file != NULL && db->default_file->stamp == 0) { /* no variables, open the file immediately */ - (void)passwd_file_open(db->default_file, TRUE); + if (passwd_file_open(db->default_file, TRUE, &error) < 0) + i_error("passwd-file: %s", error); } } @@ -421,7 +432,6 @@ struct passwd_user *pu; const struct var_expand_table *table; string_t *username, *dest; - const char *path; if (!db->vars) pw = db->default_file; @@ -437,11 +447,8 @@ } } - path = t_strdup(pw->path); - if (!passwd_file_sync(pw)) { + if (passwd_file_sync(request, pw) < 0) { /* pw may be freed now */ - auth_request_log_info(request, "passwd-file", - "no passwd file: %s", path); return NULL; } From dovecot at dovecot.org Wed May 15 12:48:31 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 12:48:31 +0300 Subject: dovecot-2.2: example-config: auth-*.conf.ext should say they're ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/93bcbf5cabca changeset: 16351:93bcbf5cabca user: Timo Sirainen date: Wed May 15 12:48:21 2013 +0300 description: example-config: auth-*.conf.ext should say they're included by 10-auth.conf diffstat: doc/example-config/conf.d/auth-checkpassword.conf.ext | 2 +- doc/example-config/conf.d/auth-deny.conf.ext | 2 +- doc/example-config/conf.d/auth-dict.conf.ext | 2 +- doc/example-config/conf.d/auth-ldap.conf.ext | 2 +- doc/example-config/conf.d/auth-master.conf.ext | 2 +- doc/example-config/conf.d/auth-passwdfile.conf.ext | 2 +- doc/example-config/conf.d/auth-sql.conf.ext | 2 +- doc/example-config/conf.d/auth-static.conf.ext | 2 +- doc/example-config/conf.d/auth-system.conf.ext | 2 +- doc/example-config/conf.d/auth-vpopmail.conf.ext | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diffs (90 lines): diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-checkpassword.conf.ext --- a/doc/example-config/conf.d/auth-checkpassword.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-checkpassword.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for checkpassword users. Included from auth.conf. +# Authentication for checkpassword users. Included from 10-auth.conf. # # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-deny.conf.ext --- a/doc/example-config/conf.d/auth-deny.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-deny.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Deny access for users. Included from auth.conf. +# Deny access for users. Included from 10-auth.conf. # Users can be (temporarily) disabled by adding a passdb with deny=yes. # If the user is found from that database, authentication will fail. diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-dict.conf.ext --- a/doc/example-config/conf.d/auth-dict.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-dict.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication via dict backend. Included from auth.conf. +# Authentication via dict backend. Included from 10-auth.conf. # # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-ldap.conf.ext --- a/doc/example-config/conf.d/auth-ldap.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-ldap.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for LDAP users. Included from auth.conf. +# Authentication for LDAP users. Included from 10-auth.conf. # # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-master.conf.ext --- a/doc/example-config/conf.d/auth-master.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-master.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for master users. Included from auth.conf. +# Authentication for master users. Included from 10-auth.conf. # By adding master=yes setting inside a passdb you make the passdb a list # of "master users", who can log in as anyone else. diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-passwdfile.conf.ext --- a/doc/example-config/conf.d/auth-passwdfile.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-passwdfile.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for passwd-file users. Included from auth.conf. +# Authentication for passwd-file users. Included from 10-auth.conf. # # passwd-like file with specified location. # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-sql.conf.ext --- a/doc/example-config/conf.d/auth-sql.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-sql.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for SQL users. Included from auth.conf. +# Authentication for SQL users. Included from 10-auth.conf. # # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-static.conf.ext --- a/doc/example-config/conf.d/auth-static.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-static.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Static passdb. Included from auth.conf. +# Static passdb. Included from 10-auth.conf. # This can be used for situations where Dovecot doesn't need to verify the # username or the password, or if there is a single password for all users: diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-system.conf.ext --- a/doc/example-config/conf.d/auth-system.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-system.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for system users. Included from auth.conf. +# Authentication for system users. Included from 10-auth.conf. # # # diff -r df20af39dc51 -r 93bcbf5cabca doc/example-config/conf.d/auth-vpopmail.conf.ext --- a/doc/example-config/conf.d/auth-vpopmail.conf.ext Tue May 14 23:34:38 2013 +0300 +++ b/doc/example-config/conf.d/auth-vpopmail.conf.ext Wed May 15 12:48:21 2013 +0300 @@ -1,4 +1,4 @@ -# Authentication for vpopmail users. Included from auth.conf. +# Authentication for vpopmail users. Included from 10-auth.conf. # # From dovecot at dovecot.org Wed May 15 12:50:08 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 12:50:08 +0300 Subject: dovecot-2.2: example-config: Removed dovecot-db.conf.ext since B... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/77b95c6d4a16 changeset: 16352:77b95c6d4a16 user: Timo Sirainen date: Wed May 15 12:50:03 2013 +0300 description: example-config: Removed dovecot-db.conf.ext since Berkeley DB support is never built in. diffstat: doc/example-config/dovecot-db.conf.ext | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-) diffs (15 lines): diff -r 93bcbf5cabca -r 77b95c6d4a16 doc/example-config/dovecot-db.conf.ext --- a/doc/example-config/dovecot-db.conf.ext Wed May 15 12:48:21 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -# Example DB_CONFIG for Berkeley DB. Typically dict_db_config setting is used -# to point to this file. -# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/db_config.html - -# Maximum number of simultaneous transactions. -set_tx_max 1000 - -# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/lock/max.html -#set_lk_max_locks 1000 -#set_lk_max_lockers 1000 -#set_lk_max_objects 1000 From dovecot at dovecot.org Wed May 15 12:50:34 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 12:50:34 +0300 Subject: dovecot-2.2: Makefile: Removed dovecot-db.conf.ext Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c60fd665e37c changeset: 16353:c60fd665e37c user: Timo Sirainen date: Wed May 15 12:50:29 2013 +0300 description: Makefile: Removed dovecot-db.conf.ext diffstat: doc/example-config/Makefile.am | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diffs (11 lines): diff -r 77b95c6d4a16 -r c60fd665e37c doc/example-config/Makefile.am --- a/doc/example-config/Makefile.am Wed May 15 12:50:03 2013 +0300 +++ b/doc/example-config/Makefile.am Wed May 15 12:50:29 2013 +0300 @@ -12,7 +12,6 @@ exampledir = $(docdir)/example-config example_DATA = \ dovecot.conf \ - dovecot-db.conf.ext \ dovecot-dict-auth.conf.ext \ dovecot-dict-sql.conf.ext \ dovecot-ldap.conf.ext \ From dovecot at dovecot.org Wed May 15 12:52:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 12:52:40 +0300 Subject: dovecot-2.2: example-config: Added comment how all *.conf.ext fi... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6b61d3578ef0 changeset: 16354:6b61d3578ef0 user: Timo Sirainen date: Wed May 15 12:52:29 2013 +0300 description: example-config: Added comment how all *.conf.ext files are accessed typically. diffstat: doc/example-config/dovecot-dict-auth.conf.ext | 2 ++ doc/example-config/dovecot-dict-sql.conf.ext | 2 ++ doc/example-config/dovecot-ldap.conf.ext | 3 +++ doc/example-config/dovecot-sql.conf.ext | 3 +++ 4 files changed, 10 insertions(+), 0 deletions(-) diffs (38 lines): diff -r c60fd665e37c -r 6b61d3578ef0 doc/example-config/dovecot-dict-auth.conf.ext --- a/doc/example-config/dovecot-dict-auth.conf.ext Wed May 15 12:50:29 2013 +0300 +++ b/doc/example-config/dovecot-dict-auth.conf.ext Wed May 15 12:52:29 2013 +0300 @@ -1,3 +1,5 @@ +# This file is commonly accessed via dict {} section in dovecot.conf + # Dictionary URI #uri = diff -r c60fd665e37c -r 6b61d3578ef0 doc/example-config/dovecot-dict-sql.conf.ext --- a/doc/example-config/dovecot-dict-sql.conf.ext Wed May 15 12:50:29 2013 +0300 +++ b/doc/example-config/dovecot-dict-sql.conf.ext Wed May 15 12:52:29 2013 +0300 @@ -1,3 +1,5 @@ +# This file is commonly accessed via dict {} section in dovecot.conf + #connect = host=localhost dbname=mails user=testuser password=pass # CREATE TABLE quota ( diff -r c60fd665e37c -r 6b61d3578ef0 doc/example-config/dovecot-ldap.conf.ext --- a/doc/example-config/dovecot-ldap.conf.ext Wed May 15 12:50:29 2013 +0300 +++ b/doc/example-config/dovecot-ldap.conf.ext Wed May 15 12:52:29 2013 +0300 @@ -1,3 +1,6 @@ +# This file is commonly accessed via passdb {} or userdb {} section in +# conf.d/auth-ldap.conf.ext + # This file is opened as root, so it should be owned by root and mode 0600. # # http://wiki2.dovecot.org/AuthDatabase/LDAP diff -r c60fd665e37c -r 6b61d3578ef0 doc/example-config/dovecot-sql.conf.ext --- a/doc/example-config/dovecot-sql.conf.ext Wed May 15 12:50:29 2013 +0300 +++ b/doc/example-config/dovecot-sql.conf.ext Wed May 15 12:52:29 2013 +0300 @@ -1,3 +1,6 @@ +# This file is commonly accessed via passdb {} or userdb {} section in +# conf.d/auth-sql.conf.ext + # This file is opened as root, so it should be owned by root and mode 0600. # # http://wiki2.dovecot.org/AuthDatabase/SQL From dovecot at dovecot.org Wed May 15 13:15:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:15:17 +0300 Subject: dovecot-2.1: liblib: Fix Unicode decomposition Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/04451ba65501 changeset: 14965:04451ba65501 user: Florian Zeitz date: Sat May 11 17:08:12 2013 +0200 description: liblib: Fix Unicode decomposition diffstat: src/lib/test-unichar.c | 13 ++++++++++++- src/lib/unichar.c | 2 +- src/lib/unicodemap.pl | 18 +++++++++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diffs (113 lines): diff -r 4de62bda5244 -r 04451ba65501 src/lib/test-unichar.c --- a/src/lib/test-unichar.c Sun May 12 17:09:10 2013 +0300 +++ b/src/lib/test-unichar.c Sat May 11 17:08:12 2013 +0200 @@ -2,11 +2,15 @@ #include "test-lib.h" #include "str.h" +#include "buffer.h" #include "unichar.h" void test_unichar(void) { - static const char *overlong_utf8 = "\xf8\x80\x95\x81\xa1"; + static const char overlong_utf8[] = "\xf8\x80\x95\x81\xa1"; + static const char collate_in[] = "\xc3\xbc \xc2\xb3"; + static const char collate_exp[] = "U\xcc\x88 3"; + buffer_t *collate_out; unichar_t chr, chr2; string_t *str = t_str_new(16); @@ -18,6 +22,13 @@ test_assert(uni_utf8_get_char(str_c(str), &chr2) > 0); test_assert(chr2 == chr); } + + collate_out = buffer_create_dynamic(default_pool, 32); + uni_utf8_to_decomposed_titlecase(collate_in, sizeof(collate_in), + collate_out); + test_assert(!strcmp(collate_out->data, collate_exp)); + buffer_free(&collate_out); + test_assert(!uni_utf8_str_is_valid(overlong_utf8)); test_assert(uni_utf8_get_char(overlong_utf8, &chr2) < 0); test_end(); diff -r 4de62bda5244 -r 04451ba65501 src/lib/unichar.c --- a/src/lib/unichar.c Sun May 12 17:09:10 2013 +0300 +++ b/src/lib/unichar.c Sat May 11 17:08:12 2013 +0200 @@ -287,7 +287,7 @@ static bool uni_ucs4_decompose_multi_utf8(unichar_t chr, buffer_t *output) { - const uint16_t *value; + const uint32_t *value; unsigned int idx; if (chr < multidecomp_keys[0] || chr > 0xffff) diff -r 4de62bda5244 -r 04451ba65501 src/lib/unicodemap.pl --- a/src/lib/unicodemap.pl Sun May 12 17:09:10 2013 +0300 +++ b/src/lib/unicodemap.pl Sat May 11 17:08:12 2013 +0200 @@ -30,14 +30,14 @@ push @titlecase32_keys, $code; push @titlecase32_values, $value; } - } elsif ($decomp =~ /\<[^>]*> (.+)/) { + } elsif ($decomp =~ /(?:\<[^>]*> )?(.+)/) { # decompositions my $decomp_codes = $1; if ($decomp_codes =~ /^([0-9A-Z]*)$/i) { # unicharacter decomposition. use separate lists for this my $value = eval("0x$1"); - if ($value > 0xffff) { - print STDERR "Error: We've assumed decomposition codes are max. 16bit\n"; + if ($value > 0xffffffff) { + print STDERR "Error: We've assumed decomposition codes are max. 32bit\n"; exit 1; } if ($code <= 0xff) { @@ -61,8 +61,8 @@ foreach my $dcode (split(" ", $decomp_codes)) { my $value = eval("0x$dcode"); - if ($value > 0xffff) { - print STDERR "Error: We've assumed decomposition codes are max. 16bit\n"; + if ($value > 0xffffffff) { + print STDERR "Error: We've assumed decomposition codes are max. 32bit\n"; exit 1; } push @multidecomp_values, $value; @@ -78,7 +78,7 @@ my $last = $#list; my $n = 0; foreach my $key (@list) { - printf("0x%04x", $key); + printf("0x%05x", $key); last if ($n == $last); print ","; @@ -137,7 +137,7 @@ print_list(\@uni16_decomp_keys); print "\n};\n"; -print "static const uint16_t uni16_decomp_values[] = {\n\t"; +print "static const uint32_t uni16_decomp_values[] = {\n\t"; print_list(\@uni16_decomp_values); print "\n};\n"; @@ -145,7 +145,7 @@ print_list(\@uni32_decomp_keys); print "\n};\n"; -print "static const uint16_t uni32_decomp_values[] = {\n\t"; +print "static const uint32_t uni32_decomp_values[] = {\n\t"; print_list(\@uni32_decomp_values); print "\n};\n"; @@ -157,6 +157,6 @@ print_list(\@multidecomp_offsets); print "\n};\n"; -print "static const uint16_t multidecomp_values[] = {\n\t"; +print "static const uint32_t multidecomp_values[] = {\n\t"; print_list(\@multidecomp_values); print "\n};\n"; From dovecot at dovecot.org Wed May 15 13:15:35 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:15:35 +0300 Subject: dovecot-2.2: liblib: Fix Unicode decomposition Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4c9420265987 changeset: 16355:4c9420265987 user: Florian Zeitz date: Sat May 11 17:08:12 2013 +0200 description: liblib: Fix Unicode decomposition diffstat: src/lib/test-unichar.c | 13 ++++++++++++- src/lib/unichar.c | 2 +- src/lib/unicodemap.pl | 18 +++++++++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diffs (113 lines): diff -r 6b61d3578ef0 -r 4c9420265987 src/lib/test-unichar.c --- a/src/lib/test-unichar.c Wed May 15 12:52:29 2013 +0300 +++ b/src/lib/test-unichar.c Sat May 11 17:08:12 2013 +0200 @@ -2,11 +2,15 @@ #include "test-lib.h" #include "str.h" +#include "buffer.h" #include "unichar.h" void test_unichar(void) { - static const char *overlong_utf8 = "\xf8\x80\x95\x81\xa1"; + static const char overlong_utf8[] = "\xf8\x80\x95\x81\xa1"; + static const char collate_in[] = "\xc3\xbc \xc2\xb3"; + static const char collate_exp[] = "U\xcc\x88 3"; + buffer_t *collate_out; unichar_t chr, chr2; string_t *str = t_str_new(16); @@ -18,6 +22,13 @@ test_assert(uni_utf8_get_char(str_c(str), &chr2) > 0); test_assert(chr2 == chr); } + + collate_out = buffer_create_dynamic(default_pool, 32); + uni_utf8_to_decomposed_titlecase(collate_in, sizeof(collate_in), + collate_out); + test_assert(!strcmp(collate_out->data, collate_exp)); + buffer_free(&collate_out); + test_assert(!uni_utf8_str_is_valid(overlong_utf8)); test_assert(uni_utf8_get_char(overlong_utf8, &chr2) < 0); test_end(); diff -r 6b61d3578ef0 -r 4c9420265987 src/lib/unichar.c --- a/src/lib/unichar.c Wed May 15 12:52:29 2013 +0300 +++ b/src/lib/unichar.c Sat May 11 17:08:12 2013 +0200 @@ -287,7 +287,7 @@ static bool uni_ucs4_decompose_multi_utf8(unichar_t chr, buffer_t *output) { - const uint16_t *value; + const uint32_t *value; unsigned int idx; if (chr < multidecomp_keys[0] || chr > 0xffff) diff -r 6b61d3578ef0 -r 4c9420265987 src/lib/unicodemap.pl --- a/src/lib/unicodemap.pl Wed May 15 12:52:29 2013 +0300 +++ b/src/lib/unicodemap.pl Sat May 11 17:08:12 2013 +0200 @@ -30,14 +30,14 @@ push @titlecase32_keys, $code; push @titlecase32_values, $value; } - } elsif ($decomp =~ /\<[^>]*> (.+)/) { + } elsif ($decomp =~ /(?:\<[^>]*> )?(.+)/) { # decompositions my $decomp_codes = $1; if ($decomp_codes =~ /^([0-9A-Z]*)$/i) { # unicharacter decomposition. use separate lists for this my $value = eval("0x$1"); - if ($value > 0xffff) { - print STDERR "Error: We've assumed decomposition codes are max. 16bit\n"; + if ($value > 0xffffffff) { + print STDERR "Error: We've assumed decomposition codes are max. 32bit\n"; exit 1; } if ($code <= 0xff) { @@ -61,8 +61,8 @@ foreach my $dcode (split(" ", $decomp_codes)) { my $value = eval("0x$dcode"); - if ($value > 0xffff) { - print STDERR "Error: We've assumed decomposition codes are max. 16bit\n"; + if ($value > 0xffffffff) { + print STDERR "Error: We've assumed decomposition codes are max. 32bit\n"; exit 1; } push @multidecomp_values, $value; @@ -78,7 +78,7 @@ my $last = $#list; my $n = 0; foreach my $key (@list) { - printf("0x%04x", $key); + printf("0x%05x", $key); last if ($n == $last); print ","; @@ -137,7 +137,7 @@ print_list(\@uni16_decomp_keys); print "\n};\n"; -print "static const uint16_t uni16_decomp_values[] = {\n\t"; +print "static const uint32_t uni16_decomp_values[] = {\n\t"; print_list(\@uni16_decomp_values); print "\n};\n"; @@ -145,7 +145,7 @@ print_list(\@uni32_decomp_keys); print "\n};\n"; -print "static const uint16_t uni32_decomp_values[] = {\n\t"; +print "static const uint32_t uni32_decomp_values[] = {\n\t"; print_list(\@uni32_decomp_values); print "\n};\n"; @@ -157,6 +157,6 @@ print_list(\@multidecomp_offsets); print "\n};\n"; -print "static const uint16_t multidecomp_values[] = {\n\t"; +print "static const uint32_t multidecomp_values[] = {\n\t"; print_list(\@multidecomp_values); print "\n};\n"; From dovecot at dovecot.org Wed May 15 13:25:09 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:25:09 +0300 Subject: dovecot-2.2: lib-storage: Added mail_always_cache_fields setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9275238a88bb changeset: 16356:9275238a88bb user: Timo Sirainen date: Wed May 15 13:20:43 2013 +0300 description: lib-storage: Added mail_always_cache_fields setting. diffstat: src/lib-storage/index/index-storage.c | 4 ++++ src/lib-storage/mail-storage-settings.c | 2 ++ src/lib-storage/mail-storage-settings.h | 1 + 3 files changed, 7 insertions(+), 0 deletions(-) diffs (44 lines): diff -r 4c9420265987 -r 9275238a88bb src/lib-storage/index/index-storage.c --- a/src/lib-storage/index/index-storage.c Sat May 11 17:08:12 2013 +0200 +++ b/src/lib-storage/index/index-storage.c Wed May 15 13:20:43 2013 +0300 @@ -65,6 +65,10 @@ set_cache_decisions("mail_cache_fields", set->mail_cache_fields, MAIL_CACHE_DECISION_TEMP); + set_cache_decisions("mail_always_cache_fields", + set->mail_always_cache_fields, + MAIL_CACHE_DECISION_YES | + MAIL_CACHE_DECISION_FORCED); set_cache_decisions("mail_never_cache_fields", set->mail_never_cache_fields, MAIL_CACHE_DECISION_NO | diff -r 4c9420265987 -r 9275238a88bb src/lib-storage/mail-storage-settings.c --- a/src/lib-storage/mail-storage-settings.c Sat May 11 17:08:12 2013 +0200 +++ b/src/lib-storage/mail-storage-settings.c Wed May 15 13:20:43 2013 +0300 @@ -33,6 +33,7 @@ DEF(SET_STR_VARS, mail_attribute_dict), DEF(SET_UINT, mail_prefetch_count), DEF(SET_STR, mail_cache_fields), + DEF(SET_STR, mail_always_cache_fields), DEF(SET_STR, mail_never_cache_fields), DEF(SET_UINT, mail_cache_min_mail_count), DEF(SET_TIME, mailbox_idle_check_interval), @@ -69,6 +70,7 @@ .mail_attribute_dict = "", .mail_prefetch_count = 0, .mail_cache_fields = "flags", + .mail_always_cache_fields = "", .mail_never_cache_fields = "imap.envelope", .mail_cache_min_mail_count = 0, .mailbox_idle_check_interval = 30, diff -r 4c9420265987 -r 9275238a88bb src/lib-storage/mail-storage-settings.h --- a/src/lib-storage/mail-storage-settings.h Sat May 11 17:08:12 2013 +0200 +++ b/src/lib-storage/mail-storage-settings.h Wed May 15 13:20:43 2013 +0300 @@ -18,6 +18,7 @@ const char *mail_attribute_dict; unsigned int mail_prefetch_count; const char *mail_cache_fields; + const char *mail_always_cache_fields; const char *mail_never_cache_fields; unsigned int mail_cache_min_mail_count; unsigned int mailbox_idle_check_interval; From dovecot at dovecot.org Wed May 15 13:44:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:44:11 +0300 Subject: dovecot-2.2: lib-index: Fixed mail_cache_register_fields() decis... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f8b99f6d993c changeset: 16357:f8b99f6d993c user: Timo Sirainen date: Wed May 15 13:34:59 2013 +0300 description: lib-index: Fixed mail_cache_register_fields() decision updates. Normally this shouldn't matter, except when mail_*cache_fields settings have been used. diffstat: src/lib-index/mail-cache-fields.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 9275238a88bb -r f8b99f6d993c src/lib-index/mail-cache-fields.c --- a/src/lib-index/mail-cache-fields.c Wed May 15 13:20:43 2013 +0300 +++ b/src/lib-index/mail-cache-fields.c Wed May 15 13:34:59 2013 +0300 @@ -74,8 +74,8 @@ i_assert(newfield->type < MAIL_CACHE_FIELD_COUNT); orig = &cache->fields[newfield->idx]; - if (newfield->decision != MAIL_CACHE_DECISION_NO && - orig->field.decision != newfield->decision) { + if ((newfield->decision & MAIL_CACHE_DECISION_FORCED) != 0 || + newfield->decision > orig->field.decision) { orig->field.decision = newfield->decision; orig->decision_dirty = TRUE; } From dovecot at dovecot.org Wed May 15 13:44:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:44:11 +0300 Subject: dovecot-2.2: lib-index: Don't mark field decisions dirty when re... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ac0170b8db14 changeset: 16358:ac0170b8db14 user: Timo Sirainen date: Wed May 15 13:36:43 2013 +0300 description: lib-index: Don't mark field decisions dirty when registering initial cache fields. diffstat: src/lib-index/mail-cache-fields.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diffs (33 lines): diff -r f8b99f6d993c -r ac0170b8db14 src/lib-index/mail-cache-fields.c --- a/src/lib-index/mail-cache-fields.c Wed May 15 13:34:59 2013 +0300 +++ b/src/lib-index/mail-cache-fields.c Wed May 15 13:36:43 2013 +0300 @@ -70,18 +70,26 @@ const struct mail_cache_field *newfield) { struct mail_cache_field_private *orig; + bool initial_registering; i_assert(newfield->type < MAIL_CACHE_FIELD_COUNT); + /* are we still doing the initial cache field registering for + internal fields and for mail_*cache_fields settings? */ + initial_registering = cache->file_fields_count == 0; + orig = &cache->fields[newfield->idx]; if ((newfield->decision & MAIL_CACHE_DECISION_FORCED) != 0 || - newfield->decision > orig->field.decision) { + ((orig->field.decision & MAIL_CACHE_DECISION_FORCED) == 0 && + newfield->decision > orig->field.decision)) { orig->field.decision = newfield->decision; - orig->decision_dirty = TRUE; + if (!initial_registering) + orig->decision_dirty = TRUE; } if (orig->field.last_used < newfield->last_used) { orig->field.last_used = newfield->last_used; - orig->decision_dirty = TRUE; + if (!initial_registering) + orig->decision_dirty = TRUE; } if (orig->decision_dirty) cache->field_header_write_pending = TRUE; From dovecot at dovecot.org Wed May 15 13:44:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 13:44:11 +0300 Subject: dovecot-2.2: lib-storage: Allow mail_*cache_fields settings to s... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/07bc030f18d3 changeset: 16359:07bc030f18d3 user: Timo Sirainen date: Wed May 15 13:44:01 2013 +0300 description: lib-storage: Allow mail_*cache_fields settings to specify any hdr.* fields. Also the fields were previously set only once globally, so if the process served multiple users, it wouldn't have been possible to use per-user values for these fields. diffstat: src/lib-storage/index/index-storage.c | 60 ++++++++++++++++++---------------- 1 files changed, 31 insertions(+), 29 deletions(-) diffs (93 lines): diff -r ac0170b8db14 -r 07bc030f18d3 src/lib-storage/index/index-storage.c --- a/src/lib-storage/index/index-storage.c Wed May 15 13:36:43 2013 +0300 +++ b/src/lib-storage/index/index-storage.c Wed May 15 13:44:01 2013 +0300 @@ -28,27 +28,35 @@ struct index_storage_module index_storage_module = MODULE_CONTEXT_INIT(&mail_storage_module_register); -static void set_cache_decisions(const char *set, const char *fields, +static void set_cache_decisions(struct mail_cache *cache, + const char *set, const char *fields, enum mail_cache_decision_type dec) { + struct mail_cache_field field; const char *const *arr; - int i; + unsigned int idx; if (fields == NULL || *fields == '\0') return; for (arr = t_strsplit_spaces(fields, " ,"); *arr != NULL; arr++) { - for (i = 0; i < MAIL_INDEX_CACHE_FIELD_COUNT; i++) { - if (strcasecmp(global_cache_fields[i].name, - *arr) == 0) { - global_cache_fields[i].decision = dec; - break; - } + const char *name = *arr; + + idx = mail_cache_register_lookup(cache, name); + if (idx != UINT_MAX) { + field = *mail_cache_register_get_field(cache, idx); + } else if (strncasecmp(name, "hdr.", 4) == 0) { + memset(&field, 0, sizeof(field)); + field.name = name; + field.type = MAIL_CACHE_FIELD_HEADER; + } else { + i_error("%s: Unknown cache field name '%s', ignoring", + set, *arr); + continue; } - if (i == MAIL_INDEX_CACHE_FIELD_COUNT) { - i_error("%s: Invalid cache field name '%s', ignoring ", - set, *arr); - } + + field.decision = dec; + mail_cache_register_fields(cache, &field, 1); } } @@ -56,30 +64,24 @@ { struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box); const struct mail_storage_settings *set = box->storage->set; - static bool initialized = FALSE; struct mail_cache *cache = box->cache; - if (!initialized) { - initialized = TRUE; - - set_cache_decisions("mail_cache_fields", - set->mail_cache_fields, - MAIL_CACHE_DECISION_TEMP); - set_cache_decisions("mail_always_cache_fields", - set->mail_always_cache_fields, - MAIL_CACHE_DECISION_YES | - MAIL_CACHE_DECISION_FORCED); - set_cache_decisions("mail_never_cache_fields", - set->mail_never_cache_fields, - MAIL_CACHE_DECISION_NO | - MAIL_CACHE_DECISION_FORCED); - } - ibox->cache_fields = i_malloc(sizeof(global_cache_fields)); memcpy(ibox->cache_fields, global_cache_fields, sizeof(global_cache_fields)); mail_cache_register_fields(cache, ibox->cache_fields, MAIL_INDEX_CACHE_FIELD_COUNT); + set_cache_decisions(cache, "mail_cache_fields", + set->mail_cache_fields, + MAIL_CACHE_DECISION_TEMP); + set_cache_decisions(cache, "mail_always_cache_fields", + set->mail_always_cache_fields, + MAIL_CACHE_DECISION_YES | + MAIL_CACHE_DECISION_FORCED); + set_cache_decisions(cache, "mail_never_cache_fields", + set->mail_never_cache_fields, + MAIL_CACHE_DECISION_NO | + MAIL_CACHE_DECISION_FORCED); } void index_storage_lock_notify(struct mailbox *box, From dovecot at dovecot.org Wed May 15 14:28:14 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 14:28:14 +0300 Subject: dovecot-2.2: quota-status: If quota_status_* settings are set, d... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/03aac782261e changeset: 16360:03aac782261e user: Timo Sirainen date: Wed May 15 14:28:04 2013 +0300 description: quota-status: If quota_status_* settings are set, don't free them before using. diffstat: src/plugins/quota/quota-status.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 07bc030f18d3 -r 03aac782261e src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Wed May 15 13:44:01 2013 +0300 +++ b/src/plugins/quota/quota-status.c Wed May 15 14:28:04 2013 +0300 @@ -109,6 +109,7 @@ if (value == NULL) value = t_strdup_printf("554 5.2.2 %s\n\n", error); } + value = t_strdup(value); /* user's pool is being freed */ mail_user_unref(&user); mail_storage_service_user_free(&service_user); } From dovecot at dovecot.org Wed May 15 14:28:24 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 14:28:24 +0300 Subject: dovecot-2.1: quota-status: If quota_status_* settings are set, d... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/30c257f2504a changeset: 14966:30c257f2504a user: Timo Sirainen date: Wed May 15 14:28:04 2013 +0300 description: quota-status: If quota_status_* settings are set, don't free them before using. diffstat: src/plugins/quota/quota-status.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 04451ba65501 -r 30c257f2504a src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Sat May 11 17:08:12 2013 +0200 +++ b/src/plugins/quota/quota-status.c Wed May 15 14:28:04 2013 +0300 @@ -113,6 +113,7 @@ if (value == NULL) value = t_strdup_printf("554 5.2.2 %s\n\n", error); } + value = t_strdup(value); /* user's pool is being freed */ mail_user_unref(&user); mail_storage_service_user_free(&service_user); } From dovecot at dovecot.org Wed May 15 15:06:59 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 15:06:59 +0300 Subject: dovecot-2.2: Added asserts to binary searches to make sure we do... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/38ca85ccd5af changeset: 16361:38ca85ccd5af user: Timo Sirainen date: Wed May 15 15:06:24 2013 +0300 description: Added asserts to binary searches to make sure we don't go to infinite loop. Using idx=left+(right-left)/2 would have worked also to allow 4GB sizes, but since none of the places in the code are likely to reach 2GB we might as well just add an assert. (Also if they do reach 2GB, it could be possible that they could reach also above 4GB and cause problems. Better to see an early error.) diffstat: src/lib-index/mail-index-map.c | 1 + src/lib-index/mail-index-transaction-update.c | 1 + src/lib-storage/index/index-sort-string.c | 1 + src/lib/bsearch-insert-pos.c | 2 ++ src/lib/bsearch-insert-pos.h | 1 + src/lib/seq-range-array.c | 2 ++ 6 files changed, 8 insertions(+), 0 deletions(-) diffs (75 lines): diff -r 03aac782261e -r 38ca85ccd5af src/lib-index/mail-index-map.c --- a/src/lib-index/mail-index-map.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib-index/mail-index-map.c Wed May 15 15:06:24 2013 +0300 @@ -514,6 +514,7 @@ idx = left_idx; right_idx = I_MIN(map->hdr.messages_count, uid); + i_assert(right_idx < INT_MAX); while (left_idx < right_idx) { idx = (left_idx + right_idx) / 2; diff -r 03aac782261e -r 38ca85ccd5af src/lib-index/mail-index-transaction-update.c --- a/src/lib-index/mail-index-transaction-update.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib-index/mail-index-transaction-update.c Wed May 15 15:06:24 2013 +0300 @@ -402,6 +402,7 @@ updates = array_get(&t->updates, &count); i_assert(left_idx <= right_idx && right_idx <= count); + i_assert(count < INT_MAX); /* find the first update with either overlapping range, or the update which will come after our insert */ diff -r 03aac782261e -r 38ca85ccd5af src/lib-storage/index/index-sort-string.c --- a/src/lib-storage/index/index-sort-string.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib-storage/index/index-sort-string.c Wed May 15 15:06:24 2013 +0300 @@ -382,6 +382,7 @@ int ret; nodes = array_get_modifiable(&ctx->nonzero_nodes, &right_idx); + i_assert(right_idx < INT_MAX); idx = left_idx = start_idx; while (left_idx < right_idx) { idx = (left_idx + right_idx) / 2; diff -r 03aac782261e -r 38ca85ccd5af src/lib/bsearch-insert-pos.c --- a/src/lib/bsearch-insert-pos.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib/bsearch-insert-pos.c Wed May 15 15:06:24 2013 +0300 @@ -13,6 +13,8 @@ unsigned int idx, left_idx, right_idx; int ret; + i_assert(nmemb < INT_MAX); + idx = 0; left_idx = 0; right_idx = nmemb; while (left_idx < right_idx) { idx = (left_idx + right_idx) / 2; diff -r 03aac782261e -r 38ca85ccd5af src/lib/bsearch-insert-pos.h --- a/src/lib/bsearch-insert-pos.h Wed May 15 14:28:04 2013 +0300 +++ b/src/lib/bsearch-insert-pos.h Wed May 15 15:06:24 2013 +0300 @@ -5,6 +5,7 @@ #define BINARY_NUMBER_SEARCH(data, count, value, idx_r) \ unsigned int idx, left_idx, right_idx; \ \ + i_assert((count) < INT_MAX); \ idx = 0; left_idx = 0; right_idx = (count); \ while (left_idx < right_idx) { \ idx = (left_idx + right_idx) / 2; \ diff -r 03aac782261e -r 38ca85ccd5af src/lib/seq-range-array.c --- a/src/lib/seq-range-array.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib/seq-range-array.c Wed May 15 15:06:24 2013 +0300 @@ -12,6 +12,7 @@ unsigned int idx, left_idx, right_idx, count; data = array_get(array, &count); + i_assert(count < INT_MAX); idx = 0; left_idx = 0; right_idx = count; while (left_idx < right_idx) { @@ -198,6 +199,7 @@ /* somewhere in the middle, array is sorted so find it with binary search */ + i_assert(count < INT_MAX); left_idx = 0; right_idx = count; while (left_idx < right_idx) { idx = (left_idx + right_idx) / 2; From dovecot at dovecot.org Wed May 15 15:27:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 15:27:10 +0300 Subject: dovecot-2.1: maildir: Fixed handling over 26 keywords in a mailbox. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7389ff729d2e changeset: 14967:7389ff729d2e user: Timo Sirainen date: Wed May 15 15:26:47 2013 +0300 description: maildir: Fixed handling over 26 keywords in a mailbox. diffstat: src/lib-storage/index/maildir/maildir-sync-index.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (19 lines): diff -r 30c257f2504a -r 7389ff729d2e src/lib-storage/index/maildir/maildir-sync-index.c --- a/src/lib-storage/index/maildir/maildir-sync-index.c Wed May 15 14:28:04 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Wed May 15 15:26:47 2013 +0300 @@ -392,10 +392,11 @@ old_indexes = array_get(&ctx->idx_keywords, &old_count); have_indexonly_keywords = FALSE; for (i = old_count; i > 0; i--) { - if (old_indexes[i-1] < MAILDIR_MAX_KEYWORDS) - break; - have_indexonly_keywords = TRUE; - array_delete(&ctx->idx_keywords, i-1, 1); + if (maildir_keywords_idx_char(ctx->keywords_sync_ctx, + old_indexes[i-1]) == '\0') { + have_indexonly_keywords = TRUE; + array_delete(&ctx->idx_keywords, i-1, 1); + } } if (!have_indexonly_keywords) { From dovecot at dovecot.org Wed May 15 15:27:50 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 15:27:50 +0300 Subject: dovecot-2.2: maildir: Fixed handling over 26 keywords in a mailbox. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2c770b01d21f changeset: 16362:2c770b01d21f user: Timo Sirainen date: Wed May 15 15:26:47 2013 +0300 description: maildir: Fixed handling over 26 keywords in a mailbox. diffstat: src/lib-storage/index/maildir/maildir-sync-index.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (19 lines): diff -r 38ca85ccd5af -r 2c770b01d21f src/lib-storage/index/maildir/maildir-sync-index.c --- a/src/lib-storage/index/maildir/maildir-sync-index.c Wed May 15 15:06:24 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Wed May 15 15:26:47 2013 +0300 @@ -390,10 +390,11 @@ old_indexes = array_get(&ctx->idx_keywords, &old_count); have_indexonly_keywords = FALSE; for (i = old_count; i > 0; i--) { - if (old_indexes[i-1] < MAILDIR_MAX_KEYWORDS) - break; - have_indexonly_keywords = TRUE; - array_delete(&ctx->idx_keywords, i-1, 1); + if (maildir_keywords_idx_char(ctx->keywords_sync_ctx, + old_indexes[i-1]) == '\0') { + have_indexonly_keywords = TRUE; + array_delete(&ctx->idx_keywords, i-1, 1); + } } if (!have_indexonly_keywords) { From dovecot at dovecot.org Wed May 15 15:35:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 15:35:25 +0300 Subject: dovecot-2.2: imap: Return how long SELECT or EXAMINE command too... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/21ab416ea0cd changeset: 16363:21ab416ea0cd user: Timo Sirainen date: Wed May 15 15:35:10 2013 +0300 description: imap: Return how long SELECT or EXAMINE command took to answer. Could be useful to know sometimes if there's a large maildir where a lot files need to be rename()d. diffstat: src/imap/cmd-select.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diffs (55 lines): diff -r 2c770b01d21f -r 21ab416ea0cd src/imap/cmd-select.c --- a/src/imap/cmd-select.c Wed May 15 15:26:47 2013 +0300 +++ b/src/imap/cmd-select.c Wed May 15 15:35:10 2013 +0300 @@ -2,6 +2,7 @@ #include "imap-common.h" #include "seq-range-array.h" +#include "time-util.h" #include "imap-commands.h" #include "mail-search-build.h" #include "imap-search-args.h" @@ -16,6 +17,7 @@ struct mail_namespace *ns; struct mailbox *box; + struct timeval start_time; struct imap_fetch_context *fetch_ctx; uint32_t qresync_uid_validity; @@ -198,14 +200,24 @@ static void cmd_select_finish(struct imap_select_context *ctx, int ret) { + const char *resp_code; + struct timeval end_time; + int time_msecs; + if (ret < 0) { if (ctx->box != NULL) mailbox_free(&ctx->box); ctx->cmd->client->mailbox = NULL; } else { - client_send_tagline(ctx->cmd, mailbox_is_readonly(ctx->box) ? - "OK [READ-ONLY] Select completed." : - "OK [READ-WRITE] Select completed."); + resp_code = mailbox_is_readonly(ctx->box) ? + "READ-ONLY" : "READ-WRITE"; + if (gettimeofday(&end_time, NULL) < 0) + memset(&end_time, 0, sizeof(end_time)); + time_msecs = timeval_diff_msecs(&end_time, &ctx->start_time); + client_send_tagline(ctx->cmd, t_strdup_printf( + "OK [%s] %s completed (%d.%03d secs).", resp_code, + ctx->cmd->client->mailbox_examined ? "Examine" : "Select", + time_msecs/1000, time_msecs%1000)); } select_context_free(ctx); } @@ -398,6 +410,7 @@ ctx = p_new(cmd->pool, struct imap_select_context, 1); ctx->cmd = cmd; ctx->ns = client_find_namespace(cmd, &mailbox); + (void)gettimeofday(&ctx->start_time, NULL); if (ctx->ns == NULL) { close_selected_mailbox(client); return TRUE; From dovecot at dovecot.org Wed May 15 16:10:59 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 16:10:59 +0300 Subject: dovecot-2.2: lib-storage: Don't lose INBOX's \Subscribed flag wh... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0d4d5f7f93df changeset: 16364:0d4d5f7f93df user: Timo Sirainen date: Wed May 15 16:10:48 2013 +0300 description: lib-storage: Don't lose INBOX's \Subscribed flag when returning it is delayed. diffstat: src/lib-storage/list/mailbox-list-iter.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (18 lines): diff -r 21ab416ea0cd -r 0d4d5f7f93df src/lib-storage/list/mailbox-list-iter.c --- a/src/lib-storage/list/mailbox-list-iter.c Wed May 15 15:35:10 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-iter.c Wed May 15 16:10:48 2013 +0300 @@ -597,9 +597,12 @@ if (info != NULL) { if (strcasecmp(info->vname, "INBOX") == 0 && ctx->inbox_list) { /* delay sending INBOX reply. we already saved its - flags at init stage, except for \Noinferiors */ + flags at init stage, except for \Noinferiors + and subscription states */ ctx->inbox_info.flags |= - (info->flags & MAILBOX_NOINFERIORS); + (info->flags & (MAILBOX_NOINFERIORS | + MAILBOX_SUBSCRIBED | + MAILBOX_CHILD_SUBSCRIBED)); return FALSE; } if (strncasecmp(info->vname, "INBOX", 5) == 0 && From dovecot at dovecot.org Wed May 15 17:09:48 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 17:09:48 +0300 Subject: dovecot-2.2: layout=fs: Always return INBOX uppercased when list... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9fcdd9f80e30 changeset: 16365:9fcdd9f80e30 user: Timo Sirainen date: Wed May 15 17:09:36 2013 +0300 description: layout=fs: Always return INBOX uppercased when listing mailboxes. diffstat: src/lib-storage/list/mailbox-list-fs-iter.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 0d4d5f7f93df -r 9fcdd9f80e30 src/lib-storage/list/mailbox-list-fs-iter.c --- a/src/lib-storage/list/mailbox-list-fs-iter.c Wed May 15 16:10:48 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-fs-iter.c Wed May 15 17:09:36 2013 +0300 @@ -682,6 +682,7 @@ return 0; } inbox_flags_set(ctx, child_dir_match); + ctx->info.vname = "INBOX"; /* always return uppercased */ ctx->inbox_found = TRUE; } else if (strcmp(storage_name, "INBOX") == 0 && (ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) { From dovecot at dovecot.org Wed May 15 17:10:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 17:10:33 +0300 Subject: dovecot-2.2: mbox: If save's input stream fails, fail saving ins... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/02f2ed55d568 changeset: 16366:02f2ed55d568 user: Timo Sirainen date: Wed May 15 17:10:28 2013 +0300 description: mbox: If save's input stream fails, fail saving instead of ignoring the error. diffstat: src/lib-storage/index/mbox/mbox-save.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (15 lines): diff -r 9fcdd9f80e30 -r 02f2ed55d568 src/lib-storage/index/mbox/mbox-save.c --- a/src/lib-storage/index/mbox/mbox-save.c Wed May 15 17:09:36 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Wed May 15 17:10:28 2013 +0300 @@ -635,6 +635,11 @@ } if (ret == 0) return 0; + if (ctx->input->stream_errno != 0) { + i_error("read(%s) failed: %m", i_stream_get_name(ctx->input)); + ctx->failed = TRUE; + return -1; + } i_assert(ctx->last_char == '\n'); From dovecot at dovecot.org Wed May 15 17:18:34 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 15 May 2013 17:18:34 +0300 Subject: dovecot-2.2: mbox: Fixed committing transaction after a previous... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1d6f42853492 changeset: 16367:1d6f42853492 user: Timo Sirainen date: Wed May 15 17:18:29 2013 +0300 description: mbox: Fixed committing transaction after a previous save had failed. diffstat: src/lib-storage/index/mbox/mbox-save.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r 02f2ed55d568 -r 1d6f42853492 src/lib-storage/index/mbox/mbox-save.c --- a/src/lib-storage/index/mbox/mbox-save.c Wed May 15 17:10:28 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Wed May 15 17:18:29 2013 +0300 @@ -715,6 +715,13 @@ ctx->mail_offset = (uoff_t)-1; } + if (ctx->seq != 0) { + mail_index_expunge(ctx->trans, ctx->seq); + /* currently we can't just drop pending cache updates for this + one specific record, so we'll reset the whole cache + transaction. */ + mail_cache_transaction_reset(ctx->ctx.transaction->cache_trans); + } index_save_context_free(_ctx); return ctx->failed ? -1 : 0; } From pigeonhole at rename-it.nl Wed May 15 22:59:37 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 15 May 2013 21:59:37 +0200 Subject: dovecot-2.2-pigeonhole: lib-sieve: Fixed datastack problem in me... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/04ad3c2f0765 changeset: 1774:04ad3c2f0765 user: Stephan Bosch date: Wed May 15 21:59:32 2013 +0200 description: lib-sieve: Fixed datastack problem in message header composition. diffstat: src/lib-sieve/rfc2822.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diffs (46 lines): diff -r a32b12ab5ea6 -r 04ad3c2f0765 src/lib-sieve/rfc2822.c --- a/src/lib-sieve/rfc2822.c Thu May 09 16:39:41 2013 +0200 +++ b/src/lib-sieve/rfc2822.c Wed May 15 21:59:32 2013 +0200 @@ -211,32 +211,26 @@ void rfc2822_header_printf (string_t *header, const char *name, const char *fmt, ...) { + const char *body; va_list args; - T_BEGIN { - const char *body; + va_start(args, fmt); + body = t_strdup_vprintf(fmt, args); + va_end(args); - va_start(args, fmt); - body = t_strdup_vprintf(fmt, args); - va_end(args); - - rfc2822_header_write(header, name, body); - } T_END; + rfc2822_header_write(header, name, body); } void rfc2822_header_utf8_printf (string_t *header, const char *name, const char *fmt, ...) { + string_t *body = t_str_new(256); va_list args; - T_BEGIN { - string_t *body = t_str_new(256); + va_start(args, fmt); + message_header_encode(t_strdup_vprintf(fmt, args), body); + va_end(args); - va_start(args, fmt); - message_header_encode(t_strdup_vprintf(fmt, args), body); - va_end(args); - - rfc2822_header_write(header, name, str_c(body)); - } T_END; + rfc2822_header_write(header, name, str_c(body)); } From dovecot at dovecot.org Sun May 19 19:51:50 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 19 May 2013 19:51:50 +0300 Subject: dovecot-2.2: imap-urlfetch: Don't leak memory on error. Use TCP ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/dd0cf0bfdb0c changeset: 16368:dd0cf0bfdb0c user: Timo Sirainen date: Sun May 19 19:51:34 2013 +0300 description: imap-urlfetch: Don't leak memory on error. Use TCP corking when sending data. diffstat: src/imap/cmd-urlfetch.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diffs (46 lines): diff -r 1d6f42853492 -r dd0cf0bfdb0c src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Wed May 15 17:18:29 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Sun May 19 19:51:34 2013 +0300 @@ -258,20 +258,14 @@ struct cmd_urlfetch_context *ctx = cmd->context; int ret; + o_stream_cork(cmd->client->output); if (reply == NULL) { /* fatal failure */ - last = TRUE; ctx->failed = TRUE; + ret = -1; } else if (reply->succeeded) { /* URL fetch succeeded */ ret = cmd_urlfetch_url_sucess(cmd, reply); - if (ret == 0) - return 0; - if (ret < 0) { - ctx->ufetch = NULL; - cmd_urlfetch_finish(cmd); - return -1; - } } else { /* URL fetch failed */ string_t *response = t_str_new(128); @@ -284,14 +278,17 @@ client_send_line(cmd->client, t_strdup_printf( "* NO %s.", reply->error)); } + ret = 1; } + o_stream_uncork(cmd->client->output); - if (last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) { + if ((last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) || + ret < 0) { ctx->ufetch = NULL; cmd_urlfetch_finish(cmd); client_command_free(&cmd); } - return 1; + return ret; } static int From dovecot at dovecot.org Sun May 19 19:55:49 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 19 May 2013 19:55:49 +0300 Subject: dovecot-2.2: lib-http: Fixed assert-crash when host had multiple... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8ee30aa47930 changeset: 16369:8ee30aa47930 user: Timo Sirainen date: Sun May 19 19:55:41 2013 +0300 description: lib-http: Fixed assert-crash when host had multiple IPs and first one had failed. diffstat: src/lib-http/http-client-host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r dd0cf0bfdb0c -r 8ee30aa47930 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Sun May 19 19:51:34 2013 +0300 +++ b/src/lib-http/http-client-host.c Sun May 19 19:55:41 2013 +0300 @@ -305,7 +305,7 @@ /* make a connection if we have an IP already */ if (host->ips_count == 0) return; - i_assert(hport->ips_connect_idx == 0); + i_assert(hport->ips_connect_idx < host->ips_count); http_client_host_connection_setup(host, hport); } From dovecot at dovecot.org Sun May 19 22:31:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 19 May 2013 22:31:11 +0300 Subject: dovecot-2.2: http_url_escape_param(): Added more characters to b... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fe66746d8a66 changeset: 16370:fe66746d8a66 user: Timo Sirainen date: Sun May 19 22:30:52 2013 +0300 description: http_url_escape_param(): Added more characters to be escaped. Most importantly '+', which encodes a space normally. The others may not be strictly necessary, but safer to escape them just in case. diffstat: src/lib-http/http-url.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (10 lines): diff -r 8ee30aa47930 -r fe66746d8a66 src/lib-http/http-url.c --- a/src/lib-http/http-url.c Sun May 19 19:55:41 2013 +0300 +++ b/src/lib-http/http-url.c Sun May 19 22:30:52 2013 +0300 @@ -285,5 +285,5 @@ void http_url_escape_param(string_t *out, const char *data) { - uri_append_query_data(out, "&;", data); + uri_append_query_data(out, "&;/?=+", data); } From dovecot at dovecot.org Sun May 19 22:37:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 19 May 2013 22:37:17 +0300 Subject: dovecot-2.2: example-config: Added missing auth-dict.conf.ext to... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fbe04e687f6f changeset: 16371:fbe04e687f6f user: Christian Wiese date: Sun May 19 22:36:36 2013 +0300 description: example-config: Added missing auth-dict.conf.ext to distribution diffstat: doc/example-config/conf.d/Makefile.am | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r fe66746d8a66 -r fbe04e687f6f doc/example-config/conf.d/Makefile.am --- a/doc/example-config/conf.d/Makefile.am Sun May 19 22:30:52 2013 +0300 +++ b/doc/example-config/conf.d/Makefile.am Sun May 19 22:36:36 2013 +0300 @@ -4,6 +4,7 @@ example_DATA = \ auth-checkpassword.conf.ext \ auth-deny.conf.ext \ + auth-dict.conf.ext \ auth-ldap.conf.ext \ auth-master.conf.ext \ auth-passwdfile.conf.ext \ From dovecot at dovecot.org Sun May 19 23:21:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 19 May 2013 23:21:30 +0300 Subject: dovecot-2.2: mbox: Previous change broke index updates to succes... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bfca9879f7b6 changeset: 16372:bfca9879f7b6 user: Timo Sirainen date: Sun May 19 23:21:20 2013 +0300 description: mbox: Previous change broke index updates to successful saves. diffstat: src/lib-storage/index/mbox/mbox-save.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r fbe04e687f6f -r bfca9879f7b6 src/lib-storage/index/mbox/mbox-save.c --- a/src/lib-storage/index/mbox/mbox-save.c Sun May 19 22:36:36 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Sun May 19 23:21:20 2013 +0300 @@ -715,7 +715,7 @@ ctx->mail_offset = (uoff_t)-1; } - if (ctx->seq != 0) { + if (ctx->seq != 0 && ctx->failed) { mail_index_expunge(ctx->trans, ctx->seq); /* currently we can't just drop pending cache updates for this one specific record, so we'll reset the whole cache From dovecot at dovecot.org Mon May 20 00:09:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 00:09:18 +0300 Subject: dovecot-2.2: lib-storage: Added mailbox_status.have_save_guids. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/35871cb142df changeset: 16373:35871cb142df user: Timo Sirainen date: Sun May 19 23:42:29 2013 +0300 description: lib-storage: Added mailbox_status.have_save_guids. diffstat: src/lib-storage/index/dbox-multi/mdbox-storage.c | 3 ++- src/lib-storage/index/dbox-single/sdbox-storage.c | 3 ++- src/lib-storage/index/maildir/maildir-storage.c | 3 ++- src/lib-storage/mail-storage-private.h | 5 ++++- src/lib-storage/mail-storage.c | 7 ++++++- src/lib-storage/mail-storage.h | 2 ++ src/plugins/virtual/virtual-storage.c | 5 +++++ src/plugins/virtual/virtual-storage.h | 1 + 8 files changed, 24 insertions(+), 5 deletions(-) diffs (130 lines): diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/dbox-multi/mdbox-storage.c --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c Sun May 19 23:42:29 2013 +0300 @@ -410,7 +410,8 @@ struct mail_storage mdbox_storage = { .name = MDBOX_STORAGE_NAME, .class_flags = MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT | - MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS, + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS | + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS, .v = { mdbox_get_setting_parser_info, diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/dbox-single/sdbox-storage.c --- a/src/lib-storage/index/dbox-single/sdbox-storage.c Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c Sun May 19 23:42:29 2013 +0300 @@ -390,7 +390,8 @@ struct mail_storage sdbox_storage = { .name = SDBOX_STORAGE_NAME, .class_flags = MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG | - MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS, + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS | + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS, .v = { NULL, diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/maildir/maildir-storage.c --- a/src/lib-storage/index/maildir/maildir-storage.c Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-storage.c Sun May 19 23:42:29 2013 +0300 @@ -657,7 +657,8 @@ struct mail_storage maildir_storage = { .name = MAILDIR_STORAGE_NAME, .class_flags = MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG | - MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS, + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS | + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS, .v = { maildir_get_setting_parser_info, diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage-private.h --- a/src/lib-storage/mail-storage-private.h Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/mail-storage-private.h Sun May 19 23:42:29 2013 +0300 @@ -66,7 +66,10 @@ /* Storage uses one file per message */ MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG = 0x20, /* Messages have GUIDs (always set mailbox_status.have_guids=TRUE) */ - MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS = 0x40 + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS = 0x40, + /* mailbox_save_set_guid() works (always set + mailbox_status.have_save_guids=TRUE) */ + MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS = 0x80 }; struct mail_binary_cache { diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/mail-storage.c Sun May 19 23:42:29 2013 +0300 @@ -1471,6 +1471,8 @@ memset(status_r, 0, sizeof(*status_r)); if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS) != 0) status_r->have_guids = TRUE; + if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS) != 0) + status_r->have_save_guids = TRUE; } int mailbox_get_status(struct mailbox *box, @@ -1480,7 +1482,10 @@ mailbox_get_status_set_defaults(box, status_r); if (mailbox_verify_existing_name(box) < 0) return -1; - return box->v.get_status(box, items, status_r); + if (box->v.get_status(box, items, status_r) < 0) + return -1; + i_assert(status_r->have_guids || !status_r->have_save_guids); + return 0; } void mailbox_get_open_status(struct mailbox *box, diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Sun May 19 23:21:20 2013 +0300 +++ b/src/lib-storage/mail-storage.h Sun May 19 23:42:29 2013 +0300 @@ -275,6 +275,8 @@ /* Messages have GUIDs (always set) */ unsigned int have_guids:1; + /* mailbox_save_set_guid() works (always set) */ + unsigned int have_save_guids:1; }; struct mailbox_cache_field { diff -r bfca9879f7b6 -r 35871cb142df src/plugins/virtual/virtual-storage.c --- a/src/plugins/virtual/virtual-storage.c Sun May 19 23:21:20 2013 +0300 +++ b/src/plugins/virtual/virtual-storage.c Sun May 19 23:42:29 2013 +0300 @@ -182,6 +182,8 @@ mailbox_get_open_status(bbox->box, 0, &status); if (!status.have_guids) mbox->have_guids = FALSE; + if (!status.have_save_guids) + mbox->have_save_guids = FALSE; return 1; } @@ -193,6 +195,7 @@ int ret; mbox->have_guids = TRUE; + mbox->have_save_guids = TRUE; bboxes = array_get(&mbox->backend_boxes, &count); for (i = 0; i < count; ) { @@ -365,6 +368,8 @@ } if (mbox->have_guids) status_r->have_guids = TRUE; + if (mbox->have_save_guids) + status_r->have_save_guids = TRUE; return 0; } diff -r bfca9879f7b6 -r 35871cb142df src/plugins/virtual/virtual-storage.h --- a/src/plugins/virtual/virtual-storage.h Sun May 19 23:21:20 2013 +0300 +++ b/src/plugins/virtual/virtual-storage.h Sun May 19 23:42:29 2013 +0300 @@ -145,6 +145,7 @@ unsigned int sync_initialized:1; unsigned int inconsistent:1; unsigned int have_guids:1; + unsigned int have_save_guids:1; }; extern MODULE_CONTEXT_DEFINE(virtual_storage_module, From dovecot at dovecot.org Mon May 20 01:53:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 01:53:52 +0300 Subject: dovecot-2.2: maildir: If we notice an unexpectedly inserted file... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/096054ae8584 changeset: 16375:096054ae8584 user: Timo Sirainen date: Mon May 20 01:52:25 2013 +0300 description: maildir: If we notice an unexpectedly inserted file, retry the sync to fix it. Without this doveadm force-resync would just ignore the inserted files. diffstat: src/lib-storage/index/maildir/maildir-sync-index.c | 1 + src/lib-storage/index/maildir/maildir-sync.c | 59 ++++++++++++++------- src/lib-storage/index/maildir/maildir-sync.h | 1 + 3 files changed, 40 insertions(+), 21 deletions(-) diffs (121 lines): diff -r 422d165d4b8e -r 096054ae8584 src/lib-storage/index/maildir/maildir-sync-index.c --- a/src/lib-storage/index/maildir/maildir-sync-index.c Mon May 20 01:39:52 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Mon May 20 01:52:25 2013 +0300 @@ -181,6 +181,7 @@ if ((uflags & MAILDIR_UIDLIST_REC_FLAG_RACING) == 0) { /* mark it racy and check in next sync */ ctx->mbox->maildir_hdr.cur_check_time = 0; + maildir_sync_set_racing(ctx->maildir_sync_ctx); maildir_uidlist_add_flags(ctx->mbox->uidlist, filename, MAILDIR_UIDLIST_REC_FLAG_RACING); return 0; diff -r 422d165d4b8e -r 096054ae8584 src/lib-storage/index/maildir/maildir-sync.c --- a/src/lib-storage/index/maildir/maildir-sync.c Mon May 20 01:39:52 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.c Mon May 20 01:52:25 2013 +0300 @@ -229,8 +229,14 @@ unsigned int partial:1; unsigned int locked:1; + unsigned int racing:1; }; +void maildir_sync_set_racing(struct maildir_sync_context *ctx) +{ + ctx->racing = TRUE; +} + void maildir_sync_notify(struct maildir_sync_context *ctx) { time_t now; @@ -981,26 +987,43 @@ return maildir_uidlist_lookup(mbox->uidlist, uid, flags_r, fname_r); } +static int maildir_sync_run(struct maildir_mailbox *mbox, + enum mailbox_sync_flags flags, bool force_resync, + uint32_t *uid, bool *lost_files_r) +{ + struct maildir_sync_context *ctx; + bool retry, lost_files; + int ret; + + T_BEGIN { + ctx = maildir_sync_context_new(mbox, flags); + ret = maildir_sync_context(ctx, force_resync, uid, lost_files_r); + retry = ctx->racing; + maildir_sync_deinit(ctx); + } T_END; + + if (retry) T_BEGIN { + /* we're racing some file. retry the sync again to see if the + file is really gone or not. if it is, this is a bit of + unnecessary work, but if it's not, this is necessary for + e.g. doveadm force-resync to work. */ + ctx = maildir_sync_context_new(mbox, 0); + ret = maildir_sync_context(ctx, TRUE, NULL, &lost_files); + maildir_sync_deinit(ctx); + } T_END; + return ret; +} + int maildir_storage_sync_force(struct maildir_mailbox *mbox, uint32_t uid) { - struct maildir_sync_context *ctx; bool lost_files; int ret; - T_BEGIN { - ctx = maildir_sync_context_new(mbox, MAILBOX_SYNC_FLAG_FAST); - ret = maildir_sync_context(ctx, TRUE, &uid, &lost_files); - maildir_sync_deinit(ctx); - } T_END; - + ret = maildir_sync_run(mbox, MAILBOX_SYNC_FLAG_FAST, + TRUE, &uid, &lost_files); if (uid != 0) { /* maybe it's expunged. check again. */ - T_BEGIN { - ctx = maildir_sync_context_new(mbox, 0); - ret = maildir_sync_context(ctx, TRUE, NULL, - &lost_files); - maildir_sync_deinit(ctx); - } T_END; + ret = maildir_sync_run(mbox, 0, TRUE, NULL, &lost_files); } return ret; } @@ -1037,7 +1060,6 @@ maildir_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags) { struct maildir_mailbox *mbox = (struct maildir_mailbox *)box; - struct maildir_sync_context *ctx; bool lost_files, force_resync; int ret = 0; @@ -1048,13 +1070,8 @@ force_resync = (flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0; if (index_mailbox_want_full_sync(&mbox->box, flags)) { - T_BEGIN { - ctx = maildir_sync_context_new(mbox, flags); - ret = maildir_sync_context(ctx, force_resync, NULL, - &lost_files); - maildir_sync_deinit(ctx); - } T_END; - + ret = maildir_sync_run(mbox, flags, force_resync, + NULL, &lost_files); i_assert(!maildir_uidlist_is_locked(mbox->uidlist) || (box->flags & MAILBOX_FLAG_KEEP_LOCKED) != 0); diff -r 422d165d4b8e -r 096054ae8584 src/lib-storage/index/maildir/maildir-sync.h --- a/src/lib-storage/index/maildir/maildir-sync.h Mon May 20 01:39:52 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.h Mon May 20 01:52:25 2013 +0300 @@ -38,6 +38,7 @@ struct maildir_keywords_sync_ctx * maildir_sync_get_keywords_sync_ctx(struct maildir_index_sync_context *ctx); +void maildir_sync_set_racing(struct maildir_sync_context *ctx); void maildir_sync_notify(struct maildir_sync_context *ctx); void maildir_sync_set_new_msgs_count(struct maildir_index_sync_context *ctx, unsigned int count); From dovecot at dovecot.org Mon May 20 01:53:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 01:53:52 +0300 Subject: dovecot-2.2: maildir: Reverted most of changeset c92ebbedc6f9. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/422d165d4b8e changeset: 16374:422d165d4b8e user: Timo Sirainen date: Mon May 20 01:39:52 2013 +0300 description: maildir: Reverted most of changeset c92ebbedc6f9. If dovecot-uidlist file is recreated, it gets a new inode number, and we should recognize by that alone that it has changed. More importantly this forced re-reading of dovecot-uidlist clears out the RACING flag, making it impossible to handle reappearing maildir files. diffstat: src/lib-storage/index/maildir/maildir-uidlist.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diffs (33 lines): diff -r 35871cb142df -r 422d165d4b8e src/lib-storage/index/maildir/maildir-uidlist.c --- a/src/lib-storage/index/maildir/maildir-uidlist.c Sun May 19 23:42:29 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-uidlist.c Mon May 20 01:39:52 2013 +0300 @@ -100,7 +100,6 @@ unsigned int unsorted:1; unsigned int have_mailbox_guid:1; unsigned int opened_readonly:1; - unsigned int reread:1; }; struct maildir_uidlist_sync_ctx { @@ -878,11 +877,6 @@ *recreated_r = TRUE; return 1; } - if (uidlist->reread) { - uidlist->reread = FALSE; - *recreated_r = TRUE; - return 1; - } if (st.st_ino != uidlist->fd_ino || !CMP_DEV_T(st.st_dev, uidlist->fd_dev)) { @@ -2075,9 +2069,6 @@ rec = hash_table_lookup(uidlist->files, filename); i_assert(rec != NULL); - if ((flags & MAILDIR_UIDLIST_REC_FLAG_RACING) != 0) - uidlist->reread = TRUE; - rec->flags |= flags; } From dovecot at dovecot.org Mon May 20 01:54:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 01:54:11 +0300 Subject: dovecot-2.1: maildir: If we notice an unexpectedly inserted file... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4c05b9447a10 changeset: 14968:4c05b9447a10 user: Timo Sirainen date: Mon May 20 01:52:25 2013 +0300 description: maildir: If we notice an unexpectedly inserted file, retry the sync to fix it. Without this doveadm force-resync would just ignore the inserted files. diffstat: src/lib-storage/index/maildir/maildir-sync-index.c | 1 + src/lib-storage/index/maildir/maildir-sync.c | 59 ++++++++++++++------- src/lib-storage/index/maildir/maildir-sync.h | 1 + 3 files changed, 40 insertions(+), 21 deletions(-) diffs (121 lines): diff -r 7389ff729d2e -r 4c05b9447a10 src/lib-storage/index/maildir/maildir-sync-index.c --- a/src/lib-storage/index/maildir/maildir-sync-index.c Wed May 15 15:26:47 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Mon May 20 01:52:25 2013 +0300 @@ -181,6 +181,7 @@ if ((uflags & MAILDIR_UIDLIST_REC_FLAG_RACING) == 0) { /* mark it racy and check in next sync */ ctx->mbox->maildir_hdr.cur_check_time = 0; + maildir_sync_set_racing(ctx->maildir_sync_ctx); maildir_uidlist_add_flags(ctx->mbox->uidlist, filename, MAILDIR_UIDLIST_REC_FLAG_RACING); return 0; diff -r 7389ff729d2e -r 4c05b9447a10 src/lib-storage/index/maildir/maildir-sync.c --- a/src/lib-storage/index/maildir/maildir-sync.c Wed May 15 15:26:47 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.c Mon May 20 01:52:25 2013 +0300 @@ -229,8 +229,14 @@ unsigned int partial:1; unsigned int locked:1; + unsigned int racing:1; }; +void maildir_sync_set_racing(struct maildir_sync_context *ctx) +{ + ctx->racing = TRUE; +} + void maildir_sync_notify(struct maildir_sync_context *ctx) { time_t now; @@ -980,26 +986,43 @@ return maildir_uidlist_lookup(mbox->uidlist, uid, flags_r, fname_r); } +static int maildir_sync_run(struct maildir_mailbox *mbox, + enum mailbox_sync_flags flags, bool force_resync, + uint32_t *uid, bool *lost_files_r) +{ + struct maildir_sync_context *ctx; + bool retry, lost_files; + int ret; + + T_BEGIN { + ctx = maildir_sync_context_new(mbox, flags); + ret = maildir_sync_context(ctx, force_resync, uid, lost_files_r); + retry = ctx->racing; + maildir_sync_deinit(ctx); + } T_END; + + if (retry) T_BEGIN { + /* we're racing some file. retry the sync again to see if the + file is really gone or not. if it is, this is a bit of + unnecessary work, but if it's not, this is necessary for + e.g. doveadm force-resync to work. */ + ctx = maildir_sync_context_new(mbox, 0); + ret = maildir_sync_context(ctx, TRUE, NULL, &lost_files); + maildir_sync_deinit(ctx); + } T_END; + return ret; +} + int maildir_storage_sync_force(struct maildir_mailbox *mbox, uint32_t uid) { - struct maildir_sync_context *ctx; bool lost_files; int ret; - T_BEGIN { - ctx = maildir_sync_context_new(mbox, MAILBOX_SYNC_FLAG_FAST); - ret = maildir_sync_context(ctx, TRUE, &uid, &lost_files); - maildir_sync_deinit(ctx); - } T_END; - + ret = maildir_sync_run(mbox, MAILBOX_SYNC_FLAG_FAST, + TRUE, &uid, &lost_files); if (uid != 0) { /* maybe it's expunged. check again. */ - T_BEGIN { - ctx = maildir_sync_context_new(mbox, 0); - ret = maildir_sync_context(ctx, TRUE, NULL, - &lost_files); - maildir_sync_deinit(ctx); - } T_END; + ret = maildir_sync_run(mbox, 0, TRUE, NULL, &lost_files); } return ret; } @@ -1036,7 +1059,6 @@ maildir_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags) { struct maildir_mailbox *mbox = (struct maildir_mailbox *)box; - struct maildir_sync_context *ctx; bool lost_files, force_resync; int ret = 0; @@ -1047,13 +1069,8 @@ force_resync = (flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0; if (index_mailbox_want_full_sync(&mbox->box, flags)) { - T_BEGIN { - ctx = maildir_sync_context_new(mbox, flags); - ret = maildir_sync_context(ctx, force_resync, NULL, - &lost_files); - maildir_sync_deinit(ctx); - } T_END; - + ret = maildir_sync_run(mbox, flags, force_resync, + NULL, &lost_files); i_assert(!maildir_uidlist_is_locked(mbox->uidlist) || (box->flags & MAILBOX_FLAG_KEEP_LOCKED) != 0); diff -r 7389ff729d2e -r 4c05b9447a10 src/lib-storage/index/maildir/maildir-sync.h --- a/src/lib-storage/index/maildir/maildir-sync.h Wed May 15 15:26:47 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.h Mon May 20 01:52:25 2013 +0300 @@ -39,6 +39,7 @@ struct maildir_keywords_sync_ctx * maildir_sync_get_keywords_sync_ctx(struct maildir_index_sync_context *ctx); +void maildir_sync_set_racing(struct maildir_sync_context *ctx); void maildir_sync_notify(struct maildir_sync_context *ctx); void maildir_sync_set_new_msgs_count(struct maildir_index_sync_context *ctx, unsigned int count); From dovecot at dovecot.org Mon May 20 02:01:13 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 02:01:13 +0300 Subject: dovecot-2.2: dsync: Don't try to sync with GUIDs if we can't set... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c6fee677172a changeset: 16376:c6fee677172a user: Timo Sirainen date: Mon May 20 02:01:02 2013 +0300 description: dsync: Don't try to sync with GUIDs if we can't set them on the needed side. With two-way syncing both sides need to have writable GUIDs. With one-way syncing only the writing side needs to have writable GUIDs. diffstat: src/doveadm/dsync/dsync-brain-mailbox.c | 11 +++++++---- src/doveadm/dsync/dsync-ibc-stream.c | 6 +++++- src/doveadm/dsync/dsync-mailbox.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diffs (77 lines): diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-brain-mailbox.c --- a/src/doveadm/dsync/dsync-brain-mailbox.c Mon May 20 01:52:25 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox.c Mon May 20 02:01:02 2013 +0300 @@ -173,8 +173,9 @@ import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_REVERT_LOCAL_CHANGES; if (brain->debug) import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_DEBUG; - if (brain->local_dsync_box.have_guids && - remote_dsync_box->have_guids) + if (brain->local_dsync_box.have_save_guids && + (remote_dsync_box->have_save_guids || + (brain->backup_recv && remote_dsync_box->have_guids))) import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_MAILS_HAVE_GUIDS; brain->box_importer = brain->backup_send ? NULL : @@ -216,8 +217,9 @@ if (!brain->mail_requests) exporter_flags |= DSYNC_MAILBOX_EXPORTER_FLAG_AUTO_EXPORT_MAILS; - if (brain->local_dsync_box.have_guids && - remote_dsync_box->have_guids) + if (remote_dsync_box->have_save_guids && + (brain->local_dsync_box.have_save_guids || + (brain->backup_send && brain->local_dsync_box.have_guids))) exporter_flags |= DSYNC_MAILBOX_EXPORTER_FLAG_MAILS_HAVE_GUIDS; brain->box_exporter = brain->backup_recv ? NULL : @@ -303,6 +305,7 @@ dsync_box_r->highest_pvt_modseq = status.highest_pvt_modseq; dsync_box_r->cache_fields = *metadata.cache_fields; dsync_box_r->have_guids = status.have_guids; + dsync_box_r->have_save_guids = status.have_save_guids; return 1; } diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 01:52:25 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 02:01:02 2013 +0300 @@ -96,7 +96,7 @@ .chr = 'B', .required_keys = "mailbox_guid uid_validity uid_next messages_count " "first_recent_uid highest_modseq highest_pvt_modseq", - .optional_keys = "mailbox_lost cache_fields have_guids" + .optional_keys = "mailbox_lost cache_fields have_guids have_save_guids" }, { .name = "mailbox_attribute", .chr = 'A', @@ -1110,6 +1110,8 @@ dsync_serializer_encode_add(encoder, "mailbox_lost", ""); if (dsync_box->have_guids) dsync_serializer_encode_add(encoder, "have_guids", ""); + if (dsync_box->have_save_guids) + dsync_serializer_encode_add(encoder, "have_save_guids", ""); dsync_serializer_encode_add(encoder, "uid_validity", dec2str(dsync_box->uid_validity)); dsync_serializer_encode_add(encoder, "uid_next", @@ -1210,6 +1212,8 @@ box->mailbox_lost = TRUE; if (dsync_deserializer_decode_try(decoder, "have_guids", &value)) box->have_guids = TRUE; + if (dsync_deserializer_decode_try(decoder, "have_save_guids", &value)) + box->have_save_guids = TRUE; value = dsync_deserializer_decode_get(decoder, "uid_validity"); if (str_to_uint32(value, &box->uid_validity) < 0) { dsync_ibc_input_error(ibc, decoder, "Invalid uid_validity"); diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-mailbox.h --- a/src/doveadm/dsync/dsync-mailbox.h Mon May 20 01:52:25 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox.h Mon May 20 02:01:02 2013 +0300 @@ -8,7 +8,7 @@ struct dsync_mailbox { guid_128_t mailbox_guid; bool mailbox_lost; - bool have_guids; + bool have_guids, have_save_guids; uint32_t uid_validity, uid_next, messages_count, first_recent_uid; uint64_t highest_modseq, highest_pvt_modseq; From dovecot at dovecot.org Mon May 20 02:32:21 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 02:32:21 +0300 Subject: dovecot-2.2: Released v2.2.2. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7aa929edd551 changeset: 16377:7aa929edd551 user: Timo Sirainen date: Mon May 20 02:25:23 2013 +0300 description: Released v2.2.2. diffstat: NEWS | 31 +++++++++++++++++++++++++++++++ configure.ac | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) diffs (52 lines): diff -r c6fee677172a -r 7aa929edd551 NEWS --- a/NEWS Mon May 20 02:01:02 2013 +0300 +++ b/NEWS Mon May 20 02:25:23 2013 +0300 @@ -1,3 +1,34 @@ +v2.2.2 2013-05-20 Timo Sirainen + + + zlib: Keep the last mail cached uncompressed in a temp file. This + fixes performance when doing small partial fetches from a large + mail. + + acl: If plugin { acl_defaults_from_inbox = yes } is set, get the + default ACLs for private and shared namespaces from the user's INBOX. + (This probably will become default in v2.3.) + + pop3: Added pop3_deleted_flag setting to switch POP3 deletions to + only hide the messages from POP3, but still be visible via IMAP. + - ACL plugin: Mailbox creation wasn't actually checking any ACLs + and always succeeded (due to some v2.2 API changes). The created + mailbox couldn't have been accessed though, so this couldn't have + caused any data leak. + - IMAP: Various URLAUTH fixes. + - IMAP: Fixed a hang with invalid APPEND parameters. + - IMAP LIST-EXTENDED: INBOX was never listed with \Subscribed flag. + - mailbox_list_index=yes still caused crashes. + - maildir: Fixed a crash after dovecot-keywords file was re-read. + - maildir: If files had reappeared unexpectedly to a Maildir, they + were ignored until index files were deleted. + - Maildir: Fixed handling over 26 keywords in a mailbox. + - Maildir++: Fixed mail_shared_explicit_inbox=no + - namespace { prefix="" list=no } was listing mailboxes. + - imap/pop3-login proxying: Fixed a crash if TCP connection succeeded, + but the remote login timed out. + - Case-insensitive search/sort didn't work correctly for all unicode + characters, as specified by i;unicode-casemap comparator. If full + text search indexes were used, they need to be rebuilt for old mails + to be handled correctly. (This bug has existed always in Dovecot.) + v2.2.1 2013-04-19 Timo Sirainen - mailbox_list_index=yes was broken. diff -r c6fee677172a -r 7aa929edd551 configure.ac --- a/configure.ac Mon May 20 02:01:02 2013 +0300 +++ b/configure.ac Mon May 20 02:25:23 2013 +0300 @@ -2,8 +2,8 @@ # Be sure to update ABI version also if anything changes that might require # recompiling plugins. Most importantly that means if any structs are changed. -AC_INIT([Dovecot],[2.2.1],[dovecot at dovecot.org]) -AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) +AC_INIT([Dovecot],[2.2.2],[dovecot at dovecot.org]) +AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv2($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Mon May 20 02:32:21 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 02:32:21 +0300 Subject: dovecot-2.2: Added tag 2.2.2 for changeset 7aa929edd551 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2560f791f6f7 changeset: 16378:2560f791f6f7 user: Timo Sirainen date: Mon May 20 02:25:23 2013 +0300 description: Added tag 2.2.2 for changeset 7aa929edd551 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 7aa929edd551 -r 2560f791f6f7 .hgtags --- a/.hgtags Mon May 20 02:25:23 2013 +0300 +++ b/.hgtags Mon May 20 02:25:23 2013 +0300 @@ -105,3 +105,4 @@ d7f29af734683149badfc45a4e2015254ca78672 2.2.rc7 1c8e7a295d4bd167a2b0a7243a3ec4d1e161360d 2.2.0 6fcf060b50f183549909f0fee17307e646edcbc6 2.2.1 +7aa929edd551e3d3bd9405643341129c7a805554 2.2.2 From dovecot at dovecot.org Mon May 20 02:32:21 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 02:32:21 +0300 Subject: dovecot-2.2: Added signature for changeset 7aa929edd551 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4f76d60ba7dd changeset: 16379:4f76d60ba7dd user: Timo Sirainen date: Mon May 20 02:25:26 2013 +0300 description: Added signature for changeset 7aa929edd551 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 2560f791f6f7 -r 4f76d60ba7dd .hgsigs --- a/.hgsigs Mon May 20 02:25:23 2013 +0300 +++ b/.hgsigs Mon May 20 02:25:26 2013 +0300 @@ -68,3 +68,4 @@ d7f29af734683149badfc45a4e2015254ca78672 0 iEYEABECAAYFAlFlvh0ACgkQyUhSUUBVislyrgCfSTX5MQWcV+eAWNlZ1jpawq9rNPMAnRNU9RBWmrUNU9PqDrsqS3WDCGyu e2cd03cc9c690c4989fb53a1871b7109c547388a 0 iEYEABECAAYFAlFnEVAACgkQyUhSUUBVismWBgCgit90C+1stGSchsVzJGghBs9278UAnj0vB6BETfOU9tNjViyCR18aEdUH 6fcf060b50f183549909f0fee17307e646edcbc6 0 iEYEABECAAYFAlFwZ7oACgkQyUhSUUBVismG6wCeI05eVDC++LqgfF9sOkoT3qRp9xYAn3pRDGYKPx7DhcTp+0RX/I9TXUmB +7aa929edd551e3d3bd9405643341129c7a805554 0 iEYEABECAAYFAlGZX2MACgkQyUhSUUBVisn2LACfWc8QwBvF31mYx3iv9ePvShCRcH4AnjZkbQEmcvaFQrfCy5YIIrstNBzx From dovecot at dovecot.org Mon May 20 17:30:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 17:30:38 +0300 Subject: dovecot-2.2: dsync: Fixed unsubscribing from an already deleted ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9878986a028d changeset: 16380:9878986a028d user: Timo Sirainen date: Mon May 20 17:30:23 2013 +0300 description: dsync: Fixed unsubscribing from an already deleted mailbox. diffstat: src/doveadm/dsync/dsync-brain-mailbox-tree.c | 34 +++++++++--- src/doveadm/dsync/dsync-ibc-stream.c | 73 ++++++++++++++++----------- src/doveadm/dsync/dsync-mailbox-tree-fill.c | 17 +++++- src/doveadm/dsync/dsync-mailbox-tree.c | 2 +- src/doveadm/dsync/dsync-mailbox-tree.h | 13 +++- 5 files changed, 96 insertions(+), 43 deletions(-) diffs (271 lines): diff -r 4f76d60ba7dd -r 9878986a028d src/doveadm/dsync/dsync-brain-mailbox-tree.c --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Mon May 20 02:25:26 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Mon May 20 17:30:23 2013 +0300 @@ -371,11 +371,24 @@ if (node == NULL) return; - if (!other_del->delete_mailbox && - other_del->timestamp <= node->last_renamed_or_created) { - /* we don't want to delete this directory, we already have a - newer timestamp for it */ - return; + switch (other_del->type) { + case DSYNC_MAILBOX_DELETE_TYPE_MAILBOX: + /* mailbox is always deleted */ + break; + case DSYNC_MAILBOX_DELETE_TYPE_DIR: + if (other_del->timestamp <= node->last_renamed_or_created) { + /* we don't want to delete this directory, we already + have a newer timestamp for it */ + return; + } + break; + case DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE: + if (other_del->timestamp <= node->last_subscription_change) { + /* we don't want to unsubscribe, since we already have + a newer subscription timestamp */ + return; + } + break; } /* make a node for it in the other mailbox tree */ @@ -384,20 +397,25 @@ if (!guid_128_is_empty(other_node->mailbox_guid) || (other_node->existence == DSYNC_MAILBOX_NODE_EXISTS && - !other_del->delete_mailbox)) { + other_del->type != DSYNC_MAILBOX_DELETE_TYPE_MAILBOX)) { /* other side has already created a new mailbox or directory with this name, we can't delete it */ return; } /* ok, mark the other node deleted */ - if (other_del->delete_mailbox) { + if (other_del->type == DSYNC_MAILBOX_DELETE_TYPE_MAILBOX) { memcpy(other_node->mailbox_guid, node->mailbox_guid, sizeof(other_node->mailbox_guid)); } i_assert(other_node->ns == NULL || other_node->ns == node->ns); other_node->ns = node->ns; - other_node->existence = DSYNC_MAILBOX_NODE_DELETED; + if (other_del->type != DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE) + other_node->existence = DSYNC_MAILBOX_NODE_DELETED; + else { + other_node->last_subscription_change = other_del->timestamp; + other_node->subscribed = FALSE; + } if (dsync_mailbox_tree_guid_hash_add(other_tree, other_node, &old_node) < 0) diff -r 4f76d60ba7dd -r 9878986a028d src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 02:25:26 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 17:30:23 2013 +0300 @@ -90,7 +90,7 @@ { .name = "mailbox_delete", .chr = 'D', .required_keys = "hierarchy_sep", - .optional_keys = "mailboxes dirs" + .optional_keys = "mailboxes dirs unsubscribes" }, { .name = "mailbox", .chr = 'B', @@ -936,6 +936,28 @@ } static void +dsync_ibc_stream_encode_delete(string_t *str, + struct dsync_serializer_encoder *encoder, + const struct dsync_mailbox_delete *deletes, + unsigned int count, const char *key, + enum dsync_mailbox_delete_type type) +{ + unsigned int i; + + str_truncate(str, 0); + for (i = 0; i < count; i++) { + if (deletes[i].type == type) { + str_append(str, guid_128_to_string(deletes[i].guid)); + str_printfa(str, " %ld ", (long)deletes[i].timestamp); + } + } + if (str_len(str) > 0) { + str_truncate(str, str_len(str)-1); + dsync_serializer_encode_add(encoder, key, str_c(str)); + } +} + +static void dsync_ibc_stream_send_mailbox_deletes(struct dsync_ibc *_ibc, const struct dsync_mailbox_delete *deletes, unsigned int count, char hierarchy_sep) @@ -944,7 +966,6 @@ struct dsync_serializer_encoder *encoder; string_t *str, *substr; char sep[2]; - unsigned int i; str = t_str_new(128); str_append_c(str, items[ITEM_MAILBOX_DELETE].chr); @@ -954,29 +975,15 @@ dsync_serializer_encode_add(encoder, "hierarchy_sep", sep); substr = t_str_new(128); - for (i = 0; i < count; i++) { - if (deletes[i].delete_mailbox) { - str_append(substr, guid_128_to_string(deletes[i].guid)); - str_printfa(substr, " %ld ", (long)deletes[i].timestamp); - } - } - if (str_len(substr) > 0) { - str_truncate(substr, str_len(substr)-1); - dsync_serializer_encode_add(encoder, "mailboxes", - str_c(substr)); - } - - str_truncate(substr, 0); - for (i = 0; i < count; i++) { - if (!deletes[i].delete_mailbox) { - str_append(substr, guid_128_to_string(deletes[i].guid)); - str_printfa(substr, " %ld ", (long)deletes[i].timestamp); - } - } - if (str_len(substr) > 0) { - str_truncate(substr, str_len(substr)-1); - dsync_serializer_encode_add(encoder, "dirs", str_c(substr)); - } + dsync_ibc_stream_encode_delete(substr, encoder, deletes, count, + "mailboxes", + DSYNC_MAILBOX_DELETE_TYPE_MAILBOX); + dsync_ibc_stream_encode_delete(substr, encoder, deletes, count, + "dirs", + DSYNC_MAILBOX_DELETE_TYPE_DIR); + dsync_ibc_stream_encode_delete(substr, encoder, deletes, count, + "unsubscribes", + DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE); dsync_serializer_encode_finish(&encoder, str); dsync_ibc_stream_send_string(ibc, str); } @@ -984,7 +991,7 @@ ARRAY_DEFINE_TYPE(dsync_mailbox_delete, struct dsync_mailbox_delete); static int decode_mailbox_deletes(ARRAY_TYPE(dsync_mailbox_delete) *deletes, - const char *value, bool delete_mailbox) + const char *value, enum dsync_mailbox_delete_type type) { struct dsync_mailbox_delete *del; const char *const *tmp; @@ -993,7 +1000,7 @@ tmp = t_strsplit(value, " "); for (i = 0; tmp[i] != NULL; i += 2) { del = array_append_space(deletes); - del->delete_mailbox = delete_mailbox; + del->type = type; if (guid_128_from_string(tmp[i], del->guid) < 0) return -1; if (tmp[i+1] == NULL || @@ -1029,12 +1036,20 @@ *hierarchy_sep_r = value[0]; if (dsync_deserializer_decode_try(decoder, "mailboxes", &value) && - decode_mailbox_deletes(&deletes, value, TRUE) < 0) { + decode_mailbox_deletes(&deletes, value, + DSYNC_MAILBOX_DELETE_TYPE_MAILBOX) < 0) { dsync_ibc_input_error(ibc, decoder, "Invalid mailboxes"); return DSYNC_IBC_RECV_RET_TRYAGAIN; } if (dsync_deserializer_decode_try(decoder, "dirs", &value) && - decode_mailbox_deletes(&deletes, value, FALSE) < 0) { + decode_mailbox_deletes(&deletes, value, + DSYNC_MAILBOX_DELETE_TYPE_DIR) < 0) { + dsync_ibc_input_error(ibc, decoder, "Invalid dirs"); + return DSYNC_IBC_RECV_RET_TRYAGAIN; + } + if (dsync_deserializer_decode_try(decoder, "unsubscribes", &value) && + decode_mailbox_deletes(&deletes, value, + DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE) < 0) { dsync_ibc_input_error(ibc, decoder, "Invalid dirs"); return DSYNC_IBC_RECV_RET_TRYAGAIN; } diff -r 4f76d60ba7dd -r 9878986a028d src/doveadm/dsync/dsync-mailbox-tree-fill.c --- a/src/doveadm/dsync/dsync-mailbox-tree-fill.c Mon May 20 02:25:26 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-tree-fill.c Mon May 20 17:30:23 2013 +0300 @@ -163,7 +163,7 @@ break; } del = array_append_space(&tree->deletes); - del->delete_mailbox = TRUE; + del->type = DSYNC_MAILBOX_DELETE_TYPE_MAILBOX; del->timestamp = timestamp; memcpy(del->guid, rec->mailbox_guid, sizeof(del->guid)); break; @@ -177,6 +177,7 @@ dsync side, it can match this deletion to the name. */ del = array_append_space(&tree->deletes); + del->type = DSYNC_MAILBOX_DELETE_TYPE_DIR; del->timestamp = timestamp; memcpy(del->guid, rec->mailbox_guid, sizeof(del->guid)); break; @@ -195,10 +196,22 @@ node->last_renamed_or_created = timestamp; break; case MAILBOX_LOG_RECORD_SUBSCRIBE: - case MAILBOX_LOG_RECORD_UNSUBSCRIBE: if (node != NULL) node->last_subscription_change = timestamp; break; + case MAILBOX_LOG_RECORD_UNSUBSCRIBE: + if (node != NULL) { + node->last_subscription_change = timestamp; + break; + } + /* The mailbox is already deleted, but it may still + exist on the other side (even the subscription + alone). */ + del = array_append_space(&tree->deletes); + del->type = DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE; + del->timestamp = timestamp; + memcpy(del->guid, rec->mailbox_guid, sizeof(del->guid)); + break; } } if (mailbox_log_iter_deinit(&iter) < 0) { diff -r 4f76d60ba7dd -r 9878986a028d src/doveadm/dsync/dsync-mailbox-tree.c --- a/src/doveadm/dsync/dsync-mailbox-tree.c Mon May 20 02:25:26 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-tree.c Mon May 20 17:30:23 2013 +0300 @@ -359,7 +359,7 @@ i_assert(hash_table_is_created(tree->guid_hash)); i_assert(tree->remote_sep != '\0'); - if (del->delete_mailbox) { + if (del->type == DSYNC_MAILBOX_DELETE_TYPE_MAILBOX) { /* find node by GUID */ return hash_table_lookup(tree->guid_hash, guid_p); } diff -r 4f76d60ba7dd -r 9878986a028d src/doveadm/dsync/dsync-mailbox-tree.h --- a/src/doveadm/dsync/dsync-mailbox-tree.h Mon May 20 02:25:26 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-tree.h Mon May 20 17:30:23 2013 +0300 @@ -63,10 +63,17 @@ #define dsync_mailbox_node_is_dir(node) \ guid_128_is_empty((node)->mailbox_guid) +enum dsync_mailbox_delete_type { + /* Delete mailbox by given GUID */ + DSYNC_MAILBOX_DELETE_TYPE_MAILBOX = 1, + /* Delete mailbox directory by given SHA1 name */ + DSYNC_MAILBOX_DELETE_TYPE_DIR, + /* Unsubscribe mailbox by given SHA1 name */ + DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE, +}; + struct dsync_mailbox_delete { - /* true: guid = mailbox GUID - false: guid = sha1 of directory name */ - bool delete_mailbox; + enum dsync_mailbox_delete_type type; guid_128_t guid; time_t timestamp; }; From dovecot at dovecot.org Mon May 20 18:26:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 20 May 2013 18:26:27 +0300 Subject: dovecot-2.2: dsync: Previous have_save_guids change somewhat bro... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e0156c479a12 changeset: 16381:e0156c479a12 user: Timo Sirainen date: Mon May 20 18:26:16 2013 +0300 description: dsync: Previous have_save_guids change somewhat broke compatibility with earlier dsync versions. diffstat: src/doveadm/dsync/dsync-ibc-stream.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (26 lines): diff -r 9878986a028d -r e0156c479a12 src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 17:30:23 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 18:26:16 2013 +0300 @@ -28,10 +28,11 @@ #define DSYNC_IBC_STREAM_OUTBUF_THROTTLE_SIZE (1024*128) #define DSYNC_PROTOCOL_VERSION_MAJOR 3 -#define DSYNC_PROTOCOL_VERSION_MINOR 1 +#define DSYNC_PROTOCOL_VERSION_MINOR 2 #define DSYNC_HANDSHAKE_VERSION "VERSION\tdsync\t3\t1\n" #define DSYNC_PROTOCOL_MINOR_HAVE_ATTRIBUTES 1 +#define DSYNC_PROTOCOL_MINOR_HAVE_SAVE_GUID 2 enum item_type { ITEM_NONE, @@ -1227,7 +1228,8 @@ box->mailbox_lost = TRUE; if (dsync_deserializer_decode_try(decoder, "have_guids", &value)) box->have_guids = TRUE; - if (dsync_deserializer_decode_try(decoder, "have_save_guids", &value)) + if (dsync_deserializer_decode_try(decoder, "have_save_guids", &value) || + (box->have_guids && ibc->minor_version < DSYNC_PROTOCOL_MINOR_HAVE_SAVE_GUID)) box->have_save_guids = TRUE; value = dsync_deserializer_decode_get(decoder, "uid_validity"); if (str_to_uint32(value, &box->uid_validity) < 0) { From pigeonhole at rename-it.nl Mon May 20 22:20:12 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 20 May 2013 21:20:12 +0200 Subject: dovecot-2.2-pigeonhole: Sieve extprograms plugin: Fixed interact... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/d4e9ca7fddcf changeset: 1775:d4e9ca7fddcf user: Stephan Bosch date: Mon May 20 21:20:04 2013 +0200 description: Sieve extprograms plugin: Fixed interaction between pipe command and remote script service. The output from the script service was never read, causing a broken pipe error at the script service. Apparently, this was broken since the I/O handling for extprograms was last revised. diffstat: src/plugins/sieve-extprograms/script-client-remote.c | 2 +- src/plugins/sieve-extprograms/script-client.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diffs (52 lines): diff -r 04ad3c2f0765 -r d4e9ca7fddcf src/plugins/sieve-extprograms/script-client-remote.c --- a/src/plugins/sieve-extprograms/script-client-remote.c Wed May 15 21:59:32 2013 +0200 +++ b/src/plugins/sieve-extprograms/script-client-remote.c Mon May 20 21:20:04 2013 +0200 @@ -183,7 +183,7 @@ io_remove(&sclient->io); script_client_init_streams(sclient); - if ( sclient->output != NULL && !slclient->noreply ) { + if ( !slclient->noreply ) { sclient->script_input = script_client_istream_create (sclient, sclient->script_input); } diff -r 04ad3c2f0765 -r d4e9ca7fddcf src/plugins/sieve-extprograms/script-client.c --- a/src/plugins/sieve-extprograms/script-client.c Wed May 15 21:59:32 2013 +0200 +++ b/src/plugins/sieve-extprograms/script-client.c Mon May 20 21:20:04 2013 +0200 @@ -145,7 +145,7 @@ if ( input == NULL ) { o_stream_unref(&sclient->script_output); - if ( sclient->output == NULL ) { + if ( sclient->script_input == NULL ) { script_client_disconnect(sclient, FALSE); } else { sclient->close_output(sclient); @@ -164,17 +164,19 @@ size_t size; int ret = 0; - if ( input != NULL && output != NULL ) { + if ( input != NULL ) { + while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) { + if ( output != NULL ) { + ssize_t sent; - while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) { - ssize_t sent; - - if ( (sent=o_stream_send(output, data, size)) < 0 ) { - script_client_fail(sclient, SCRIPT_CLIENT_ERROR_IO); - return; + if ( (sent=o_stream_send(output, data, size)) < 0 ) { + script_client_fail(sclient, SCRIPT_CLIENT_ERROR_IO); + return; + } + size = (size_t)sent; } - i_stream_skip(input, sent); + i_stream_skip(input, size); } if ( ret < 0 ) { From dovecot at dovecot.org Tue May 21 17:09:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 21 May 2013 17:09:43 +0300 Subject: dovecot-2.2: auth: Fixed crash if LDAP query returned multiple r... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0e324209d885 changeset: 16382:0e324209d885 user: Timo Sirainen date: Tue May 21 17:09:37 2013 +0300 description: auth: Fixed crash if LDAP query returned multiple results. diffstat: src/auth/db-ldap.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (23 lines): diff -r e0156c479a12 -r 0e324209d885 src/auth/db-ldap.c --- a/src/auth/db-ldap.c Mon May 20 18:26:16 2013 +0300 +++ b/src/auth/db-ldap.c Tue May 21 17:09:37 2013 +0300 @@ -825,8 +825,10 @@ if (srequest->result == res) res = NULL; - if (srequest->result != NULL) + if (srequest->result != NULL) { ldap_msgfree(srequest->result); + srequest->result = NULL; + } if (array_is_created(&srequest->named_results)) { array_foreach(&srequest->named_results, named_res) { @@ -835,6 +837,7 @@ if (named_res->result != NULL) ldap_msgfree(named_res->result); } + array_clear(&srequest->named_results); } } if (res != NULL) From dovecot at dovecot.org Tue May 21 22:55:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 21 May 2013 22:55:45 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed local URLAUTH fetches that ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fd35705fbde6 changeset: 16383:fd35705fbde6 user: Stephan Bosch date: Tue May 21 22:55:12 2013 +0300 description: lib-imap-urlauth: Fixed local URLAUTH fetches that didn't immediately finish handling content. Local requests are now also properly counted. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 38 +++++++++++++++++------------- src/lib-imap-urlauth/imap-urlauth-fetch.h | 4 +- 2 files changed, 24 insertions(+), 18 deletions(-) diffs (135 lines): diff -r 0e324209d885 -r fd35705fbde6 src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 17:09:37 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 22:55:12 2013 +0300 @@ -55,8 +55,10 @@ { struct imap_urlauth_fetch_url *url, *url_next; - if (ufetch->local_url != NULL) + if (ufetch->local_url != NULL) { + ufetch->pending_requests--; imap_msgpart_url_free(&ufetch->local_url); + } i_free_and_null(ufetch->pending_reply.url); i_free_and_null(ufetch->pending_reply.bodypartstruct); @@ -153,7 +155,6 @@ struct imap_msgpart_url *mpurl = NULL; int ret; - ufetch->pending_requests--; success = TRUE; if (debug) @@ -226,6 +227,7 @@ } if (!success && ret < 0) { + ufetch->pending_requests--; (void)ufetch->callback(NULL, TRUE, ufetch->context); imap_urlauth_fetch_fail(ufetch); return; @@ -242,12 +244,14 @@ reply.size = mpresult.size; reply.input = mpresult.input; - ret = ufetch->callback(&reply, ufetch->pending_requests == 0, + ret = ufetch->callback(&reply, ufetch->pending_requests == 1, ufetch->context); if (ret == 0) { ufetch->local_url = mpurl; ufetch->waiting = TRUE; } else { + ufetch->pending_requests--; + if (mpurl != NULL) imap_msgpart_url_free(&mpurl); if (ret < 0) @@ -302,26 +306,30 @@ int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url, enum imap_urlauth_fetch_flags url_flags) { + struct imap_urlauth_context *uctx = ufetch->uctx; enum imap_url_parse_flags url_parse_flags = IMAP_URL_PARSE_ALLOW_URLAUTH; - struct imap_urlauth_context *uctx = ufetch->uctx; struct mail_user *mail_user = uctx->user; - struct imap_url *imap_url = NULL; + struct imap_url *imap_url; const char *error, *errormsg; - ufetch->failed = FALSE; - ufetch->pending_requests++; - /* parse the url */ if (imap_url_parse(url, NULL, url_parse_flags, &imap_url, &error) < 0) { errormsg = t_strdup_printf( "Failed to fetch URLAUTH \"%s\": %s", url, error); if (mail_user->mail_debug) i_debug("%s", errormsg); + ufetch->pending_requests++; imap_urlauth_fetch_error(ufetch, url, url_flags, errormsg); - + return 1; + } + + ufetch->failed = FALSE; + ufetch->pending_requests++; + /* if access user and target user match, handle fetch request locally */ - } else if (strcmp(mail_user->username, imap_url->userid) == 0) { + if (imap_url->userid != NULL && + strcmp(mail_user->username, imap_url->userid) == 0) { if (ufetch->waiting) { struct imap_urlauth_fetch_url *url_local; @@ -352,15 +360,11 @@ (void)imap_urlauth_request_new(uctx->conn, imap_url->userid, url, url_flags, imap_urlauth_fetch_request_callback, ufetch); - } - - if (ufetch->pending_requests > 0) { i_assert(uctx->conn != NULL); if (imap_urlauth_connection_connect(uctx->conn) < 0) return -1; - return 0; } - return 1; + return (ufetch->pending_requests > 0 ? 0 : 1); } bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch) @@ -377,8 +381,10 @@ return ufetch->pending_requests > 0; } - if (ufetch->local_url != NULL) + if (ufetch->local_url != NULL) { + ufetch->pending_requests--; imap_msgpart_url_free(&ufetch->local_url); + } ufetch->waiting = FALSE; /* handle pending remote reply */ diff -r 0e324209d885 -r fd35705fbde6 src/lib-imap-urlauth/imap-urlauth-fetch.h --- a/src/lib-imap-urlauth/imap-urlauth-fetch.h Tue May 21 17:09:37 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.h Tue May 21 22:55:12 2013 +0300 @@ -31,7 +31,7 @@ /* Callback to handle fetch reply. Returns 1 if handled completely and ready for next reply, 0 if not all data was processed, and -1 for error. If a - callback returns 0, imap_urlauth_connection_continue() must be called once + callback returns 0, imap_urlauth_fetch_continue() must be called once new replies may be processed. If this is the last request to yield a reply, argument last is TRUE. The callback must not call imap_urlauth_fetch_deinit(). */ @@ -45,7 +45,7 @@ void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **_ufetch); int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url, - enum imap_urlauth_fetch_flags flags); + enum imap_urlauth_fetch_flags url_flags); bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch); #endif From dovecot at dovecot.org Tue May 21 22:55:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 21 May 2013 22:55:45 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed resuming in URLAUTH fetch h... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9dbcd10cac28 changeset: 16384:9dbcd10cac28 user: Stephan Bosch date: Tue May 21 22:55:17 2013 +0300 description: lib-imap-urlauth: Fixed resuming in URLAUTH fetch handler. Fixed URLAUTH fetch handler to properly resume the URLAUTH connection, even when it is deinitialized. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 34 ++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 12 deletions(-) diffs (125 lines): diff -r fd35705fbde6 -r 9dbcd10cac28 src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 22:55:12 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 22:55:17 2013 +0300 @@ -48,7 +48,8 @@ } pending_reply; unsigned int failed:1; - unsigned int waiting:1; + unsigned int waiting_local:1; + unsigned int waiting_service:1; }; static void imap_urlauth_fetch_abort_local(struct imap_urlauth_fetch *ufetch) @@ -112,6 +113,10 @@ *_ufetch = NULL; imap_urlauth_fetch_abort(ufetch); + + /* dont leave the connection in limbo; make sure resume is called */ + if (ufetch->waiting_service) + imap_urlauth_connection_continue(ufetch->uctx->conn); i_free(ufetch); } @@ -137,7 +142,7 @@ } T_END; if (ret == 0) - ufetch->waiting = TRUE; + ufetch->waiting_local = TRUE; else if (ret < 0) imap_urlauth_fetch_fail(ufetch); } @@ -248,7 +253,7 @@ ufetch->context); if (ret == 0) { ufetch->local_url = mpurl; - ufetch->waiting = TRUE; + ufetch->waiting_local = TRUE; } else { ufetch->pending_requests--; @@ -267,7 +272,7 @@ (struct imap_urlauth_fetch *)context; int ret = 1; - if (ufetch->waiting && reply != NULL) { + if (ufetch->waiting_local && reply != NULL) { i_assert(ufetch->pending_reply.url == NULL); ufetch->pending_reply.url = i_strdup(reply->url); ufetch->pending_reply.flags = reply->flags; @@ -284,7 +289,7 @@ return 0; } - ufetch->waiting = FALSE; + ufetch->waiting_local = FALSE; ufetch->pending_requests--; if (!ufetch->failed) { @@ -297,6 +302,8 @@ if (!ufetch->failed) imap_urlauth_fetch_abort_local(ufetch); ufetch->failed = TRUE; + } else if (ret == 0) { + ufetch->waiting_service = TRUE; } if (ret != 0) imap_urlauth_fetch_deinit(&ufetch); @@ -331,7 +338,7 @@ if (imap_url->userid != NULL && strcmp(mail_user->username, imap_url->userid) == 0) { - if (ufetch->waiting) { + if (ufetch->waiting_local) { struct imap_urlauth_fetch_url *url_local; url_local = i_new(struct imap_urlauth_fetch_url, 1); @@ -375,17 +382,22 @@ if (ufetch->failed) return FALSE; - if (!ufetch->waiting) { + if (!ufetch->waiting_local && !ufetch->waiting_service) + return ufetch->pending_requests > 0; + + if (!ufetch->waiting_local) { /* not waiting for local request handling */ + ufetch->waiting_service = FALSE; imap_urlauth_connection_continue(ufetch->uctx->conn); return ufetch->pending_requests > 0; } + /* finished local request */ if (ufetch->local_url != NULL) { ufetch->pending_requests--; imap_msgpart_url_free(&ufetch->local_url); } - ufetch->waiting = FALSE; + ufetch->waiting_local = FALSE; /* handle pending remote reply */ if (ufetch->pending_reply.url != NULL) { @@ -419,11 +431,9 @@ imap_urlauth_fetch_fail(ufetch); return FALSE; } - - imap_urlauth_connection_continue(ufetch->uctx->conn); if (ret == 0) { - ufetch->waiting = TRUE; + ufetch->waiting_service = TRUE; return TRUE; } } @@ -440,7 +450,7 @@ &ufetch->local_urls_tail, url); i_free(url->url); i_free(url); - if (ufetch->waiting) + if (ufetch->waiting_local) return TRUE; url = url_next; } From dovecot at dovecot.org Tue May 21 22:55:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 21 May 2013 22:55:45 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed deinitialization of the URL... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5a36736445e9 changeset: 16385:5a36736445e9 user: Stephan Bosch date: Tue May 21 22:55:23 2013 +0300 description: lib-imap-urlauth: Fixed deinitialization of the URLAUTH fetch handler. Added reference counting to make sure callbacks will not deinitialize the handler prematurely. diffstat: src/imap/cmd-urlfetch.c | 1 - src/lib-imap-urlauth/imap-urlauth-fetch.c | 57 +++++++++++++++++++++++++++--- src/lib-imap-urlauth/imap-urlauth-fetch.h | 5 +- 3 files changed, 52 insertions(+), 11 deletions(-) diffs (192 lines): diff -r 9dbcd10cac28 -r 5a36736445e9 src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Tue May 21 22:55:17 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Tue May 21 22:55:23 2013 +0300 @@ -284,7 +284,6 @@ if ((last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) || ret < 0) { - ctx->ufetch = NULL; cmd_urlfetch_finish(cmd); client_command_free(&cmd); } diff -r 9dbcd10cac28 -r 5a36736445e9 src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 22:55:17 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Tue May 21 22:55:23 2013 +0300 @@ -22,6 +22,7 @@ }; struct imap_urlauth_fetch { + unsigned int refcount; struct imap_urlauth_context *uctx; imap_urlauth_fetch_callback_t *callback; @@ -100,17 +101,28 @@ struct imap_urlauth_fetch *ufetch; ufetch = i_new(struct imap_urlauth_fetch, 1); + ufetch->refcount = 1; ufetch->uctx = uctx; ufetch->callback = callback; ufetch->context = context; return ufetch; } -void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **_ufetch) +static void imap_urlauth_fetch_ref(struct imap_urlauth_fetch *ufetch) +{ + i_assert(ufetch->refcount > 0); + ufetch->refcount++; +} + +static void imap_urlauth_fetch_unref(struct imap_urlauth_fetch **_ufetch) { struct imap_urlauth_fetch *ufetch = *_ufetch; + i_assert(ufetch->refcount > 0); + *_ufetch = NULL; + if (--ufetch->refcount > 0) + return; imap_urlauth_fetch_abort(ufetch); @@ -120,6 +132,11 @@ i_free(ufetch); } +void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **_ufetch) +{ + imap_urlauth_fetch_unref(_ufetch); +} + static void imap_urlauth_fetch_error(struct imap_urlauth_fetch *ufetch, const char *url, enum imap_urlauth_fetch_flags url_flags, @@ -232,6 +249,8 @@ } if (!success && ret < 0) { + if (mpurl != NULL) + imap_msgpart_url_free(&mpurl); ufetch->pending_requests--; (void)ufetch->callback(NULL, TRUE, ufetch->context); imap_urlauth_fetch_fail(ufetch); @@ -292,6 +311,8 @@ ufetch->waiting_local = FALSE; ufetch->pending_requests--; + imap_urlauth_fetch_ref(ufetch); + if (!ufetch->failed) { bool last = ufetch->pending_requests == 0 || reply == NULL; ret = ufetch->callback(reply, last, ufetch->context); @@ -305,8 +326,8 @@ } else if (ret == 0) { ufetch->waiting_service = TRUE; } - if (ret != 0) - imap_urlauth_fetch_deinit(&ufetch); + + imap_urlauth_fetch_unref(&ufetch); return ret; } @@ -319,6 +340,7 @@ struct mail_user *mail_user = uctx->user; struct imap_url *imap_url; const char *error, *errormsg; + int ret = 0; /* parse the url */ if (imap_url_parse(url, NULL, url_parse_flags, &imap_url, &error) < 0) { @@ -327,13 +349,17 @@ if (mail_user->mail_debug) i_debug("%s", errormsg); ufetch->pending_requests++; + imap_urlauth_fetch_ref(ufetch); imap_urlauth_fetch_error(ufetch, url, url_flags, errormsg); + imap_urlauth_fetch_unref(&ufetch); return 1; } ufetch->failed = FALSE; ufetch->pending_requests++; + imap_urlauth_fetch_ref(ufetch); + /* if access user and target user match, handle fetch request locally */ if (imap_url->userid != NULL && strcmp(mail_user->username, imap_url->userid) == 0) { @@ -364,17 +390,22 @@ /* create request for url */ if (imap_url != NULL && imap_url->userid != NULL) { + i_assert(uctx->conn != NULL); (void)imap_urlauth_request_new(uctx->conn, imap_url->userid, url, url_flags, imap_urlauth_fetch_request_callback, ufetch); i_assert(uctx->conn != NULL); if (imap_urlauth_connection_connect(uctx->conn) < 0) - return -1; + ret = -1; } - return (ufetch->pending_requests > 0 ? 0 : 1); + if (ret >= 0) + ret = (ufetch->pending_requests > 0 ? 0 : 1); + + imap_urlauth_fetch_unref(&ufetch); + return ret; } -bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch) +static bool imap_urlauth_fetch_do_continue(struct imap_urlauth_fetch *ufetch) { struct imap_urlauth_fetch_url *url, *url_next; int ret; @@ -390,7 +421,7 @@ ufetch->waiting_service = FALSE; imap_urlauth_connection_continue(ufetch->uctx->conn); return ufetch->pending_requests > 0; - } + } /* finished local request */ if (ufetch->local_url != NULL) { @@ -457,3 +488,15 @@ return ufetch->pending_requests > 0; } + +bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch) +{ + bool pending; + + imap_urlauth_fetch_ref(ufetch); + pending = imap_urlauth_fetch_do_continue(ufetch); + imap_urlauth_fetch_unref(&ufetch); + + return pending; +} + diff -r 9dbcd10cac28 -r 5a36736445e9 src/lib-imap-urlauth/imap-urlauth-fetch.h --- a/src/lib-imap-urlauth/imap-urlauth-fetch.h Tue May 21 22:55:17 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.h Tue May 21 22:55:23 2013 +0300 @@ -33,8 +33,7 @@ for next reply, 0 if not all data was processed, and -1 for error. If a callback returns 0, imap_urlauth_fetch_continue() must be called once new replies may be processed. If this is the last request to yield a reply, - argument last is TRUE. The callback must not call - imap_urlauth_fetch_deinit(). */ + argument last is TRUE. */ typedef int imap_urlauth_fetch_callback_t(struct imap_urlauth_fetch_reply *reply, bool last, void *context); @@ -42,7 +41,7 @@ struct imap_urlauth_fetch * imap_urlauth_fetch_init(struct imap_urlauth_context *uctx, imap_urlauth_fetch_callback_t *callback, void *context); -void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **_ufetch); +void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **ufetch); int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url, enum imap_urlauth_fetch_flags url_flags); From dovecot at dovecot.org Tue May 21 22:57:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 21 May 2013 22:57:15 +0300 Subject: dovecot-2.2: *-login: If auth failed with a specified reason, th... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b05b772ff78f changeset: 16386:b05b772ff78f user: Timo Sirainen date: Tue May 21 22:57:06 2013 +0300 description: *-login: If auth failed with a specified reason, the reason wasn't actually shown to client. diffstat: src/login-common/client-common-auth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 5a36736445e9 -r b05b772ff78f src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Tue May 21 22:55:23 2013 +0300 +++ b/src/login-common/client-common-auth.c Tue May 21 22:57:06 2013 +0300 @@ -538,7 +538,7 @@ } else { client_auth_result(client, CLIENT_AUTH_RESULT_AUTHFAILED_REASON, NULL, - AUTH_FAILED_MSG); + data); } if (!client->destroyed) From dovecot at dovecot.org Wed May 22 14:56:57 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 22 May 2013 14:56:57 +0300 Subject: dovecot-2.2: dsync: Don't notify replicator process about succes... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3984f384257e changeset: 16387:3984f384257e user: Timo Sirainen date: Wed May 22 14:56:41 2013 +0300 description: dsync: Don't notify replicator process about successful dsync if the dsync failed. diffstat: src/doveadm/dsync/doveadm-dsync.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r b05b772ff78f -r 3984f384257e src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Tue May 21 22:57:06 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Wed May 22 14:56:41 2013 +0300 @@ -949,7 +949,7 @@ o_stream_close(_ctx->conn->output); } - if (ctx->replicator_notify) + if (ctx->replicator_notify && _ctx->exit_code == 0) dsync_replicator_notify(ctx, sync_type, str_c(state_str)); return _ctx->exit_code == 0 ? 0 : -1; } From dovecot at dovecot.org Wed May 22 15:16:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 22 May 2013 15:16:33 +0300 Subject: dovecot-2.2: dsync: Fixed unsubscribing from mailbox within same... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/33efc5396e44 changeset: 16388:33efc5396e44 user: Timo Sirainen date: Wed May 22 15:16:22 2013 +0300 description: dsync: Fixed unsubscribing from mailbox within same session as the mailbox's deletion. diffstat: src/doveadm/dsync/dsync-brain-mailbox-tree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 3984f384257e -r 33efc5396e44 src/doveadm/dsync/dsync-brain-mailbox-tree.c --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Wed May 22 14:56:41 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Wed May 22 15:16:22 2013 +0300 @@ -395,8 +395,8 @@ name = dsync_mailbox_node_get_full_name(tree, node); other_node = dsync_mailbox_tree_get(other_tree, name); - if (!guid_128_is_empty(other_node->mailbox_guid) || - (other_node->existence == DSYNC_MAILBOX_NODE_EXISTS && + if (other_node->existence == DSYNC_MAILBOX_NODE_EXISTS && + (!guid_128_is_empty(other_node->mailbox_guid) || other_del->type != DSYNC_MAILBOX_DELETE_TYPE_MAILBOX)) { /* other side has already created a new mailbox or directory with this name, we can't delete it */ From dovecot at dovecot.org Wed May 22 15:44:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 22 May 2013 15:44:17 +0300 Subject: dovecot-2.2: lib-storage: Optimize SEARCH_MODSEQ query if it's h... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3b6ec8db4166 changeset: 16389:3b6ec8db4166 user: Timo Sirainen date: Wed May 22 15:44:05 2013 +0300 description: lib-storage: Optimize SEARCH_MODSEQ query if it's higher than HIGHESTMODSEQ. diffstat: src/lib-storage/index/index-search.c | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diffs (61 lines): diff -r 33efc5396e44 -r 3b6ec8db4166 src/lib-storage/index/index-search.c --- a/src/lib-storage/index/index-search.c Wed May 22 15:16:22 2013 +0300 +++ b/src/lib-storage/index/index-search.c Wed May 22 15:44:05 2013 +0300 @@ -904,12 +904,13 @@ *first_seq = seq1; } -static bool search_limit_by_flags(struct index_search_context *ctx, - struct mail_search_arg *args, - uint32_t *seq1, uint32_t *seq2) +static bool search_limit_by_hdr(struct index_search_context *ctx, + struct mail_search_arg *args, + uint32_t *seq1, uint32_t *seq2) { const struct mail_index_header *hdr; enum mail_flags pvt_flags_mask; + uint64_t highest_modseq; hdr = mail_index_get_header(ctx->view); /* we can't trust that private view's header is fully up to date, @@ -918,12 +919,23 @@ mailbox_get_private_flags_mask(ctx->box); for (; args != NULL; args = args->next) { - if (args->type != SEARCH_FLAGS) { - if (args->type == SEARCH_ALL) { - if (args->match_not) - return FALSE; + switch (args->type) { + case SEARCH_ALL: + if (args->match_not) { + /* NOT ALL - pointless noop query */ + return FALSE; } continue; + case SEARCH_MODSEQ: + /* MODSEQ higher than current HIGHESTMODSEQ? */ + highest_modseq = mail_index_modseq_get_highest(ctx->view); + if (args->value.modseq->modseq > highest_modseq) + return FALSE; + continue; + default: + continue; + case SEARCH_FLAGS: + break; } if ((args->value.flags & MAIL_SEEN) != 0 && (pvt_flags_mask & MAIL_SEEN) == 0) { @@ -995,8 +1007,10 @@ return; } - /* UNSEEN and DELETED in root search level may limit the range */ - if (!search_limit_by_flags(ctx, args, &ctx->seq1, &ctx->seq2)) { + /* See if this search query can never match based on data in index's + header. We'll scan only the root level args, which is usually + enough. */ + if (!search_limit_by_hdr(ctx, args, &ctx->seq1, &ctx->seq2)) { /* no matches */ ctx->seq1 = 1; ctx->seq2 = 0; From dovecot at dovecot.org Wed May 22 15:59:55 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 22 May 2013 15:59:55 +0300 Subject: dovecot-2.2: *-login: If ssl=required, don't list any SASL mecha... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9d21241fa792 changeset: 16391:9d21241fa792 user: Timo Sirainen date: Wed May 22 15:59:38 2013 +0300 description: *-login: If ssl=required, don't list any SASL mechanisms before STARTTLS. diffstat: src/login-common/sasl-server.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (21 lines): diff -r 787ef06c4c95 -r 9d21241fa792 src/login-common/sasl-server.c --- a/src/login-common/sasl-server.c Wed May 22 15:57:13 2013 +0300 +++ b/src/login-common/sasl-server.c Wed May 22 15:59:38 2013 +0300 @@ -13,6 +13,7 @@ #include "auth-client.h" #include "ssl-proxy.h" #include "master-service.h" +#include "master-service-ssl-settings.h" #include "master-interface.h" #include "master-auth.h" #include "client-common.h" @@ -38,7 +39,8 @@ unsigned int i, j, count; mech = auth_client_get_available_mechs(auth_client, &count); - if (count == 0) { + if (count == 0 || (!client->secured && + strcmp(client->ssl_set->ssl, "required") == 0)) { *count_r = 0; return NULL; } From dovecot at dovecot.org Wed May 22 15:59:55 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 22 May 2013 15:59:55 +0300 Subject: dovecot-2.2: *-login: ssl=required should imply disable_plaintex... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/787ef06c4c95 changeset: 16390:787ef06c4c95 user: Timo Sirainen date: Wed May 22 15:57:13 2013 +0300 description: *-login: ssl=required should imply disable_plaintext_auth=yes diffstat: src/imap-login/client.c | 4 +++- src/login-common/client-common-auth.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diffs (34 lines): diff -r 3b6ec8db4166 -r 787ef06c4c95 src/imap-login/client.c --- a/src/imap-login/client.c Wed May 22 15:44:05 2013 +0300 +++ b/src/imap-login/client.c Wed May 22 15:57:13 2013 +0300 @@ -12,6 +12,7 @@ #include "imap-id.h" #include "imap-resp-code.h" #include "master-service.h" +#include "master-service-ssl-settings.h" #include "master-auth.h" #include "client.h" #include "client-authenticate.h" @@ -64,7 +65,8 @@ if (client_is_tls_enabled(client) && !client->tls) str_append(cap_str, " STARTTLS"); - if (client->set->disable_plaintext_auth && !client->secured) + if (!client->secured & (client->set->disable_plaintext_auth || + strcmp(client->ssl_set->ssl, "required") == 0)) str_append(cap_str, " LOGINDISABLED"); client_authenticate_get_capabilities(client, cap_str); diff -r 3b6ec8db4166 -r 787ef06c4c95 src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Wed May 22 15:44:05 2013 +0300 +++ b/src/login-common/client-common-auth.c Wed May 22 15:57:13 2013 +0300 @@ -615,7 +615,8 @@ bool client_check_plaintext_auth(struct client *client, bool pass_sent) { - if (client->secured || !client->set->disable_plaintext_auth) + if (client->secured || (!client->set->disable_plaintext_auth && + strcmp(client->ssl_set->ssl, "required") != 0)) return TRUE; if (client->set->auth_verbose) { From dovecot at dovecot.org Thu May 23 17:37:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 23 May 2013 17:37:11 +0300 Subject: dovecot-2.2: lib-http: Added ssl_cert|key|key_password settings ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/af9947e1e5f7 changeset: 16392:af9947e1e5f7 user: Timo Sirainen date: Thu May 23 17:36:54 2013 +0300 description: lib-http: Added ssl_cert|key|key_password settings to be passed to ssl-iostream. These are used for sending client's SSL certificate. diffstat: src/lib-http/http-client.c | 6 ++++++ src/lib-http/http-client.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diffs (35 lines): diff -r 9d21241fa792 -r af9947e1e5f7 src/lib-http/http-client.c --- a/src/lib-http/http-client.c Wed May 22 15:59:38 2013 +0300 +++ b/src/lib-http/http-client.c Thu May 23 17:36:54 2013 +0300 @@ -86,6 +86,9 @@ client->set.ssl_ca = p_strdup(pool, set->ssl_ca); client->set.ssl_crypto_device = p_strdup(pool, set->ssl_crypto_device); client->set.ssl_allow_invalid_cert = set->ssl_allow_invalid_cert; + client->set.ssl_cert = p_strdup(pool, set->ssl_cert); + client->set.ssl_key = p_strdup(pool, set->ssl_key); + client->set.ssl_key_password = p_strdup(pool, set->ssl_key_password); client->set.max_idle_time_msecs = set->max_idle_time_msecs; client->set.max_parallel_connections = (set->max_parallel_connections > 0 ? set->max_parallel_connections : 1); @@ -197,6 +200,9 @@ ssl_set.ca = client->set.ssl_ca; ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = client->set.ssl_crypto_device; + ssl_set.cert = client->set.ssl_cert; + ssl_set.key = client->set.ssl_key; + ssl_set.key_password = client->set.ssl_key_password; ssl_set.verbose = client->set.debug; ssl_set.verbose_invalid_cert = client->set.debug; diff -r 9d21241fa792 -r af9947e1e5f7 src/lib-http/http-client.h --- a/src/lib-http/http-client.h Wed May 22 15:59:38 2013 +0300 +++ b/src/lib-http/http-client.h Thu May 23 17:36:54 2013 +0300 @@ -36,6 +36,8 @@ const char *ssl_ca_dir, *ssl_ca_file, *ssl_ca; const char *ssl_crypto_device; bool ssl_allow_invalid_cert; + /* user cert */ + const char *ssl_cert, *ssl_key, *ssl_key_password; const char *rawlog_dir; From pigeonhole at rename-it.nl Fri May 24 14:12:30 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 24 May 2013 13:12:30 +0200 Subject: dovecot-2.2-pigeonhole: Merged changes from Pigeonhole v0.3 tree. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/eff46ace3456 changeset: 1778:eff46ace3456 user: Stephan Bosch date: Fri May 24 13:12:24 2013 +0200 description: Merged changes from Pigeonhole v0.3 tree. diffstat: doc/example-config/conf.d/20-managesieve.conf | 2 +- src/managesieve-login/client.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diffs (27 lines): diff -r d4e9ca7fddcf -r eff46ace3456 doc/example-config/conf.d/20-managesieve.conf --- a/doc/example-config/conf.d/20-managesieve.conf Mon May 20 21:20:04 2013 +0200 +++ b/doc/example-config/conf.d/20-managesieve.conf Fri May 24 13:12:24 2013 +0200 @@ -30,7 +30,7 @@ #service managesieve { # Max. number of ManageSieve processes (connections) - #process_count = 1024 + #process_limit = 1024 #} # Service configuration diff -r d4e9ca7fddcf -r eff46ace3456 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Mon May 20 21:20:04 2013 +0200 +++ b/src/managesieve-login/client.c Fri May 24 13:12:24 2013 +0200 @@ -382,9 +382,9 @@ str_append(line, prefix); if (resp_code != NULL) { - str_append(line, " ["); + str_append(line, " ("); str_append(line, resp_code); - str_append_c(line, ']'); + str_append_c(line, ')'); } if ( text != NULL ) { From pigeonhole at rename-it.nl Fri May 24 14:12:30 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 24 May 2013 13:12:30 +0200 Subject: dovecot-2.2-pigeonhole: managesieve-login: Fixed '[' ']' stupidi... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/d4ae981567e1 changeset: 1777:d4ae981567e1 user: Stephan Bosch date: Fri May 24 13:07:23 2013 +0200 description: managesieve-login: Fixed '[' ']' stupidity for response codes. Emerged when Sieve and ManageSieve were merged into Pigeonhole. diffstat: src/managesieve-login/client.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (15 lines): diff -r 7319f0becc98 -r d4ae981567e1 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Sun May 12 19:14:18 2013 +0200 +++ b/src/managesieve-login/client.c Fri May 24 13:07:23 2013 +0200 @@ -372,9 +372,9 @@ str_append(line, oknobye); if (resp_code != NULL) { - str_append(line, " ["); + str_append(line, " ("); str_append(line, resp_code); - str_append_c(line, ']'); + str_append_c(line, ')'); } if ( msg != NULL ) From pigeonhole at rename-it.nl Fri May 24 14:12:30 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 24 May 2013 13:12:30 +0200 Subject: dovecot-2.2-pigeonhole: Fixed setting name in example-config/con... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/7319f0becc98 changeset: 1776:7319f0becc98 user: Stephan Bosch date: Sun May 12 19:14:18 2013 +0200 description: Fixed setting name in example-config/conf.d/20-managesieve.conf. diffstat: doc/example-config/conf.d/20-managesieve.conf | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 34cb3668f86d -r 7319f0becc98 doc/example-config/conf.d/20-managesieve.conf --- a/doc/example-config/conf.d/20-managesieve.conf Thu May 09 15:21:43 2013 +0200 +++ b/doc/example-config/conf.d/20-managesieve.conf Sun May 12 19:14:18 2013 +0200 @@ -30,7 +30,7 @@ #service managesieve { # Max. number of ManageSieve processes (connections) - #process_count = 1024 + #process_limit = 1024 #} # Service configuration From pigeonhole at rename-it.nl Fri May 24 14:12:42 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 24 May 2013 13:12:42 +0200 Subject: dovecot-2.1-pigeonhole: managesieve-login: Fixed '[' ']' stupidi... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/d4ae981567e1 changeset: 1692:d4ae981567e1 user: Stephan Bosch date: Fri May 24 13:07:23 2013 +0200 description: managesieve-login: Fixed '[' ']' stupidity for response codes. Emerged when Sieve and ManageSieve were merged into Pigeonhole. diffstat: src/managesieve-login/client.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (15 lines): diff -r 7319f0becc98 -r d4ae981567e1 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Sun May 12 19:14:18 2013 +0200 +++ b/src/managesieve-login/client.c Fri May 24 13:07:23 2013 +0200 @@ -372,9 +372,9 @@ str_append(line, oknobye); if (resp_code != NULL) { - str_append(line, " ["); + str_append(line, " ("); str_append(line, resp_code); - str_append_c(line, ']'); + str_append_c(line, ')'); } if ( msg != NULL ) From pigeonhole at rename-it.nl Fri May 24 14:12:53 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 24 May 2013 13:12:53 +0200 Subject: dovecot-2.0-pigeonhole: managesieve-login: Fixed '[' ']' stupidi... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/5e61de7d3196 changeset: 1560:5e61de7d3196 user: Stephan Bosch date: Fri May 24 13:07:23 2013 +0200 description: managesieve-login: Fixed '[' ']' stupidity for response codes. Emerged when Sieve and ManageSieve were merged into Pigeonhole. diffstat: src/managesieve-login/client.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (15 lines): diff -r e42a38f02d28 -r 5e61de7d3196 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Tue Nov 20 00:17:45 2012 +0100 +++ b/src/managesieve-login/client.c Fri May 24 13:07:23 2013 +0200 @@ -341,9 +341,9 @@ str_append(line, oknobye); if (resp_code != NULL) { - str_append(line, " ["); + str_append(line, " ("); str_append(line, resp_code); - str_append_c(line, ']'); + str_append_c(line, ')'); } if ( msg != NULL ) From dovecot at dovecot.org Sun May 26 19:05:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 19:05:37 +0300 Subject: dovecot-2.2: lib-index: mail_cache_lookup*() can now return fiel... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b9a312951881 changeset: 16393:b9a312951881 user: Timo Sirainen date: Sun May 26 19:04:00 2013 +0300 description: lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add() Previously it was returning them if they had already been written to dovecot.index.cache, but not if they were still in the in-memory buffer. This avoids caching/parsing the same field multiple times when messages aren't accessed in ascending order (e.g. when sorting messages). diffstat: src/lib-index/mail-cache-lookup.c | 39 +++++++++++++++++++++++---- src/lib-index/mail-cache-private.h | 9 +++++- src/lib-index/mail-cache-transaction.c | 47 +++++++++++++++++++++++++++------ 3 files changed, 79 insertions(+), 16 deletions(-) diffs (215 lines): diff -r af9947e1e5f7 -r b9a312951881 src/lib-index/mail-cache-lookup.c --- a/src/lib-index/mail-cache-lookup.c Thu May 23 17:36:54 2013 +0300 +++ b/src/lib-index/mail-cache-lookup.c Sun May 26 19:04:00 2013 +0300 @@ -163,31 +163,58 @@ memset(&view->loop_track, 0, sizeof(view->loop_track)); } +static bool +mail_cache_lookup_iter_transaction(struct mail_cache_lookup_iterate_ctx *ctx) +{ + ctx->rec = mail_cache_transaction_lookup_rec(ctx->view->transaction, + ctx->seq, + &ctx->trans_next_idx); + if (ctx->rec == NULL) + return FALSE; + + ctx->remap_counter = ctx->view->cache->remap_counter; + ctx->pos = sizeof(*ctx->rec); + ctx->rec_size = ctx->rec->size; + return TRUE; +} + static int mail_cache_lookup_iter_next_record(struct mail_cache_lookup_iterate_ctx *ctx) { struct mail_cache_view *view = ctx->view; - if (ctx->stop) - return ctx->failed ? -1 : 0; + if (ctx->failed) + return -1; if (ctx->rec != NULL) ctx->offset = ctx->rec->prev_offset; if (ctx->offset == 0) { /* end of this record list. check newly appended data. */ - if (ctx->appends_checked || - view->trans_seq1 > ctx->seq || + if (view->trans_seq1 > ctx->seq || view->trans_seq2 < ctx->seq || - MAIL_CACHE_IS_UNUSABLE(view->cache) || + MAIL_CACHE_IS_UNUSABLE(view->cache)) + return 0; + /* check data still in memory */ + if (!ctx->memory_appends_checked) { + if (mail_cache_lookup_iter_transaction(ctx)) + return 1; + ctx->memory_appends_checked = TRUE; + } + + /* check data already written to cache file */ + if (ctx->disk_appends_checked || mail_cache_lookup_offset(view->cache, view->trans_view, ctx->seq, &ctx->offset) <= 0) return 0; - ctx->appends_checked = TRUE; + ctx->disk_appends_checked = TRUE; ctx->remap_counter = view->cache->remap_counter; memset(&view->loop_track, 0, sizeof(view->loop_track)); } + if (ctx->stop) + return 0; + /* look up the next record */ if (mail_cache_get_record(view->cache, ctx->offset, &ctx->rec) < 0) return -1; diff -r af9947e1e5f7 -r b9a312951881 src/lib-index/mail-cache-private.h --- a/src/lib-index/mail-cache-private.h Thu May 23 17:36:54 2013 +0300 +++ b/src/lib-index/mail-cache-private.h Sun May 26 19:04:00 2013 +0300 @@ -202,9 +202,12 @@ unsigned int pos, rec_size; uint32_t offset; + unsigned int trans_next_idx; + unsigned int stop:1; unsigned int failed:1; - unsigned int appends_checked:1; + unsigned int memory_appends_checked:1; + unsigned int disk_appends_checked:1; }; /* Explicitly lock the cache file. Returns -1 if error / timed out, @@ -243,6 +246,10 @@ /* Returns 1 if field was returned, 0 if end of fields, or -1 if error */ int mail_cache_lookup_iter_next(struct mail_cache_lookup_iterate_ctx *ctx, struct mail_cache_iterate_field *field_r); +const struct mail_cache_record * +mail_cache_transaction_lookup_rec(struct mail_cache_transaction_ctx *ctx, + unsigned int seq, + unsigned int *trans_next_idx); int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size, const void **data_r); diff -r af9947e1e5f7 -r b9a312951881 src/lib-index/mail-cache-transaction.c --- a/src/lib-index/mail-cache-transaction.c Thu May 23 17:36:54 2013 +0300 +++ b/src/lib-index/mail-cache-transaction.c Sun May 26 19:04:00 2013 +0300 @@ -21,6 +21,11 @@ #define CACHE_TRANS_CONTEXT(obj) \ MODULE_CONTEXT(obj, cache_mail_index_transaction_module) +struct mail_cache_transaction_rec { + uint32_t seq; + uint32_t cache_data_pos; +}; + struct mail_cache_transaction_ctx { union mail_index_transaction_module_context module_ctx; struct mail_index_transaction_vfuncs super; @@ -33,7 +38,7 @@ uint32_t first_new_seq; buffer_t *cache_data; - ARRAY(uint32_t) cache_data_seq; + ARRAY(struct mail_cache_transaction_rec) cache_data_seq; uint32_t prev_seq, min_seq; size_t last_rec_pos; @@ -272,13 +277,33 @@ return 1; } +const struct mail_cache_record * +mail_cache_transaction_lookup_rec(struct mail_cache_transaction_ctx *ctx, + unsigned int seq, + unsigned int *trans_next_idx) +{ + const struct mail_cache_transaction_rec *recs; + unsigned int i, count; + + recs = array_get(&ctx->cache_data_seq, &count); + for (i = *trans_next_idx; i < count; i++) { + if (recs[i].seq == seq) { + *trans_next_idx = i + 1; + return CONST_PTR_OFFSET(ctx->cache_data->data, + recs[i].cache_data_pos); + } + } + *trans_next_idx = i; + return NULL; +} + static int mail_cache_transaction_update_index(struct mail_cache_transaction_ctx *ctx, uint32_t write_offset) { struct mail_cache *cache = ctx->cache; const struct mail_cache_record *rec = ctx->cache_data->data; - const uint32_t *seqs; + const struct mail_cache_transaction_rec *recs; uint32_t i, seq_count; mail_index_ext_using_reset_id(ctx->trans, ctx->cache->ext_id, @@ -287,9 +312,9 @@ /* write the cache_offsets to index file. records' prev_offset is updated to point to old cache record when index is being synced. */ - seqs = array_get(&ctx->cache_data_seq, &seq_count); + recs = array_get(&ctx->cache_data_seq, &seq_count); for (i = 0; i < seq_count; i++) { - mail_index_update_ext(ctx->trans, seqs[i], cache->ext_id, + mail_index_update_ext(ctx->trans, recs[i].seq, cache->ext_id, &write_offset, NULL); write_offset += rec->size; @@ -304,7 +329,8 @@ { struct mail_index_map *map; struct mail_cache_record *rec; - const uint32_t *seqs, *prev_offsetp; + const struct mail_cache_transaction_rec *recs; + const uint32_t *prev_offsetp; ARRAY_TYPE(uint32_t) seq_offsets; uint32_t i, seq_count, reset_id, prev_offset, *offsetp; const void *data; @@ -312,15 +338,15 @@ i_assert(ctx->min_seq != 0); i_array_init(&seq_offsets, 64); - seqs = array_get(&ctx->cache_data_seq, &seq_count); + recs = array_get(&ctx->cache_data_seq, &seq_count); rec = buffer_get_modifiable_data(ctx->cache_data, NULL); for (i = 0; i < seq_count; i++) { offsetp = array_idx_modifiable(&seq_offsets, - seqs[i] - ctx->min_seq); + recs[i].seq - ctx->min_seq); if (*offsetp != 0) prev_offset = *offsetp; else { - mail_index_lookup_ext_full(ctx->view->trans_view, seqs[i], + mail_index_lookup_ext_full(ctx->view->trans_view, recs[i].seq, ctx->cache->ext_id, &map, &data, NULL); prev_offsetp = data; @@ -423,6 +449,7 @@ static void mail_cache_transaction_update_last_rec(struct mail_cache_transaction_ctx *ctx) { + struct mail_cache_transaction_rec *trans_rec; struct mail_cache_record *rec; void *data; size_t size; @@ -439,7 +466,9 @@ if (ctx->min_seq > ctx->prev_seq || ctx->min_seq == 0) ctx->min_seq = ctx->prev_seq; - array_append(&ctx->cache_data_seq, &ctx->prev_seq, 1); + trans_rec = array_append_space(&ctx->cache_data_seq); + trans_rec->seq = ctx->prev_seq; + trans_rec->cache_data_pos = ctx->last_rec_pos; ctx->last_rec_pos = size; } From dovecot at dovecot.org Sun May 26 19:14:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 19:14:44 +0300 Subject: dovecot-2.2: dbox: Added support for POP3 message order. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8ee242b6e417 changeset: 16394:8ee242b6e417 user: Timo Sirainen date: Sun May 26 19:14:21 2013 +0300 description: dbox: Added support for POP3 message order. diffstat: src/doveadm/doveadm-dump-dbox.c | 3 +++ src/lib-storage/index/dbox-common/dbox-file.h | 2 ++ src/lib-storage/index/dbox-common/dbox-mail.c | 23 ++++++++++++++++++++--- src/lib-storage/index/dbox-common/dbox-save.c | 4 ++++ src/lib-storage/index/index-mail.c | 5 +++++ src/lib-storage/index/index-mail.h | 1 + 6 files changed, 35 insertions(+), 3 deletions(-) diffs (124 lines): diff -r b9a312951881 -r 8ee242b6e417 src/doveadm/doveadm-dump-dbox.c --- a/src/doveadm/doveadm-dump-dbox.c Sun May 26 19:04:00 2013 +0300 +++ b/src/doveadm/doveadm-dump-dbox.c Sun May 26 19:14:21 2013 +0300 @@ -148,6 +148,9 @@ case DBOX_METADATA_POP3_UIDL: printf("msg.pop3-uidl = %s\n", line + 1); break; + case DBOX_METADATA_POP3_ORDER: + printf("msg.pop3-order = %s\n", line + 1); + break; case DBOX_METADATA_RECEIVED_TIME: dump_timestamp(input, "msg.received", line + 1); break; diff -r b9a312951881 -r 8ee242b6e417 src/lib-storage/index/dbox-common/dbox-file.h --- a/src/lib-storage/index/dbox-common/dbox-file.h Sun May 26 19:04:00 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-file.h Sun May 26 19:14:21 2013 +0300 @@ -45,6 +45,8 @@ DBOX_METADATA_GUID = 'G', /* POP3 UIDL overriding the default format */ DBOX_METADATA_POP3_UIDL = 'P', + /* POP3 message ordering (for migrated mails) */ + DBOX_METADATA_POP3_ORDER = 'O', /* Received UNIX timestamp in hex */ DBOX_METADATA_RECEIVED_TIME = 'R', /* Physical message size in hex. Necessary only if it differs from diff -r b9a312951881 -r 8ee242b6e417 src/lib-storage/index/dbox-common/dbox-mail.c --- a/src/lib-storage/index/dbox-common/dbox-mail.c Sun May 26 19:04:00 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-mail.c Sun May 26 19:14:21 2013 +0300 @@ -165,12 +165,19 @@ INDEX_STORAGE_CONTEXT(imail->mail.mail.box); const char *value; string_t *str; + uint32_t order; str = str_new(imail->mail.data_pool, 64); if (mail_cache_lookup_field(imail->mail.mail.transaction->cache_view, str, imail->mail.mail.seq, ibox->cache_fields[cache_field].idx) > 0) { - *value_r = str_c(str); + if (cache_field != MAIL_CACHE_POP3_ORDER) + *value_r = str_c(str); + else { + i_assert(str_len(str) == sizeof(order)); + memcpy(&order, str_data(str), sizeof(order)); + *value_r = dec2str(order); + } return 0; } @@ -179,8 +186,15 @@ if (value == NULL) value = ""; - index_mail_cache_add_idx(imail, ibox->cache_fields[cache_field].idx, - value, strlen(value)+1); + if (cache_field != MAIL_CACHE_POP3_ORDER) { + index_mail_cache_add_idx(imail, ibox->cache_fields[cache_field].idx, + value, strlen(value)+1); + } else { + if (str_to_uint(value, &order) < 0) + order = 0; + index_mail_cache_add_idx(imail, ibox->cache_fields[cache_field].idx, + &order, sizeof(order)); + } /* don't return pointer to dbox metadata directly, since it may change unexpectedly */ @@ -202,6 +216,9 @@ case MAIL_FETCH_UIDL_BACKEND: return dbox_get_cached_metadata(mail, DBOX_METADATA_POP3_UIDL, MAIL_CACHE_POP3_UIDL, value_r); + case MAIL_FETCH_POP3_ORDER: + return dbox_get_cached_metadata(mail, DBOX_METADATA_POP3_ORDER, + MAIL_CACHE_POP3_ORDER, value_r); case MAIL_FETCH_GUID: return dbox_get_cached_metadata(mail, DBOX_METADATA_GUID, MAIL_CACHE_GUID, value_r); diff -r b9a312951881 -r 8ee242b6e417 src/lib-storage/index/dbox-common/dbox-save.c --- a/src/lib-storage/index/dbox-common/dbox-save.c Sun May 26 19:04:00 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-save.c Sun May 26 19:14:21 2013 +0300 @@ -164,6 +164,10 @@ str_printfa(str, "%c%s\n", DBOX_METADATA_POP3_UIDL, mdata->pop3_uidl); } + if (mdata->pop3_order != 0) { + str_printfa(str, "%c%u\n", DBOX_METADATA_POP3_ORDER, + mdata->pop3_order); + } guid = mdata->guid; if (guid != NULL) diff -r b9a312951881 -r 8ee242b6e417 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Sun May 26 19:04:00 2013 +0300 +++ b/src/lib-storage/index/index-mail.c Sun May 26 19:14:21 2013 +0300 @@ -46,6 +46,9 @@ .type = MAIL_CACHE_FIELD_STRING }, { .name = "pop3.uidl", .type = MAIL_CACHE_FIELD_STRING }, + { .name = "pop3.order", + .type = MAIL_CACHE_FIELD_FIXED_SIZE, + .field_size = sizeof(uint32_t) }, { .name = "guid", .type = MAIL_CACHE_FIELD_STRING }, { .name = "mime.parts", @@ -1871,6 +1874,8 @@ (void)mail_get_physical_size(mail, &size); if ((cache & MAIL_FETCH_UIDL_BACKEND) != 0) (void)mail_get_special(mail, MAIL_FETCH_UIDL_BACKEND, &str); + if ((cache & MAIL_FETCH_POP3_ORDER) != 0) + (void)mail_get_special(mail, MAIL_FETCH_POP3_ORDER, &str); if ((cache & MAIL_FETCH_GUID) != 0) (void)mail_get_special(mail, MAIL_FETCH_GUID, &str); } diff -r b9a312951881 -r 8ee242b6e417 src/lib-storage/index/index-mail.h --- a/src/lib-storage/index/index-mail.h Sun May 26 19:04:00 2013 +0300 +++ b/src/lib-storage/index/index-mail.h Sun May 26 19:14:21 2013 +0300 @@ -19,6 +19,7 @@ MAIL_CACHE_IMAP_BODYSTRUCTURE, MAIL_CACHE_IMAP_ENVELOPE, MAIL_CACHE_POP3_UIDL, + MAIL_CACHE_POP3_ORDER, MAIL_CACHE_GUID, MAIL_CACHE_MESSAGE_PARTS, MAIL_CACHE_BINARY_PARTS, From dovecot at dovecot.org Sun May 26 21:07:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 21:07:15 +0300 Subject: dovecot-2.2: imapc: Pass through SPECIAL-USE LIST flags if imapc... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e0f7eb1c8e42 changeset: 16395:e0f7eb1c8e42 user: Timo Sirainen date: Sun May 26 21:07:09 2013 +0300 description: imapc: Pass through SPECIAL-USE LIST flags if imapc is in INBOX namespace. diffstat: src/lib-storage/index/imapc/imapc-list.c | 78 ++++++++++++++++++++++++++++--- src/lib-storage/mailbox-list.h | 13 ++++- 2 files changed, 81 insertions(+), 10 deletions(-) diffs (146 lines): diff -r 8ee242b6e417 -r e0f7eb1c8e42 src/lib-storage/index/imapc/imapc-list.c --- a/src/lib-storage/index/imapc/imapc-list.c Sun May 26 19:14:21 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-list.c Sun May 26 21:07:09 2013 +0300 @@ -18,6 +18,26 @@ struct mailbox_tree_iterate_context *iter; struct mailbox_info info; + string_t *special_use; +}; + +static struct { + const char *str; + enum mailbox_info_flags flag; +} imap_list_flags[] = { + { "\\NoSelect", MAILBOX_NOSELECT }, + { "\\NonExistent", MAILBOX_NONEXISTENT }, + { "\\NoInferiors", MAILBOX_NOINFERIORS }, + { "\\Subscribed", MAILBOX_SUBSCRIBED }, + { "\\Subscribed", MAILBOX_SUBSCRIBED }, + { "\\All", MAILBOX_SPECIALUSE_ALL }, + { "\\Archive", MAILBOX_SPECIALUSE_ARCHIVE }, + { "\\Drafts", MAILBOX_SPECIALUSE_DRAFTS }, + { "\\Flagged", MAILBOX_SPECIALUSE_FLAGGED }, + { "\\Junk", MAILBOX_SPECIALUSE_JUNK }, + { "\\Sent", MAILBOX_SPECIALUSE_SENT }, + { "\\Trash", MAILBOX_SPECIALUSE_TRASH }, + { "\\Important", MAILBOX_SPECIALUSE_IMPORTANT } }; extern struct mailbox_list imapc_mailbox_list; @@ -63,6 +83,20 @@ } } +static bool +imap_list_flag_parse(const char *str, enum mailbox_info_flags *flag_r) +{ + unsigned int i; + + for (i = 0; i < N_ELEMENTS(imap_list_flags); i++) { + if (strcasecmp(str, imap_list_flags[i].str) == 0) { + *flag_r = imap_list_flags[i].flag; + return TRUE; + } + } + return FALSE; +} + static struct mailbox_node * imapc_list_update_tree(struct imapc_mailbox_list *list, struct mailbox_tree_context *tree, @@ -71,7 +105,7 @@ struct mailbox_node *node; const struct imap_arg *flags; const char *name, *flag; - enum mailbox_info_flags info_flags = 0; + enum mailbox_info_flags info_flag, info_flags = 0; bool created; if (!imap_arg_get_list(&args[0], &flags) || @@ -80,14 +114,8 @@ return NULL; while (imap_arg_get_atom(flags, &flag)) { - if (strcasecmp(flag, "\\NoSelect") == 0) - info_flags |= MAILBOX_NOSELECT; - else if (strcasecmp(flag, "\\NonExistent") == 0) - info_flags |= MAILBOX_NONEXISTENT; - else if (strcasecmp(flag, "\\NoInferiors") == 0) - info_flags |= MAILBOX_NOINFERIORS; - else if (strcasecmp(flag, "\\Subscribed") == 0) - info_flags |= MAILBOX_SUBSCRIBED; + if (imap_list_flag_parse(flag, &info_flag)) + info_flags |= info_flag; flags++; } @@ -450,6 +478,31 @@ return &ctx->ctx; } +static void +imapc_list_write_special_use(struct imapc_mailbox_list_iterate_context *ctx, + struct mailbox_node *node) +{ + unsigned int i; + + if (ctx->special_use == NULL) + ctx->special_use = str_new(ctx->ctx.pool, 64); + str_truncate(ctx->special_use, 0); + + for (i = 0; i < N_ELEMENTS(imap_list_flags); i++) { + if ((node->flags & imap_list_flags[i].flag) != 0) { + str_append(ctx->special_use, imap_list_flags[i].str); + str_append_c(ctx->special_use, ' '); + } + } + + if (str_len(ctx->special_use) > 0) { + str_truncate(ctx->special_use, str_len(ctx->special_use) - 1); + ctx->info.special_use = str_c(ctx->special_use); + } else { + ctx->info.special_use = NULL; + } +} + static const struct mailbox_info * imapc_list_iter_next(struct mailbox_list_iterate_context *_ctx) { @@ -472,6 +525,13 @@ ctx->info.vname = vname; ctx->info.flags = node->flags; + if ((_ctx->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) { + /* we're iterating the INBOX namespace. pass through the + SPECIAL-USE flags if they exist. */ + imapc_list_write_special_use(ctx, node); + } else { + ctx->info.special_use = NULL; + } return &ctx->info; } diff -r 8ee242b6e417 -r e0f7eb1c8e42 src/lib-storage/mailbox-list.h --- a/src/lib-storage/mailbox-list.h Sun May 26 19:14:21 2013 +0300 +++ b/src/lib-storage/mailbox-list.h Sun May 26 21:07:09 2013 +0300 @@ -48,7 +48,18 @@ MAILBOX_CHILD_SUBSCRIBED = 0x100, MAILBOX_CHILD_SPECIALUSE = 0x200, - /* Internally used by lib-storage */ + /* Internally used by lib-storage, use mailbox_info.special_use + to actually access these: */ + MAILBOX_SPECIALUSE_ALL = 0x00010000, + MAILBOX_SPECIALUSE_ARCHIVE = 0x00020000, + MAILBOX_SPECIALUSE_DRAFTS = 0x00040000, + MAILBOX_SPECIALUSE_FLAGGED = 0x00080000, + MAILBOX_SPECIALUSE_JUNK = 0x00100000, + MAILBOX_SPECIALUSE_SENT = 0x00200000, + MAILBOX_SPECIALUSE_TRASH = 0x00400000, + MAILBOX_SPECIALUSE_IMPORTANT = 0x00800000, + + /* Internally used by lib-storage: */ MAILBOX_SELECT = 0x20000000, MAILBOX_MATCHED = 0x40000000 }; From dovecot at dovecot.org Sun May 26 21:20:53 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 21:20:53 +0300 Subject: dovecot-2.2: dsync: Small code cleanup. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2d6a3035a6f7 changeset: 16396:2d6a3035a6f7 user: Timo Sirainen date: Sun May 26 21:20:47 2013 +0300 description: dsync: Small code cleanup. diffstat: src/doveadm/dsync/doveadm-dsync.c | 21 ++++++++++++--------- src/doveadm/dsync/dsync-brain.c | 31 ++++++++++++++++--------------- src/doveadm/dsync/dsync-brain.h | 20 ++++++++++++++++---- 3 files changed, 44 insertions(+), 28 deletions(-) diffs (143 lines): diff -r e0f7eb1c8e42 -r 2d6a3035a6f7 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Sun May 26 21:07:09 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Sun May 26 21:20:47 2013 +0300 @@ -486,16 +486,22 @@ struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx; struct dsync_ibc *ibc, *ibc2 = NULL; struct dsync_brain *brain; - struct mail_namespace *sync_ns = NULL; + struct dsync_brain_settings set; enum dsync_brain_flags brain_flags; bool remote_errors_logged = FALSE; int status = 0, ret = 0; + memset(&set, 0, sizeof(set)); + set.sync_box = ctx->mailbox; + memcpy(set.sync_box_guid, ctx->mailbox_guid, sizeof(set.sync_box_guid)); + set.lock_timeout_secs = ctx->lock_timeout; + set.state = ctx->state_input; + user->dsyncing = TRUE; if (ctx->namespace_prefix != NULL) { - sync_ns = mail_namespace_find(user->namespaces, - ctx->namespace_prefix); + set.sync_ns = mail_namespace_find(user->namespaces, + ctx->namespace_prefix); } if (ctx->run_type == DSYNC_RUN_TYPE_LOCAL) @@ -524,12 +530,9 @@ brain_flags |= DSYNC_BRAIN_FLAG_NO_MAIL_SYNC; if (doveadm_debug) brain_flags |= DSYNC_BRAIN_FLAG_DEBUG; - brain = dsync_brain_master_init(user, ibc, sync_ns, ctx->mailbox, - ctx->mailbox_guid, - ctx->sync_type, brain_flags, - ctx->lock_timeout, - ctx->state_input == NULL ? "" : - ctx->state_input); + + brain = dsync_brain_master_init(user, ibc, ctx->sync_type, + brain_flags, &set); if (ctx->run_type == DSYNC_RUN_TYPE_LOCAL) { if (cmd_dsync_run_local(ctx, user, brain, ibc2) < 0) diff -r e0f7eb1c8e42 -r 2d6a3035a6f7 src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Sun May 26 21:07:09 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Sun May 26 21:20:47 2013 +0300 @@ -86,32 +86,32 @@ struct dsync_brain * dsync_brain_master_init(struct mail_user *user, struct dsync_ibc *ibc, - struct mail_namespace *sync_ns, const char *sync_box, - const guid_128_t sync_box_guid, enum dsync_brain_sync_type sync_type, - enum dsync_brain_flags flags, unsigned int lock_timeout, - const char *state) + enum dsync_brain_flags flags, + const struct dsync_brain_settings *set) { struct dsync_ibc_settings ibc_set; struct dsync_brain *brain; const char *error; i_assert(sync_type != DSYNC_BRAIN_SYNC_TYPE_UNKNOWN); - i_assert(sync_type != DSYNC_BRAIN_SYNC_TYPE_STATE || *state != '\0'); + i_assert(sync_type != DSYNC_BRAIN_SYNC_TYPE_STATE || + (set->state != NULL && *set->state != '\0')); brain = dsync_brain_common_init(user, ibc); brain->sync_type = sync_type; - if (sync_ns != NULL) - brain->sync_ns = sync_ns; - brain->sync_box = p_strdup(brain->pool, sync_box); - memcpy(brain->sync_box_guid, sync_box_guid, sizeof(brain->sync_box_guid)); - brain->lock_timeout = lock_timeout; + if (set->sync_ns != NULL) + brain->sync_ns = set->sync_ns; + brain->sync_box = p_strdup(brain->pool, set->sync_box); + memcpy(brain->sync_box_guid, set->sync_box_guid, + sizeof(brain->sync_box_guid)); + brain->lock_timeout = set->lock_timeout_secs; brain->master_brain = TRUE; dsync_brain_set_flags(brain, flags); if (sync_type == DSYNC_BRAIN_SYNC_TYPE_STATE && dsync_mailbox_states_import(brain->mailbox_states, - brain->pool, state, &error) < 0) { + brain->pool, set->state, &error) < 0) { hash_table_clear(brain->mailbox_states, FALSE); i_error("Saved sync state is invalid, " "falling back to full sync: %s", error); @@ -121,12 +121,13 @@ memset(&ibc_set, 0, sizeof(ibc_set)); ibc_set.hostname = my_hostdomain(); - ibc_set.sync_ns_prefix = sync_ns == NULL ? NULL : sync_ns->prefix; - ibc_set.sync_box = sync_box; - memcpy(ibc_set.sync_box_guid, sync_box_guid, + ibc_set.sync_ns_prefix = set->sync_ns == NULL ? NULL : + set->sync_ns->prefix; + ibc_set.sync_box = set->sync_box; + memcpy(ibc_set.sync_box_guid, set->sync_box_guid, sizeof(ibc_set.sync_box_guid)); ibc_set.sync_type = sync_type; - ibc_set.lock_timeout = lock_timeout; + ibc_set.lock_timeout = set->lock_timeout_secs; /* reverse the backup direction for the slave */ ibc_set.brain_flags = flags & ~(DSYNC_BRAIN_FLAG_BACKUP_SEND | DSYNC_BRAIN_FLAG_BACKUP_RECV); diff -r e0f7eb1c8e42 -r 2d6a3035a6f7 src/doveadm/dsync/dsync-brain.h --- a/src/doveadm/dsync/dsync-brain.h Sun May 26 21:07:09 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.h Sun May 26 21:20:47 2013 +0300 @@ -30,13 +30,25 @@ DSYNC_BRAIN_SYNC_TYPE_STATE }; +struct dsync_brain_settings { + /* Sync only this namespace */ + struct mail_namespace *sync_ns; + /* Sync only this mailbox name */ + const char *sync_box; + /* Sync only this mailbox GUID */ + guid_128_t sync_box_guid; + + /* If non-zero, use dsync lock file for this user */ + unsigned int lock_timeout_secs; + /* Input state for DSYNC_BRAIN_SYNC_TYPE_STATE */ + const char *state; +}; + struct dsync_brain * dsync_brain_master_init(struct mail_user *user, struct dsync_ibc *ibc, - struct mail_namespace *sync_ns, const char *sync_box, - const guid_128_t sync_box_guid, enum dsync_brain_sync_type sync_type, - enum dsync_brain_flags flags, unsigned int lock_timeout, - const char *state); + enum dsync_brain_flags flags, + const struct dsync_brain_settings *set); struct dsync_brain * dsync_brain_slave_init(struct mail_user *user, struct dsync_ibc *ibc); /* Returns 0 if everything was successful, -1 if syncing failed in some way */ From dovecot at dovecot.org Sun May 26 21:45:01 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 21:45:01 +0300 Subject: dovecot-2.2: imapc: Fixed assert-crash when copying messages. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0b02dc66e9f1 changeset: 16397:0b02dc66e9f1 user: Timo Sirainen date: Sun May 26 21:44:50 2013 +0300 description: imapc: Fixed assert-crash when copying messages. diffstat: src/lib-storage/index/imapc/imapc-save.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 2d6a3035a6f7 -r 0b02dc66e9f1 src/lib-storage/index/imapc/imapc-save.c --- a/src/lib-storage/index/imapc/imapc-save.c Sun May 26 21:20:47 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-save.c Sun May 26 21:44:50 2013 +0300 @@ -422,6 +422,7 @@ while (sctx.ret == -2) imapc_storage_run(src_mbox->storage); ctx->finished = TRUE; + index_save_context_free(_ctx); return sctx.ret; } return mail_storage_copy(_ctx, mail); From dovecot at dovecot.org Sun May 26 21:45:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 26 May 2013 21:45:38 +0300 Subject: dovecot-2.1: imapc: Fixed memory leak when copying messages. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c0c5dac8ff48 changeset: 14969:c0c5dac8ff48 user: Timo Sirainen date: Sun May 26 21:45:33 2013 +0300 description: imapc: Fixed memory leak when copying messages. diffstat: src/lib-storage/index/imapc/imapc-save.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 4c05b9447a10 -r c0c5dac8ff48 src/lib-storage/index/imapc/imapc-save.c --- a/src/lib-storage/index/imapc/imapc-save.c Mon May 20 01:52:25 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-save.c Sun May 26 21:45:33 2013 +0300 @@ -420,6 +420,7 @@ while (sctx.ret == -2) imapc_storage_run(src_mbox->storage); ctx->finished = TRUE; + index_save_context_free(_ctx); return sctx.ret; } return mail_storage_copy(_ctx, mail); From dovecot at dovecot.org Mon May 27 02:10:39 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 02:10:39 +0300 Subject: dovecot-2.2: dsync: Added -x parameter to exclude mailboxes from... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4883a8e1db13 changeset: 16398:4883a8e1db13 user: Timo Sirainen date: Sun May 26 21:57:36 2013 +0300 description: dsync: Added -x parameter to exclude mailboxes from sync. Multiple -x parameters can be added. Giving \flag as parameter means that the mailbox with the given SPECIAL-USE \flag is skipped. For example: doveadm sync -x '\All' -x '\Flagged' -x '\Important' mdbox:~/mdbox diffstat: src/doveadm/dsync/doveadm-dsync.c | 19 ++++++++++- src/doveadm/dsync/dsync-brain-mailbox-tree.c | 20 ++++-------- src/doveadm/dsync/dsync-brain-private.h | 1 + src/doveadm/dsync/dsync-brain.c | 5 +++ src/doveadm/dsync/dsync-brain.h | 3 + src/doveadm/dsync/dsync-ibc-pipe.c | 2 + src/doveadm/dsync/dsync-ibc-stream.c | 19 +++++++++++- src/doveadm/dsync/dsync-ibc.h | 3 + src/doveadm/dsync/dsync-mailbox-tree-fill.c | 43 ++++++++++++++++++++++++--- src/doveadm/dsync/dsync-mailbox-tree.h | 3 +- 10 files changed, 95 insertions(+), 23 deletions(-) diffs (truncated from 315 to 300 lines): diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Sun May 26 21:57:36 2013 +0300 @@ -36,7 +36,7 @@ #include #include -#define DSYNC_COMMON_GETOPT_ARGS "+dEfg:l:m:n:Nr:Rs:U" +#define DSYNC_COMMON_GETOPT_ARGS "+dEfg:l:m:n:Nr:Rs:Ux:" #define DSYNC_REMOTE_CMD_EXIT_WAIT_SECS 30 enum dsync_run_type { @@ -51,6 +51,7 @@ const char *mailbox, *namespace_prefix; guid_128_t mailbox_guid; const char *state_input, *rawlog_path; + ARRAY_TYPE(const_string) exclude_mailboxes; const char *remote_name; const char *local_location; @@ -496,6 +497,10 @@ memcpy(set.sync_box_guid, ctx->mailbox_guid, sizeof(set.sync_box_guid)); set.lock_timeout_secs = ctx->lock_timeout; set.state = ctx->state_input; + if (array_count(&ctx->exclude_mailboxes) > 0) { + /* array is NULL-terminated in init() */ + set.exclude_mailboxes = array_idx(&ctx->exclude_mailboxes, 0); + } user->dsyncing = TRUE; @@ -803,6 +808,8 @@ if (args[0] == NULL) doveadm_mail_help_name(_ctx->cmd->name); } + if (array_count(&ctx->exclude_mailboxes) > 0) + array_append_zero(&ctx->exclude_mailboxes); lib_signals_ignore(SIGHUP, TRUE); } @@ -817,6 +824,7 @@ cmd_mailbox_dsync_parse_arg(struct doveadm_mail_cmd_context *_ctx, int c) { struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx; + const char *str; switch (c) { case 'd': @@ -847,6 +855,10 @@ else ctx->mailbox = optarg; break; + case 'x': + str = optarg; + array_append(&ctx->exclude_mailboxes, &str, 1); + break; case 'n': ctx->namespace_prefix = optarg; break; @@ -891,6 +903,7 @@ doveadm_print_init(DOVEADM_PRINT_TYPE_FLOW); doveadm_print_header("state", "state", DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE); + p_array_init(&ctx->exclude_mailboxes, ctx->ctx.pool, 4); return &ctx->ctx; } @@ -995,11 +1008,11 @@ struct doveadm_mail_cmd cmd_dsync_mirror = { cmd_dsync_alloc, "sync", - "[-dfR] [-l ] [-m ] [-n ] [-s ] " + "[-dfR] [-l ] [-m ] [-n ] [-x ] [-s ] " }; struct doveadm_mail_cmd cmd_dsync_backup = { cmd_dsync_backup_alloc, "backup", - "[-dfR] [-l ] [-m ] [-n ] [-s ] " + "[-dfR] [-l ] [-m ] [-n ] [-x ] [-s ] " }; struct doveadm_mail_cmd cmd_dsync_server = { cmd_dsync_server_alloc, "dsync-server", &doveadm_mail_cmd_hide diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-brain-mailbox-tree.c --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Sun May 26 21:57:36 2013 +0300 @@ -83,20 +83,14 @@ doveadm_settings->dsync_alt_char[0]); /* fill the local mailbox tree */ - if (brain->sync_ns != NULL) { - if (dsync_mailbox_tree_fill(brain->local_mailbox_tree, - brain->sync_ns, brain->sync_box, - brain->sync_box_guid) < 0) + for (ns = brain->user->namespaces; ns != NULL; ns = ns->next) { + if (!dsync_brain_want_namespace(brain, ns)) + continue; + if (dsync_mailbox_tree_fill(brain->local_mailbox_tree, ns, + brain->sync_box, + brain->sync_box_guid, + brain->exclude_mailboxes) < 0) brain->failed = TRUE; - } else { - for (ns = brain->user->namespaces; ns != NULL; ns = ns->next) { - if (!dsync_brain_want_namespace(brain, ns)) - continue; - if (dsync_mailbox_tree_fill(brain->local_mailbox_tree, - ns, brain->sync_box, - brain->sync_box_guid) < 0) - brain->failed = TRUE; - } } brain->local_tree_iter = diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-brain-private.h --- a/src/doveadm/dsync/dsync-brain-private.h Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-private.h Sun May 26 21:57:36 2013 +0300 @@ -52,6 +52,7 @@ struct mail_namespace *sync_ns; const char *sync_box; guid_128_t sync_box_guid; + const char *const *exclude_mailboxes; enum dsync_brain_sync_type sync_type; unsigned int lock_timeout; diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Sun May 26 21:57:36 2013 +0300 @@ -103,6 +103,8 @@ if (set->sync_ns != NULL) brain->sync_ns = set->sync_ns; brain->sync_box = p_strdup(brain->pool, set->sync_box); + brain->exclude_mailboxes = set->exclude_mailboxes == NULL ? NULL : + p_strarray_dup(brain->pool, set->exclude_mailboxes); memcpy(brain->sync_box_guid, set->sync_box_guid, sizeof(brain->sync_box_guid)); brain->lock_timeout = set->lock_timeout_secs; @@ -124,6 +126,7 @@ ibc_set.sync_ns_prefix = set->sync_ns == NULL ? NULL : set->sync_ns->prefix; ibc_set.sync_box = set->sync_box; + ibc_set.exclude_mailboxes = set->exclude_mailboxes; memcpy(ibc_set.sync_box_guid, set->sync_box_guid, sizeof(ibc_set.sync_box_guid)); ibc_set.sync_type = sync_type; @@ -312,6 +315,8 @@ ibc_set->sync_ns_prefix); } brain->sync_box = p_strdup(brain->pool, ibc_set->sync_box); + brain->exclude_mailboxes = ibc_set->exclude_mailboxes == NULL ? NULL : + p_strarray_dup(brain->pool, ibc_set->exclude_mailboxes); memcpy(brain->sync_box_guid, ibc_set->sync_box_guid, sizeof(brain->sync_box_guid)); i_assert(brain->sync_type == DSYNC_BRAIN_SYNC_TYPE_UNKNOWN); diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-brain.h --- a/src/doveadm/dsync/dsync-brain.h Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.h Sun May 26 21:57:36 2013 +0300 @@ -37,6 +37,9 @@ const char *sync_box; /* Sync only this mailbox GUID */ guid_128_t sync_box_guid; + /* Exclude these mailboxes from the sync. They can contain '*' + wildcards and be \special-use flags. */ + const char *const *exclude_mailboxes; /* If non-zero, use dsync lock file for this user */ unsigned int lock_timeout_secs; diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-ibc-pipe.c --- a/src/doveadm/dsync/dsync-ibc-pipe.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-pipe.c Sun May 26 21:57:36 2013 +0300 @@ -161,6 +161,8 @@ item->u.set = *set; item->u.set.sync_ns_prefix = p_strdup(item->pool, set->sync_ns_prefix); item->u.set.sync_box = p_strdup(item->pool, set->sync_box); + item->u.set.exclude_mailboxes = set->exclude_mailboxes == NULL ? NULL : + p_strarray_dup(item->pool, set->exclude_mailboxes); memcpy(item->u.set.sync_box_guid, set->sync_box_guid, sizeof(item->u.set.sync_box_guid)); } diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Sun May 26 21:57:36 2013 +0300 @@ -73,7 +73,7 @@ .chr = 'H', .required_keys = "hostname", .optional_keys = "sync_ns_prefix sync_box sync_box_guid sync_type " - "debug sync_visible_namespaces " + "debug sync_visible_namespaces exclude_mailboxes" "send_mail_requests backup_send backup_recv lock_timeout" }, { .name = "mailbox_state", @@ -594,6 +594,18 @@ } if (set->sync_box != NULL) dsync_serializer_encode_add(encoder, "sync_box", set->sync_box); + if (set->exclude_mailboxes != NULL) { + string_t *substr = t_str_new(64); + unsigned int i; + + for (i = 0; set->exclude_mailboxes[i] != NULL; i++) { + if (i != 0) + str_append_c(substr, '\t'); + str_append_tabescaped(substr, set->exclude_mailboxes[i]); + } + dsync_serializer_encode_add(encoder, "exclude_mailboxes", + str_c(substr)); + } if (!guid_128_is_empty(set->sync_box_guid)) { dsync_serializer_encode_add(encoder, "sync_box_guid", guid_128_to_string(set->sync_box_guid)); @@ -670,6 +682,11 @@ "Invalid sync_box_guid: %s", value); return DSYNC_IBC_RECV_RET_TRYAGAIN; } + if (dsync_deserializer_decode_try(decoder, "exclude_mailboxes", &value) && + *value != '\0') { + char **boxes = p_strsplit_tabescaped(pool, value); + set->exclude_mailboxes = (const void *)boxes; + } if (dsync_deserializer_decode_try(decoder, "sync_type", &value)) { switch (value[0]) { case 'f': diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-ibc.h --- a/src/doveadm/dsync/dsync-ibc.h Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc.h Sun May 26 21:57:36 2013 +0300 @@ -49,6 +49,9 @@ const char *sync_box; /* if non-empty, sync only this mailbox GUID */ guid_128_t sync_box_guid; + /* Exclude these mailboxes from the sync. They can contain '*' + wildcards and be \special-use flags. */ + const char *const *exclude_mailboxes; enum dsync_brain_sync_type sync_type; enum dsync_brain_flags brain_flags; diff -r 0b02dc66e9f1 -r 4883a8e1db13 src/doveadm/dsync/dsync-mailbox-tree-fill.c --- a/src/doveadm/dsync/dsync-mailbox-tree-fill.c Sun May 26 21:44:50 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-tree-fill.c Sun May 26 21:57:36 2013 +0300 @@ -5,6 +5,7 @@ #include "hash.h" #include "guid.h" #include "str.h" +#include "wildcard-match.h" #include "mailbox-log.h" #include "mail-namespace.h" #include "mail-storage.h" @@ -265,9 +266,39 @@ return ret; } +static bool +dsync_mailbox_info_is_excluded(const struct mailbox_info *info, + const char *const *exclude_mailboxes) +{ + const char *const *info_specialuses; + unsigned int i; + + if (exclude_mailboxes == NULL) + return FALSE; + + info_specialuses = info->special_use == NULL ? NULL : + t_strsplit(info->special_use, " "); + for (i = 0; exclude_mailboxes[i] != NULL; i++) { + const char *exclude = exclude_mailboxes[i]; + + if (exclude[0] == '\\') { + /* special-use */ + if (info_specialuses != NULL && + str_array_icase_find(info_specialuses, exclude)) + return TRUE; + } else { + /* mailbox with wildcards */ + if (wildcard_match(info->vname, exclude)) + return TRUE; + } + } + return FALSE; +} + int dsync_mailbox_tree_fill(struct dsync_mailbox_tree *tree, struct mail_namespace *ns, const char *box_name, - const guid_128_t box_guid) + const guid_128_t box_guid, + const char *const *exclude_mailboxes) { const enum mailbox_list_iter_flags list_flags = /* FIXME: we'll skip symlinks, because we can't handle them @@ -298,10 +329,12 @@ /* first add all of the existing mailboxes */ iter = mailbox_list_iter_init(ns->list, list_pattern, list_flags); - while ((info = mailbox_list_iter_next(iter)) != NULL) { - if (dsync_mailbox_tree_add(tree, info, box_guid) < 0) - ret = -1; - } + while ((info = mailbox_list_iter_next(iter)) != NULL) T_BEGIN { + if (!dsync_mailbox_info_is_excluded(info, exclude_mailboxes)) { + if (dsync_mailbox_tree_add(tree, info, box_guid) < 0) + ret = -1; + } + } T_END; if (mailbox_list_iter_deinit(&iter) < 0) { From dovecot at dovecot.org Mon May 27 20:45:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 20:45:15 +0300 Subject: dovecot-2.2: dbox: Return cached pop3.order=0 as empty string in... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/360fd0ccd3dd changeset: 16399:360fd0ccd3dd user: Timo Sirainen date: Mon May 27 20:18:35 2013 +0300 description: dbox: Return cached pop3.order=0 as empty string instead to fix sorting problems. diffstat: src/lib-storage/index/dbox-common/dbox-mail.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 4883a8e1db13 -r 360fd0ccd3dd src/lib-storage/index/dbox-common/dbox-mail.c --- a/src/lib-storage/index/dbox-common/dbox-mail.c Sun May 26 21:57:36 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-mail.c Mon May 27 20:18:35 2013 +0300 @@ -176,7 +176,7 @@ else { i_assert(str_len(str) == sizeof(order)); memcpy(&order, str_data(str), sizeof(order)); - *value_r = dec2str(order); + *value_r = order == 0 ? "" : dec2str(order); } return 0; } From dovecot at dovecot.org Mon May 27 20:45:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 20:45:15 +0300 Subject: dovecot-2.2: lib-index: Create ext-intro records using the lates... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a8bc96640cf0 changeset: 16400:a8bc96640cf0 user: Timo Sirainen date: Mon May 27 20:44:05 2013 +0300 description: lib-index: Create ext-intro records using the latest sizes, not initial sizes. diffstat: src/lib-index/mail-index-transaction-export.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diffs (36 lines): diff -r 360fd0ccd3dd -r a8bc96640cf0 src/lib-index/mail-index-transaction-export.c --- a/src/lib-index/mail-index-transaction-export.c Mon May 27 20:18:35 2013 +0300 +++ b/src/lib-index/mail-index-transaction-export.c Mon May 27 20:44:05 2013 +0300 @@ -86,6 +86,7 @@ { struct mail_index_transaction *t = ctx->trans; const struct mail_index_registered_ext *rext; + const struct mail_index_ext *ext; struct mail_transaction_ext_intro *intro, *resizes; buffer_t *buf; uint32_t idx; @@ -120,12 +121,19 @@ /* generate a new intro structure */ intro = buffer_append_space_unsafe(buf, sizeof(*intro)); intro->ext_id = idx; - intro->hdr_size = rext->hdr_size; - intro->record_size = rext->record_size; - intro->record_align = rext->record_align; + if (idx == (uint32_t)-1) { + intro->hdr_size = rext->hdr_size; + intro->record_size = rext->record_size; + intro->record_align = rext->record_align; + intro->name_size = strlen(rext->name); + } else { + ext = array_idx(&t->view->index->map->extensions, idx); + intro->hdr_size = ext->hdr_size; + intro->record_size = ext->record_size; + intro->record_align = ext->record_align; + intro->name_size = 0; + } intro->flags = MAIL_TRANSACTION_EXT_INTRO_FLAG_NO_SHRINK; - intro->name_size = idx != (uint32_t)-1 ? 0 : - strlen(rext->name); } if (reset_id != 0) { /* we're going to reset this extension in this transaction */ From dovecot at dovecot.org Mon May 27 20:45:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 20:45:15 +0300 Subject: dovecot-2.2: lib-index: Added mail_index_ext_resize_hdr() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bd8ec99cf502 changeset: 16402:bd8ec99cf502 user: Timo Sirainen date: Mon May 27 20:45:08 2013 +0300 description: lib-index: Added mail_index_ext_resize_hdr() diffstat: src/lib-index/mail-index-transaction-update.c | 24 ++++++++++++++++++++---- src/lib-index/mail-index.h | 3 +++ 2 files changed, 23 insertions(+), 4 deletions(-) diffs (76 lines): diff -r ad78dcbe67be -r bd8ec99cf502 src/lib-index/mail-index-transaction-update.c --- a/src/lib-index/mail-index-transaction-update.c Mon May 27 20:44:56 2013 +0300 +++ b/src/lib-index/mail-index-transaction-update.c Mon May 27 20:45:08 2013 +0300 @@ -717,7 +717,7 @@ uint16_t record_align) { struct mail_transaction_ext_intro intro; - uint32_t old_record_size, old_record_align; + uint32_t old_record_size, old_record_align, old_header_size; memset(&intro, 0, sizeof(intro)); @@ -730,17 +730,20 @@ rext = array_idx(&t->view->index->extensions, ext_id); old_record_size = rext->record_size; old_record_align = rext->record_align; + old_header_size = rext->hdr_size; } else { const struct mail_index_ext *ext; ext = array_idx(&t->view->map->extensions, intro.ext_id); old_record_size = ext->record_size; old_record_align = ext->record_align; + old_header_size = ext->hdr_size; } /* allow only header size changes if extension records have already been changed in transaction */ i_assert(!array_is_created(&t->ext_rec_updates) || + record_size == (uint16_t)-1 || (old_record_size == record_size && old_record_align == record_align)); @@ -749,13 +752,26 @@ if (!array_is_created(&t->ext_resizes)) i_array_init(&t->ext_resizes, ext_id + 2); - intro.hdr_size = hdr_size; - intro.record_size = record_size; - intro.record_align = record_align; + intro.hdr_size = hdr_size != (uint32_t)-1 ? hdr_size : old_header_size; + if (record_size != (uint16_t)-1) { + i_assert(record_align != (uint16_t)-1); + intro.record_size = record_size; + intro.record_align = record_align; + } else { + i_assert(record_align == (uint16_t)-1); + intro.record_size = old_record_size; + intro.record_align = old_record_align; + } intro.name_size = 1; array_idx_set(&t->ext_resizes, ext_id, &intro); } +void mail_index_ext_resize_hdr(struct mail_index_transaction *t, + uint32_t ext_id, uint32_t hdr_size) +{ + mail_index_ext_resize(t, ext_id, hdr_size, (uint16_t)-1, (uint16_t)-1); +} + void mail_index_ext_reset(struct mail_index_transaction *t, uint32_t ext_id, uint32_t reset_id, bool clear_data) { diff -r ad78dcbe67be -r bd8ec99cf502 src/lib-index/mail-index.h --- a/src/lib-index/mail-index.h Mon May 27 20:44:56 2013 +0300 +++ b/src/lib-index/mail-index.h Mon May 27 20:45:08 2013 +0300 @@ -555,6 +555,9 @@ void mail_index_ext_resize(struct mail_index_transaction *t, uint32_t ext_id, uint32_t hdr_size, uint16_t record_size, uint16_t record_align); +/* Resize header, keeping the old record size. */ +void mail_index_ext_resize_hdr(struct mail_index_transaction *t, + uint32_t ext_id, uint32_t hdr_size); /* Reset extension. Any updates for this extension which were issued before the writer had seen this reset are discarded. reset_id is used to figure this From dovecot at dovecot.org Mon May 27 20:45:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 20:45:15 +0300 Subject: dovecot-2.2: lib-index: Fixed resizing header when old&new sizes... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ad78dcbe67be changeset: 16401:ad78dcbe67be user: Timo Sirainen date: Mon May 27 20:44:56 2013 +0300 description: lib-index: Fixed resizing header when old&new sizes were the same when aligned. diffstat: src/lib-index/mail-index-sync-ext.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r a8bc96640cf0 -r ad78dcbe67be src/lib-index/mail-index-sync-ext.c --- a/src/lib-index/mail-index-sync-ext.c Mon May 27 20:44:05 2013 +0300 +++ b/src/lib-index/mail-index-sync-ext.c Mon May 27 20:44:56 2013 +0300 @@ -289,6 +289,13 @@ new_size - old_size); ext->hdr_size = u->hdr_size; modified = TRUE; + } else { + if (ext->hdr_size != u->hdr_size) { + /* aligned sizes were the same, but the actual sizes + had changed */ + ext->hdr_size = u->hdr_size; + modified = TRUE; + } } if (ext->record_align < u->record_align || From dovecot at dovecot.org Mon May 27 21:03:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 27 May 2013 21:03:30 +0300 Subject: dovecot-2.2: dbox: Don't cache pop3.uidl|order unless index head... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/967ef2a7fa6f changeset: 16403:967ef2a7fa6f user: Timo Sirainen date: Mon May 27 21:03:14 2013 +0300 description: dbox: Don't cache pop3.uidl|order unless index header indicates there are those. They exist only when doing a migration, so it's pretty wasteful storing "doesn't exist" for all other installations. diffstat: src/doveadm/doveadm-dump-index.c | 16 +++++++- src/lib-storage/index/dbox-common/dbox-save.c | 31 ++++++++++++++++ src/lib-storage/index/dbox-common/dbox-save.h | 7 +++ src/lib-storage/index/dbox-common/dbox-storage.c | 13 ++++++ src/lib-storage/index/dbox-common/dbox-storage.h | 9 ++++ src/lib-storage/index/dbox-multi/mdbox-mail.c | 22 ++++++++++- src/lib-storage/index/dbox-multi/mdbox-save.c | 4 ++ src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 24 +++++++++++- src/lib-storage/index/dbox-multi/mdbox-storage.c | 15 +++++-- src/lib-storage/index/dbox-multi/mdbox-storage.h | 4 +- src/lib-storage/index/dbox-single/sdbox-mail.c | 20 +++++++++- src/lib-storage/index/dbox-single/sdbox-save.c | 4 ++ src/lib-storage/index/dbox-single/sdbox-storage.c | 22 ++++++++--- src/lib-storage/index/dbox-single/sdbox-storage.h | 5 ++- src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c | 6 ++- src/lib-storage/index/dbox-single/sdbox-sync.c | 3 +- 16 files changed, 184 insertions(+), 21 deletions(-) diffs (truncated from 600 to 300 lines): diff -r bd8ec99cf502 -r 967ef2a7fa6f src/doveadm/doveadm-dump-index.c --- a/src/doveadm/doveadm-dump-index.c Mon May 27 20:45:08 2013 +0300 +++ b/src/doveadm/doveadm-dump-index.c Mon May 27 21:03:14 2013 +0300 @@ -36,10 +36,14 @@ struct sdbox_index_header { uint32_t rebuild_count; guid_128_t mailbox_guid; + uint8_t flags; + uint8_t unused[3]; }; struct mdbox_index_header { uint32_t map_uid_validity; guid_128_t mailbox_guid; + uint8_t flags; + uint8_t unused[3]; }; struct mdbox_mail_index_record { uint32_t map_uid; @@ -122,11 +126,18 @@ const struct mail_index_ext *ext) { const void *data; + void *buf; if (strcmp(ext->name, MAIL_INDEX_EXT_KEYWORDS) == 0) return; + /* add some padding, since we don't bother to handle undersized + headers correctly */ + buf = t_malloc0(ext->hdr_size + 128); data = CONST_PTR_OFFSET(index->map->hdr_base, ext->hdr_offset); + memcpy(buf, data, ext->hdr_size); + data = buf; + if (strcmp(ext->name, "hdr-vsize") == 0) { const struct index_vsize_header *hdr = data; @@ -164,6 +175,7 @@ printf(" - map_uid_validity .. = %u\n", hdr->map_uid_validity); printf(" - mailbox_guid ...... = %s\n", guid_128_to_string(hdr->mailbox_guid)); + printf(" - flags ............. = 0x%x\n", hdr->flags); } else if (strcmp(ext->name, "dbox-hdr") == 0) { const struct sdbox_index_header *hdr = data; @@ -171,6 +183,7 @@ printf(" - rebuild_count . = %u\n", hdr->rebuild_count); printf(" - mailbox_guid .. = %s\n", guid_128_to_string(hdr->mailbox_guid)); + printf(" - flags ......... = 0x%x\n", hdr->flags); } else if (strcmp(ext->name, "modseq") == 0) { const struct mail_index_modseq_header *hdr = data; @@ -241,8 +254,9 @@ printf("record_offset = %u\n", ext->record_offset); printf("record_size . = %u\n", ext->record_size); printf("record_align = %u\n", ext->record_align); - if (ext->hdr_size > 0) + if (ext->hdr_size > 0) T_BEGIN { dump_extension_header(index, ext); + } T_END; } } diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-common/dbox-save.c --- a/src/lib-storage/index/dbox-common/dbox-save.c Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-save.c Mon May 27 21:03:14 2013 +0300 @@ -163,10 +163,12 @@ i_assert(strchr(mdata->pop3_uidl, '\n') == NULL); str_printfa(str, "%c%s\n", DBOX_METADATA_POP3_UIDL, mdata->pop3_uidl); + ctx->have_pop3_uidls = TRUE; } if (mdata->pop3_order != 0) { str_printfa(str, "%c%u\n", DBOX_METADATA_POP3_ORDER, mdata->pop3_order); + ctx->have_pop3_orders = TRUE; } guid = mdata->guid; @@ -193,3 +195,32 @@ str_append_c(str, '\n'); o_stream_nsend(output, str_data(str), str_len(str)); } + +void dbox_save_update_header_flags(struct dbox_save_context *ctx, + struct mail_index_view *sync_view, + uint32_t ext_id, + unsigned int flags_offset) +{ + const void *data; + size_t data_size; + uint8_t old_flags = 0, flags; + + mail_index_get_header_ext(sync_view, ext_id, &data, &data_size); + if (flags_offset < data_size) + old_flags = *((const uint8_t *)data + flags_offset); + else { + /* grow old dbox header */ + mail_index_ext_resize_hdr(ctx->trans, ext_id, flags_offset+1); + } + + flags = old_flags; + if (ctx->have_pop3_uidls) + flags |= DBOX_INDEX_HEADER_FLAG_HAVE_POP3_UIDLS; + if (ctx->have_pop3_orders) + flags |= DBOX_INDEX_HEADER_FLAG_HAVE_POP3_ORDERS; + if (flags != old_flags) { + /* flags changed, update them */ + mail_index_update_header_ext(ctx->trans, ext_id, + flags_offset, &flags, 1); + } +} diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-common/dbox-save.h --- a/src/lib-storage/index/dbox-common/dbox-save.h Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-save.h Mon May 27 21:03:14 2013 +0300 @@ -16,6 +16,8 @@ unsigned int failed:1; unsigned int finished:1; + unsigned int have_pop3_uidls:1; + unsigned int have_pop3_orders:1; }; void dbox_save_begin(struct dbox_save_context *ctx, struct istream *input); @@ -29,4 +31,9 @@ void dbox_save_add_to_index(struct dbox_save_context *ctx); +void dbox_save_update_header_flags(struct dbox_save_context *ctx, + struct mail_index_view *sync_view, + uint32_t ext_id, + unsigned int flags_offset); + #endif diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-common/dbox-storage.c --- a/src/lib-storage/index/dbox-common/dbox-storage.c Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-storage.c Mon May 27 21:03:14 2013 +0300 @@ -336,3 +336,16 @@ return -1; return 0; } + +bool dbox_header_have_flag(struct mailbox *box, uint32_t ext_id, + unsigned int flags_offset, uint8_t flag) +{ + const void *data; + size_t data_size; + uint8_t flags = 0; + + mail_index_get_header_ext(box->view, ext_id, &data, &data_size); + if (flags_offset < data_size) + flags = *((const uint8_t *)data + flags_offset); + return (flags & flag) != 0; +} diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-common/dbox-storage.h --- a/src/lib-storage/index/dbox-common/dbox-storage.h Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-storage.h Mon May 27 21:03:14 2013 +0300 @@ -23,6 +23,13 @@ /* Flag specifies if the message should be in primary or alternative storage */ #define DBOX_INDEX_FLAG_ALT MAIL_INDEX_MAIL_FLAG_BACKEND +enum dbox_index_header_flags { + /* messages' metadata contain POP3 UIDLs */ + DBOX_INDEX_HEADER_FLAG_HAVE_POP3_UIDLS = 0x01, + /* messages' metadata contain POP3 orders */ + DBOX_INDEX_HEADER_FLAG_HAVE_POP3_ORDERS = 0x02 +}; + struct dbox_storage_vfuncs { /* dbox file has zero references now. it should be either freed or left open in case it's accessed again soon */ @@ -67,5 +74,7 @@ int dbox_mailbox_create(struct mailbox *box, const struct mailbox_update *update, bool directory); int dbox_verify_alt_storage(struct mailbox_list *list); +bool dbox_header_have_flag(struct mailbox *box, uint32_t ext_id, + unsigned int flags_offset, uint8_t flag); #endif diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-multi/mdbox-mail.c --- a/src/lib-storage/index/dbox-multi/mdbox-mail.c Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c Mon May 27 21:03:14 2013 +0300 @@ -21,6 +21,7 @@ struct mdbox_index_header hdr; const void *data; uint32_t uid, cur_map_uid_validity; + bool need_resize; mail_index_lookup_ext(view, seq, mbox->ext_id, &data, NULL); dbox_rec = data; @@ -34,7 +35,7 @@ } if (mbox->map_uid_validity == 0) { - if (mdbox_read_header(mbox, &hdr) < 0) + if (mdbox_read_header(mbox, &hdr, &need_resize) < 0) return -1; mbox->map_uid_validity = hdr.map_uid_validity; } @@ -190,9 +191,26 @@ *value_r = p_strdup_printf(mail->imail.mail.data_pool, "%u", refcount); return 0; + case MAIL_FETCH_UIDL_BACKEND: + if (!dbox_header_have_flag(&mbox->box, mbox->hdr_ext_id, + offsetof(struct mdbox_index_header, flags), + DBOX_INDEX_HEADER_FLAG_HAVE_POP3_UIDLS)) { + *value_r = ""; + return 0; + } + break; + case MAIL_FETCH_POP3_ORDER: + if (!dbox_header_have_flag(&mbox->box, mbox->hdr_ext_id, + offsetof(struct mdbox_index_header, flags), + DBOX_INDEX_HEADER_FLAG_HAVE_POP3_ORDERS)) { + *value_r = ""; + return 0; + } + break; default: - return dbox_mail_get_special(_mail, field, value_r); + break; } + return dbox_mail_get_special(_mail, field, value_r); } static void diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-multi/mdbox-save.c --- a/src/lib-storage/index/dbox-multi/mdbox-save.c Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c Mon May 27 21:03:14 2013 +0300 @@ -314,6 +314,10 @@ return -1; } + /* update dbox header flags */ + dbox_save_update_header_flags(&ctx->ctx, ctx->sync_ctx->sync_view, + ctx->mbox->hdr_ext_id, offsetof(struct mdbox_index_header, flags)); + /* assign UIDs for new messages */ hdr = mail_index_get_header(ctx->sync_ctx->sync_view); mail_index_append_finish_uids(ctx->ctx.trans, hdr->next_uid, diff -r bd8ec99cf502 -r 967ef2a7fa6f src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Mon May 27 20:45:08 2013 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Mon May 27 21:03:14 2013 +0300 @@ -58,6 +58,9 @@ struct mailbox_list *default_list; struct rebuild_msg_mailbox prev_msg; + + unsigned int have_pop3_uidls:1; + unsigned int have_pop3_orders:1; }; static struct mdbox_storage_rebuild_context * @@ -126,6 +129,15 @@ return 0; } +static void rebuild_scan_metadata(struct mdbox_storage_rebuild_context *ctx, + struct dbox_file *file) +{ + if (dbox_file_metadata_get(file, DBOX_METADATA_POP3_UIDL) != NULL) + ctx->have_pop3_uidls = TRUE; + if (dbox_file_metadata_get(file, DBOX_METADATA_POP3_ORDER) != NULL) + ctx->have_pop3_orders = TRUE; +} + static int rebuild_file_mails(struct mdbox_storage_rebuild_context *ctx, struct dbox_file *file, uint32_t file_id) { @@ -177,6 +189,7 @@ ret = 0; break; } + rebuild_scan_metadata(ctx, file); rec = p_new(ctx->pool, struct mdbox_rebuild_msg, 1); rec->file_id = file_id; @@ -476,7 +489,8 @@ memcpy(hdr_r, data, I_MIN(data_size, sizeof(*hdr_r))); } -static void mdbox_header_update(struct index_rebuild_context *rebuild_ctx, +static void mdbox_header_update(struct mdbox_storage_rebuild_context *ctx, + struct index_rebuild_context *rebuild_ctx, struct mdbox_mailbox *mbox) { struct mdbox_index_header hdr, backup_hdr; @@ -502,6 +516,11 @@ /* update map's uid-validity */ hdr.map_uid_validity = mdbox_map_get_uid_validity(mbox->storage->map); + if (ctx->have_pop3_uidls) + hdr.flags |= DBOX_INDEX_HEADER_FLAG_HAVE_POP3_UIDLS; + if (ctx->have_pop3_orders) + hdr.flags |= DBOX_INDEX_HEADER_FLAG_HAVE_POP3_ORDERS; + /* and write changes */ mail_index_update_header_ext(rebuild_ctx->trans, mbox->hdr_ext_id, 0, From dovecot at dovecot.org Tue May 28 01:04:07 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 01:04:07 +0300 Subject: dovecot-2.2: lib-fs: Added fs_get_root_driver() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/16183ae98947 changeset: 16404:16183ae98947 user: Timo Sirainen date: Tue May 28 01:03:58 2013 +0300 description: lib-fs: Added fs_get_root_driver() diffstat: src/lib-fs/fs-api.c | 7 +++++++ src/lib-fs/fs-api.h | 3 +++ 2 files changed, 10 insertions(+), 0 deletions(-) diffs (30 lines): diff -r 967ef2a7fa6f -r 16183ae98947 src/lib-fs/fs-api.c --- a/src/lib-fs/fs-api.c Mon May 27 21:03:14 2013 +0300 +++ b/src/lib-fs/fs-api.c Tue May 28 01:03:58 2013 +0300 @@ -140,6 +140,13 @@ str_free(&last_error); } +const char *fs_get_root_driver(struct fs *fs) +{ + while (fs->parent != NULL) + fs = fs->parent; + return fs->name; +} + struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags) { struct fs_file *file; diff -r 967ef2a7fa6f -r 16183ae98947 src/lib-fs/fs-api.h --- a/src/lib-fs/fs-api.h Mon May 27 21:03:14 2013 +0300 +++ b/src/lib-fs/fs-api.h Tue May 28 01:03:58 2013 +0300 @@ -92,6 +92,9 @@ struct fs **fs_r, const char **error_r); void fs_deinit(struct fs **fs); +/* Returns the root fs's driver name (bypassing all wrapper fses) */ +const char *fs_get_root_driver(struct fs *fs); + struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags); void fs_file_deinit(struct fs_file **file); From dovecot at dovecot.org Tue May 28 16:30:31 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 16:30:31 +0300 Subject: dovecot-2.2: auth: If blocking userdb returns no fields, don't c... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f9f6467001b9 changeset: 16405:f9f6467001b9 user: Timo Sirainen date: Tue May 28 16:30:19 2013 +0300 description: auth: If blocking userdb returns no fields, don't crash when trying to cache the result. diffstat: src/auth/userdb-blocking.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 16183ae98947 -r f9f6467001b9 src/auth/userdb-blocking.c --- a/src/auth/userdb-blocking.c Tue May 28 01:03:58 2013 +0300 +++ b/src/auth/userdb-blocking.c Tue May 28 16:30:19 2013 +0300 @@ -36,8 +36,8 @@ args = ""; } + request->userdb_reply = auth_fields_init(request->pool); if (*args != '\0') { - request->userdb_reply = auth_fields_init(request->pool); auth_fields_import(request->userdb_reply, args, 0); if (auth_fields_exists(request->userdb_reply, "tempfail")) request->userdb_lookup_failed = TRUE; From dovecot at dovecot.org Tue May 28 16:30:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 16:30:43 +0300 Subject: dovecot-2.2: auth: Fixed caching empty userdb result. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c40d67ee9de2 changeset: 16406:c40d67ee9de2 user: Timo Sirainen date: Tue May 28 16:30:38 2013 +0300 description: auth: Fixed caching empty userdb result. diffstat: src/auth/auth-request.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diffs (32 lines): diff -r f9f6467001b9 -r c40d67ee9de2 src/auth/auth-request.c --- a/src/auth/auth-request.c Tue May 28 16:30:19 2013 +0300 +++ b/src/auth/auth-request.c Tue May 28 16:30:38 2013 +0300 @@ -32,6 +32,7 @@ #define AUTH_DNS_DEFAULT_TIMEOUT_MSECS (1000*10) #define AUTH_DNS_WARN_MSECS 500 #define CACHED_PASSWORD_SCHEME "SHA1" +#define AUTH_REQUEST_KEY_IGNORE " " struct auth_request_proxy_dns_lookup_ctx { struct auth_request *request; @@ -923,6 +924,11 @@ auth_fields_append(request->userdb_reply, str, AUTH_FIELD_FLAG_CHANGED, AUTH_FIELD_FLAG_CHANGED); + if (str_len(str) == 0) { + /* no userdb fields. but we can't save an empty string, + since that means "user unknown". */ + str_append(str, AUTH_REQUEST_KEY_IGNORE); + } cache_value = str_c(str); } /* last_success has no meaning with userdb */ @@ -1503,6 +1509,8 @@ warned = TRUE; } name = "system_groups_user"; + } else if (strcmp(name, AUTH_REQUEST_KEY_IGNORE) == 0) { + return; } auth_fields_add(request->userdb_reply, name, value, 0); From dovecot at dovecot.org Tue May 28 17:10:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 17:10:11 +0300 Subject: dovecot-2.2: doveadm-server: Pass local/remote_ip/port to passdb... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/feee5a1527d9 changeset: 16407:feee5a1527d9 user: Timo Sirainen date: Tue May 28 17:10:03 2013 +0300 description: doveadm-server: Pass local/remote_ip/port to passdb lookups so proxy_maybe works. diffstat: src/doveadm/client-connection.c | 9 ++++++--- src/doveadm/client-connection.h | 1 + src/doveadm/doveadm-mail-server.c | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diffs (58 lines): diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Tue May 28 16:30:38 2013 +0300 +++ b/src/doveadm/client-connection.c Tue May 28 17:10:03 2013 +0300 @@ -166,6 +166,10 @@ memset(&input, 0, sizeof(input)); input.service = "doveadm"; + input.local_ip = conn->local_ip; + input.remote_ip = conn->remote_ip; + input.local_port = conn->local_port; + input.remote_port = conn->remote_port; for (argc = 0; args[argc] != NULL; argc++) args[argc] = str_tabunescape(args[argc]); @@ -390,7 +394,6 @@ client_connection_create(int fd, int listen_fd, bool ssl) { struct client_connection *conn; - unsigned int port; pool_t pool; pool = pool_alloconly_create("doveadm client", 1024*16); @@ -402,8 +405,8 @@ conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE); o_stream_set_no_error_handling(conn->output, TRUE); - (void)net_getsockname(fd, &conn->local_ip, &port); - (void)net_getpeername(fd, &conn->remote_ip, &port); + (void)net_getsockname(fd, &conn->local_ip, &conn->local_port); + (void)net_getpeername(fd, &conn->remote_ip, &conn->remote_port); if (client_connection_read_settings(conn) < 0) { client_connection_destroy(&conn); diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/client-connection.h --- a/src/doveadm/client-connection.h Tue May 28 16:30:38 2013 +0300 +++ b/src/doveadm/client-connection.h Tue May 28 17:10:03 2013 +0300 @@ -12,6 +12,7 @@ struct ostream *output; struct ssl_iostream *ssl_iostream; struct ip_addr local_ip, remote_ip; + unsigned int local_port, remote_port; const struct doveadm_settings *set; unsigned int handshaked:1; diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Tue May 28 16:30:38 2013 +0300 +++ b/src/doveadm/doveadm-mail-server.c Tue May 28 17:10:03 2013 +0300 @@ -190,6 +190,10 @@ memset(&info, 0, sizeof(info)); info.service = master_service_get_name(master_service); + info.local_ip = input->local_ip; + info.remote_ip = input->remote_ip; + info.local_port = input->local_port; + info.remote_port = input->remote_port; pool = pool_alloconly_create("auth lookup", 1024); auth_conn = mail_storage_service_get_auth_conn(ctx->storage_service); From dovecot at dovecot.org Tue May 28 17:30:59 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 17:30:59 +0300 Subject: dovecot-2.2: auth: Keep auth_request referenced during DNS lookup. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5a223c6d833f changeset: 16408:5a223c6d833f user: Timo Sirainen date: Tue May 28 17:30:42 2013 +0300 description: auth: Keep auth_request referenced during DNS lookup. If the underlying auth connection gets closed, there's nothing else referencing the auth_request. diffstat: src/auth/auth-request.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (26 lines): diff -r feee5a1527d9 -r 5a223c6d833f src/auth/auth-request.c --- a/src/auth/auth-request.c Tue May 28 17:10:03 2013 +0300 +++ b/src/auth/auth-request.c Tue May 28 17:30:42 2013 +0300 @@ -1656,6 +1656,7 @@ } if (ctx->callback != NULL) ctx->callback(result->ret == 0, request); + auth_request_unref(&request); } static int auth_request_proxy_host_lookup(struct auth_request *request, @@ -1683,12 +1684,14 @@ ctx = p_new(request->pool, struct auth_request_proxy_dns_lookup_ctx, 1); ctx->request = request; + auth_request_ref(request); if (dns_lookup(host, &dns_set, auth_request_proxy_dns_callback, ctx, &ctx->dns_lookup) < 0) { /* failed early */ request->internal_failure = TRUE; auth_request_proxy_finish_failure(request); + auth_request_unref(&request); return -1; } ctx->callback = callback; From dovecot at dovecot.org Tue May 28 17:33:39 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 17:33:39 +0300 Subject: dovecot-2.1: auth: Keep auth_request referenced during DNS lookup. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/f819e0a3a4df changeset: 14970:f819e0a3a4df user: Timo Sirainen date: Tue May 28 17:33:35 2013 +0300 description: auth: Keep auth_request referenced during DNS lookup. If the underlying auth connection gets closed, there's nothing else referencing the auth_request. diffstat: src/auth/auth-request.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (25 lines): diff -r c0c5dac8ff48 -r f819e0a3a4df src/auth/auth-request.c --- a/src/auth/auth-request.c Sun May 26 21:45:33 2013 +0300 +++ b/src/auth/auth-request.c Tue May 28 17:33:35 2013 +0300 @@ -1594,6 +1594,7 @@ } if (ctx->callback != NULL) ctx->callback(result->ret == 0, request); + auth_request_unref(&request); i_free(ctx); } @@ -1631,11 +1632,13 @@ ctx = i_new(struct auth_request_proxy_dns_lookup_ctx, 1); ctx->request = request; + auth_request_ref(request); if (dns_lookup(host, &dns_set, auth_request_proxy_dns_callback, ctx) < 0) { /* failed early */ request->internal_failure = TRUE; auth_request_proxy_finish_failure(request); + auth_request_unref(&request); return -1; } ctx->callback = callback; From dovecot at dovecot.org Tue May 28 18:18:56 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 18:18:56 +0300 Subject: dovecot-2.1: auth ldap: If ldap debug_level>0, log how long init... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/22c5aff7b25c changeset: 14971:22c5aff7b25c user: Timo Sirainen date: Tue May 28 18:18:45 2013 +0300 description: auth ldap: If ldap debug_level>0, log how long initialization took. diffstat: src/auth/db-ldap.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diffs (42 lines): diff -r f819e0a3a4df -r 22c5aff7b25c src/auth/db-ldap.c --- a/src/auth/db-ldap.c Tue May 28 17:33:35 2013 +0300 +++ b/src/auth/db-ldap.c Tue May 28 18:18:45 2013 +0300 @@ -10,6 +10,7 @@ #include "hash.h" #include "aqueue.h" #include "str.h" +#include "time-util.h" #include "env-util.h" #include "var-expand.h" #include "settings.h" @@ -836,11 +837,17 @@ int db_ldap_connect(struct ldap_connection *conn) { + bool debug = atoi(conn->set.debug_level) > 0; + struct timeval start, end; int ret; if (conn->conn_state != LDAP_CONN_STATE_DISCONNECTED) return 0; + if (debug) { + if (gettimeofday(&start, NULL) < 0) + memset(&start, 0, sizeof(start)); + } i_assert(conn->pending_count == 0); if (conn->ld == NULL) { if (conn->set.uris != NULL) { @@ -907,6 +914,12 @@ if (db_ldap_bind(conn) < 0) return -1; } + if (debug) { + if (gettimeofday(&end, NULL) == 0) { + int msecs = timeval_diff_msecs(&end, &start); + i_debug("LDAP initialization took %d msecs", msecs); + } + } db_ldap_get_fd(conn); conn->io = io_add(conn->fd, IO_READ, ldap_input, conn); From dovecot at dovecot.org Tue May 28 18:19:21 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 28 May 2013 18:19:21 +0300 Subject: dovecot-2.2: auth ldap: If ldap debug_level>0, log how long init... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c6165b5d6cce changeset: 16409:c6165b5d6cce user: Timo Sirainen date: Tue May 28 18:18:45 2013 +0300 description: auth ldap: If ldap debug_level>0, log how long initialization took. diffstat: src/auth/db-ldap.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diffs (42 lines): diff -r 5a223c6d833f -r c6165b5d6cce src/auth/db-ldap.c --- a/src/auth/db-ldap.c Tue May 28 17:30:42 2013 +0300 +++ b/src/auth/db-ldap.c Tue May 28 18:18:45 2013 +0300 @@ -10,6 +10,7 @@ #include "hash.h" #include "aqueue.h" #include "str.h" +#include "time-util.h" #include "env-util.h" #include "var-expand.h" #include "settings.h" @@ -1099,11 +1100,17 @@ int db_ldap_connect(struct ldap_connection *conn) { + bool debug = atoi(conn->set.debug_level) > 0; + struct timeval start, end; int ret; if (conn->conn_state != LDAP_CONN_STATE_DISCONNECTED) return 0; + if (debug) { + if (gettimeofday(&start, NULL) < 0) + memset(&start, 0, sizeof(start)); + } i_assert(conn->pending_count == 0); if (conn->ld == NULL) { if (conn->set.uris != NULL) { @@ -1170,6 +1177,12 @@ if (db_ldap_bind(conn) < 0) return -1; } + if (debug) { + if (gettimeofday(&end, NULL) == 0) { + int msecs = timeval_diff_msecs(&end, &start); + i_debug("LDAP initialization took %d msecs", msecs); + } + } db_ldap_get_fd(conn); conn->io = io_add(conn->fd, IO_READ, ldap_input, conn); From dovecot at dovecot.org Wed May 29 03:18:12 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 03:18:12 +0300 Subject: dovecot-2.2: Fixed compiling with gcc v3.3 and older. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8307019ce491 changeset: 16410:8307019ce491 user: Timo Sirainen date: Wed May 29 03:18:04 2013 +0300 description: Fixed compiling with gcc v3.3 and older. Perhaps the check needs to be also for somewhat newer versions?.. diffstat: src/lib/macros.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c6165b5d6cce -r 8307019ce491 src/lib/macros.h --- a/src/lib/macros.h Tue May 28 18:18:45 2013 +0300 +++ b/src/lib/macros.h Wed May 29 03:18:04 2013 +0300 @@ -142,7 +142,7 @@ #endif /* Macros to provide type safety for callback functions' context parameters */ -#ifdef __GNUC__ +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) # define CALLBACK_TYPECHECK(callback, type) \ (COMPILE_ERROR_IF_TRUE(!__builtin_types_compatible_p( \ typeof(&callback), type)) ? 1 : 0) From dovecot at dovecot.org Wed May 29 03:23:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 03:23:51 +0300 Subject: dovecot-2.2: lib-storage: Don't try to mkdir() empty directory w... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2306acef767e changeset: 16411:2306acef767e user: Timo Sirainen date: Wed May 29 03:23:40 2013 +0300 description: lib-storage: Don't try to mkdir() empty directory with INDEX=MEMORY diffstat: src/lib-storage/mailbox-list.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 8307019ce491 -r 2306acef767e src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Wed May 29 03:18:04 2013 +0300 +++ b/src/lib-storage/mailbox-list.c Wed May 29 03:23:40 2013 +0300 @@ -1454,6 +1454,8 @@ &index_dir); if (ret <= 0) return ret; + if (index_dir[0] == '\0') + return 0; ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX, &root_dir); if (ret <= 0) From dovecot at dovecot.org Wed May 29 03:27:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 03:27:37 +0300 Subject: dovecot-2.2: lib-storage: Reverted previous change after all. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/429a8cd829d6 changeset: 16412:429a8cd829d6 user: Timo Sirainen date: Wed May 29 03:26:41 2013 +0300 description: lib-storage: Reverted previous change after all. diffstat: src/lib-storage/mailbox-list.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diffs (12 lines): diff -r 2306acef767e -r 429a8cd829d6 src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Wed May 29 03:23:40 2013 +0300 +++ b/src/lib-storage/mailbox-list.c Wed May 29 03:26:41 2013 +0300 @@ -1454,8 +1454,6 @@ &index_dir); if (ret <= 0) return ret; - if (index_dir[0] == '\0') - return 0; ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX, &root_dir); if (ret <= 0) From dovecot at dovecot.org Wed May 29 03:27:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 03:27:37 +0300 Subject: dovecot-2.2: lib-storage: If INDEX=MEMORY, return index root dir... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1a565186aee0 changeset: 16413:1a565186aee0 user: Timo Sirainen date: Wed May 29 03:27:09 2013 +0300 description: lib-storage: If INDEX=MEMORY, return index root dir as nonexistent instead of as "". diffstat: src/lib-storage/mailbox-list.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 429a8cd829d6 -r 1a565186aee0 src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Wed May 29 03:26:41 2013 +0300 +++ b/src/lib-storage/mailbox-list.c Wed May 29 03:27:09 2013 +0300 @@ -1271,8 +1271,15 @@ set->control_dir : set->root_dir; break; case MAILBOX_LIST_PATH_TYPE_INDEX: - path = set->index_dir != NULL ? - set->index_dir : set->root_dir; + if (set->index_dir != NULL) { + if (set->index_dir[0] == '\0') { + /* in-memory indexes */ + return 0; + } + path = set->index_dir; + } else { + path = set->root_dir; + } break; case MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE: path = set->index_pvt_dir; From dovecot at dovecot.org Wed May 29 03:48:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 03:48:06 +0300 Subject: dovecot-2.2: lib-index: Fixed mail_cache_lookup_headers() when f... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e7c474011934 changeset: 16414:e7c474011934 user: Timo Sirainen date: Wed May 29 03:47:38 2013 +0300 description: lib-index: Fixed mail_cache_lookup_headers() when fields were still in memory buffer. diffstat: src/lib-index/mail-cache-lookup.c | 41 +++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 20 deletions(-) diffs (128 lines): diff -r 1a565186aee0 -r e7c474011934 src/lib-index/mail-cache-lookup.c --- a/src/lib-index/mail-cache-lookup.c Wed May 29 03:27:09 2013 +0300 +++ b/src/lib-index/mail-cache-lookup.c Wed May 29 03:47:38 2013 +0300 @@ -434,17 +434,18 @@ } struct header_lookup_data { - uint32_t offset; uint32_t data_size; + const unsigned char *data; }; struct header_lookup_line { uint32_t line_num; - struct header_lookup_data *data; + struct header_lookup_data *data; }; struct header_lookup_context { struct mail_cache_view *view; + pool_t pool; ARRAY(struct header_lookup_line) lines; }; @@ -461,7 +462,8 @@ uint32_t data_size = field->size; struct header_lookup_line hdr_line; struct header_lookup_data *hdr_data; - unsigned int i, lines_count; + void *data_dup; + unsigned int i, lines_count, pos; /* data = { line_nums[], 0, "headers" } */ for (i = 0; data_size >= sizeof(uint32_t); i++) { @@ -470,10 +472,13 @@ break; } lines_count = i; + pos = (lines_count+1) * sizeof(uint32_t); - hdr_data = t_new(struct header_lookup_data, 1); - hdr_data->offset = field->offset + (lines_count+1) * sizeof(uint32_t); + hdr_data = p_new(ctx->pool, struct header_lookup_data, 1); hdr_data->data_size = data_size; + hdr_data->data = data_dup = data_size == 0 ? NULL : + p_malloc(ctx->pool, data_size); + memcpy(data_dup, CONST_PTR_OFFSET(field->data, pos), data_size); for (i = 0; i < lines_count; i++) { hdr_line.line_num = lines[i]; @@ -491,14 +496,13 @@ static int mail_cache_lookup_headers_real(struct mail_cache_view *view, string_t *dest, uint32_t seq, unsigned int field_idxs[], - unsigned int fields_count) + unsigned int fields_count, pool_t *pool_r) { struct mail_cache *cache = view->cache; struct mail_cache_lookup_iterate_ctx iter; struct mail_cache_iterate_field field; struct header_lookup_context ctx; struct header_lookup_line *lines; - const void *data; const unsigned char *p, *start, *end; uint8_t *field_state; unsigned int i, count, max_field = 0; @@ -507,6 +511,8 @@ buffer_t *buf; int ret; + *pool_r = NULL; + if (fields_count == 0) return 1; @@ -534,6 +540,7 @@ /* lookup the fields */ memset(&ctx, 0, sizeof(ctx)); ctx.view = view; + ctx.pool = *pool_r = pool_alloconly_create("mail cache headers", 1024); t_array_init(&ctx.lines, 32); mail_cache_lookup_iter_init(view, seq, &iter); @@ -563,17 +570,7 @@ /* then start filling dest buffer from the headers */ for (i = 0; i < count; i++) { - ret = mail_cache_map(cache, lines[i].data->offset, - lines[i].data->data_size, &data); - if (ret <= 0) { - if (ret < 0) - return -1; - - mail_cache_set_corrupted(cache, - "header record unexpectedly points outside file"); - return -1; - } - start = data; + start = lines[i].data->data; end = start + lines[i].data->data_size; /* find the end of the (multiline) header */ @@ -589,7 +586,7 @@ /* if there are more lines for this header, the following lines continue after this one. so skip this line. */ - lines[i].data->offset += hdr_size; + lines[i].data->data += hdr_size; lines[i].data->data_size -= hdr_size; } return 1; @@ -599,11 +596,15 @@ uint32_t seq, unsigned int field_idxs[], unsigned int fields_count) { + pool_t pool; int ret; T_BEGIN { ret = mail_cache_lookup_headers_real(view, dest, seq, - field_idxs, fields_count); + field_idxs, fields_count, + &pool); + if (pool != NULL) + pool_unref(&pool); } T_END; return ret; } From dovecot at dovecot.org Wed May 29 12:33:32 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 12:33:32 +0300 Subject: dovecot-2.2: dsync: Fixed dsync handshaking since recent change. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/239e0e2098c1 changeset: 16415:239e0e2098c1 user: Timo Sirainen date: Wed May 29 12:33:17 2013 +0300 description: dsync: Fixed dsync handshaking since recent change. diffstat: src/doveadm/dsync/dsync-ibc-stream.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r e7c474011934 -r 239e0e2098c1 src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Wed May 29 03:47:38 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Wed May 29 12:33:17 2013 +0300 @@ -73,7 +73,7 @@ .chr = 'H', .required_keys = "hostname", .optional_keys = "sync_ns_prefix sync_box sync_box_guid sync_type " - "debug sync_visible_namespaces exclude_mailboxes" + "debug sync_visible_namespaces exclude_mailboxes " "send_mail_requests backup_send backup_recv lock_timeout" }, { .name = "mailbox_state", From dovecot at dovecot.org Wed May 29 12:44:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 12:44:27 +0300 Subject: dovecot-2.2: lib-settings: Support also "seconds" and "minutes" ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f294d40a8978 changeset: 16416:f294d40a8978 user: Timo Sirainen date: Wed May 29 12:44:15 2013 +0300 description: lib-settings: Support also "seconds" and "minutes" (instead of just secs/mins) diffstat: src/lib-settings/settings-parser.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 239e0e2098c1 -r f294d40a8978 src/lib-settings/settings-parser.c --- a/src/lib-settings/settings-parser.c Wed May 29 12:33:17 2013 +0300 +++ b/src/lib-settings/settings-parser.c Wed May 29 12:44:15 2013 +0300 @@ -362,12 +362,14 @@ switch (i_toupper(*p)) { case 'S': multiply = 1; - if (strncasecmp(p, "secs", strlen(p)) == 0) + if (strncasecmp(p, "secs", strlen(p)) == 0 || + strncasecmp(p, "seconds", strlen(p)) == 0) p = ""; break; case 'M': multiply = 60; - if (strncasecmp(p, "mins", strlen(p)) == 0) + if (strncasecmp(p, "mins", strlen(p)) == 0 || + strncasecmp(p, "minutes", strlen(p)) == 0) p = ""; break; case 'H': From dovecot at dovecot.org Wed May 29 12:45:13 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 12:45:13 +0300 Subject: dovecot-2.1: lib-settings: Support also "seconds" and "minutes" ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d16581e2d7cf changeset: 14972:d16581e2d7cf user: Timo Sirainen date: Wed May 29 12:44:15 2013 +0300 description: lib-settings: Support also "seconds" and "minutes" (instead of just secs/mins) diffstat: src/lib-settings/settings-parser.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 22c5aff7b25c -r d16581e2d7cf src/lib-settings/settings-parser.c --- a/src/lib-settings/settings-parser.c Tue May 28 18:18:45 2013 +0300 +++ b/src/lib-settings/settings-parser.c Wed May 29 12:44:15 2013 +0300 @@ -354,12 +354,14 @@ switch (i_toupper(*p)) { case 'S': multiply = 1; - if (strncasecmp(p, "secs", strlen(p)) == 0) + if (strncasecmp(p, "secs", strlen(p)) == 0 || + strncasecmp(p, "seconds", strlen(p)) == 0) p = ""; break; case 'M': multiply = 60; - if (strncasecmp(p, "mins", strlen(p)) == 0) + if (strncasecmp(p, "mins", strlen(p)) == 0 || + strncasecmp(p, "minutes", strlen(p)) == 0) p = ""; break; case 'H': From dovecot at dovecot.org Wed May 29 16:40:55 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 29 May 2013 16:40:55 +0300 Subject: dovecot-2.2: lib-imap: imap_append_string_for_humans() returned ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/714320c3cfa6 changeset: 16417:714320c3cfa6 user: Timo Sirainen date: Wed May 29 16:40:50 2013 +0300 description: lib-imap: imap_append_string_for_humans() returned broken output for whitespace-only input. This returned broken IMAP ENVELOPEs, especially for subjects that contained only whitespace. Since the broken output returned a huge literal, it basically caused the IMAP client to hang. diffstat: src/lib-imap/Makefile.am | 5 ++++ src/lib-imap/imap-quote.c | 17 +++++++++++--- src/lib-imap/test-imap-quote.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 4 deletions(-) diffs (127 lines): diff -r f294d40a8978 -r 714320c3cfa6 src/lib-imap/Makefile.am --- a/src/lib-imap/Makefile.am Wed May 29 12:44:15 2013 +0300 +++ b/src/lib-imap/Makefile.am Wed May 29 16:40:50 2013 +0300 @@ -44,6 +44,7 @@ test-imap-bodystructure \ test-imap-match \ test-imap-parser \ + test-imap-quote \ test-imap-url \ test-imap-utf7 \ test-imap-util @@ -68,6 +69,10 @@ test_imap_parser_LDADD = imap-parser.lo imap-arg.lo $(test_libs) test_imap_parser_DEPENDENCIES = $(test_deps) +test_imap_quote_SOURCES = test-imap-quote.c +test_imap_quote_LDADD = imap-quote.lo $(test_libs) +test_imap_quote_DEPENDENCIES = $(test_deps) + test_imap_url_SOURCES = test-imap-url.c test_imap_url_LDADD = imap-url.lo $(test_libs) test_imap_url_DEPENDENCIES = $(test_deps) diff -r f294d40a8978 -r 714320c3cfa6 src/lib-imap/imap-quote.c --- a/src/lib-imap/imap-quote.c Wed May 29 12:44:15 2013 +0300 +++ b/src/lib-imap/imap-quote.c Wed May 29 16:40:50 2013 +0300 @@ -119,7 +119,7 @@ const unsigned char *src, size_t size) { size_t i, pos, remove_count = 0; - bool last_lwsp = TRUE, modify = FALSE; + bool whitespace_prefix = TRUE, last_lwsp = TRUE, modify = FALSE; /* first check if there is anything to change */ for (i = 0; i < size; i++) { @@ -155,8 +155,10 @@ last_lwsp = FALSE; break; } + if (!last_lwsp) + whitespace_prefix = FALSE; } - if (last_lwsp && i > 0) { + if (last_lwsp && i > 0 && !whitespace_prefix) { modify = TRUE; remove_count++; } @@ -168,11 +170,16 @@ str_append_c(dest, '"'); return; } + if (size == remove_count) { + /* contained only whitespace */ + str_append(dest, "\"\""); + return; + } str_printfa(dest, "{%"PRIuSIZE_T"}\r\n", size - remove_count); pos = str_len(dest); - last_lwsp = TRUE; + last_lwsp = TRUE; whitespace_prefix = TRUE; for (i = 0; i < size; i++) { switch (src[i]) { case 0: @@ -193,8 +200,10 @@ str_append_c(dest, src[i]); break; } + if (!last_lwsp) + whitespace_prefix = FALSE; } - if (last_lwsp) + if (last_lwsp && i > 0 && !whitespace_prefix) str_truncate(dest, str_len(dest)-1); i_assert(str_len(dest) - pos == size - remove_count); } diff -r f294d40a8978 -r 714320c3cfa6 src/lib-imap/test-imap-quote.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-imap/test-imap-quote.c Wed May 29 16:40:50 2013 +0300 @@ -0,0 +1,47 @@ +/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "str.h" +#include "imap-quote.h" +#include "test-common.h" + +static void test_imap_append_string_for_humans(void) +{ + static struct { + const char *input, *output; + } tests[] = { + { "", "\"\"" }, + { " ", "\"\"" }, + { " ", "\"\"" }, + { "\t", "\"\"" }, + { " \t", "\"\"" }, + { " \t ", "\"\"" }, + { " foo", "{3}\r\nfoo" }, + { "\tfoo", "{3}\r\nfoo" }, + { "\t \tfoo", "{3}\r\nfoo" }, + { " foo ", "{3}\r\nfoo" }, + { " foo ", "{3}\r\nfoo" }, + { " foo \t \t", "{3}\r\nfoo" } + }; + string_t *str = t_str_new(128); + unsigned int i; + + test_begin("imap_append_string_for_humans()"); + + for (i = 0; i < N_ELEMENTS(tests); i++) { + str_truncate(str, 0); + imap_append_string_for_humans(str, (const void *)tests[i].input, + strlen(tests[i].input)); + test_assert(strcmp(tests[i].output, str_c(str)) == 0); + } + test_end(); +} + +int main(void) +{ + static void (*test_functions[])(void) = { + test_imap_append_string_for_humans, + NULL + }; + return test_run(test_functions); +} From dovecot at dovecot.org Thu May 30 17:45:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 17:45:40 +0300 Subject: dovecot-2.2: var_expand(): Added %N, which is the same as %H exc... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4d711ec26847 changeset: 16418:4d711ec26847 user: Timo Sirainen date: Thu May 30 17:45:27 2013 +0300 description: var_expand(): Added %N, which is the same as %H except based on MD5. This gives a better distribution of values than %H. diffstat: src/lib/var-expand.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diffs (41 lines): diff -r 714320c3cfa6 -r 4d711ec26847 src/lib/var-expand.c --- a/src/lib/var-expand.c Wed May 29 16:40:50 2013 +0300 +++ b/src/lib/var-expand.c Thu May 30 17:45:27 2013 +0300 @@ -88,6 +88,29 @@ } static const char * +m_str_newhash(const char *str, struct var_expand_context *ctx) +{ + string_t *hash = t_str_new(20); + unsigned char result[MD5_RESULTLEN]; + unsigned int value; + + md5_get_digest(str, strlen(str), result); + memcpy(&value, result, sizeof(value)); + + if (ctx->width != 0) { + value %= ctx->width; + ctx->width = 0; + } + + str_printfa(hash, "%x", value); + while ((int)str_len(hash) < ctx->offset) + str_insert(hash, 0, "0"); + ctx->offset = 0; + + return str_c(hash); +} + +static const char * m_str_md5(const char *str, struct var_expand_context *ctx ATTR_UNUSED) { unsigned char digest[16]; @@ -132,6 +155,7 @@ { 'X', m_str_hex }, { 'R', m_str_reverse }, { 'H', m_str_hash }, + { 'N', m_str_newhash }, { 'M', m_str_md5 }, { 'D', m_str_ldap_dn }, { 'T', m_str_trim }, From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Made sure callbacks from URLAUTH ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3ee64234a125 changeset: 16419:3ee64234a125 user: Stephan Bosch date: Thu May 30 18:03:38 2013 +0300 description: lib-imap-urlauth: Made sure callbacks from URLAUTH service connection are executed only once. diffstat: src/lib-imap-urlauth/imap-urlauth-connection.c | 38 ++++++++++++++++--------- 1 files changed, 24 insertions(+), 14 deletions(-) diffs (84 lines): diff -r 4d711ec26847 -r 3ee64234a125 src/lib-imap-urlauth/imap-urlauth-connection.c --- a/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 17:45:27 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 18:03:38 2013 +0300 @@ -320,9 +320,13 @@ void imap_urlauth_request_abort(struct imap_urlauth_connection *conn, struct imap_urlauth_request *urlreq) { - if (urlreq->callback != NULL) { + imap_urlauth_request_callback_t *callback; + + callback = urlreq->callback; + urlreq->callback = NULL; + if (callback != NULL) { T_BEGIN { - urlreq->callback(NULL, urlreq->context); + callback(NULL, urlreq->context); } T_END; } @@ -331,7 +335,6 @@ conn->targets_head->requests_head == urlreq) { /* cannot just drop pending request without breaking protocol state */ - urlreq->callback = NULL; return; } imap_urlauth_request_free(urlreq); @@ -343,22 +346,26 @@ const char *error) { struct imap_urlauth_fetch_reply reply; + imap_urlauth_request_callback_t *callback; - memset(&reply, 0, sizeof(reply)); - reply.url = urlreq->url; - reply.flags = urlreq->flags; - reply.succeeded = FALSE; - reply.error = error; + callback = urlreq->callback; + urlreq->callback = NULL; + if (callback != NULL) { + memset(&reply, 0, sizeof(reply)); + reply.url = urlreq->url; + reply.flags = urlreq->flags; + reply.succeeded = FALSE; + reply.error = error; - if (urlreq->callback != NULL) T_BEGIN { - (void)urlreq->callback(&reply, urlreq->context); - } T_END; + T_BEGIN { + (void)callback(&reply, urlreq->context); + } T_END; + } if (conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING && conn->targets_head != NULL && conn->targets_head->requests_head == urlreq) { /* cannot just drop pending request without breaking protocol state */ - urlreq->callback = NULL; return; } @@ -617,6 +624,7 @@ { struct imap_urlauth_request *urlreq = conn->targets_head->requests_head; struct imap_urlauth_fetch_reply reply; + imap_urlauth_request_callback_t *callback; int ret; i_assert(conn->reading_literal); @@ -643,8 +651,10 @@ reply.succeeded = TRUE; ret = 1; - if (urlreq->callback != NULL) T_BEGIN { - ret = urlreq->callback(&reply, urlreq->context); + callback = urlreq->callback; + urlreq->callback = NULL; + if (callback != NULL) T_BEGIN { + ret = callback(&reply, urlreq->context); } T_END; if (reply.input != NULL) From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed URLAUTH connection resume a... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bb221f236d4f changeset: 16420:bb221f236d4f user: Stephan Bosch date: Thu May 30 18:03:46 2013 +0300 description: lib-imap-urlauth: Fixed URLAUTH connection resume after error. diffstat: src/lib-imap-urlauth/imap-urlauth-connection.c | 41 ++++++++++++++++--------- 1 files changed, 26 insertions(+), 15 deletions(-) diffs (84 lines): diff -r 3ee64234a125 -r bb221f236d4f src/lib-imap-urlauth/imap-urlauth-connection.c --- a/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 18:03:38 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 18:03:46 2013 +0300 @@ -317,6 +317,21 @@ i_free(urlreq); } +static void imap_urlauth_request_drop(struct imap_urlauth_connection *conn, + struct imap_urlauth_request *urlreq) +{ + if ((conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING || + conn->state == IMAP_URLAUTH_STATE_REQUEST_WAIT) && + conn->targets_head != NULL && + conn->targets_head->requests_head == urlreq) { + /* cannot just drop pending request without breaking + protocol state */ + return; + } + imap_urlauth_request_free(urlreq); + +} + void imap_urlauth_request_abort(struct imap_urlauth_connection *conn, struct imap_urlauth_request *urlreq) { @@ -330,14 +345,7 @@ } T_END; } - if (conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING && - conn->targets_head != NULL && - conn->targets_head->requests_head == urlreq) { - /* cannot just drop pending request without breaking - protocol state */ - return; - } - imap_urlauth_request_free(urlreq); + imap_urlauth_request_drop(conn, urlreq); } static void @@ -347,6 +355,7 @@ { struct imap_urlauth_fetch_reply reply; imap_urlauth_request_callback_t *callback; + int ret = 1; callback = urlreq->callback; urlreq->callback = NULL; @@ -358,18 +367,19 @@ reply.error = error; T_BEGIN { - (void)callback(&reply, urlreq->context); + ret = callback(&reply, urlreq->context); } T_END; } - if (conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING && - conn->targets_head != NULL && - conn->targets_head->requests_head == urlreq) { - /* cannot just drop pending request without breaking protocol state */ - return; + imap_urlauth_request_drop(conn, urlreq); + + if (ret < 0) { + /* Drop any related requests upon error */ + imap_urlauth_request_abort_by_context(conn, urlreq->context); } - imap_urlauth_request_free(urlreq); + if (ret != 0) + imap_urlauth_connection_continue(conn); } static void @@ -714,6 +724,7 @@ param[6] != '\0') { error = param+6; } + conn->state = IMAP_URLAUTH_STATE_REQUEST_WAIT; imap_urlauth_request_fail(conn, conn->targets_head->requests_head, error); return 1; From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed URLAUTH fetch reference cou... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8f09509323cd changeset: 16421:8f09509323cd user: Stephan Bosch date: Thu May 30 18:03:53 2013 +0300 description: lib-imap-urlauth: Fixed URLAUTH fetch reference counting for when requests are aborted at deinit. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (19 lines): diff -r bb221f236d4f -r 8f09509323cd src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:03:46 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:03:53 2013 +0300 @@ -121,11 +121,14 @@ i_assert(ufetch->refcount > 0); *_ufetch = NULL; - if (--ufetch->refcount > 0) + if (ufetch->refcount-1 > 0) return; imap_urlauth_fetch_abort(ufetch); + ufetch->refcount--; + i_assert(ufetch->refcount == 0); + /* dont leave the connection in limbo; make sure resume is called */ if (ufetch->waiting_service) imap_urlauth_connection_continue(ufetch->uctx->conn); From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed pending_request counter dif... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ec5d1686852c changeset: 16422:ec5d1686852c user: Stephan Bosch date: Thu May 30 18:04:10 2013 +0300 description: lib-imap-urlauth: Fixed pending_request counter difference between locally and remotely fetched URLAUTHs. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diffs (105 lines): diff -r 8f09509323cd -r ec5d1686852c src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:03:53 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:10 2013 +0300 @@ -121,15 +121,15 @@ i_assert(ufetch->refcount > 0); *_ufetch = NULL; - if (ufetch->refcount-1 > 0) + if (--ufetch->refcount > 0) return; + ufetch->refcount++; imap_urlauth_fetch_abort(ufetch); - ufetch->refcount--; i_assert(ufetch->refcount == 0); - /* dont leave the connection in limbo; make sure resume is called */ + /* dont leave the connection in limbo; make sure continue is called */ if (ufetch->waiting_service) imap_urlauth_connection_continue(ufetch->uctx->conn); i_free(ufetch); @@ -161,10 +161,12 @@ ufetch->context); } T_END; - if (ret == 0) + if (ret == 0) { ufetch->waiting_local = TRUE; - else if (ret < 0) + ufetch->pending_requests++; + } else if (ret < 0) { imap_urlauth_fetch_fail(ufetch); + } } static void @@ -251,10 +253,11 @@ } } + ufetch->pending_requests--; + if (!success && ret < 0) { if (mpurl != NULL) imap_msgpart_url_free(&mpurl); - ufetch->pending_requests--; (void)ufetch->callback(NULL, TRUE, ufetch->context); imap_urlauth_fetch_fail(ufetch); return; @@ -271,13 +274,13 @@ reply.size = mpresult.size; reply.input = mpresult.input; - ret = ufetch->callback(&reply, ufetch->pending_requests == 1, + ret = ufetch->callback(&reply, ufetch->pending_requests == 0, ufetch->context); if (ret == 0) { ufetch->local_url = mpurl; ufetch->waiting_local = TRUE; + ufetch->pending_requests++; } else { - ufetch->pending_requests--; if (mpurl != NULL) imap_msgpart_url_free(&mpurl); @@ -328,6 +331,7 @@ ufetch->failed = TRUE; } else if (ret == 0) { ufetch->waiting_service = TRUE; + ufetch->pending_requests++; } imap_urlauth_fetch_unref(&ufetch); @@ -416,8 +420,13 @@ if (ufetch->failed) return FALSE; - if (!ufetch->waiting_local && !ufetch->waiting_service) + if (!ufetch->waiting_local && !ufetch->waiting_service) { + /* not currently waiting for anything */ return ufetch->pending_requests > 0; + } + + /* we finished a request */ + ufetch->pending_requests--; if (!ufetch->waiting_local) { /* not waiting for local request handling */ @@ -428,7 +437,6 @@ /* finished local request */ if (ufetch->local_url != NULL) { - ufetch->pending_requests--; imap_msgpart_url_free(&ufetch->local_url); } ufetch->waiting_local = FALSE; @@ -468,6 +476,7 @@ if (ret == 0) { ufetch->waiting_service = TRUE; + ufetch->pending_requests++; return TRUE; } } From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed handling of URLAUTH service... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b2541217f74b changeset: 16423:b2541217f74b user: Stephan Bosch date: Thu May 30 18:04:17 2013 +0300 description: lib-imap-urlauth: Fixed handling of URLAUTH service connection resume after pending local request. This was erroneously removed in an earlier commit. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diffs (21 lines): diff -r ec5d1686852c -r b2541217f74b src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:10 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:17 2013 +0300 @@ -311,6 +311,7 @@ ufetch->pending_reply.size = reply->size; ufetch->pending_reply.succeeded = reply->succeeded; ufetch->pending_reply.binary_has_nuls = reply->binary_has_nuls; + ufetch->waiting_service = TRUE; return 0; } @@ -479,6 +480,9 @@ ufetch->pending_requests++; return TRUE; } + + ufetch->waiting_service = FALSE; + imap_urlauth_connection_continue(ufetch->uctx->conn); } /* handle pending local urls */ From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: imap: Fixed segfault in URLFETCH command. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8d20f3cde49a changeset: 16424:8d20f3cde49a user: Stephan Bosch date: Thu May 30 18:04:52 2013 +0300 description: imap: Fixed segfault in URLFETCH command. Command would be cleaned up while requests were still pending, causing a segfault once a request finished. Added API determining whether the URLAUTH fetch interface still has pending requests. diffstat: src/imap/cmd-urlfetch.c | 8 +++----- src/lib-imap-urlauth/imap-urlauth-fetch.c | 4 ++++ src/lib-imap-urlauth/imap-urlauth-fetch.h | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diffs (55 lines): diff -r b2541217f74b -r 8d20f3cde49a src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Thu May 30 18:04:17 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Thu May 30 18:04:52 2013 +0300 @@ -357,7 +357,6 @@ const struct cmd_urlfetch_url *url; const struct imap_arg *args; struct cmd_urlfetch_url *ufurl; - int ret; if (client->urlauth_ctx == NULL) { client_send_command_error(cmd, "URLAUTH disabled."); @@ -387,17 +386,16 @@ ctx->ufetch = imap_urlauth_fetch_init(client->urlauth_ctx, cmd_urlfetch_url_callback, cmd); - ret = 1; array_foreach(&urls, url) { - ret = imap_urlauth_fetch_url(ctx->ufetch, url->url, url->flags); - if (ret < 0) { + if (imap_urlauth_fetch_url(ctx->ufetch, url->url, url->flags) < 0) { /* fatal error */ ctx->failed = TRUE; break; } } - if (ret != 0 && cmd->client->output_cmd_lock != cmd) { + if ((ctx->failed || !imap_urlauth_fetch_is_pending(ctx->ufetch)) + && cmd->client->output_cmd_lock != cmd) { /* finished */ cmd_urlfetch_finish(cmd); return TRUE; diff -r b2541217f74b -r 8d20f3cde49a src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:17 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:52 2013 +0300 @@ -516,3 +516,7 @@ return pending; } +bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch) +{ + return ufetch->pending_requests > 0; +} diff -r b2541217f74b -r 8d20f3cde49a src/lib-imap-urlauth/imap-urlauth-fetch.h --- a/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:17 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:52 2013 +0300 @@ -45,6 +45,8 @@ int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url, enum imap_urlauth_fetch_flags url_flags); + bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch); +bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch); #endif From dovecot at dovecot.org Thu May 30 18:05:20 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 18:05:20 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Added API for using the fetch int... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fc2ba01feb78 changeset: 16425:fc2ba01feb78 user: Stephan Bosch date: Thu May 30 18:04:58 2013 +0300 description: lib-imap-urlauth: Added API for using the fetch interface with an already parsed IMAP URL object. diffstat: src/lib-imap-urlauth/imap-urlauth-fetch.c | 13 ++++++++++++- src/lib-imap-urlauth/imap-urlauth-fetch.h | 4 ++++ 2 files changed, 16 insertions(+), 1 deletions(-) diffs (51 lines): diff -r 8d20f3cde49a -r fc2ba01feb78 src/lib-imap-urlauth/imap-urlauth-fetch.c --- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:52 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:58 2013 +0300 @@ -348,7 +348,6 @@ struct mail_user *mail_user = uctx->user; struct imap_url *imap_url; const char *error, *errormsg; - int ret = 0; /* parse the url */ if (imap_url_parse(url, NULL, url_parse_flags, &imap_url, &error) < 0) { @@ -363,6 +362,18 @@ return 1; } + return imap_urlauth_fetch_url_parsed(ufetch, url, imap_url, url_flags); +} + +int imap_urlauth_fetch_url_parsed(struct imap_urlauth_fetch *ufetch, + const char *url, struct imap_url *imap_url, + enum imap_urlauth_fetch_flags url_flags) +{ + struct imap_urlauth_context *uctx = ufetch->uctx; + struct mail_user *mail_user = uctx->user; + const char *error, *errormsg; + int ret = 0; + ufetch->failed = FALSE; ufetch->pending_requests++; diff -r 8d20f3cde49a -r fc2ba01feb78 src/lib-imap-urlauth/imap-urlauth-fetch.h --- a/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:52 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:58 2013 +0300 @@ -1,6 +1,7 @@ #ifndef IMAP_URLAUTH_FETCH_H #define IMAP_URLAUTH_FETCH_H +struct imap_url; struct imap_urlauth_context; struct imap_urlauth_fetch; @@ -45,6 +46,9 @@ int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url, enum imap_urlauth_fetch_flags url_flags); +int imap_urlauth_fetch_url_parsed(struct imap_urlauth_fetch *ufetch, + const char *url, struct imap_url *imap_url, + enum imap_urlauth_fetch_flags url_flags); bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch); bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch); From dovecot at dovecot.org Thu May 30 19:03:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 19:03:15 +0300 Subject: dovecot-2.2: lib-index: Fixed a broken assert. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/528c64739e39 changeset: 16426:528c64739e39 user: Timo Sirainen date: Thu May 30 19:03:05 2013 +0300 description: lib-index: Fixed a broken assert. diffstat: src/lib-index/mail-index-transaction-export.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r fc2ba01feb78 -r 528c64739e39 src/lib-index/mail-index-transaction-export.c --- a/src/lib-index/mail-index-transaction-export.c Thu May 30 18:04:58 2013 +0300 +++ b/src/lib-index/mail-index-transaction-export.c Thu May 30 19:03:05 2013 +0300 @@ -113,7 +113,7 @@ /* we're resizing the extension. use the resize struct. */ intro = &resizes[ext_id]; - i_assert(intro->ext_id == idx); + i_assert(intro->ext_id == idx || idx == (uint32_t)-1); intro->name_size = idx != (uint32_t)-1 ? 0 : strlen(rext->name); buffer_append(buf, intro, sizeof(*intro)); From dovecot at dovecot.org Thu May 30 21:45:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 21:45:25 +0300 Subject: dovecot-2.2: layout=index: Allow mailbox create/delete/rename du... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e90e9a7c4ff8 changeset: 16427:e90e9a7c4ff8 user: Timo Sirainen date: Thu May 30 21:45:13 2013 +0300 description: layout=index: Allow mailbox create/delete/rename during mailbox list iteration. diffstat: src/lib-storage/list/mailbox-list-index-iter.c | 9 +++---- src/lib-storage/list/mailbox-list-index.c | 28 ++++++++++++------------- src/lib-storage/list/mailbox-list-index.h | 5 +--- 3 files changed, 18 insertions(+), 24 deletions(-) diffs (114 lines): diff -r 528c64739e39 -r e90e9a7c4ff8 src/lib-storage/list/mailbox-list-index-iter.c --- a/src/lib-storage/list/mailbox-list-index-iter.c Thu May 30 19:03:05 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index-iter.c Thu May 30 21:45:13 2013 +0300 @@ -59,7 +59,8 @@ ctx->info.ns = list->ns; ctx->path = str_new(pool, 128); ctx->next_node = ilist->mailbox_tree; - ilist->iter_refcount++; + ctx->mailbox_pool = ilist->mailbox_pool; + pool_ref(ctx->mailbox_pool); } return &ctx->ctx; } @@ -188,10 +189,8 @@ if (ctx->backend_ctx != NULL) ret = ilist->module_ctx.super.iter_deinit(ctx->backend_ctx); - else { - i_assert(ilist->iter_refcount > 0); - ilist->iter_refcount--; - } + else + pool_unref(&ctx->mailbox_pool); pool_unref(&ctx->info_pool); pool_unref(&_ctx->pool); diff -r 528c64739e39 -r e90e9a7c4ff8 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Thu May 30 19:03:05 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Thu May 30 21:45:13 2013 +0300 @@ -23,17 +23,25 @@ mail_index_reset_error(ilist->index); } +static void mailbox_list_index_init_pool(struct mailbox_list_index *ilist) +{ + ilist->mailbox_pool = pool_alloconly_create("mailbox list index", 4096); + hash_table_create_direct(&ilist->mailbox_names, ilist->mailbox_pool, 0); + hash_table_create_direct(&ilist->mailbox_hash, ilist->mailbox_pool, 0); +} + void mailbox_list_index_reset(struct mailbox_list_index *ilist) { - i_assert(ilist->iter_refcount == 0); + hash_table_destroy(&ilist->mailbox_names); + hash_table_destroy(&ilist->mailbox_hash); + pool_unref(&ilist->mailbox_pool); - hash_table_clear(ilist->mailbox_names, TRUE); - hash_table_clear(ilist->mailbox_hash, TRUE); - p_clear(ilist->mailbox_pool); ilist->mailbox_tree = NULL; ilist->highest_name_id = 0; ilist->sync_log_file_seq = 0; ilist->sync_log_file_offset = 0; + + mailbox_list_index_init_pool(ilist); } static int mailbox_list_index_index_open(struct mailbox_list *list) @@ -300,8 +308,6 @@ const struct mail_index_header *hdr; const char *error; - i_assert(ilist->iter_refcount == 0); - hdr = mail_index_get_header(view); if (!force && hdr->log_file_seq == ilist->sync_log_file_seq && @@ -357,11 +363,6 @@ struct mail_index_view *view; int ret; - if (ilist->iter_refcount > 0) { - /* someone's already iterating. don't break them. */ - return 0; - } - if (mailbox_list_index_index_open(list) < 0) return -1; if (mail_index_refresh(ilist->index) < 0) { @@ -608,10 +609,7 @@ ilist->subs_hdr_ext_id = mail_index_ext_register(ilist->index, "subs", sizeof(uint32_t), 0, sizeof(uint32_t)); - - ilist->mailbox_pool = pool_alloconly_create("mailbox list index", 4096); - hash_table_create_direct(&ilist->mailbox_names, ilist->mailbox_pool, 0); - hash_table_create_direct(&ilist->mailbox_hash, ilist->mailbox_pool, 0); + mailbox_list_index_init_pool(ilist); mailbox_list_index_status_init_finish(list); } diff -r 528c64739e39 -r e90e9a7c4ff8 src/lib-storage/list/mailbox-list-index.h --- a/src/lib-storage/list/mailbox-list-index.h Thu May 30 19:03:05 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.h Thu May 30 21:45:13 2013 +0300 @@ -87,10 +87,6 @@ struct mail_index *index; uint32_t ext_id, msgs_ext_id, hmodseq_ext_id, subs_hdr_ext_id; - /* Number of iterations going on. Don't refresh mailbox list while - any iterations are going on. */ - int iter_refcount; - pool_t mailbox_pool; /* uin32_t id => name */ HASH_TABLE(void *, char *) mailbox_names; @@ -115,6 +111,7 @@ struct mailbox_list_index_iterate_context { struct mailbox_list_iterate_context ctx; struct mailbox_list_iterate_context *backend_ctx; + pool_t mailbox_pool; struct mailbox_info info; pool_t info_pool; From dovecot at dovecot.org Thu May 30 22:26:09 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:26:09 +0300 Subject: dovecot-2.1: auth: Fixed error handling for proxy host dns_lookup() Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/99952f2b56ae changeset: 14973:99952f2b56ae user: Timo Sirainen date: Thu May 30 22:25:57 2013 +0300 description: auth: Fixed error handling for proxy host dns_lookup() diffstat: src/auth/auth-worker-server.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r d16581e2d7cf -r 99952f2b56ae src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Wed May 29 12:44:15 2013 +0300 +++ b/src/auth/auth-worker-server.c Thu May 30 22:25:57 2013 +0300 @@ -392,6 +392,13 @@ struct auth_worker_connection *conn; struct auth_worker_request *request; + if (worker_request_queue == NULL) { + /* we're deinitializing */ + callback(t_strdup_printf("FAIL\t%d", + PASSDB_RESULT_INTERNAL_FAILURE), context); + return NULL; + } + request = p_new(pool, struct auth_worker_request, 1); request->created = ioloop_time; request->data_str = p_strdup(pool, auth_stream_reply_export(data)); From dovecot at dovecot.org Thu May 30 22:26:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:26:18 +0300 Subject: dovecot-2.2: auth: Fixed error handling for proxy host dns_lookup() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b8a175d93ef6 changeset: 16428:b8a175d93ef6 user: Timo Sirainen date: Thu May 30 22:26:14 2013 +0300 description: auth: Fixed error handling for proxy host dns_lookup() diffstat: src/auth/auth-worker-server.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r e90e9a7c4ff8 -r b8a175d93ef6 src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Thu May 30 21:45:13 2013 +0300 +++ b/src/auth/auth-worker-server.c Thu May 30 22:26:14 2013 +0300 @@ -393,6 +393,13 @@ struct auth_worker_connection *conn; struct auth_worker_request *request; + if (worker_request_queue == NULL) { + /* we're deinitializing */ + callback(t_strdup_printf("FAIL\t%d", + PASSDB_RESULT_INTERNAL_FAILURE), context); + return NULL; + } + request = p_new(pool, struct auth_worker_request, 1); request->created = ioloop_time; request->data = p_strdup(pool, data); From dovecot at dovecot.org Thu May 30 22:27:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:27:18 +0300 Subject: dovecot-2.1: Reverted previous wrong commit. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7961f4f3b341 changeset: 14974:7961f4f3b341 user: Timo Sirainen date: Thu May 30 22:27:07 2013 +0300 description: Reverted previous wrong commit. diffstat: src/auth/auth-worker-server.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diffs (17 lines): diff -r 99952f2b56ae -r 7961f4f3b341 src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Thu May 30 22:25:57 2013 +0300 +++ b/src/auth/auth-worker-server.c Thu May 30 22:27:07 2013 +0300 @@ -392,13 +392,6 @@ struct auth_worker_connection *conn; struct auth_worker_request *request; - if (worker_request_queue == NULL) { - /* we're deinitializing */ - callback(t_strdup_printf("FAIL\t%d", - PASSDB_RESULT_INTERNAL_FAILURE), context); - return NULL; - } - request = p_new(pool, struct auth_worker_request, 1); request->created = ioloop_time; request->data_str = p_strdup(pool, auth_stream_reply_export(data)); From dovecot at dovecot.org Thu May 30 22:27:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:27:28 +0300 Subject: dovecot-2.2: Reverted previous wrong commit. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f98fdf0a7ba4 changeset: 16429:f98fdf0a7ba4 user: Timo Sirainen date: Thu May 30 22:27:23 2013 +0300 description: Reverted previous wrong commit. diffstat: src/auth/auth-worker-server.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diffs (17 lines): diff -r b8a175d93ef6 -r f98fdf0a7ba4 src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Thu May 30 22:26:14 2013 +0300 +++ b/src/auth/auth-worker-server.c Thu May 30 22:27:23 2013 +0300 @@ -393,13 +393,6 @@ struct auth_worker_connection *conn; struct auth_worker_request *request; - if (worker_request_queue == NULL) { - /* we're deinitializing */ - callback(t_strdup_printf("FAIL\t%d", - PASSDB_RESULT_INTERNAL_FAILURE), context); - return NULL; - } - request = p_new(pool, struct auth_worker_request, 1); request->created = ioloop_time; request->data = p_strdup(pool, data); From dovecot at dovecot.org Thu May 30 22:27:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:27:47 +0300 Subject: dovecot-2.1: auth: Fixed error handling for proxy host dns_lookup() Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e4b66c2912da changeset: 14975:e4b66c2912da user: Timo Sirainen date: Thu May 30 22:27:38 2013 +0300 description: auth: Fixed error handling for proxy host dns_lookup() diffstat: src/auth/auth-request.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diffs (13 lines): diff -r 7961f4f3b341 -r e4b66c2912da src/auth/auth-request.c --- a/src/auth/auth-request.c Thu May 30 22:27:07 2013 +0300 +++ b/src/auth/auth-request.c Thu May 30 22:27:38 2013 +0300 @@ -1636,9 +1636,6 @@ if (dns_lookup(host, &dns_set, auth_request_proxy_dns_callback, ctx) < 0) { /* failed early */ - request->internal_failure = TRUE; - auth_request_proxy_finish_failure(request); - auth_request_unref(&request); return -1; } ctx->callback = callback; From dovecot at dovecot.org Thu May 30 22:28:01 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:28:01 +0300 Subject: dovecot-2.2: auth: Fixed error handling for proxy host dns_lookup() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1cf6ce033a25 changeset: 16430:1cf6ce033a25 user: Timo Sirainen date: Thu May 30 22:27:57 2013 +0300 description: auth: Fixed error handling for proxy host dns_lookup() diffstat: src/auth/auth-request.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diffs (13 lines): diff -r f98fdf0a7ba4 -r 1cf6ce033a25 src/auth/auth-request.c --- a/src/auth/auth-request.c Thu May 30 22:27:23 2013 +0300 +++ b/src/auth/auth-request.c Thu May 30 22:27:57 2013 +0300 @@ -1689,9 +1689,6 @@ if (dns_lookup(host, &dns_set, auth_request_proxy_dns_callback, ctx, &ctx->dns_lookup) < 0) { /* failed early */ - request->internal_failure = TRUE; - auth_request_proxy_finish_failure(request); - auth_request_unref(&request); return -1; } ctx->callback = callback; From dovecot at dovecot.org Thu May 30 22:45:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 30 May 2013 22:45:15 +0300 Subject: dovecot-2.2: imap: URLFETCH's tagged reply wasn't sent while TCP... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/04b325dbb7bc changeset: 16431:04b325dbb7bc user: Timo Sirainen date: Thu May 30 22:44:54 2013 +0300 description: imap: URLFETCH's tagged reply wasn't sent while TCP corked. diffstat: src/imap/cmd-urlfetch.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (40 lines): diff -r 1cf6ce033a25 -r 04b325dbb7bc src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Thu May 30 22:27:57 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Thu May 30 22:44:54 2013 +0300 @@ -255,10 +255,11 @@ bool last, void *context) { struct client_command_context *cmd = context; + struct client *client = cmd->client; struct cmd_urlfetch_context *ctx = cmd->context; int ret; - o_stream_cork(cmd->client->output); + o_stream_cork(client->output); if (reply == NULL) { /* fatal failure */ ctx->failed = TRUE; @@ -273,20 +274,20 @@ str_append(response, "* URLFETCH "); imap_append_astring(response, reply->url); str_append(response, " NIL"); - client_send_line(cmd->client, str_c(response)); + client_send_line(client, str_c(response)); if (reply->error != NULL) { - client_send_line(cmd->client, t_strdup_printf( + client_send_line(client, t_strdup_printf( "* NO %s.", reply->error)); } ret = 1; } - o_stream_uncork(cmd->client->output); if ((last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) || ret < 0) { cmd_urlfetch_finish(cmd); client_command_free(&cmd); } + o_stream_uncork(client->output); return ret; } From dovecot at dovecot.org Fri May 31 02:30:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 31 May 2013 02:30:36 +0300 Subject: dovecot-2.2: imap: URLFETCH's URL callback would prematurely unc... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a3b5b762639a changeset: 16432:a3b5b762639a user: Stephan Bosch date: Fri May 31 02:29:49 2013 +0300 description: imap: URLFETCH's URL callback would prematurely uncork the output stream when called for a local URL. diffstat: src/imap/cmd-urlfetch.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diffs (71 lines): diff -r 04b325dbb7bc -r a3b5b762639a src/imap/cmd-urlfetch.c --- a/src/imap/cmd-urlfetch.c Thu May 30 22:44:54 2013 +0300 +++ b/src/imap/cmd-urlfetch.c Fri May 31 02:29:49 2013 +0300 @@ -22,6 +22,7 @@ unsigned int failed:1; unsigned int finished:1; unsigned int extended:1; + unsigned int in_io_handler:1; }; struct cmd_urlfetch_url { @@ -132,6 +133,7 @@ struct client *client = cmd->client; struct cmd_urlfetch_context *ctx = (struct cmd_urlfetch_context *)cmd->context; + bool urls_pending; int ret = 1; if (cmd->cancel) @@ -158,7 +160,11 @@ client_send_line(client, ""); client->output_cmd_lock = NULL; - if (imap_urlauth_fetch_continue(ctx->ufetch)) { + ctx->in_io_handler = TRUE; + urls_pending = imap_urlauth_fetch_continue(ctx->ufetch); + ctx->in_io_handler = FALSE; + + if (urls_pending) { /* waiting for imap urlauth service */ cmd->state = CLIENT_COMMAND_STATE_WAIT_EXTERNAL; cmd->func = cmd_urlfetch_cancel; @@ -257,9 +263,11 @@ struct client_command_context *cmd = context; struct client *client = cmd->client; struct cmd_urlfetch_context *ctx = cmd->context; + bool in_io_handler = ctx->in_io_handler; int ret; - o_stream_cork(client->output); + if (!in_io_handler) + o_stream_cork(client->output); if (reply == NULL) { /* fatal failure */ ctx->failed = TRUE; @@ -287,7 +295,8 @@ cmd_urlfetch_finish(cmd); client_command_free(&cmd); } - o_stream_uncork(client->output); + if (!in_io_handler) + o_stream_uncork(client->output); return ret; } @@ -387,6 +396,7 @@ ctx->ufetch = imap_urlauth_fetch_init(client->urlauth_ctx, cmd_urlfetch_url_callback, cmd); + ctx->in_io_handler = TRUE; array_foreach(&urls, url) { if (imap_urlauth_fetch_url(ctx->ufetch, url->url, url->flags) < 0) { /* fatal error */ @@ -394,6 +404,7 @@ break; } } + ctx->in_io_handler = FALSE; if ((ctx->failed || !imap_urlauth_fetch_is_pending(ctx->ufetch)) && cmd->client->output_cmd_lock != cmd) { From dovecot at dovecot.org Fri May 31 17:05:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 31 May 2013 17:05:25 +0300 Subject: dovecot-2.2: lib-imap-client: Connect and command timeouts are n... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a6b0a45319ab changeset: 16433:a6b0a45319ab user: Timo Sirainen date: Fri May 31 17:05:13 2013 +0300 description: lib-imap-client: Connect and command timeouts are now configurable. Also use the same connect timeout for the DNS lookup's timeout. diffstat: src/lib-imap-client/imapc-client.c | 5 +++++ src/lib-imap-client/imapc-client.h | 9 +++++++++ src/lib-imap-client/imapc-connection.c | 13 +++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) diffs (95 lines): diff -r a3b5b762639a -r a6b0a45319ab src/lib-imap-client/imapc-client.c --- a/src/lib-imap-client/imapc-client.c Fri May 31 02:29:49 2013 +0300 +++ b/src/lib-imap-client/imapc-client.c Fri May 31 17:05:13 2013 +0300 @@ -59,6 +59,11 @@ p_strdup(pool, set->temp_path_prefix); client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir); client->set.max_idle_time = set->max_idle_time; + client->set.connect_timeout_msecs = set->connect_timeout_msecs != 0 ? + set->connect_timeout_msecs : + IMAPC_DEFAULT_CONNECT_TIMEOUT_MSECS; + client->set.cmd_timeout_msecs = set->cmd_timeout_msecs != 0 ? + set->cmd_timeout_msecs : IMAPC_DEFAULT_COMMAND_TIMEOUT_MSECS; if (set->ssl_mode != IMAPC_CLIENT_SSL_MODE_NONE) { client->set.ssl_mode = set->ssl_mode; diff -r a3b5b762639a -r a6b0a45319ab src/lib-imap-client/imapc-client.h --- a/src/lib-imap-client/imapc-client.h Fri May 31 02:29:49 2013 +0300 +++ b/src/lib-imap-client/imapc-client.h Fri May 31 17:05:13 2013 +0300 @@ -49,6 +49,9 @@ IMAPC_CLIENT_SSL_MODE_STARTTLS }; +#define IMAPC_DEFAULT_CONNECT_TIMEOUT_MSECS (1000*30) +#define IMAPC_DEFAULT_COMMAND_TIMEOUT_MSECS (1000*60*5) + struct imapc_client_settings { const char *host; unsigned int port; @@ -68,6 +71,12 @@ const char *rawlog_dir; const char *ssl_crypto_device; bool debug; + + /* Timeout for logging in. 0 = default. */ + unsigned int connect_timeout_msecs; + /* Timeout for IMAP commands. Reset every time more data is being + sent or received. 0 = default. */ + unsigned int cmd_timeout_msecs; }; struct imapc_command_reply { diff -r a3b5b762639a -r a6b0a45319ab src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Fri May 31 02:29:49 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Fri May 31 17:05:13 2013 +0300 @@ -20,9 +20,6 @@ #include #include -#define IMAPC_DNS_LOOKUP_TIMEOUT_MSECS (1000*30) -#define IMAPC_CONNECT_TIMEOUT_MSECS (1000*30) -#define IMAPC_COMMAND_TIMEOUT_MSECS (1000*60*5) #define IMAPC_MAX_INLINE_LITERAL_SIZE (1024*32) enum imapc_input_state { @@ -1238,11 +1235,11 @@ case IMAPC_CONNECTION_STATE_CONNECTING: i_error("imapc(%s): connect(%s, %u) timed out after %u seconds", conn->name, net_ip2addr(ip), conn->client->set.port, - IMAPC_CONNECT_TIMEOUT_MSECS/1000); + conn->client->set.connect_timeout_msecs/1000); break; case IMAPC_CONNECTION_STATE_AUTHENTICATING: i_error("imapc(%s): Authentication timed out after %u seconds", - conn->name, IMAPC_CONNECT_TIMEOUT_MSECS/1000); + conn->name, conn->client->set.connect_timeout_msecs/1000); break; default: i_unreached(); @@ -1307,7 +1304,7 @@ conn); conn->io = io_add(fd, IO_WRITE, imapc_connection_connected, conn); conn->parser = imap_parser_create(conn->input, NULL, (size_t)-1); - conn->to = timeout_add(IMAPC_CONNECT_TIMEOUT_MSECS, + conn->to = timeout_add(conn->client->set.connect_timeout_msecs, imapc_connection_timeout, conn); conn->to_output = timeout_add(conn->client->set.max_idle_time*1000, imapc_connection_reset_idle, conn); @@ -1364,7 +1361,7 @@ memset(&dns_set, 0, sizeof(dns_set)); dns_set.dns_client_socket_path = conn->client->set.dns_client_socket_path; - dns_set.timeout_msecs = IMAPC_DNS_LOOKUP_TIMEOUT_MSECS; + dns_set.timeout_msecs = conn->client->set.connect_timeout_msecs; imapc_connection_set_state(conn, IMAPC_CONNECTION_STATE_CONNECTING); if (conn->ips_count == 0 && @@ -1679,7 +1676,7 @@ /* add timeout for commands if there's not one yet (pre-login has its own timeout) */ if (conn->to == NULL) { - conn->to = timeout_add(IMAPC_COMMAND_TIMEOUT_MSECS, + conn->to = timeout_add(conn->client->set.cmd_timeout_msecs, imapc_command_timeout, conn); } } From dovecot at dovecot.org Fri May 31 17:36:56 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 31 May 2013 17:36:56 +0300 Subject: dovecot-2.2: imapc: Empty imapc_user expands to namespace's owne... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6e07d290066c changeset: 16434:6e07d290066c user: Timo Sirainen date: Fri May 31 17:36:19 2013 +0300 description: imapc: Empty imapc_user expands to namespace's owner, or with public namespaces to user itself. The main idea is that with shared namespaces it now expands to the shared username, allowing shared mailbox access via imapc. diffstat: src/lib-storage/index/imapc/imapc-storage.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diffs (17 lines): diff -r a6b0a45319ab -r 6e07d290066c src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Fri May 31 17:05:13 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Fri May 31 17:36:19 2013 +0300 @@ -230,7 +230,12 @@ return -1; } set.port = storage->set->imapc_port; - set.username = storage->set->imapc_user; + if (storage->set->imapc_user[0] != '\0') + set.username = storage->set->imapc_user; + else if (ns->owner != NULL) + set.username = ns->owner->username; + else + set.username = ns->user->username; set.master_user = storage->set->imapc_master_user; set.password = storage->set->imapc_password; if (*set.password == '\0') { From dovecot at dovecot.org Fri May 31 17:36:56 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 31 May 2013 17:36:56 +0300 Subject: dovecot-2.2: imapc: Changed imapc_user setting's default to empty. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/199769f2979f changeset: 16435:199769f2979f user: Timo Sirainen date: Fri May 31 17:36:45 2013 +0300 description: imapc: Changed imapc_user setting's default to empty. diffstat: src/lib-storage/index/imapc/imapc-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 6e07d290066c -r 199769f2979f src/lib-storage/index/imapc/imapc-settings.c --- a/src/lib-storage/index/imapc/imapc-settings.c Fri May 31 17:36:19 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-settings.c Fri May 31 17:36:45 2013 +0300 @@ -36,7 +36,7 @@ .imapc_host = "", .imapc_port = 143, - .imapc_user = "%u", + .imapc_user = "", .imapc_master_user = "", .imapc_password = "",