From dovecot at dovecot.org Tue Apr 2 11:18:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 11:18:54 +0300 Subject: dovecot-2.2: auth: Fixed ANONYMOUS mechanism to work again. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/caead8e506dc changeset: 16136:caead8e506dc user: Timo Sirainen date: Tue Apr 02 11:18:45 2013 +0300 description: auth: Fixed ANONYMOUS mechanism to work again. diffstat: src/auth/mech-anonymous.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r c75b26e1d17f -r caead8e506dc src/auth/mech-anonymous.c --- a/src/auth/mech-anonymous.c Sun Mar 31 19:02:32 2013 +0300 +++ b/src/auth/mech-anonymous.c Tue Apr 02 11:18:45 2013 +0300 @@ -20,6 +20,7 @@ request->user = p_strdup(request->pool, request->set->anonymous_username); + request->passdb_success = TRUE; auth_request_success(request, "", 0); } From dovecot at dovecot.org Tue Apr 2 11:23:03 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 11:23:03 +0300 Subject: dovecot-2.2: auth: Fixed also DOVECOT-TOKEN (=URLAUTH) and NTLM/... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ac54838e9071 changeset: 16137:ac54838e9071 user: Timo Sirainen date: Tue Apr 02 11:22:52 2013 +0300 description: auth: Fixed also DOVECOT-TOKEN (=URLAUTH) and NTLM/GSS-SPNEGO (via winbind) to work. diffstat: src/auth/mech-dovecot-token.c | 6 ++++-- src/auth/mech-winbind.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diffs (31 lines): diff -r caead8e506dc -r ac54838e9071 src/auth/mech-dovecot-token.c --- a/src/auth/mech-dovecot-token.c Tue Apr 02 11:18:45 2013 +0300 +++ b/src/auth/mech-dovecot-token.c Tue Apr 02 11:22:52 2013 +0300 @@ -51,10 +51,12 @@ const char *valid_token = auth_token_get(service, pid, request->user, session_id); - if (strcmp(auth_token, valid_token) == 0) + if (strcmp(auth_token, valid_token) == 0) { + request->passdb_success = TRUE; auth_request_success(request, NULL, 0); - else + } else { auth_request_fail(request); + } } /* make sure it's cleared */ diff -r caead8e506dc -r ac54838e9071 src/auth/mech-winbind.c --- a/src/auth/mech-winbind.c Tue Apr 02 11:18:45 2013 +0300 +++ b/src/auth/mech-winbind.c Tue Apr 02 11:22:52 2013 +0300 @@ -257,7 +257,8 @@ "%s", error); return HR_FAIL; } - + + request->auth_request.passdb_success = TRUE; if (gss_spnego && strcmp(token[1], "*") != 0) { buffer_t *buf; From dovecot at dovecot.org Tue Apr 2 11:32:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 11:32:44 +0300 Subject: dovecot-2.1: lib-index: Backported MAIL_TRANSACTION_ATTRIBUTE_UP... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b2fad9b21e60 changeset: 14945:b2fad9b21e60 user: Timo Sirainen date: Tue Apr 02 11:32:24 2013 +0300 description: lib-index: Backported MAIL_TRANSACTION_ATTRIBUTE_UPDATE from v2.2 diffstat: src/doveadm/doveadm-dump-log.c | 14 ++++++++++++++ src/lib-index/mail-index-modseq.c | 4 +++- src/lib-index/mail-index-sync-update.c | 5 +++++ src/lib-index/mail-transaction-log.h | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) diffs (93 lines): diff -r 78eb04213251 -r b2fad9b21e60 src/doveadm/doveadm-dump-log.c --- a/src/doveadm/doveadm-dump-log.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/doveadm/doveadm-dump-log.c Tue Apr 02 11:32:24 2013 +0300 @@ -52,6 +52,7 @@ case MAIL_TRANSACTION_FLAG_UPDATE: case MAIL_TRANSACTION_KEYWORD_UPDATE: case MAIL_TRANSACTION_KEYWORD_RESET: + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: /* these changes increase modseq */ return TRUE; } @@ -114,6 +115,9 @@ case MAIL_TRANSACTION_BOUNDARY: name = "boundary"; break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + name = "attribute-update"; + break; default: name = t_strdup_printf("unknown: %x", type); break; @@ -413,6 +417,16 @@ printf(" - size=%u\n", rec->size); break; } + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: { + const char *keys = data; + unsigned int i; + + for (i = 0; i < size && keys[i] != '\0'; ) { + printf(" - %s\n", keys+i); + i += strlen(keys+i) + 1; + } + break; + } default: break; } diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-index-modseq.c --- a/src/lib-index/mail-index-modseq.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-index-modseq.c Tue Apr 02 11:32:24 2013 +0300 @@ -375,12 +375,14 @@ array_create_from_buffer(&uids, &uid_buf, sizeof(struct mail_transaction_keyword_reset)); break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + break; default: return; } /* update modseqs */ - count = array_count(&uids); + count = array_is_created(&uids) ? array_count(&uids) : 0; for (i = 0; i < count; i++) { rec = array_idx(&uids, i); if (mail_index_lookup_seq_range(ctx->view, rec->seq1, rec->seq2, diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-index-sync-update.c --- a/src/lib-index/mail-index-sync-update.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-index-sync-update.c Tue Apr 02 11:32:24 2013 +0300 @@ -523,6 +523,7 @@ const struct mail_transaction_header *hdr, const void *data) { + uint64_t modseq; int ret = 0; switch (hdr->type & MAIL_TRANSACTION_TYPE_MASK) { @@ -804,6 +805,10 @@ break; case MAIL_TRANSACTION_BOUNDARY: break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + modseq = mail_transaction_log_view_get_prev_modseq(ctx->view->log_view); + mail_index_modseq_update_highest(ctx->modseq_ctx, modseq); + break; default: mail_index_sync_set_corrupted(ctx, "Unknown transaction record type 0x%x", diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-transaction-log.h --- a/src/lib-index/mail-transaction-log.h Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-transaction-log.h Tue Apr 02 11:32:24 2013 +0300 @@ -44,8 +44,9 @@ MAIL_TRANSACTION_INDEX_DELETED = 0x00020000, MAIL_TRANSACTION_INDEX_UNDELETED = 0x00040000, MAIL_TRANSACTION_BOUNDARY = 0x00080000, + MAIL_TRANSACTION_ATTRIBUTE_UPDATE = 0x00100000, - MAIL_TRANSACTION_TYPE_MASK = 0x000fffff, + MAIL_TRANSACTION_TYPE_MASK = 0x0fffffff, #define MAIL_TRANSACTION_EXT_MASK \ (MAIL_TRANSACTION_EXT_INTRO | MAIL_TRANSACTION_EXT_RESET | \ From dovecot at dovecot.org Tue Apr 2 11:52:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 11:52:45 +0300 Subject: dovecot-2.1: quota-status: If size parameter is given, use it to... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/2493ec20df8c changeset: 14946:2493ec20df8c user: Timo Sirainen date: Tue Apr 02 11:52:36 2013 +0300 description: quota-status: If size parameter is given, use it to check quota. diffstat: src/plugins/quota/quota-status.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diffs (50 lines): diff -r b2fad9b21e60 -r 2493ec20df8c src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Tue Apr 02 11:32:24 2013 +0300 +++ b/src/plugins/quota/quota-status.c Tue Apr 02 11:52:36 2013 +0300 @@ -21,6 +21,7 @@ struct connection conn; char *recipient; + uoff_t size; }; static enum quota_protocol protocol; @@ -42,7 +43,8 @@ i_free_and_null(client->recipient); } -static int quota_check(struct mail_user *user, const char **error_r) +static int +quota_check(struct mail_user *user, uoff_t mail_size, const char **error_r) { struct quota_user *quser = QUOTA_USER_CONTEXT(user); struct mail_namespace *ns; @@ -60,7 +62,7 @@ box = mailbox_alloc(ns->list, "INBOX", 0); ctx = quota_transaction_begin(box); - ret = quota_test_alloc(ctx, 1, &too_large); + ret = quota_test_alloc(ctx, I_MAX(1, mail_size), &too_large); quota_transaction_rollback(&ctx); mailbox_free(&box); @@ -95,7 +97,7 @@ o_stream_send_str(client->conn.output, "action=REJECT Unknown user\n\n"); } else if (ret > 0) { - if ((ret = quota_check(user, &error)) > 0) + if ((ret = quota_check(user, client->size, &error)) > 0) o_stream_send_str(client->conn.output, "action=OK\n\n"); else if (ret == 0) { o_stream_send_str(client->conn.output, t_strdup_printf( @@ -124,6 +126,10 @@ if (client->recipient == NULL && strncmp(line, "recipient=", 10) == 0) client->recipient = i_strdup(line + 10); + else if (strncmp(line, "size=", 5) == 0) { + if (str_to_uoff(line+5, &client->size) < 0) + client->size = 0; + } return 1; } From dovecot at dovecot.org Tue Apr 2 23:11:56 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 23:11:56 +0300 Subject: dovecot-2.2: dovecot.m4: Removed --without-dovecot-install-dirs ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f11ffd0e8b16 changeset: 16138:f11ffd0e8b16 user: Timo Sirainen date: Tue Apr 02 23:11:30 2013 +0300 description: dovecot.m4: Removed --without-dovecot-install-dirs from distcheck configure flags. Perhaps the whole feature should be designed some other way. Some plugins require the dovecot_* variables to point to their real paths. diffstat: dovecot.m4 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r ac54838e9071 -r f11ffd0e8b16 dovecot.m4 --- a/dovecot.m4 Tue Apr 02 11:22:52 2013 +0300 +++ b/dovecot.m4 Tue Apr 02 23:11:30 2013 +0300 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 9 +# serial 10 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" eval `grep -i '^dovecot_[[a-z_]]*=' "$dovecotdir"/dovecot-config` eval `grep '^LIBDOVECOT[[A-Z_]]*=' "$dovecotdir"/dovecot-config` From dovecot at dovecot.org Tue Apr 2 23:32:22 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 23:32:22 +0300 Subject: dovecot-2.2: lib-master: If fifo isn't accepted, don't double-de... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5f365feb5a2b changeset: 16140:5f365feb5a2b user: Timo Sirainen date: Tue Apr 02 23:32:10 2013 +0300 description: lib-master: If fifo isn't accepted, don't double-destroy the connection. diffstat: src/lib-master/master-service.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r c256b246302d -r 5f365feb5a2b src/lib-master/master-service.c --- a/src/lib-master/master-service.c Tue Apr 02 23:29:43 2013 +0300 +++ b/src/lib-master/master-service.c Tue Apr 02 23:32:10 2013 +0300 @@ -814,8 +814,7 @@ if (close(conn.fd) < 0) i_error("close(service connection) failed: %m"); master_service_client_connection_destroyed(service); - } - if (conn.fifo) { + } else if (conn.fifo) { /* reading FIFOs stays open forever, don't count them as real clients */ master_service_client_connection_destroyed(service); From dovecot at dovecot.org Tue Apr 2 23:32:22 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Apr 2013 23:32:22 +0300 Subject: dovecot-2.2: lib-http: Added ssl_ca setting to specify the CA ce... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c256b246302d changeset: 16139:c256b246302d user: Timo Sirainen date: Tue Apr 02 23:29:43 2013 +0300 description: lib-http: Added ssl_ca setting to specify the CA certificate directly. diffstat: src/lib-http/http-client-peer.c | 1 + src/lib-http/http-client.c | 1 + src/lib-http/http-client.h | 2 +- 3 files changed, 3 insertions(+), 1 deletions(-) diffs (34 lines): diff -r f11ffd0e8b16 -r c256b246302d src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Tue Apr 02 23:11:30 2013 +0300 +++ b/src/lib-http/http-client-peer.c Tue Apr 02 23:29:43 2013 +0300 @@ -228,6 +228,7 @@ const char *source; memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = peer->client->set.ssl_ca_dir; + ssl_set.ca = peer->client->set.ssl_ca; ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = peer->client->set.ssl_crypto_device; diff -r f11ffd0e8b16 -r c256b246302d src/lib-http/http-client.c --- a/src/lib-http/http-client.c Tue Apr 02 23:11:30 2013 +0300 +++ b/src/lib-http/http-client.c Tue Apr 02 23:29:43 2013 +0300 @@ -82,6 +82,7 @@ if (set->rawlog_dir != NULL && *set->rawlog_dir != '\0') client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir); client->set.ssl_ca_dir = p_strdup(pool, set->ssl_ca_dir); + client->set.ssl_ca = p_strdup(pool, set->ssl_ca); 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); diff -r f11ffd0e8b16 -r c256b246302d src/lib-http/http-client.h --- a/src/lib-http/http-client.h Tue Apr 02 23:11:30 2013 +0300 +++ b/src/lib-http/http-client.h Tue Apr 02 23:29:43 2013 +0300 @@ -33,7 +33,7 @@ struct http_client_settings { const char *dns_client_socket_path; - const char *ssl_ca_dir; + const char *ssl_ca_dir, *ssl_ca; const char *ssl_crypto_device; bool ssl_allow_invalid_cert; bool ssl_verify; From pigeonhole at rename-it.nl Wed Apr 3 00:09:30 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:09:30 +0200 Subject: dovecot-2.1-pigeonhole: lib-sieve: Fixed plugin module load func... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/5860cbaaffaa changeset: 1680:5860cbaaffaa user: Stephan Bosch date: Tue Apr 02 23:09:14 2013 +0200 description: lib-sieve: Fixed plugin module load functionality. Initializing multiple Sieve instances would hang. diffstat: src/lib-sieve/sieve-plugins.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) diffs (36 lines): diff -r b086291b9b9a -r 5860cbaaffaa src/lib-sieve/sieve-plugins.c --- a/src/lib-sieve/sieve-plugins.c Thu Mar 28 22:12:03 2013 +0100 +++ b/src/lib-sieve/sieve-plugins.c Tue Apr 02 23:09:14 2013 +0200 @@ -58,7 +58,7 @@ void sieve_plugins_load (struct sieve_instance *svinst, const char *path, const char *plugins) { - struct module *new_modules, *module; + struct module *module; struct module_dir_load_settings mod_set; const char **module_names; unsigned int i; @@ -83,22 +83,9 @@ /* Load missing plugin modules */ - new_modules = module_dir_load_missing + sieve_modules = module_dir_load_missing (sieve_modules, path, plugins, &mod_set); - if ( sieve_modules == NULL ) { - /* No modules loaded yet */ - sieve_modules = new_modules; - } else { - /* Find the end of the list */ - module = sieve_modules; - while ( module != NULL && module->next != NULL ) - module = module->next; - - /* Add newly loaded modules */ - module->next = new_modules; - } - /* Call plugin load functions for this Sieve instance */ if ( svinst->plugins == NULL ) { From pigeonhole at rename-it.nl Wed Apr 3 00:14:44 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:14:44 +0200 Subject: dovecot-2.2-pigeonhole: lib-sievestorage: Fixed a few potential ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/b086291b9b9a changeset: 1732:b086291b9b9a user: Stephan Bosch date: Thu Mar 28 22:12:03 2013 +0100 description: lib-sievestorage: Fixed a few potential problems in script save code. diffstat: src/lib-sievestorage/sieve-storage-save.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (30 lines): diff -r 3ba1c379a6b8 -r b086291b9b9a src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Thu Mar 28 21:31:59 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-save.c Thu Mar 28 22:12:03 2013 +0100 @@ -202,7 +202,7 @@ ctx = p_new(pool, struct sieve_save_context, 1); ctx->pool = pool; ctx->storage = storage; - ctx->scriptname = scriptname; + ctx->scriptname = p_strdup(pool, scriptname); ctx->scriptobject = NULL; T_BEGIN { @@ -305,7 +305,7 @@ if ( ctx->scriptobject == NULL ) { if ( ctx->storage->error_code == SIEVE_ERROR_NOT_FOUND ) { sieve_storage_set_critical(ctx->storage, - "save: Temporary script file with name '%s' got lost, " + "save: Temporary script file '%s' got lost, " "which should not happen (possibly deleted externally).", ctx->tmp_path); } @@ -324,7 +324,7 @@ const char *scriptname; int ret; - ret = sieve_storage_get_active_scriptfile(ctx->storage, &scriptname); + ret = sieve_storage_get_active_scriptname(ctx->storage, &scriptname); if ( ret > 0 ) { /* Is the requested script active? */ result = ( strcmp(ctx->scriptname, scriptname) == 0 ); From pigeonhole at rename-it.nl Wed Apr 3 00:14:44 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:14:44 +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/5323b5e65289 changeset: 1733:5323b5e65289 user: Stephan Bosch date: Thu Mar 28 22:14:21 2013 +0100 description: Merged changes from Pigeonhole v0.3 tree. diffstat: src/lib-sievestorage/sieve-storage-save.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (30 lines): diff -r 42f11a1be763 -r 5323b5e65289 src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Thu Mar 28 21:33:31 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-save.c Thu Mar 28 22:14:21 2013 +0100 @@ -202,7 +202,7 @@ ctx = p_new(pool, struct sieve_save_context, 1); ctx->pool = pool; ctx->storage = storage; - ctx->scriptname = scriptname; + ctx->scriptname = p_strdup(pool, scriptname); ctx->scriptobject = NULL; T_BEGIN { @@ -305,7 +305,7 @@ if ( ctx->scriptobject == NULL ) { if ( ctx->storage->error_code == SIEVE_ERROR_NOT_FOUND ) { sieve_storage_set_critical(ctx->storage, - "save: Temporary script file with name '%s' got lost, " + "save: Temporary script file '%s' got lost, " "which should not happen (possibly deleted externally).", ctx->tmp_path); } @@ -324,7 +324,7 @@ const char *scriptname; int ret; - ret = sieve_storage_get_active_scriptfile(ctx->storage, &scriptname); + ret = sieve_storage_get_active_scriptname(ctx->storage, &scriptname); if ( ret > 0 ) { /* Is the requested script active? */ result = ( strcmp(ctx->scriptname, scriptname) == 0 ); From pigeonhole at rename-it.nl Wed Apr 3 00:14:45 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:14:45 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Implemented handling the ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/8b8bba6e8c2c changeset: 1735:8b8bba6e8c2c user: Stephan Bosch date: Tue Apr 02 23:14:13 2013 +0200 description: doveadm-sieve: Implemented handling the situation when the main active script is a regular file. Tested whether this change breaks ManageSieve and basic dsync, but not much more. More tests pending. If you use sync be careful with this commit. diffstat: src/lib-sieve/sieve-plugins.c | 17 +- src/lib-sievestorage/sieve-storage-list.c | 2 +- src/lib-sievestorage/sieve-storage-save.c | 55 ++++- src/lib-sievestorage/sieve-storage-save.h | 6 + src/lib-sievestorage/sieve-storage-script.c | 95 +++++-- src/lib-sievestorage/sieve-storage-script.h | 22 +- src/lib-sievestorage/sieve-storage.c | 67 ++-- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 262 +++++++++++++++++----- 8 files changed, 365 insertions(+), 161 deletions(-) diffs (truncated from 932 to 300 lines): diff -r 5323b5e65289 -r 8b8bba6e8c2c src/lib-sieve/sieve-plugins.c --- a/src/lib-sieve/sieve-plugins.c Thu Mar 28 22:14:21 2013 +0100 +++ b/src/lib-sieve/sieve-plugins.c Tue Apr 02 23:14:13 2013 +0200 @@ -58,7 +58,7 @@ void sieve_plugins_load (struct sieve_instance *svinst, const char *path, const char *plugins) { - struct module *new_modules, *module; + struct module *module; struct module_dir_load_settings mod_set; const char **module_names; unsigned int i; @@ -83,22 +83,9 @@ /* Load missing plugin modules */ - new_modules = module_dir_load_missing + sieve_modules = module_dir_load_missing (sieve_modules, path, plugins, &mod_set); - if ( sieve_modules == NULL ) { - /* No modules loaded yet */ - sieve_modules = new_modules; - } else { - /* Find the end of the list */ - module = sieve_modules; - while ( module != NULL && module->next != NULL ) - module = module->next; - - /* Add newly loaded modules */ - module->next = new_modules; - } - /* Call plugin load functions for this Sieve instance */ if ( svinst->plugins == NULL ) { diff -r 5323b5e65289 -r 8b8bba6e8c2c src/lib-sievestorage/sieve-storage-list.c --- a/src/lib-sievestorage/sieve-storage-list.c Thu Mar 28 22:14:21 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-list.c Tue Apr 02 23:14:13 2013 +0200 @@ -45,7 +45,7 @@ T_BEGIN { /* Get the name of the active script */ - if ( sieve_storage_get_active_scriptfile(storage, &active) < 0) { + if ( sieve_storage_active_script_get_file(storage, &active) < 0) { ctx = NULL; } else { pool = pool_alloconly_create("sieve_list_context", 4096); diff -r 5323b5e65289 -r 8b8bba6e8c2c src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Thu Mar 28 22:14:21 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-save.c Tue Apr 02 23:14:13 2013 +0200 @@ -9,6 +9,7 @@ #include "ostream.h" #include "str.h" #include "eacces-error.h" +#include "safe-mkstemp.h" #include "sieve-script.h" #include "sieve-script-file.h" @@ -324,7 +325,7 @@ const char *scriptname; int ret; - ret = sieve_storage_get_active_scriptname(ctx->storage, &scriptname); + ret = sieve_storage_active_script_get_name(ctx->storage, &scriptname); if ( ret > 0 ) { /* Is the requested script active? */ result = ( strcmp(ctx->scriptname, scriptname) == 0 ); @@ -368,3 +369,55 @@ sieve_storage_save_destroy(ctx); } + +int sieve_storage_save_as_active_script(struct sieve_storage *storage, + struct istream *input) +{ + int fd; + string_t *temp_path; + struct ostream *output; + + temp_path = t_str_new(256); + str_append(temp_path, storage->active_path); + str_append_c(temp_path, '.'); + fd = safe_mkstemp_hostpid + (temp_path, storage->file_create_mode, (uid_t)-1, (gid_t)-1); + if ( fd < 0 ) { + if ( errno == EACCES ) { + sieve_storage_set_critical(storage, + "failed to create temporary file: %s", + eacces_error_get_creating("open", str_c(temp_path))); + } else { + sieve_storage_set_critical(storage, + "failed to create temporary file: open(%s) failed: %m", + str_c(temp_path)); + } + return -1; + } + + output = o_stream_create_fd(fd, 0, FALSE); + if (o_stream_send_istream(output, input) < 0) { + sieve_storage_set_critical(storage, + "o_stream_send_istream(%s) failed: %m", str_c(temp_path)); + o_stream_destroy(&output); + (void)unlink(str_c(temp_path)); + return -1; + } + o_stream_destroy(&output); + + if (rename(str_c(temp_path), storage->active_path) < 0) { + if ( ENOSPACE(errno) ) { + sieve_storage_set_error(storage, + SIEVE_ERROR_NO_SPACE, "Not enough disk space"); + } else if ( errno == EACCES ) { + sieve_storage_set_critical(storage, + "%s", eacces_error_get("rename", storage->active_path)); + } else { + sieve_storage_set_critical(storage, + "rename(%s, %s) failed: %m", str_c(temp_path), storage->active_path); + } + } + + (void)unlink(str_c(temp_path)); + return 0; +} diff -r 5323b5e65289 -r 8b8bba6e8c2c src/lib-sievestorage/sieve-storage-save.h --- a/src/lib-sievestorage/sieve-storage-save.h Thu Mar 28 22:14:21 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-save.h Tue Apr 02 23:14:13 2013 +0200 @@ -26,5 +26,11 @@ int sieve_storage_save_commit(struct sieve_save_context **ctx); +/* Saves input directly as a regular file at the active script path. + * This is needed for the doveadm-sieve plugin. + */ +int sieve_storage_save_as_active_script(struct sieve_storage *storage, + struct istream *input); + #endif diff -r 5323b5e65289 -r 8b8bba6e8c2c src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Thu Mar 28 22:14:21 2013 +0100 +++ b/src/lib-sievestorage/sieve-storage-script.c Tue Apr 02 23:14:13 2013 +0200 @@ -41,7 +41,7 @@ /* Prevent initializing the active script link as a script when it * resides in the sieve storage directory. */ - if ( *(storage->link_path) == '\0' ) { + if ( scriptname != NULL && *(storage->link_path) == '\0' ) { const char *fname; fname = strrchr(path, '/'); @@ -154,7 +154,7 @@ return 1; } -static const char *sieve_storage_parse_link +static const char *sieve_storage_parse_active_link (struct sieve_storage *storage, const char *link, const char **scriptname_r) { const char *fname, *scriptname, *scriptpath; @@ -197,7 +197,7 @@ return fname; } -int sieve_storage_get_active_scriptfile +int sieve_storage_active_script_get_file (struct sieve_storage *storage, const char **file_r) { const char *link, *scriptfile; @@ -210,7 +210,7 @@ return ret; /* Parse the link */ - scriptfile = sieve_storage_parse_link(storage, link, NULL); + scriptfile = sieve_storage_parse_active_link(storage, link, NULL); if (scriptfile == NULL) { /* Obviously someone has been playing with our symlink, @@ -224,7 +224,7 @@ return 1; } -int sieve_storage_get_active_scriptname +int sieve_storage_active_script_get_name (struct sieve_storage *storage, const char **name_r) { const char *link; @@ -236,7 +236,7 @@ if ( (ret=sieve_storage_read_active_link(storage, &link)) <= 0 ) return ret; - if ( sieve_storage_parse_link(storage, link, name_r) == NULL ) { + if ( sieve_storage_parse_active_link(storage, link, name_r) == NULL ) { /* Obviously someone has been playing with our symlink, * ignore this situation and report 'no active script'. * Activation should fix this situation. @@ -247,7 +247,13 @@ return 1; } -struct sieve_script *sieve_storage_get_active_script +const char *sieve_storage_active_script_get_path + (struct sieve_storage *storage) +{ + return storage->active_path; +} + +struct sieve_script *sieve_storage_active_script_get (struct sieve_storage *storage) { struct sieve_script *script; @@ -268,7 +274,7 @@ } /* Parse the link */ - scriptfile = sieve_storage_parse_link(storage, link, NULL); + scriptfile = sieve_storage_parse_active_link(storage, link, NULL); if (scriptfile == NULL) { /* Obviously someone has been playing with our symlink, @@ -289,6 +295,54 @@ return script; } +int sieve_storage_active_script_get_last_change +(struct sieve_storage *storage, time_t *last_change_r) +{ + struct stat st; + + /* Try direct lstat first */ + if (lstat(storage->active_path, &st) == 0) { + *last_change_r = st.st_mtime; + return 0; + } + + /* Check error */ + if (errno != ENOENT) { + sieve_storage_set_critical(storage, "lstat(%s) failed: %m", + storage->active_path); + } + + /* Fall back to statting storage directory */ + return sieve_storage_get_last_change(storage, last_change_r); +} + +int +sieve_storage_active_script_is_no_link(struct sieve_storage *storage) +{ + struct stat st; + + /* Stat the file */ + if ( lstat(storage->active_path, &st) != 0 ) { + if ( errno != ENOENT ) { + sieve_storage_set_critical(storage, + "Failed to stat active sieve script symlink (%s): %m.", + storage->active_path); + return -1; + } + return 0; + } + + if ( S_ISLNK( st.st_mode ) ) + return 0; + if ( !S_ISREG( st.st_mode ) ) { + sieve_storage_set_critical( storage, + "Active sieve script file '%s' is no symlink nor a regular file.", + storage->active_path ); + return -1; + } + return 1; +} + int sieve_storage_script_is_active(struct sieve_script *script) { struct sieve_storage_script *st_script = @@ -297,7 +351,7 @@ int ret = 0; T_BEGIN { - ret = sieve_storage_get_active_scriptfile(st_script->storage, &afile); + ret = sieve_storage_active_script_get_file(st_script->storage, &afile); if ( ret > 0 ) { /* Is the requested script active? */ @@ -486,7 +540,7 @@ * resolves automatically. This step is only necessary to provide a * proper return value indicating whether the script was already active. */ - ret = sieve_storage_get_active_scriptfile(storage, &afile); + ret = sieve_storage_active_script_get_file(storage, &afile); /* Is the requested script already active? */ if ( ret <= 0 || strcmp(st_script->file.filename, afile) != 0 ) @@ -545,27 +599,6 @@ return ret; } -int sieve_storage_get_active_script_last_change -(struct sieve_storage *storage, time_t *last_change_r) -{ From pigeonhole at rename-it.nl Wed Apr 3 00:14:45 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:14:45 +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/0dffac42192b changeset: 1736:0dffac42192b user: Stephan Bosch date: Tue Apr 02 23:14:37 2013 +0200 description: Merged changes from Pigeonhole v0.3 tree. From pigeonhole at rename-it.nl Wed Apr 3 00:14:44 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 02 Apr 2013 23:14:44 +0200 Subject: dovecot-2.2-pigeonhole: lib-sieve: Fixed plugin module load func... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/5860cbaaffaa changeset: 1734:5860cbaaffaa user: Stephan Bosch date: Tue Apr 02 23:09:14 2013 +0200 description: lib-sieve: Fixed plugin module load functionality. Initializing multiple Sieve instances would hang. diffstat: src/lib-sieve/sieve-plugins.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) diffs (36 lines): diff -r b086291b9b9a -r 5860cbaaffaa src/lib-sieve/sieve-plugins.c --- a/src/lib-sieve/sieve-plugins.c Thu Mar 28 22:12:03 2013 +0100 +++ b/src/lib-sieve/sieve-plugins.c Tue Apr 02 23:09:14 2013 +0200 @@ -58,7 +58,7 @@ void sieve_plugins_load (struct sieve_instance *svinst, const char *path, const char *plugins) { - struct module *new_modules, *module; + struct module *module; struct module_dir_load_settings mod_set; const char **module_names; unsigned int i; @@ -83,22 +83,9 @@ /* Load missing plugin modules */ - new_modules = module_dir_load_missing + sieve_modules = module_dir_load_missing (sieve_modules, path, plugins, &mod_set); - if ( sieve_modules == NULL ) { - /* No modules loaded yet */ - sieve_modules = new_modules; - } else { - /* Find the end of the list */ - module = sieve_modules; - while ( module != NULL && module->next != NULL ) - module = module->next; - - /* Add newly loaded modules */ - module->next = new_modules; - } - /* Call plugin load functions for this Sieve instance */ if ( svinst->plugins == NULL ) { From pigeonhole at rename-it.nl Wed Apr 3 01:08:11 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 03 Apr 2013 00:08:11 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Prevented initializing th... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/097d68a9dd32 changeset: 1737:097d68a9dd32 user: Stephan Bosch date: Wed Apr 03 00:08:05 2013 +0200 description: doveadm-sieve: Prevented initializing the Sieve storage multiple times. diffstat: src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diffs (22 lines): diff -r 0dffac42192b -r 097d68a9dd32 src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Tue Apr 02 23:14:37 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Wed Apr 03 00:08:05 2013 +0200 @@ -83,11 +83,16 @@ mail_sieve_user_init (struct mail_user *user, struct sieve_storage **svstorage_r) { - /* delayed initialization of sieve storage until it's actually needed */ + struct sieve_mail_user *suser = SIEVE_USER_CONTEXT(user); struct mail_user_vfuncs *v = user->vlast; struct sieve_environment svenv; - struct sieve_mail_user *suser; + if (suser != NULL) { + *svstorage_r = suser->sieve_storage; + return 0; + } + + /* Delayed initialization of sieve storage until it's actually needed */ memset(&svenv, 0, sizeof(svenv)); svenv.username = user->username; (void)mail_user_get_home(user, &svenv.home_dir); From dovecot at dovecot.org Wed Apr 3 11:40:35 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 03 Apr 2013 11:40:35 +0300 Subject: dovecot-2.2: dovecot.m4: Reverted last change with added comments. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cd3482684bd2 changeset: 16141:cd3482684bd2 user: Timo Sirainen date: Wed Apr 03 11:36:56 2013 +0300 description: dovecot.m4: Reverted last change with added comments. diffstat: dovecot.m4 | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (28 lines): diff -r 5f365feb5a2b -r cd3482684bd2 dovecot.m4 --- a/dovecot.m4 Tue Apr 02 23:32:10 2013 +0300 +++ b/dovecot.m4 Wed Apr 03 11:36:56 2013 +0300 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 10 +# serial 11 AC_DEFUN([DC_DOVECOT_MODULEDIR],[ AC_ARG_WITH(moduledir, @@ -70,12 +70,14 @@ cd $dovecotdir abs_dovecotdir=`pwd` cd $old - DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir" + DISTCHECK_CONFIGURE_FLAGS="--with-dovecot=$abs_dovecotdir --without-dovecot-install-dirs" eval `grep -i '^dovecot_[[a-z_]]*=' "$dovecotdir"/dovecot-config` 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' From dovecot at dovecot.org Thu Apr 4 12:21:16 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 12:21:16 +0300 Subject: dovecot-2.2: lib-http: Pass DNS lookup error message to caller i... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/25d77e31d914 changeset: 16142:25d77e31d914 user: Timo Sirainen date: Thu Apr 04 12:21:04 2013 +0300 description: lib-http: Pass DNS lookup error message to caller instead of logging it. diffstat: src/lib-http/http-client-host.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diffs (43 lines): diff -r cd3482684bd2 -r 25d77e31d914 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Wed Apr 03 11:36:56 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 12:21:04 2013 +0300 @@ -164,13 +164,15 @@ } static void -http_client_host_lookup_failure(struct http_client_host *host) +http_client_host_lookup_failure(struct http_client_host *host, const char *error) { struct http_client_host_port *hport; + error = t_strdup_printf("Failed to lookup host %s: %s", + host->name, error); array_foreach_modifiable(&host->ports, hport) { http_client_host_port_error(hport, - HTTP_CLIENT_REQUEST_ERROR_HOST_LOOKUP_FAILED, "Failed to lookup host"); + HTTP_CLIENT_REQUEST_ERROR_HOST_LOOKUP_FAILED, error); } } @@ -184,9 +186,7 @@ host->dns_lookup = NULL; if (result->ret != 0) { - i_error("http-client: dns_lookup(%s) failed: %s", - host->name, result->error); - http_client_host_lookup_failure(host); + http_client_host_lookup_failure(host, result->error); return; } @@ -235,9 +235,7 @@ } else if (dns_set.dns_client_socket_path == NULL) { ret = net_gethostbyname(host->name, &ips, &ips_count); if (ret != 0) { - i_error("http-client: net_gethostbyname(%s) failed: %s", - host->name, net_gethosterror(ret)); - http_client_host_lookup_failure(host); + http_client_host_lookup_failure(host, net_gethosterror(ret)); return; } From dovecot at dovecot.org Thu Apr 4 13:21:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 13:21:10 +0300 Subject: dovecot-2.2: lib-http: Each peer doesn't need a separate ssl con... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cb4dc46f3327 changeset: 16143:cb4dc46f3327 user: Timo Sirainen date: Thu Apr 04 12:48:52 2013 +0300 description: lib-http: Each peer doesn't need a separate ssl context, enough to have one for http_client. Also removed #ifdefs for building with SSL support. lib-ssl-iostream nowadays dynamically loads the SSL library when needed, and also handles failures if Dovecot was built without SSL support. diffstat: src/lib-http/http-client-connection.c | 10 +------- src/lib-http/http-client-host.c | 11 ++++++++++ src/lib-http/http-client-peer.c | 36 +--------------------------------- src/lib-http/http-client-private.h | 14 ++---------- src/lib-http/http-client.c | 23 ++++++++++++++++++++++ 5 files changed, 41 insertions(+), 53 deletions(-) diffs (233 lines): diff -r 25d77e31d914 -r cb4dc46f3327 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 12:21:04 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 12:48:52 2013 +0300 @@ -651,7 +651,6 @@ (void)http_client_connection_next_request(conn); } -#ifdef HTTP_BUILD_SSL static int http_client_connection_ssl_handshaked(void *context) { struct http_client_connection *conn = context; @@ -689,7 +688,7 @@ struct ssl_iostream_settings ssl_set; const char *source; - if (conn->peer->ssl_ctx == NULL) { + if (conn->client->ssl_ctx == NULL) { http_client_connection_error(conn, "No SSL context"); return -1; } @@ -706,7 +705,7 @@ source = t_strdup_printf ("connection %s: ", http_client_connection_label(conn)); - if (io_stream_create_ssl(conn->peer->ssl_ctx, source, &ssl_set, + if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, &conn->conn.input, &conn->conn.output, &conn->ssl_iostream) < 0) { http_client_connection_error(conn, "Couldn't initialize SSL client"); return -1; @@ -722,7 +721,6 @@ http_client_connection_ready(conn); return 0; } -#endif static void http_client_connection_connected(struct connection *_conn, bool success) @@ -736,13 +734,11 @@ } else { http_client_connection_debug(conn, "Connected"); -#ifdef HTTP_BUILD_SSL if (conn->peer->addr.ssl) { if (http_client_connection_ssl_init(conn) < 0) http_client_peer_connection_failure(conn->peer); return; } -#endif http_client_connection_ready(conn); } } @@ -829,10 +825,8 @@ conn->closing = TRUE; conn->connected = FALSE; -#ifdef HTTP_BUILD_SSL if (conn->ssl_iostream != NULL) ssl_iostream_unref(&conn->ssl_iostream); -#endif connection_deinit(&conn->conn); diff -r 25d77e31d914 -r cb4dc46f3327 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Thu Apr 04 12:21:04 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 12:48:52 2013 +0300 @@ -118,6 +118,17 @@ { struct http_client_peer *peer = NULL; struct http_client_peer_addr addr; + const char *error; + + if (hport->ssl && host->client->ssl_ctx == NULL) { + if (http_client_init_ssl_ctx(host->client, &error) < 0) { + http_client_host_port_error(hport, + HTTP_CLIENT_REQUEST_ERROR_CONNECT_FAILED, error); + if (host->client->ioloop != NULL) + io_loop_stop(host->client->ioloop); + return; + } + } while (hport->ips_connect_idx < host->ips_count) { addr.ip = host->ips[hport->ips_connect_idx]; diff -r 25d77e31d914 -r cb4dc46f3327 src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 12:21:04 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 12:48:52 2013 +0300 @@ -207,9 +207,8 @@ const struct http_client_peer_addr *addr) { struct http_client_peer *peer; -#ifdef HTTP_BUILD_SSL - struct ssl_iostream_settings ssl_set; -#endif + + i_assert(!addr->ssl || client->ssl_ctx != NULL); peer = i_new(struct http_client_peer, 1); peer->client = client; @@ -223,32 +222,6 @@ http_client_peer_debug(peer, "Peer created"); -#ifdef HTTP_BUILD_SSL - if (peer->addr.ssl && peer->ssl_ctx == NULL) { - const char *source; - memset(&ssl_set, 0, sizeof(ssl_set)); - ssl_set.ca_dir = peer->client->set.ssl_ca_dir; - ssl_set.ca = peer->client->set.ssl_ca; - ssl_set.verify_remote_cert = TRUE; - ssl_set.crypto_device = peer->client->set.ssl_crypto_device; - - source = t_strdup_printf("http-client: peer %s:%u", - net_ip2addr(&peer->addr.ip), peer->addr.port); - if (ssl_iostream_context_init_client - (source, &ssl_set, &peer->ssl_ctx) < 0) { - http_client_peer_error(peer, "Couldn't initialize SSL context"); - http_client_peer_free(&peer); - return NULL; - } - } -#else - if (peer->addr.ssl) { - http_client_peer_error(peer, "HTTPS is not supported"); - http_client_peer_free(&peer); - return NULL; - } -#endif - if (http_client_peer_connect(peer, 1) < 0) { http_client_peer_free(&peer); return NULL; @@ -281,11 +254,6 @@ array_free(&peer->conns); array_free(&peer->hosts); -#ifdef HTTP_BUILD_SSL - if (peer->ssl_ctx != NULL) - ssl_iostream_context_deinit(&peer->ssl_ctx); -#endif - hash_table_remove (peer->client->peers, (const struct http_client_peer_addr *)&peer->addr); DLLIST_REMOVE(&peer->client->peers_list, peer); diff -r 25d77e31d914 -r cb4dc46f3327 src/lib-http/http-client-private.h --- a/src/lib-http/http-client-private.h Thu Apr 04 12:21:04 2013 +0300 +++ b/src/lib-http/http-client-private.h Thu Apr 04 12:48:52 2013 +0300 @@ -5,8 +5,6 @@ #include "http-client.h" -#define HTTP_BUILD_SSL - #define HTTP_DEFAULT_PORT 80 #define HTTPS_DEFAULT_PORT 443 @@ -113,11 +111,6 @@ /* active connections to this peer */ ARRAY_TYPE(http_client_connection) conns; - /* ssl */ -#ifdef HTTP_BUILD_SSL - struct ssl_iostream_context *ssl_ctx; -#endif - unsigned int destroyed:1; /* peer is being destroyed */ unsigned int no_payload_sync:1; /* expect: 100-continue failed before */ unsigned int last_connect_failed:1; @@ -133,11 +126,7 @@ unsigned int id; // DEBUG: identify parallel connections - /* ssl */ -#ifdef HTTP_BUILD_SSL struct ssl_iostream *ssl_iostream; -#endif - struct http_response_parser *http_parser; struct timeout *to_input, *to_idle, *to_response; @@ -161,6 +150,7 @@ struct http_client_settings set; struct ioloop *ioloop; + struct ssl_iostream_context *ssl_ctx; struct connection_list *conn_list; @@ -185,6 +175,8 @@ net_ip2addr(&conn->conn.ip), conn->conn.port, conn->id); } +int http_client_init_ssl_ctx(struct http_client *client, const char **error_r); + void http_client_request_ref(struct http_client_request *req); void http_client_request_unref(struct http_client_request **_req); int http_client_request_send(struct http_client_request *req, diff -r 25d77e31d914 -r cb4dc46f3327 src/lib-http/http-client.c --- a/src/lib-http/http-client.c Thu Apr 04 12:21:04 2013 +0300 +++ b/src/lib-http/http-client.c Thu Apr 04 12:48:52 2013 +0300 @@ -122,6 +122,9 @@ hash_table_destroy(&client->hosts); connection_list_deinit(&client->conn_list); + + if (client->ssl_ctx != NULL) + ssl_iostream_context_deinit(&client->ssl_ctx); pool_unref(&client->pool); *_client = NULL; } @@ -180,3 +183,23 @@ io_loop_destroy(&client->ioloop); } +int http_client_init_ssl_ctx(struct http_client *client, const char **error_r) +{ + struct ssl_iostream_settings ssl_set; + + if (client->ssl_ctx != NULL) + return 0; + + memset(&ssl_set, 0, sizeof(ssl_set)); + ssl_set.ca_dir = client->set.ssl_ca_dir; + ssl_set.ca = client->set.ssl_ca; + ssl_set.verify_remote_cert = TRUE; + ssl_set.crypto_device = client->set.ssl_crypto_device; + + if (ssl_iostream_context_init_client("lib-http", &ssl_set, + &client->ssl_ctx) < 0) { + *error_r = "Couldn't initialize SSL context"; + return -1; + } + return 0; +} From dovecot at dovecot.org Thu Apr 4 13:21:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 13:21:10 +0300 Subject: dovecot-2.2: lib-ssl-iostream: Removed unused iostream-ssl-none.c Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/778daa3852ef changeset: 16144:778daa3852ef user: Timo Sirainen date: Thu Apr 04 13:12:26 2013 +0300 description: lib-ssl-iostream: Removed unused iostream-ssl-none.c diffstat: src/lib-ssl-iostream/iostream-ssl-none.c | 68 -------------------------------- 1 files changed, 0 insertions(+), 68 deletions(-) diffs (72 lines): diff -r cb4dc46f3327 -r 778daa3852ef src/lib-ssl-iostream/iostream-ssl-none.c --- a/src/lib-ssl-iostream/iostream-ssl-none.c Thu Apr 04 12:48:52 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* Copyright (c) 2011-2013 Dovecot authors, see the included COPYING file */ - -#include "lib.h" -#include "iostream-ssl.h" - -int io_stream_create_ssl(struct ssl_iostream_context *ctx ATTR_UNUSED, - const char *source ATTR_UNUSED, - const struct ssl_iostream_settings *set ATTR_UNUSED, - struct istream **input ATTR_UNUSED, - struct ostream **output ATTR_UNUSED, - struct ssl_iostream **iostream_r) -{ - *iostream_r = NULL; - return -1; -} - -void ssl_iostream_unref(struct ssl_iostream **ssl_io ATTR_UNUSED) -{ -} - -void ssl_iostream_destroy(struct ssl_iostream **ssl_io ATTR_UNUSED) -{ -} - -int ssl_iostream_handshake(struct ssl_iostream *ssl_io ATTR_UNUSED) -{ - return -1; -} -void ssl_iostream_set_handshake_callback(struct ssl_iostream *ssl_io ATTR_UNUSED, - int (*callback)(void *context) ATTR_UNUSED, - void *context ATTR_UNUSED) {} - -bool ssl_iostream_is_handshaked(const struct ssl_iostream *ssl_io ATTR_UNUSED) { return FALSE; } -bool ssl_iostream_has_valid_client_cert(const struct ssl_iostream *ssl_io ATTR_UNUSED) { return FALSE; } -bool ssl_iostream_has_broken_client_cert(struct ssl_iostream *ssl_io ATTR_UNUSED) { return TRUE; } -int ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io ATTR_UNUSED, const char *name ATTR_UNUSED) { return -1; } -const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io ATTR_UNUSED) { return NULL; } -const char *ssl_iostream_get_security_string(struct ssl_iostream *ssl_io ATTR_UNUSED) { return NULL; } -const char *ssl_iostream_get_last_error(struct ssl_iostream *ssl_io ATTR_UNUSED) { return NULL; } - -int ssl_iostream_generate_params(buffer_t *output ATTR_UNUSED) -{ - return -1; -} -int ssl_iostream_context_import_params(struct ssl_iostream_context *ctx ATTR_UNUSED, - const buffer_t *input ATTR_UNUSED) -{ - return -1; -} - -int ssl_iostream_context_init_client(const char *source ATTR_UNUSED, - const struct ssl_iostream_settings *set ATTR_UNUSED, - struct ssl_iostream_context **ctx_r ATTR_UNUSED) -{ - return -1; -} - -int ssl_iostream_context_init_server(const char *source ATTR_UNUSED, - const struct ssl_iostream_settings *set ATTR_UNUSED, - struct ssl_iostream_context **ctx_r) -{ - *ctx_r = NULL; - return -1; -} - -void ssl_iostream_context_deinit(struct ssl_iostream_context **ctx ATTR_UNUSED) -{ -} From dovecot at dovecot.org Thu Apr 4 13:21:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 13:21:10 +0300 Subject: dovecot-2.2: lib-ssl-iostream: API changes to return error strin... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/02f6b66458b1 changeset: 16145:02f6b66458b1 user: Timo Sirainen date: Thu Apr 04 13:20:59 2013 +0300 description: lib-ssl-iostream: API changes to return error strings if init() functions fail. This also fixed a couple of broken error handlings. diffstat: src/doveadm/client-connection.c | 6 +- src/doveadm/dsync/doveadm-dsync.c | 12 +- src/doveadm/server-connection.c | 5 +- src/lib-http/http-client-connection.c | 8 +- src/lib-http/http-client.c | 7 +- src/lib-imap-client/imapc-client.c | 11 +- src/lib-imap-client/imapc-connection.c | 8 +- src/lib-master/master-service-ssl.c | 17 ++- src/lib-master/master-service-ssl.h | 3 +- src/lib-ssl-iostream/iostream-openssl-context.c | 128 +++++++++++++---------- src/lib-ssl-iostream/iostream-openssl-params.c | 14 +- src/lib-ssl-iostream/iostream-openssl.c | 54 +++++---- src/lib-ssl-iostream/iostream-openssl.h | 18 +- src/lib-ssl-iostream/iostream-ssl-private.h | 16 +- src/lib-ssl-iostream/iostream-ssl.c | 44 ++++--- src/lib-ssl-iostream/iostream-ssl.h | 17 +- src/lib-storage/index/pop3c/pop3c-client.c | 19 +- 17 files changed, 213 insertions(+), 174 deletions(-) diffs (truncated from 1032 to 300 lines): diff -r 778daa3852ef -r 02f6b66458b1 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/doveadm/client-connection.c Thu Apr 04 13:20:59 2013 +0300 @@ -350,10 +350,14 @@ static int client_connection_init_ssl(struct client_connection *conn) { + const char *error; + if (master_service_ssl_init(master_service, &conn->input, &conn->output, - &conn->ssl_iostream) < 0) + &conn->ssl_iostream, &error) < 0) { + i_error("SSL init failed: %s", error); return -1; + } if (ssl_iostream_handshake(conn->ssl_iostream) < 0) { i_error("SSL handshake failed: %s", ssl_iostream_get_last_error(conn->ssl_iostream)); diff -r 778daa3852ef -r 02f6b66458b1 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Thu Apr 04 13:20:59 2013 +0300 @@ -569,7 +569,8 @@ } static int dsync_init_ssl_ctx(struct dsync_cmd_context *ctx, - const struct mail_storage_settings *mail_set) + const struct mail_storage_settings *mail_set, + const char **error_r) { struct ssl_iostream_settings ssl_set; @@ -581,8 +582,7 @@ ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = mail_set->ssl_crypto_device; - return ssl_iostream_context_init_client("doveadm", &ssl_set, - &ctx->ssl_ctx); + return ssl_iostream_context_init_client(&ssl_set, &ctx->ssl_ctx, error_r); } static int @@ -594,12 +594,14 @@ struct server_connection *conn; struct ioloop *ioloop; string_t *cmd; + const char *error; server = p_new(ctx->ctx.pool, struct doveadm_server, 1); server->name = p_strdup(ctx->ctx.pool, target); if (ssl) { - if (dsync_init_ssl_ctx(ctx, mail_set) < 0) { - *error_r = "Couldn't initialize SSL context"; + if (dsync_init_ssl_ctx(ctx, mail_set, &error) < 0) { + *error_r = t_strdup_printf( + "Couldn't initialize SSL context: %s", error); return -1; } server->ssl_ctx = ctx->ssl_ctx; diff -r 778daa3852ef -r 02f6b66458b1 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/doveadm/server-connection.c Thu Apr 04 13:20:59 2013 +0300 @@ -350,6 +350,7 @@ static int server_connection_init_ssl(struct server_connection *conn) { struct ssl_iostream_settings ssl_set; + const char *error; if (conn->server->ssl_ctx == NULL) return 0; @@ -361,8 +362,8 @@ if (io_stream_create_ssl(conn->server->ssl_ctx, "doveadm", &ssl_set, &conn->input, &conn->output, - &conn->ssl_iostream) < 0) { - i_error("Couldn't initialize SSL client"); + &conn->ssl_iostream, &error) < 0) { + i_error("Couldn't initialize SSL client: %s", error); return -1; } ssl_iostream_set_handshake_callback(conn->ssl_iostream, diff -r 778daa3852ef -r 02f6b66458b1 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 13:20:59 2013 +0300 @@ -686,7 +686,7 @@ http_client_connection_ssl_init(struct http_client_connection *conn) { struct ssl_iostream_settings ssl_set; - const char *source; + const char *source, *error; if (conn->client->ssl_ctx == NULL) { http_client_connection_error(conn, "No SSL context"); @@ -706,8 +706,10 @@ source = t_strdup_printf ("connection %s: ", http_client_connection_label(conn)); if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, - &conn->conn.input, &conn->conn.output, &conn->ssl_iostream) < 0) { - http_client_connection_error(conn, "Couldn't initialize SSL client"); + &conn->conn.input, &conn->conn.output, + &conn->ssl_iostream, &error) < 0) { + http_client_connection_error(conn, + "Couldn't initialize SSL client: %s", error); return -1; } ssl_iostream_set_handshake_callback(conn->ssl_iostream, diff -r 778daa3852ef -r 02f6b66458b1 src/lib-http/http-client.c --- a/src/lib-http/http-client.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-http/http-client.c Thu Apr 04 13:20:59 2013 +0300 @@ -186,6 +186,7 @@ int http_client_init_ssl_ctx(struct http_client *client, const char **error_r) { struct ssl_iostream_settings ssl_set; + const char *error; if (client->ssl_ctx != NULL) return 0; @@ -196,9 +197,9 @@ ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = client->set.ssl_crypto_device; - if (ssl_iostream_context_init_client("lib-http", &ssl_set, - &client->ssl_ctx) < 0) { - *error_r = "Couldn't initialize SSL context"; + if (ssl_iostream_context_init_client(&ssl_set, &client->ssl_ctx, &error) < 0) { + *error_r = t_strdup_printf("Couldn't initialize SSL context: %s", + error); return -1; } return 0; diff -r 778daa3852ef -r 02f6b66458b1 src/lib-imap-client/imapc-client.c --- a/src/lib-imap-client/imapc-client.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-imap-client/imapc-client.c Thu Apr 04 13:20:59 2013 +0300 @@ -39,7 +39,7 @@ { struct imapc_client *client; struct ssl_iostream_settings ssl_set; - const char *source; + const char *error; pool_t pool; pool = pool_alloconly_create("imapc client", 1024); @@ -70,11 +70,10 @@ ssl_set.verify_remote_cert = set->ssl_verify; ssl_set.crypto_device = set->ssl_crypto_device; - source = t_strdup_printf("%s:%u", set->host, set->port); - if (ssl_iostream_context_init_client(source, &ssl_set, - &client->ssl_ctx) < 0) { - i_error("imapc(%s): Couldn't initialize SSL context", - source); + if (ssl_iostream_context_init_client(&ssl_set, &client->ssl_ctx, + &error) < 0) { + i_error("imapc(%s:%u): Couldn't initialize SSL context: %s", + set->host, set->port, error); } } client->untagged_callback = default_untagged_callback; diff -r 778daa3852ef -r 02f6b66458b1 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 13:20:59 2013 +0300 @@ -1161,7 +1161,7 @@ { struct ssl_iostream_settings ssl_set; struct stat st; - const char *source; + const char *source, *error; if (conn->client->ssl_ctx == NULL) { i_error("imapc(%s): No SSL context", conn->name); @@ -1191,9 +1191,9 @@ source = t_strdup_printf("imapc(%s): ", conn->name); if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, &conn->input, &conn->output, - &conn->ssl_iostream) < 0) { - i_error("imapc(%s): Couldn't initialize SSL client", - conn->name); + &conn->ssl_iostream, &error) < 0) { + i_error("imapc(%s): Couldn't initialize SSL client: %s", + conn->name, error); return -1; } ssl_iostream_set_handshake_callback(conn->ssl_iostream, diff -r 778daa3852ef -r 02f6b66458b1 src/lib-master/master-service-ssl.c --- a/src/lib-master/master-service-ssl.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-master/master-service-ssl.c Thu Apr 04 13:20:59 2013 +0300 @@ -61,15 +61,18 @@ int master_service_ssl_init(struct master_service *service, struct istream **input, struct ostream **output, - struct ssl_iostream **ssl_iostream_r) + struct ssl_iostream **ssl_iostream_r, + const char **error_r) { const struct master_service_ssl_settings *set; struct ssl_iostream_settings ssl_set; i_assert(service->ssl_ctx_initialized); - if (service->ssl_ctx == NULL) + if (service->ssl_ctx == NULL) { + *error_r = "Failed to initialize SSL context"; return -1; + } (void)ssl_refresh_parameters(service); @@ -80,7 +83,7 @@ ssl_set.verify_remote_cert = set->ssl_verify_client_cert; return io_stream_create_ssl(service->ssl_ctx, service->name, &ssl_set, - input, output, ssl_iostream_r); + input, output, ssl_iostream_r, error_r); } bool master_service_ssl_is_enabled(struct master_service *service) @@ -92,6 +95,7 @@ { const struct master_service_ssl_settings *set; struct ssl_iostream_settings ssl_set; + const char *error; if (service->ssl_ctx_initialized) return; @@ -116,9 +120,10 @@ ssl_set.verbose = set->verbose_ssl; ssl_set.verify_remote_cert = set->ssl_verify_client_cert; - if (ssl_iostream_context_init_server(service->name, &ssl_set, - &service->ssl_ctx) < 0) { - i_error("SSL context initialization failed, disabling SSL"); + if (ssl_iostream_context_init_server(&ssl_set, &service->ssl_ctx, + &error) < 0) { + i_error("SSL context initialization failed, disabling SSL: %s", + error); master_service_ssl_io_listeners_remove(service); return; } diff -r 778daa3852ef -r 02f6b66458b1 src/lib-master/master-service-ssl.h --- a/src/lib-master/master-service-ssl.h Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-master/master-service-ssl.h Thu Apr 04 13:20:59 2013 +0300 @@ -5,7 +5,8 @@ int master_service_ssl_init(struct master_service *service, struct istream **input, struct ostream **output, - struct ssl_iostream **ssl_iostream_r); + struct ssl_iostream **ssl_iostream_r, + const char **error_r); bool master_service_ssl_is_enabled(struct master_service *service); diff -r 778daa3852ef -r 02f6b66458b1 src/lib-ssl-iostream/iostream-openssl-context.c --- a/src/lib-ssl-iostream/iostream-openssl-context.c Thu Apr 04 13:12:26 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl-context.c Thu Apr 04 13:20:59 2013 +0300 @@ -14,14 +14,15 @@ struct ssl_iostream_password_context { const char *password; - const char *key_source; + const char *error; }; static bool ssl_global_initialized = FALSE; static ENGINE *ssl_iostream_engine; int dovecot_ssl_extdata_index; -static void ssl_iostream_init_global(const struct ssl_iostream_settings *set); +static int ssl_iostream_init_global(const struct ssl_iostream_settings *set, + const char **error_r); const char *openssl_iostream_error(void) { @@ -82,21 +83,20 @@ struct ssl_iostream_password_context *ctx = userdata; if (ctx->password == NULL) { - i_error("%s: SSL private key file is password protected, " - "but password isn't given", ctx->key_source); + ctx->error = "SSL private key file is password protected, " + "but password isn't given"; return 0; } if (i_strocpy(buf, userdata, size) < 0) { - i_error("%s: SSL private key password is too long", - ctx->key_source); + ctx->error = "SSL private key password is too long"; return 0; } return strlen(buf); } int openssl_iostream_load_key(const struct ssl_iostream_settings *set, - const char *key_source, EVP_PKEY **pkey_r) + EVP_PKEY **pkey_r, const char **error_r) { struct ssl_iostream_password_context ctx; EVP_PKEY *pkey; @@ -106,38 +106,42 @@ key = t_strdup_noconst(set->key); From dovecot at dovecot.org Thu Apr 4 13:21:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 13:21:51 +0300 Subject: dovecot-2.2: lib-http: Removed unused code. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ace3911ca077 changeset: 16146:ace3911ca077 user: Timo Sirainen date: Thu Apr 04 13:21:42 2013 +0300 description: lib-http: Removed unused code. diffstat: src/lib-http/http-client-peer.c | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-) diffs (22 lines): diff -r 02f6b66458b1 -r ace3911ca077 src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 13:20:59 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 13:21:42 2013 +0300 @@ -36,18 +36,6 @@ } } -static inline void ATTR_FORMAT(2, 3) -http_client_peer_error(struct http_client_peer *peer, - const char *format, ...) -{ - va_list args; - va_start(args, format); - i_error("http-client: peer %s:%u: %s", - net_ip2addr(&peer->addr.ip), peer->addr.port, - t_strdup_vprintf(format, args)); - va_end(args); -} - /* * Peer address */ From dovecot at dovecot.org Thu Apr 4 14:11:16 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:11:16 +0300 Subject: dovecot-2.2: lib-http: If http_client_request_submit() fails, do... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b4927eea33fd changeset: 16147:b4927eea33fd user: Timo Sirainen date: Thu Apr 04 14:11:10 2013 +0300 description: lib-http: If http_client_request_submit() fails, don't immediately call the callback. This simplifies the caller's error handling since there is now only one error code path instead of two. diffstat: src/lib-http/http-client-host.c | 11 +++++++++ src/lib-http/http-client-private.h | 8 ++++++ src/lib-http/http-client-request.c | 44 ++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 2 deletions(-) diffs (145 lines): diff -r ace3911ca077 -r b4927eea33fd src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Thu Apr 04 13:21:42 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 14:11:10 2013 +0300 @@ -278,6 +278,7 @@ host->client = client; host->name = i_strdup(hostname); i_array_init(&host->ports, 4); + i_array_init(&host->delayed_failing_requests, 1); hostname = host->name; hash_table_insert(client->hosts, hostname, host); @@ -397,6 +398,9 @@ } array_free(&host->ports); + i_assert(array_count(&host->delayed_failing_requests) == 0); + array_free(&host->delayed_failing_requests); + i_free(host->ips); i_free(host->name); i_free(host); @@ -404,6 +408,13 @@ void http_client_host_switch_ioloop(struct http_client_host *host) { + struct http_client_request **req; + if (host->dns_lookup != NULL) dns_lookup_switch_ioloop(host->dns_lookup); + array_foreach_modifiable(&host->delayed_failing_requests, req) { + (*req)->to_delayed_error = + io_loop_move_timeout(&(*req)->to_delayed_error); + } + } diff -r ace3911ca077 -r b4927eea33fd src/lib-http/http-client-private.h --- a/src/lib-http/http-client-private.h Thu Apr 04 13:21:42 2013 +0300 +++ b/src/lib-http/http-client-private.h Thu Apr 04 14:11:10 2013 +0300 @@ -50,6 +50,10 @@ unsigned int attempts; unsigned int redirects; + unsigned int delayed_error_status; + const char *delayed_error; + struct timeout *to_delayed_error; + http_client_request_callback_t *callback; void *context; @@ -63,6 +67,7 @@ unsigned int payload_wait:1; unsigned int ssl:1; unsigned int urgent:1; + unsigned int submitted:1; }; struct http_client_host_port { @@ -87,6 +92,9 @@ unsigned int ips_count; struct ip_addr *ips; + /* list of requests in this host that are waiting for ioloop */ + ARRAY(struct http_client_request *) delayed_failing_requests; + /* requests are managed on a per-port basis */ ARRAY_TYPE(http_client_host_port) ports; diff -r ace3911ca077 -r b4927eea33fd src/lib-http/http-client-request.c --- a/src/lib-http/http-client-request.c Thu Apr 04 13:21:42 2013 +0300 +++ b/src/lib-http/http-client-request.c Thu Apr 04 14:11:10 2013 +0300 @@ -81,6 +81,23 @@ req->refcount++; } +static void http_client_request_remove_delayed(struct http_client_request *req) +{ + struct http_client_request *const *reqs; + unsigned int i, count; + + timeout_remove(&req->to_delayed_error); + + reqs = array_get(&req->host->delayed_failing_requests, &count); + for (i = 0; i < count; i++) { + if (reqs[i] == req) { + array_delete(&req->host->delayed_failing_requests, i, 1); + return; + } + } + i_unreached(); +} + void http_client_request_unref(struct http_client_request **_req) { struct http_client_request *req = *_req; @@ -101,6 +118,8 @@ if (client->pending_requests == 0 && client->ioloop != NULL) io_loop_stop(client->ioloop); + if (req->to_delayed_error != NULL) + http_client_request_remove_delayed(req); if (req->payload_input != NULL) i_stream_unref(&req->payload_input); if (req->payload_output != NULL) @@ -193,6 +212,7 @@ req->client->pending_requests++; http_client_request_do_submit(req); + req->submitted = TRUE; } static void @@ -454,11 +474,31 @@ } } +static void http_client_request_error_delayed(struct http_client_request *req) +{ + http_client_request_remove_delayed(req); + http_client_request_send_error(req, req->delayed_error_status, + req->delayed_error); + http_client_request_unref(&req); +} + void http_client_request_error(struct http_client_request *req, unsigned int status, const char *error) { - http_client_request_send_error(req, status, error); - http_client_request_unref(&req); + if (!req->submitted) { + /* we're still in http_client_request_submit(). delay + reporting the error, so the caller doesn't have to handle + immediate callbacks. */ + i_assert(req->delayed_error == NULL); + req->delayed_error = p_strdup(req->pool, error); + req->delayed_error_status = status; + req->to_delayed_error = timeout_add_short(0, + http_client_request_error_delayed, req); + array_append(&req->host->delayed_failing_requests, &req, 1); + } else { + http_client_request_send_error(req, status, error); + http_client_request_unref(&req); + } } void http_client_request_abort(struct http_client_request **_req) From dovecot at dovecot.org Thu Apr 4 14:20:48 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:20:48 +0300 Subject: dovecot-2.2: lib-http: Simplify error handling by delaying conne... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1bd5972eac0a changeset: 16148:1bd5972eac0a user: Timo Sirainen date: Thu Apr 04 14:18:38 2013 +0300 description: lib-http: Simplify error handling by delaying connect() failures. diffstat: src/lib-http/http-client-connection.c | 30 ++++++++++++----------- src/lib-http/http-client-host.c | 44 ++++++++++++++-------------------- src/lib-http/http-client-peer.c | 27 +++------------------ src/lib-http/http-client-private.h | 1 + 4 files changed, 39 insertions(+), 63 deletions(-) diffs (197 lines): diff -r b4927eea33fd -r 1bd5972eac0a src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:11:10 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:18:38 2013 +0300 @@ -731,7 +731,8 @@ (struct http_client_connection *)_conn; if (!success) { - http_client_connection_error(conn, "Connect failed: %m"); + http_client_connection_error(conn, "connect(%s) failed: %m", + _conn->name); http_client_peer_connection_failure(conn->peer); } else { @@ -764,16 +765,21 @@ (&http_client_connection_set, &http_client_connection_vfuncs); } -static int http_client_connection_connect(struct http_client_connection *conn) +static void +http_client_connection_delayed_connect_error(struct http_client_connection *conn) { - if (conn->conn.fd_in == -1) { - if (connection_client_connect(&conn->conn) < 0) { - http_client_connection_error(conn, "Could not connect"); - return -1; - } + timeout_remove(&conn->to_input); + errno = conn->connect_errno; + http_client_connection_connected(&conn->conn, FALSE); +} + +static void http_client_connection_connect(struct http_client_connection *conn) +{ + if (connection_client_connect(&conn->conn) < 0) { + conn->connect_errno = errno; + conn->to_input = timeout_add_short(0, + http_client_connection_delayed_connect_error, conn); } - - return 0; } struct http_client_connection * @@ -790,11 +796,7 @@ connection_init_client_ip (peer->client->conn_list, &conn->conn, &peer->addr.ip, peer->addr.port); - - if (http_client_connection_connect(conn) < 0) { - http_client_connection_unref(&conn); - return NULL; - } + http_client_connection_connect(conn); conn->id = id++; array_append(&peer->conns, &conn, 1); diff -r b4927eea33fd -r 1bd5972eac0a src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Thu Apr 04 14:11:10 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 14:18:38 2013 +0300 @@ -118,33 +118,8 @@ { struct http_client_peer *peer = NULL; struct http_client_peer_addr addr; - const char *error; - if (hport->ssl && host->client->ssl_ctx == NULL) { - if (http_client_init_ssl_ctx(host->client, &error) < 0) { - http_client_host_port_error(hport, - HTTP_CLIENT_REQUEST_ERROR_CONNECT_FAILED, error); - if (host->client->ioloop != NULL) - io_loop_stop(host->client->ioloop); - return; - } - } - - while (hport->ips_connect_idx < host->ips_count) { - addr.ip = host->ips[hport->ips_connect_idx]; - addr.port = hport->port; - addr.ssl = hport->ssl; - - http_client_host_debug(host, "Setting up connection to %s:%u (ssl=%s)", - net_ip2addr(&addr.ip), addr.port, (addr.ssl ? "yes" : "no")); - - if ((peer=http_client_peer_get(host->client, &addr)) != NULL) - break; - - hport->ips_connect_idx++; - } - - if (peer == NULL) { + if (hport->ips_connect_idx == host->ips_count) { /* all IPs failed, but retry all of them again on the next request. */ hport->ips_connect_idx = 0; @@ -155,6 +130,14 @@ return; } + addr.ip = host->ips[hport->ips_connect_idx]; + addr.port = hport->port; + addr.ssl = hport->ssl; + + http_client_host_debug(host, "Setting up connection to %s:%u (ssl=%s)", + net_ip2addr(&addr.ip), addr.port, (addr.ssl ? "yes" : "no")); + + peer = http_client_peer_get(host->client, &addr); http_client_peer_add_host(peer, host); } @@ -293,9 +276,18 @@ struct http_client_request *req) { struct http_client_host_port *hport; + const char *error; req->host = host; + if (req->ssl && host->client->ssl_ctx == NULL) { + if (http_client_init_ssl_ctx(host->client, &error) < 0) { + http_client_request_error(req, + HTTP_CLIENT_REQUEST_ERROR_CONNECT_FAILED, error); + return; + } + } + /* add request to host (grouped by tcp port) */ hport = http_client_host_port_init(host, req->port, req->ssl); if (req->urgent) diff -r b4927eea33fd -r 1bd5972eac0a src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 14:11:10 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 14:18:38 2013 +0300 @@ -78,23 +78,15 @@ return (*host)->name; } -static int +static void http_client_peer_connect(struct http_client_peer *peer, unsigned int count) { - struct http_client_connection *conn; unsigned int i; for (i = 0; i < count; i++) { http_client_peer_debug(peer, "Making new connection %u of %u", i+1, count); - - conn = http_client_connection_create(peer); - if (conn == NULL) { - http_client_peer_debug(peer, "Failed to make new connection"); - return -1; - } + (void)http_client_connection_create(peer); } - - return 0; } static unsigned int @@ -173,13 +165,7 @@ } else { new_connections = (num_urgent > connecting ? num_urgent - connecting : 0); } - if (http_client_peer_connect(peer, new_connections) < 0) { - /* connection failed */ - if (conn == NULL) - return FALSE; - /* pipeline it on the least busy connection we found */ - return http_client_connection_next_request(conn); - } + http_client_peer_connect(peer, new_connections); /* now we wait until it is connected */ return FALSE; @@ -209,12 +195,7 @@ DLLIST_PREPEND(&client->peers_list, peer); http_client_peer_debug(peer, "Peer created"); - - if (http_client_peer_connect(peer, 1) < 0) { - http_client_peer_free(&peer); - return NULL; - } - + http_client_peer_connect(peer, 1); return peer; } diff -r b4927eea33fd -r 1bd5972eac0a src/lib-http/http-client-private.h --- a/src/lib-http/http-client-private.h Thu Apr 04 14:11:10 2013 +0300 +++ b/src/lib-http/http-client-private.h Thu Apr 04 14:18:38 2013 +0300 @@ -133,6 +133,7 @@ const char *label; unsigned int id; // DEBUG: identify parallel connections + int connect_errno; struct ssl_iostream *ssl_iostream; struct http_response_parser *http_parser; From dovecot at dovecot.org Thu Apr 4 14:30:57 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:30:57 +0300 Subject: dovecot-2.2: lib-http: If connect() fails, destroy the http_clie... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/74eb53f797d6 changeset: 16149:74eb53f797d6 user: Timo Sirainen date: Thu Apr 04 14:30:41 2013 +0300 description: lib-http: If connect() fails, destroy the http_client_connection. Fixes hanging requests when a peer has multiple connections. diffstat: src/lib-http/http-client-connection.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 1bd5972eac0a -r 74eb53f797d6 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:18:38 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:30:41 2013 +0300 @@ -734,7 +734,7 @@ http_client_connection_error(conn, "connect(%s) failed: %m", _conn->name); http_client_peer_connection_failure(conn->peer); - + http_client_connection_unref(&conn); } else { http_client_connection_debug(conn, "Connected"); if (conn->peer->addr.ssl) { From dovecot at dovecot.org Thu Apr 4 14:41:12 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:41:12 +0300 Subject: dovecot-2.2: lib-http: If SSL init/handshake fails for connectio... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d3921050f540 changeset: 16150:d3921050f540 user: Timo Sirainen date: Thu Apr 04 14:41:06 2013 +0300 description: lib-http: If SSL init/handshake fails for connection, destroy it. diffstat: src/lib-http/http-client-connection.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (15 lines): diff -r 74eb53f797d6 -r d3921050f540 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:30:41 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:41:06 2013 +0300 @@ -738,8 +738,10 @@ } else { http_client_connection_debug(conn, "Connected"); if (conn->peer->addr.ssl) { - if (http_client_connection_ssl_init(conn) < 0) + if (http_client_connection_ssl_init(conn) < 0) { http_client_peer_connection_failure(conn->peer); + http_client_connection_unref(&conn); + } return; } http_client_connection_ready(conn); From dovecot at dovecot.org Thu Apr 4 14:51:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:51:30 +0300 Subject: dovecot-2.2: lib-http: Fixed double-free on delayed connect() fa... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/18a0b570df80 changeset: 16151:18a0b570df80 user: Timo Sirainen date: Thu Apr 04 14:51:20 2013 +0300 description: lib-http: Fixed double-free on delayed connect() failures caused by recent change. diffstat: src/lib-http/http-client-connection.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (19 lines): diff -r d3921050f540 -r 18a0b570df80 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:41:06 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:51:20 2013 +0300 @@ -734,7 +734,6 @@ http_client_connection_error(conn, "connect(%s) failed: %m", _conn->name); http_client_peer_connection_failure(conn->peer); - http_client_connection_unref(&conn); } else { http_client_connection_debug(conn, "Connected"); if (conn->peer->addr.ssl) { @@ -773,6 +772,7 @@ timeout_remove(&conn->to_input); errno = conn->connect_errno; http_client_connection_connected(&conn->conn, FALSE); + http_client_connection_unref(&conn); } static void http_client_connection_connect(struct http_client_connection *conn) From dovecot at dovecot.org Thu Apr 4 14:55:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:55:10 +0300 Subject: dovecot-2.2: lib-http: Reorder http_client_connection deinit cod... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/998afe8ffed9 changeset: 16152:998afe8ffed9 user: Timo Sirainen date: Thu Apr 04 14:55:03 2013 +0300 description: lib-http: Reorder http_client_connection deinit code just to be safe. I'm not sure if this fixes any actual bugs, but just in case request callbacks cause the connection to be accessed/modified in some way abort the requests before doing anything else. diffstat: src/lib-http/http-client-connection.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diffs (39 lines): diff -r 18a0b570df80 -r 998afe8ffed9 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:51:20 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:55:03 2013 +0300 @@ -831,10 +831,7 @@ conn->closing = TRUE; conn->connected = FALSE; - if (conn->ssl_iostream != NULL) - ssl_iostream_unref(&conn->ssl_iostream); - - connection_deinit(&conn->conn); + connection_disconnect(&conn->conn); /* abort all pending requests */ array_foreach_modifiable(&conn->request_wait_list, req) { @@ -844,6 +841,13 @@ } array_free(&conn->request_wait_list); + if (conn->http_parser != NULL) + http_response_parser_deinit(&conn->http_parser); + + if (conn->ssl_iostream != NULL) + ssl_iostream_unref(&conn->ssl_iostream); + connection_deinit(&conn->conn); + if (conn->to_input != NULL) timeout_remove(&conn->to_input); if (conn->to_idle != NULL) @@ -860,9 +864,6 @@ } } - if (conn->http_parser != NULL) - http_response_parser_deinit(&conn->http_parser); - i_free(conn); *_conn = NULL; From dovecot at dovecot.org Thu Apr 4 14:58:05 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 14:58:05 +0300 Subject: dovecot-2.2: lib-http: Pass connect failures all the way to requ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3580439c06d8 changeset: 16153:3580439c06d8 user: Timo Sirainen date: Thu Apr 04 14:58:00 2013 +0300 description: lib-http: Pass connect failures all the way to request callback's error string. diffstat: src/lib-http/http-client-connection.c | 30 +++++++++++++++--------------- src/lib-http/http-client-host.c | 30 +++++++++++++++--------------- src/lib-http/http-client-peer.c | 5 +++-- src/lib-http/http-client-private.h | 5 +++-- 4 files changed, 36 insertions(+), 34 deletions(-) diffs (181 lines): diff -r 998afe8ffed9 -r 3580439c06d8 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:55:03 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 14:58:00 2013 +0300 @@ -307,7 +307,8 @@ switch (_conn->disconnect_reason) { case CONNECTION_DISCONNECT_CONNECT_TIMEOUT: - http_client_peer_connection_failure(conn->peer); + http_client_peer_connection_failure(conn->peer, t_strdup_printf( + "connect(%s) failed: Connection timed out", _conn->name)); break; case CONNECTION_DISCONNECT_CONN_CLOSED: /* retry pending requests if possible */ @@ -683,15 +684,13 @@ } static int -http_client_connection_ssl_init(struct http_client_connection *conn) +http_client_connection_ssl_init(struct http_client_connection *conn, + const char **error_r) { struct ssl_iostream_settings ssl_set; const char *source, *error; - if (conn->client->ssl_ctx == NULL) { - http_client_connection_error(conn, "No SSL context"); - return -1; - } + i_assert(conn->client->ssl_ctx != NULL); memset(&ssl_set, 0, sizeof(ssl_set)); if (conn->client->set.ssl_verify) { @@ -708,15 +707,16 @@ if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, &conn->conn.input, &conn->conn.output, &conn->ssl_iostream, &error) < 0) { - http_client_connection_error(conn, - "Couldn't initialize SSL client: %s", error); + *error_r = t_strdup_printf( + "Couldn't initialize SSL client for %s: %s", + conn->conn.name, error); return -1; } ssl_iostream_set_handshake_callback(conn->ssl_iostream, http_client_connection_ssl_handshaked, conn); if (ssl_iostream_handshake(conn->ssl_iostream) < 0) { - http_client_connection_error(conn, "SSL handshake failed: %s", - ssl_iostream_get_last_error(conn->ssl_iostream)); + *error_r = t_strdup_printf("SSL handshake to %s failed: %s", + conn->conn.name, ssl_iostream_get_last_error(conn->ssl_iostream)); return -1; } @@ -729,16 +729,16 @@ { struct http_client_connection *conn = (struct http_client_connection *)_conn; + const char *error; if (!success) { - http_client_connection_error(conn, "connect(%s) failed: %m", - _conn->name); - http_client_peer_connection_failure(conn->peer); + http_client_peer_connection_failure(conn->peer, t_strdup_printf( + "connect(%s) failed: %m", _conn->name)); } else { http_client_connection_debug(conn, "Connected"); if (conn->peer->addr.ssl) { - if (http_client_connection_ssl_init(conn) < 0) { - http_client_peer_connection_failure(conn->peer); + if (http_client_connection_ssl_init(conn, &error) < 0) { + http_client_peer_connection_failure(conn->peer, error); http_client_connection_unref(&conn); } return; diff -r 998afe8ffed9 -r 3580439c06d8 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Thu Apr 04 14:55:03 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 14:58:00 2013 +0300 @@ -119,17 +119,6 @@ struct http_client_peer *peer = NULL; struct http_client_peer_addr addr; - if (hport->ips_connect_idx == host->ips_count) { - /* all IPs failed, but retry all of them again on the - next request. */ - hport->ips_connect_idx = 0; - http_client_host_port_error - (hport, HTTP_CLIENT_REQUEST_ERROR_CONNECT_FAILED, "Connection failed"); - if (host->client->ioloop != NULL) - io_loop_stop(host->client->ioloop); - return; - } - addr.ip = host->ips[hport->ips_connect_idx]; addr.port = hport->port; addr.ssl = hport->ssl; @@ -142,18 +131,28 @@ } void http_client_host_connection_failure(struct http_client_host *host, - const struct http_client_peer_addr *addr) + const struct http_client_peer_addr *addr, const char *reason) { struct http_client_host_port *hport; - http_client_host_debug(host, "Failed to connect to %s:%u", - net_ip2addr(&addr->ip), addr->port); + http_client_host_debug(host, "Failed to connect to %s:%u: %s", + net_ip2addr(&addr->ip), addr->port, reason); hport = http_client_host_port_find(host, addr->port, addr->ssl); if (hport == NULL) return; - hport->ips_connect_idx++; + i_assert(hport->ips_connect_idx < host->ips_count); + if (++hport->ips_connect_idx == host->ips_count) { + /* all IPs failed, but retry all of them again on the + next request. */ + hport->ips_connect_idx = 0; + http_client_host_port_error(hport, + HTTP_CLIENT_REQUEST_ERROR_CONNECT_FAILED, reason); + if (host->client->ioloop != NULL) + io_loop_stop(host->client->ioloop); + return; + } http_client_host_connection_setup(host, hport); } @@ -302,6 +301,7 @@ /* make a connection if we have an IP already */ if (host->ips_count == 0) return; + i_assert(hport->ips_connect_idx == 0); http_client_host_connection_setup(host, hport); } diff -r 998afe8ffed9 -r 3580439c06d8 src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 14:55:03 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 14:58:00 2013 +0300 @@ -279,7 +279,8 @@ return NULL; } -void http_client_peer_connection_failure(struct http_client_peer *peer) +void http_client_peer_connection_failure(struct http_client_peer *peer, + const char *reason) { struct http_client_host *const *host; unsigned int num_urgent; @@ -299,7 +300,7 @@ failed. a second connect will probably also fail, so just abort all requests. */ array_foreach(&peer->hosts, host) { - http_client_host_connection_failure(*host, &peer->addr); + http_client_host_connection_failure(*host, &peer->addr, reason); } } if (array_count(&peer->conns) == 0 && diff -r 998afe8ffed9 -r 3580439c06d8 src/lib-http/http-client-private.h --- a/src/lib-http/http-client-private.h Thu Apr 04 14:55:03 2013 +0300 +++ b/src/lib-http/http-client-private.h Thu Apr 04 14:58:00 2013 +0300 @@ -232,7 +232,8 @@ http_client_peer_claim_request(struct http_client_peer *peer, bool no_urgent); void http_client_peer_handle_requests(struct http_client_peer *peer); -void http_client_peer_connection_failure(struct http_client_peer *peer); +void http_client_peer_connection_failure(struct http_client_peer *peer, + const char *reason); void http_client_peer_connection_lost(struct http_client_peer *peer); unsigned int http_client_peer_idle_connections(struct http_client_peer *peer); @@ -245,7 +246,7 @@ http_client_host_claim_request(struct http_client_host *host, const struct http_client_peer_addr *addr, bool no_urgent); void http_client_host_connection_failure(struct http_client_host *host, - const struct http_client_peer_addr *addr); + const struct http_client_peer_addr *addr, const char *reason); unsigned int http_client_host_requests_pending(struct http_client_host *host, const struct http_client_peer_addr *addr, unsigned int *num_urgent_r); void http_client_host_drop_request(struct http_client_host *host, From dovecot at dovecot.org Thu Apr 4 15:22:00 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 15:22:00 +0300 Subject: dovecot-2.2: lib-ssl-iostream: ssl_iostream_set_handshake_callba... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/970914436288 changeset: 16154:970914436288 user: Timo Sirainen date: Thu Apr 04 15:21:00 2013 +0300 description: lib-ssl-iostream: ssl_iostream_set_handshake_callback() API changed. The callback can now return the error message to caller instead of having to log it itself. diffstat: src/doveadm/server-connection.c | 18 ++++++++---------- src/lib-http/http-client-connection.c | 20 ++++++++++---------- src/lib-imap-client/imapc-connection.c | 18 ++++++++---------- src/lib-ssl-iostream/iostream-openssl.c | 7 +++++-- src/lib-ssl-iostream/iostream-openssl.h | 2 +- src/lib-ssl-iostream/iostream-ssl-private.h | 2 +- src/lib-ssl-iostream/iostream-ssl.c | 2 +- src/lib-ssl-iostream/iostream-ssl.h | 7 ++++++- src/lib-storage/index/pop3c/pop3c-client.c | 16 +++++++--------- 9 files changed, 47 insertions(+), 45 deletions(-) diffs (244 lines): diff -r 3580439c06d8 -r 970914436288 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/doveadm/server-connection.c Thu Apr 04 15:21:00 2013 +0300 @@ -315,7 +315,7 @@ return 0; } -static int server_connection_ssl_handshaked(void *context) +static int server_connection_ssl_handshaked(const char **error_r, void *context) { struct server_connection *conn = context; const char *host, *p; @@ -326,16 +326,14 @@ host = t_strdup_until(host, p); if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) { - i_error("%s: SSL certificate not received", - conn->server->name); - } else { - i_error("%s: Received invalid SSL certificate", - conn->server->name); - } + if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) + *error_r = "SSL certificate not received"; + else + *error_r = "Received invalid SSL certificate"; } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) < 0) { - i_error("%s: SSL certificate doesn't match host name", - conn->server->name); + *error_r = t_strdup_printf( + "SSL certificate doesn't match expected host name %s", + host); } else { if (doveadm_debug) { i_debug("%s: SSL handshake successful", diff -r 3580439c06d8 -r 970914436288 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 15:21:00 2013 +0300 @@ -652,7 +652,8 @@ (void)http_client_connection_next_request(conn); } -static int http_client_connection_ssl_handshaked(void *context) +static int +http_client_connection_ssl_handshaked(const char **error_r, void *context) { struct http_client_connection *conn = context; @@ -661,23 +662,22 @@ http_client_connection_debug(conn, "SSL handshake successful"); return 0; } else if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) { - http_client_connection_error(conn, "SSL certificate not received"); - } else { - http_client_connection_error(conn, "Received invalid SSL certificate"); - } + if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) + *error_r = "SSL certificate not received"; + else + *error_r = "Received invalid SSL certificate"; } else { const char *host = http_client_peer_get_hostname(conn->peer); i_assert(host != NULL); - if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) < 0) { - http_client_connection_error(conn, - "SSL certificate doesn't match host name"); - } else { + if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) == 0) { http_client_connection_debug(conn, "SSL handshake successful"); return 0; } + + *error_r = t_strdup_printf( + "SSL certificate doesn't match expected host name %s", host); } i_stream_close(conn->conn.input); return -1; diff -r 3580439c06d8 -r 970914436288 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 15:21:00 2013 +0300 @@ -1126,7 +1126,7 @@ imapc_connection_unref(&conn); } -static int imapc_connection_ssl_handshaked(void *context) +static int imapc_connection_ssl_handshaked(const char **error_r, void *context) { struct imapc_connection *conn = context; @@ -1134,17 +1134,15 @@ /* skip certificate checks */ return 0; } else if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) { - i_error("imapc(%s): SSL certificate not received", - conn->name); - } else { - i_error("imapc(%s): Received invalid SSL certificate", - conn->name); - } + if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) + *error_r = "SSL certificate not received"; + else + *error_r = "Received invalid SSL certificate"; } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, conn->client->set.host) < 0) { - i_error("imapc(%s): SSL certificate doesn't match host name", - conn->name); + *error_r = t_strdup_printf( + "SSL certificate doesn't match expected host name %s", + conn->client->set.host); } else { if (conn->client->set.debug) { i_debug("imapc(%s): SSL handshake successful", diff -r 3580439c06d8 -r 970914436288 src/lib-ssl-iostream/iostream-openssl.c --- a/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 15:21:00 2013 +0300 @@ -516,6 +516,7 @@ static int openssl_iostream_handshake(struct ssl_iostream *ssl_io) { + const char *error = NULL; int ret; i_assert(!ssl_io->handshaked); @@ -542,7 +543,9 @@ ssl_io->handshaked = TRUE; if (ssl_io->handshake_callback != NULL) { - if (ssl_io->handshake_callback(ssl_io->handshake_context) < 0) { + if (ssl_io->handshake_callback(&error, ssl_io->handshake_context) < 0) { + i_assert(error != NULL); + openssl_iostream_set_error(ssl_io, error); errno = EINVAL; return -1; } @@ -554,7 +557,7 @@ static void openssl_iostream_set_handshake_callback(struct ssl_iostream *ssl_io, - int (*callback)(void *context), + ssl_iostream_handshake_callback_t *callback, void *context) { ssl_io->handshake_callback = callback; diff -r 3580439c06d8 -r 970914436288 src/lib-ssl-iostream/iostream-openssl.h --- a/src/lib-ssl-iostream/iostream-openssl.h Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.h Thu Apr 04 15:21:00 2013 +0300 @@ -38,7 +38,7 @@ bool verbose, verbose_invalid_cert, require_valid_cert; int username_nid; - int (*handshake_callback)(void *context); + ssl_iostream_handshake_callback_t *handshake_callback; void *handshake_context; unsigned int handshaked:1; diff -r 3580439c06d8 -r 970914436288 src/lib-ssl-iostream/iostream-ssl-private.h --- a/src/lib-ssl-iostream/iostream-ssl-private.h Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl-private.h Thu Apr 04 15:21:00 2013 +0300 @@ -25,7 +25,7 @@ int (*handshake)(struct ssl_iostream *ssl_io); void (*set_handshake_callback)(struct ssl_iostream *ssl_io, - int (*callback)(void *context), + ssl_iostream_handshake_callback_t *callback, void *context); bool (*is_handshaked)(const struct ssl_iostream *ssl_io); diff -r 3580439c06d8 -r 970914436288 src/lib-ssl-iostream/iostream-ssl.c --- a/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 15:21:00 2013 +0300 @@ -124,7 +124,7 @@ } void ssl_iostream_set_handshake_callback(struct ssl_iostream *ssl_io, - int (*callback)(void *context), + ssl_iostream_handshake_callback_t *callback, void *context) { ssl_vfuncs->set_handshake_callback(ssl_io, callback, context); diff -r 3580439c06d8 -r 970914436288 src/lib-ssl-iostream/iostream-ssl.h --- a/src/lib-ssl-iostream/iostream-ssl.h Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.h Thu Apr 04 15:21:00 2013 +0300 @@ -19,6 +19,11 @@ bool require_valid_cert; /* stream-only */ }; +/* Returns 0 if ok, -1 and sets error_r if failed. The returned error string + becomes available via ssl_iostream_get_last_error() */ +typedef int +ssl_iostream_handshake_callback_t(const char **error_r, void *context); + int io_stream_create_ssl(struct ssl_iostream_context *ctx, const char *source, const struct ssl_iostream_settings *set, struct istream **input, struct ostream **output, @@ -31,7 +36,7 @@ int ssl_iostream_handshake(struct ssl_iostream *ssl_io); void ssl_iostream_set_handshake_callback(struct ssl_iostream *ssl_io, - int (*callback)(void *context), + ssl_iostream_handshake_callback_t *callback, void *context); bool ssl_iostream_is_handshaked(const struct ssl_iostream *ssl_io); diff -r 3580439c06d8 -r 970914436288 src/lib-storage/index/pop3c/pop3c-client.c --- a/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 14:58:00 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 15:21:00 2013 +0300 @@ -409,7 +409,7 @@ } } -static int pop3c_client_ssl_handshaked(void *context) +static int pop3c_client_ssl_handshaked(const char **error_r, void *context) { struct pop3c_client *client = context; @@ -417,16 +417,14 @@ /* skip certificate checks */ return 0; } else if (!ssl_iostream_has_valid_client_cert(client->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(client->ssl_iostream)) { - i_error("pop3c(%s): SSL certificate not received", - client->set.host); - } else { - i_error("pop3c(%s): Received invalid SSL certificate", - client->set.host); - } + if (!ssl_iostream_has_broken_client_cert(client->ssl_iostream)) + *error_r = "SSL certificate not received"; + else + *error_r = "Received invalid SSL certificate"; } else if (ssl_iostream_cert_match_name(client->ssl_iostream, client->set.host) < 0) { - i_error("pop3c(%s): SSL certificate doesn't match host name", + *error_r = t_strdup_printf( + "SSL certificate doesn't match expected host name %s", client->set.host); } else { if (client->set.debug) { From dovecot at dovecot.org Thu Apr 4 15:22:00 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 15:22:00 +0300 Subject: dovecot-2.2: lib-http: Removed last traces of http_client_connec... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c1f1624a299c changeset: 16155:c1f1624a299c user: Timo Sirainen date: Thu Apr 04 15:21:52 2013 +0300 description: lib-http: Removed last traces of http_client_connection_error() diffstat: src/lib-http/http-client-connection.c | 18 +----------------- 1 files changed, 1 insertions(+), 17 deletions(-) diffs (42 lines): diff -r 970914436288 -r c1f1624a299c src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 15:21:00 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 15:21:52 2013 +0300 @@ -21,9 +21,6 @@ static inline void http_client_connection_debug(struct http_client_connection *conn, const char *format, ...) ATTR_FORMAT(2, 3); -static inline void -http_client_connection_error(struct http_client_connection *conn, - const char *format, ...) ATTR_FORMAT(2, 3); static inline void http_client_connection_debug(struct http_client_connection *conn, @@ -40,19 +37,6 @@ } } -static inline void -http_client_connection_error(struct http_client_connection *conn, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - i_error("http-client: conn %s: %s", - http_client_connection_label(conn), t_strdup_vprintf(format, args)); - va_end(args); -} - - /* * Connection */ @@ -482,7 +466,7 @@ if (req == NULL) { /* server sent response without any requests in the wait list */ - http_client_connection_error(conn, "Got unexpected input from server"); + http_client_connection_debug(conn, "Got unexpected input from server"); http_client_connection_unref(&conn); return; } From dovecot at dovecot.org Thu Apr 4 15:40:19 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 15:40:19 +0300 Subject: dovecot-2.2: lib-ssl-iostream: If handshake callback fails, clos... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4e9851e24c28 changeset: 16156:4e9851e24c28 user: Timo Sirainen date: Thu Apr 04 15:40:08 2013 +0300 description: lib-ssl-iostream: If handshake callback fails, close the iostreams immediately. This way the callback itself doesn't have to do it. Also fixes errors caused by it, since they didn't close the ostream. diffstat: src/doveadm/server-connection.c | 4 ++-- src/lib-http/http-client-connection.c | 8 ++++---- src/lib-http/http-client.h | 1 - src/lib-imap-client/imapc-connection.c | 1 - src/lib-ssl-iostream/iostream-openssl.c | 2 ++ src/lib-storage/index/pop3c/pop3c-client.c | 1 - 6 files changed, 8 insertions(+), 9 deletions(-) diffs (110 lines): diff -r c1f1624a299c -r 4e9851e24c28 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Thu Apr 04 15:21:52 2013 +0300 +++ b/src/doveadm/server-connection.c Thu Apr 04 15:40:08 2013 +0300 @@ -330,10 +330,12 @@ *error_r = "SSL certificate not received"; else *error_r = "Received invalid SSL certificate"; + return -1; } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) < 0) { *error_r = t_strdup_printf( "SSL certificate doesn't match expected host name %s", host); + return -1; } else { if (doveadm_debug) { i_debug("%s: SSL handshake successful", @@ -341,8 +343,6 @@ } return 0; } - i_stream_close(conn->input); - return -1; } static int server_connection_init_ssl(struct server_connection *conn) diff -r c1f1624a299c -r 4e9851e24c28 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 15:21:52 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 15:40:08 2013 +0300 @@ -641,7 +641,7 @@ { struct http_client_connection *conn = context; - if (!conn->client->set.ssl_verify) { + if (conn->client->set.ssl_allow_invalid_cert) { /* skip certificate checks */ http_client_connection_debug(conn, "SSL handshake successful"); return 0; @@ -650,6 +650,7 @@ *error_r = "SSL certificate not received"; else *error_r = "Received invalid SSL certificate"; + return -1; } else { const char *host = http_client_peer_get_hostname(conn->peer); @@ -662,9 +663,8 @@ *error_r = t_strdup_printf( "SSL certificate doesn't match expected host name %s", host); + return -1; } - i_stream_close(conn->conn.input); - return -1; } static int @@ -677,7 +677,7 @@ i_assert(conn->client->ssl_ctx != NULL); memset(&ssl_set, 0, sizeof(ssl_set)); - if (conn->client->set.ssl_verify) { + if (!conn->client->set.ssl_allow_invalid_cert) { ssl_set.verbose_invalid_cert = TRUE; ssl_set.verify_remote_cert = TRUE; ssl_set.require_valid_cert = TRUE; diff -r c1f1624a299c -r 4e9851e24c28 src/lib-http/http-client.h --- a/src/lib-http/http-client.h Thu Apr 04 15:21:52 2013 +0300 +++ b/src/lib-http/http-client.h Thu Apr 04 15:40:08 2013 +0300 @@ -36,7 +36,6 @@ const char *ssl_ca_dir, *ssl_ca; const char *ssl_crypto_device; bool ssl_allow_invalid_cert; - bool ssl_verify; const char *rawlog_dir; diff -r c1f1624a299c -r 4e9851e24c28 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 15:21:52 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 15:40:08 2013 +0300 @@ -1151,7 +1151,6 @@ return 0; } conn->handshake_failed = TRUE; - i_stream_close(conn->input); return -1; } diff -r c1f1624a299c -r 4e9851e24c28 src/lib-ssl-iostream/iostream-openssl.c --- a/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 15:21:52 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 15:40:08 2013 +0300 @@ -545,6 +545,8 @@ if (ssl_io->handshake_callback != NULL) { if (ssl_io->handshake_callback(&error, ssl_io->handshake_context) < 0) { i_assert(error != NULL); + i_stream_close(ssl_io->plain_input); + o_stream_close(ssl_io->plain_output); openssl_iostream_set_error(ssl_io, error); errno = EINVAL; return -1; diff -r c1f1624a299c -r 4e9851e24c28 src/lib-storage/index/pop3c/pop3c-client.c --- a/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 15:21:52 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 15:40:08 2013 +0300 @@ -434,7 +434,6 @@ return 0; } client->handshake_failed = TRUE; - i_stream_close(client->input); return -1; } From dovecot at dovecot.org Thu Apr 4 16:53:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 16:53:23 +0300 Subject: dovecot-2.2: lib-ssl: If debug=TRUE, set also SSL verbose=TRUE Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c040fa0fcfdf changeset: 16157:c040fa0fcfdf user: Timo Sirainen date: Thu Apr 04 16:53:08 2013 +0300 description: lib-ssl: If debug=TRUE, set also SSL verbose=TRUE diffstat: src/lib-http/http-client.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 4e9851e24c28 -r c040fa0fcfdf src/lib-http/http-client.c --- a/src/lib-http/http-client.c Thu Apr 04 15:40:08 2013 +0300 +++ b/src/lib-http/http-client.c Thu Apr 04 16:53:08 2013 +0300 @@ -196,6 +196,8 @@ ssl_set.ca = client->set.ssl_ca; ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = client->set.ssl_crypto_device; + ssl_set.verbose = client->set.debug; + ssl_set.verbose_invalid_cert = client->set.debug; if (ssl_iostream_context_init_client(&ssl_set, &client->ssl_ctx, &error) < 0) { *error_r = t_strdup_printf("Couldn't initialize SSL context: %s", From dovecot at dovecot.org Thu Apr 4 17:39:29 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 17:39:29 +0300 Subject: dovecot-2.2: lib-http: Prepare for TLS SNI support. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/52efc1740e15 changeset: 16158:52efc1740e15 user: Timo Sirainen date: Thu Apr 04 17:34:23 2013 +0300 description: lib-http: Prepare for TLS SNI support. diffstat: src/lib-http/http-client-connection.c | 15 +++++---------- src/lib-http/http-client-host.c | 31 ++++++++++++++++++------------- src/lib-http/http-client-peer.c | 24 ++++++------------------ src/lib-http/http-client-private.h | 6 ++---- 4 files changed, 31 insertions(+), 45 deletions(-) diffs (253 lines): diff -r c040fa0fcfdf -r 52efc1740e15 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 16:53:08 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 17:34:23 2013 +0300 @@ -640,6 +640,7 @@ http_client_connection_ssl_handshaked(const char **error_r, void *context) { struct http_client_connection *conn = context; + const char *host = conn->peer->addr.https_name; if (conn->client->set.ssl_allow_invalid_cert) { /* skip certificate checks */ @@ -651,16 +652,10 @@ else *error_r = "Received invalid SSL certificate"; return -1; + } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) == 0) { + http_client_connection_debug(conn, "SSL handshake successful"); + return 0; } else { - const char *host = http_client_peer_get_hostname(conn->peer); - - i_assert(host != NULL); - - if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) == 0) { - http_client_connection_debug(conn, "SSL handshake successful"); - return 0; - } - *error_r = t_strdup_printf( "SSL certificate doesn't match expected host name %s", host); return -1; @@ -720,7 +715,7 @@ "connect(%s) failed: %m", _conn->name)); } else { http_client_connection_debug(conn, "Connected"); - if (conn->peer->addr.ssl) { + if (conn->peer->addr.https_name != NULL) { if (http_client_connection_ssl_init(conn, &error) < 0) { http_client_peer_connection_failure(conn->peer, error); http_client_connection_unref(&conn); diff -r c040fa0fcfdf -r 52efc1740e15 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Thu Apr 04 16:53:08 2013 +0300 +++ b/src/lib-http/http-client-host.c Thu Apr 04 17:34:23 2013 +0300 @@ -43,12 +43,13 @@ static struct http_client_host_port * http_client_host_port_find(struct http_client_host *host, - unsigned int port, bool ssl) + unsigned int port, const char *https_name) { struct http_client_host_port *hport; array_foreach_modifiable(&host->ports, hport) { - if (hport->port == port && hport->ssl == ssl) + if (hport->port == port && + null_strcmp(hport->https_name, https_name) == 0) return hport; } @@ -57,15 +58,15 @@ static struct http_client_host_port * http_client_host_port_init(struct http_client_host *host, - unsigned int port, bool ssl) + unsigned int port, const char *https_name) { struct http_client_host_port *hport; - hport = http_client_host_port_find(host, port, ssl); + hport = http_client_host_port_find(host, port, https_name); if (hport == NULL) { hport = array_append_space(&host->ports); hport->port = port; - hport->ssl = ssl; + hport->https_name = i_strdup(https_name); hport->ips_connect_idx = 0; i_array_init(&hport->request_queue, 16); } @@ -89,6 +90,7 @@ { http_client_host_port_error (hport, HTTP_CLIENT_REQUEST_ERROR_ABORTED, "Aborted"); + i_free(hport->https_name); array_free(&hport->request_queue); } @@ -121,10 +123,11 @@ addr.ip = host->ips[hport->ips_connect_idx]; addr.port = hport->port; - addr.ssl = hport->ssl; + addr.https_name = hport->https_name; - http_client_host_debug(host, "Setting up connection to %s:%u (ssl=%s)", - net_ip2addr(&addr.ip), addr.port, (addr.ssl ? "yes" : "no")); + http_client_host_debug(host, "Setting up connection to %s:%u%s", + net_ip2addr(&addr.ip), addr.port, addr.https_name == NULL ? "" : + t_strdup_printf(" (SSL=%s)", addr.https_name)); peer = http_client_peer_get(host->client, &addr); http_client_peer_add_host(peer, host); @@ -138,7 +141,7 @@ http_client_host_debug(host, "Failed to connect to %s:%u: %s", net_ip2addr(&addr->ip), addr->port, reason); - hport = http_client_host_port_find(host, addr->port, addr->ssl); + hport = http_client_host_port_find(host, addr->port, addr->https_name); if (hport == NULL) return; @@ -275,6 +278,7 @@ struct http_client_request *req) { struct http_client_host_port *hport; + const char *https_name = req->ssl ? req->hostname : NULL; const char *error; req->host = host; @@ -288,7 +292,7 @@ } /* add request to host (grouped by tcp port) */ - hport = http_client_host_port_init(host, req->port, req->ssl); + hport = http_client_host_port_init(host, req->port, https_name); if (req->urgent) array_insert(&hport->request_queue, 0, &req, 1); else @@ -314,7 +318,7 @@ struct http_client_request *req; unsigned int i, count; - hport = http_client_host_port_find(host, addr->port, addr->ssl); + hport = http_client_host_port_find(host, addr->port, addr->https_name); if (hport == NULL) return NULL; @@ -348,7 +352,7 @@ *num_urgent_r = 0; - hport = http_client_host_port_find(host, addr->port, addr->ssl); + hport = http_client_host_port_find(host, addr->port, addr->https_name); if (hport == NULL) return 0; @@ -362,8 +366,9 @@ struct http_client_request *req) { struct http_client_host_port *hport; + const char *https_name = req->ssl ? req->hostname : NULL; - hport = http_client_host_port_find(host, req->port, req->ssl); + hport = http_client_host_port_find(host, req->port, https_name); if (hport == NULL) return; diff -r c040fa0fcfdf -r 52efc1740e15 src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 16:53:08 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 17:34:23 2013 +0300 @@ -43,7 +43,8 @@ unsigned int http_client_peer_addr_hash (const struct http_client_peer_addr *peer) { - return net_ip_hash(&peer->ip) + peer->port + peer->ssl; + return net_ip_hash(&peer->ip) + peer->port + + str_hash(peer->https_name); } int http_client_peer_addr_cmp @@ -56,28 +57,13 @@ return ret; if (peer1->port != peer2->port) return (peer1->port > peer2->port ? 1 : -1); - if (peer1->ssl != peer2->ssl) - return (peer1->ssl > peer2->ssl ? 1 : -1); - return 0; + return null_strcmp(peer1->https_name, peer2->https_name); } /* * Peer */ -const char * -http_client_peer_get_hostname(struct http_client_peer *peer) -{ - struct http_client_host *const *host; - - if (array_count(&peer->hosts) == 0) - return NULL; - - /* just return name of initial host */ - host = array_idx(&peer->hosts, 1); - return (*host)->name; -} - static void http_client_peer_connect(struct http_client_peer *peer, unsigned int count) { @@ -182,11 +168,12 @@ { struct http_client_peer *peer; - i_assert(!addr->ssl || client->ssl_ctx != NULL); + i_assert(addr->https_name == NULL || client->ssl_ctx != NULL); peer = i_new(struct http_client_peer, 1); peer->client = client; peer->addr = *addr; + peer->addr.https_name = i_strdup(addr->https_name); i_array_init(&peer->hosts, 16); i_array_init(&peer->conns, 16); @@ -227,6 +214,7 @@ (peer->client->peers, (const struct http_client_peer_addr *)&peer->addr); DLLIST_REMOVE(&peer->client->peers_list, peer); + i_free(peer->addr.https_name); i_free(peer); *_peer = NULL; } diff -r c040fa0fcfdf -r 52efc1740e15 src/lib-http/http-client-private.h --- a/src/lib-http/http-client-private.h Thu Apr 04 16:53:08 2013 +0300 +++ b/src/lib-http/http-client-private.h Thu Apr 04 17:34:23 2013 +0300 @@ -79,7 +79,7 @@ /* requests pending in queue to be picked up by connections */ ARRAY_TYPE(http_client_request) request_queue; - unsigned int ssl:1; + char *https_name; }; struct http_client_host { @@ -103,9 +103,9 @@ }; struct http_client_peer_addr { + char *https_name; /* TLS SNI */ struct ip_addr ip; unsigned int port; - unsigned int ssl:1; /* https */ }; struct http_client_peer { @@ -220,8 +220,6 @@ (const struct http_client_peer_addr *peer1, const struct http_client_peer_addr *peer2) ATTR_PURE; -const char * - http_client_peer_get_hostname(struct http_client_peer *peer); struct http_client_peer * http_client_peer_get(struct http_client *client, const struct http_client_peer_addr *addr); From dovecot at dovecot.org Thu Apr 4 17:39:29 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 17:39:29 +0300 Subject: dovecot-2.2: lib-ssl-iostream: Added support for TLS SNI, which ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f4bac0352464 changeset: 16159:f4bac0352464 user: Timo Sirainen date: Thu Apr 04 17:39:17 2013 +0300 description: lib-ssl-iostream: Added support for TLS SNI, which caused some API changes. diffstat: src/doveadm/server-connection.c | 7 ++- src/lib-http/http-client-connection.c | 11 +++--- src/lib-imap-client/imapc-connection.c | 10 +++--- src/lib-master/master-service-ssl.c | 4 +- src/lib-ssl-iostream/iostream-openssl-context.c | 28 +++++++++++++++++ src/lib-ssl-iostream/iostream-openssl.c | 40 ++++++++++++++++++------ src/lib-ssl-iostream/iostream-openssl.h | 5 +- src/lib-ssl-iostream/iostream-ssl-private.h | 4 +- src/lib-ssl-iostream/iostream-ssl.c | 33 ++++++++++++++++--- src/lib-ssl-iostream/iostream-ssl.h | 20 +++++++++--- src/lib-storage/index/pop3c/pop3c-client.c | 9 ++--- 11 files changed, 125 insertions(+), 46 deletions(-) diffs (truncated from 417 to 300 lines): diff -r 52efc1740e15 -r f4bac0352464 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/doveadm/server-connection.c Thu Apr 04 17:39:17 2013 +0300 @@ -358,9 +358,10 @@ ssl_set.require_valid_cert = TRUE; ssl_set.verbose_invalid_cert = TRUE; - if (io_stream_create_ssl(conn->server->ssl_ctx, "doveadm", &ssl_set, - &conn->input, &conn->output, - &conn->ssl_iostream, &error) < 0) { + if (io_stream_create_ssl_client(conn->server->ssl_ctx, + conn->server->name, &ssl_set, + &conn->input, &conn->output, + &conn->ssl_iostream, &error) < 0) { i_error("Couldn't initialize SSL client: %s", error); return -1; } diff -r 52efc1740e15 -r f4bac0352464 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 17:39:17 2013 +0300 @@ -667,7 +667,7 @@ const char **error_r) { struct ssl_iostream_settings ssl_set; - const char *source, *error; + const char *error; i_assert(conn->client->ssl_ctx != NULL); @@ -681,11 +681,10 @@ if (conn->client->set.debug) http_client_connection_debug(conn, "Starting SSL handshake"); - source = t_strdup_printf - ("connection %s: ", http_client_connection_label(conn)); - if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, - &conn->conn.input, &conn->conn.output, - &conn->ssl_iostream, &error) < 0) { + if (io_stream_create_ssl_client(conn->client->ssl_ctx, + conn->peer->addr.https_name, &ssl_set, + &conn->conn.input, &conn->conn.output, + &conn->ssl_iostream, &error) < 0) { *error_r = t_strdup_printf( "Couldn't initialize SSL client for %s: %s", conn->conn.name, error); diff -r 52efc1740e15 -r f4bac0352464 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 17:39:17 2013 +0300 @@ -1158,7 +1158,7 @@ { struct ssl_iostream_settings ssl_set; struct stat st; - const char *source, *error; + const char *error; if (conn->client->ssl_ctx == NULL) { i_error("imapc(%s): No SSL context", conn->name); @@ -1185,10 +1185,10 @@ conn->output = conn->raw_output; } - source = t_strdup_printf("imapc(%s): ", conn->name); - if (io_stream_create_ssl(conn->client->ssl_ctx, source, &ssl_set, - &conn->input, &conn->output, - &conn->ssl_iostream, &error) < 0) { + if (io_stream_create_ssl_client(conn->client->ssl_ctx, + conn->client->set.host, + &ssl_set, &conn->input, &conn->output, + &conn->ssl_iostream, &error) < 0) { i_error("imapc(%s): Couldn't initialize SSL client: %s", conn->name, error); return -1; diff -r 52efc1740e15 -r f4bac0352464 src/lib-master/master-service-ssl.c --- a/src/lib-master/master-service-ssl.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-master/master-service-ssl.c Thu Apr 04 17:39:17 2013 +0300 @@ -82,8 +82,8 @@ ssl_set.verbose = set->verbose_ssl; ssl_set.verify_remote_cert = set->ssl_verify_client_cert; - return io_stream_create_ssl(service->ssl_ctx, service->name, &ssl_set, - input, output, ssl_iostream_r, error_r); + return io_stream_create_ssl_server(service->ssl_ctx, &ssl_set, + input, output, ssl_iostream_r, error_r); } bool master_service_ssl_is_enabled(struct master_service *service) diff -r 52efc1740e15 -r f4bac0352464 src/lib-ssl-iostream/iostream-openssl-context.c --- a/src/lib-ssl-iostream/iostream-openssl-context.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl-context.c Thu Apr 04 17:39:17 2013 +0300 @@ -291,6 +291,25 @@ return new_set; } +#ifdef HAVE_SSL_GET_SERVERNAME +static int ssl_servername_callback(SSL *ssl, int *al ATTR_UNUSED, + void *context ATTR_UNUSED) +{ + struct ssl_iostream *ssl_io; + const char *host; + + ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index); + host = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); + if (SSL_get_servername_type(ssl) != -1) { + i_free(ssl_io->host); + ssl_io->host = i_strdup(host); + } else if (ssl_io->verbose) { + i_debug("SSL_get_servername() failed"); + } + return SSL_TLSEXT_ERR_OK; +} +#endif + static int ssl_iostream_context_set(struct ssl_iostream_context *ctx, const struct ssl_iostream_settings *set, @@ -355,6 +374,15 @@ return -1; } } +#ifdef HAVE_SSL_GET_SERVERNAME + if (!ctx->client_ctx) { + if (SSL_CTX_set_tlsext_servername_callback(ctx->ssl_ctx, + ssl_servername_callback) != 1) { + if (set->verbose) + i_debug("OpenSSL library doesn't support SNI"); + } + } +#endif return 0; } diff -r 52efc1740e15 -r f4bac0352464 src/lib-ssl-iostream/iostream-openssl.c --- a/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 17:39:17 2013 +0300 @@ -15,16 +15,16 @@ ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index); if ((where & SSL_CB_ALERT) != 0) { - i_warning("%s: SSL alert: where=0x%x, ret=%d: %s %s", - ssl_io->source, where, ret, + i_warning("%sSSL alert: where=0x%x, ret=%d: %s %s", + ssl_io->log_prefix, where, ret, SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret)); } else if (ret == 0) { - i_warning("%s: SSL failed: where=0x%x: %s", - ssl_io->source, where, SSL_state_string_long(ssl)); + i_warning("%sSSL failed: where=0x%x: %s", + ssl_io->log_prefix, where, SSL_state_string_long(ssl)); } else { - i_debug("%s: SSL: where=0x%x, ret=%d: %s", - ssl_io->source, where, ret, + i_debug("%sSSL: where=0x%x, ret=%d: %s", + ssl_io->log_prefix, where, ret, SSL_state_string_long(ssl)); } } @@ -128,7 +128,7 @@ if (set->verbose) SSL_set_info_callback(ssl_io->ssl, openssl_info_callback); - if (set->cipher_list != NULL && + if (set->cipher_list != NULL && strcmp(ctx_set->cipher_list, set->cipher_list) != 0) { if (!SSL_set_cipher_list(ssl_io->ssl, set->cipher_list)) { *error_r = t_strdup_printf( @@ -179,7 +179,7 @@ } static int -openssl_iostream_create(struct ssl_iostream_context *ctx, const char *source, +openssl_iostream_create(struct ssl_iostream_context *ctx, const char *host, const struct ssl_iostream_settings *set, struct istream **input, struct ostream **output, struct ssl_iostream **iostream_r, @@ -215,10 +215,15 @@ ssl_io->bio_ext = bio_ext; ssl_io->plain_input = *input; ssl_io->plain_output = *output; - ssl_io->source = i_strdup(source); + ssl_io->host = i_strdup(host); + ssl_io->log_prefix = host == NULL ? i_strdup("") : + i_strdup_printf("%s: ", host); /* bio_int will be freed by SSL_free() */ SSL_set_bio(ssl_io->ssl, bio_int, bio_int); SSL_set_ex_data(ssl_io->ssl, dovecot_ssl_extdata_index, ssl_io); +#ifdef HAVE_SSL_GET_SERVERNAME + SSL_set_tlsext_host_name(ssl_io->ssl, host); +#endif if (openssl_iostream_set(ssl_io, set, error_r) < 0) { openssl_iostream_free(ssl_io); @@ -249,7 +254,8 @@ BIO_free(ssl_io->bio_ext); SSL_free(ssl_io->ssl); i_free(ssl_io->last_error); - i_free(ssl_io->source); + i_free(ssl_io->host); + i_free(ssl_io->log_prefix); i_free(ssl_io); } @@ -566,6 +572,13 @@ ssl_io->handshake_context = context; } +static void openssl_iostream_set_log_prefix(struct ssl_iostream *ssl_io, + const char *prefix) +{ + i_free(ssl_io->log_prefix); + ssl_io->log_prefix = i_strdup(prefix); +} + static bool openssl_iostream_is_handshaked(const struct ssl_iostream *ssl_io) { return ssl_io->handshaked; @@ -617,6 +630,11 @@ return *name == '\0' ? NULL : name; } +static const char *openssl_iostream_get_server_name(struct ssl_iostream *ssl_io) +{ + return ssl_io->host; +} + static const char * openssl_iostream_get_security_string(struct ssl_iostream *ssl_io) { @@ -666,11 +684,13 @@ openssl_iostream_handshake, openssl_iostream_set_handshake_callback, + openssl_iostream_set_log_prefix, openssl_iostream_is_handshaked, openssl_iostream_has_valid_client_cert, openssl_iostream_has_broken_client_cert, openssl_iostream_cert_match_name, openssl_iostream_get_peer_name, + openssl_iostream_get_server_name, openssl_iostream_get_security_string, openssl_iostream_get_last_error }; diff -r 52efc1740e15 -r f4bac0352464 src/lib-ssl-iostream/iostream-openssl.h --- a/src/lib-ssl-iostream/iostream-openssl.h Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.h Thu Apr 04 17:39:17 2013 +0300 @@ -21,8 +21,6 @@ int refcount; struct ssl_iostream_context *ctx; - const struct ssl_iostream_settings *set; - SSL *ssl; BIO *bio_ext; @@ -30,8 +28,9 @@ struct ostream *plain_output; struct ostream *ssl_output; - char *source; + char *host; char *last_error; + char *log_prefix; int plain_stream_errno; /* copied settings */ diff -r 52efc1740e15 -r f4bac0352464 src/lib-ssl-iostream/iostream-ssl-private.h --- a/src/lib-ssl-iostream/iostream-ssl-private.h Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl-private.h Thu Apr 04 17:39:17 2013 +0300 @@ -16,7 +16,7 @@ int (*context_import_params)(struct ssl_iostream_context *ctx, const buffer_t *input); - int (*create)(struct ssl_iostream_context *ctx, const char *source, + int (*create)(struct ssl_iostream_context *ctx, const char *host, const struct ssl_iostream_settings *set, struct istream **input, struct ostream **output, struct ssl_iostream **iostream_r, const char **error_r); @@ -28,11 +28,13 @@ ssl_iostream_handshake_callback_t *callback, void *context); + void (*set_log_prefix)(struct ssl_iostream *ssl_io, const char *prefix); bool (*is_handshaked)(const struct ssl_iostream *ssl_io); bool (*has_valid_client_cert)(const struct ssl_iostream *ssl_io); bool (*has_broken_client_cert)(struct ssl_iostream *ssl_io); int (*cert_match_name)(struct ssl_iostream *ssl_io, const char *name); const char *(*get_peer_name)(struct ssl_iostream *ssl_io); + const char *(*get_server_name)(struct ssl_iostream *ssl_io); const char *(*get_security_string)(struct ssl_iostream *ssl_io); const char *(*get_last_error)(struct ssl_iostream *ssl_io); }; diff -r 52efc1740e15 -r f4bac0352464 src/lib-ssl-iostream/iostream-ssl.c --- a/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 17:34:23 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 17:39:17 2013 +0300 @@ -92,13 +92,23 @@ return ssl_vfuncs->context_import_params(ctx, input); } -int io_stream_create_ssl(struct ssl_iostream_context *ctx, const char *source, - const struct ssl_iostream_settings *set, From dovecot at dovecot.org Thu Apr 4 17:40:35 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 17:40:35 +0300 Subject: dovecot-2.2: lib-http: Crashfix for previous change. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/41c10ddda867 changeset: 16160:41c10ddda867 user: Timo Sirainen date: Thu Apr 04 17:40:30 2013 +0300 description: lib-http: Crashfix for previous change. diffstat: src/lib-http/http-client-peer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r f4bac0352464 -r 41c10ddda867 src/lib-http/http-client-peer.c --- a/src/lib-http/http-client-peer.c Thu Apr 04 17:39:17 2013 +0300 +++ b/src/lib-http/http-client-peer.c Thu Apr 04 17:40:30 2013 +0300 @@ -44,7 +44,7 @@ (const struct http_client_peer_addr *peer) { return net_ip_hash(&peer->ip) + peer->port + - str_hash(peer->https_name); + (peer->https_name == NULL ? 0 : str_hash(peer->https_name)); } int http_client_peer_addr_cmp From dovecot at dovecot.org Thu Apr 4 18:10:12 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 18:10:12 +0300 Subject: dovecot-2.2: lib-ssl-iostream: Simplified certificate validation... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ef939a32de27 changeset: 16161:ef939a32de27 user: Timo Sirainen date: Thu Apr 04 18:10:04 2013 +0300 description: lib-ssl-iostream: Simplified certificate validation. Also give better error messages. diffstat: src/doveadm/server-connection.c | 21 ++--------- src/lib-http/http-client-connection.c | 22 +++-------- src/lib-imap-client/imapc-connection.c | 30 +++++++-------- src/lib-ssl-iostream/iostream-openssl.c | 55 ++++++++++++++--------------- src/lib-ssl-iostream/iostream-ssl.c | 21 +++++++++++ src/lib-ssl-iostream/iostream-ssl.h | 2 + src/lib-storage/index/pop3c/pop3c-client.c | 30 +++++++-------- 7 files changed, 89 insertions(+), 92 deletions(-) diffs (truncated from 311 to 300 lines): diff -r 41c10ddda867 -r ef939a32de27 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/doveadm/server-connection.c Thu Apr 04 18:10:04 2013 +0300 @@ -325,24 +325,11 @@ if (p != NULL) host = t_strdup_until(host, p); - if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) - *error_r = "SSL certificate not received"; - else - *error_r = "Received invalid SSL certificate"; + if (ssl_iostream_check_cert_validity(conn->ssl_iostream, host, error_r) < 0) return -1; - } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) < 0) { - *error_r = t_strdup_printf( - "SSL certificate doesn't match expected host name %s", - host); - return -1; - } else { - if (doveadm_debug) { - i_debug("%s: SSL handshake successful", - conn->server->name); - } - return 0; - } + if (doveadm_debug) + i_debug("%s: SSL handshake successful", conn->server->name); + return 0; } static int server_connection_init_ssl(struct server_connection *conn) diff -r 41c10ddda867 -r ef939a32de27 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-http/http-client-connection.c Thu Apr 04 18:10:04 2013 +0300 @@ -640,26 +640,18 @@ http_client_connection_ssl_handshaked(const char **error_r, void *context) { struct http_client_connection *conn = context; - const char *host = conn->peer->addr.https_name; + const char *error, *host = conn->peer->addr.https_name; - if (conn->client->set.ssl_allow_invalid_cert) { - /* skip certificate checks */ + if (ssl_iostream_check_cert_validity(conn->ssl_iostream, host, &error) == 0) http_client_connection_debug(conn, "SSL handshake successful"); - return 0; - } else if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) - *error_r = "SSL certificate not received"; - else - *error_r = "Received invalid SSL certificate"; - return -1; - } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) == 0) { - http_client_connection_debug(conn, "SSL handshake successful"); - return 0; + else if (conn->client->set.ssl_allow_invalid_cert) { + http_client_connection_debug(conn, "SSL handshake successful, " + "ignoring invalid certificate: %s", error); } else { - *error_r = t_strdup_printf( - "SSL certificate doesn't match expected host name %s", host); + *error_r = error; return -1; } + return 0; } static int diff -r 41c10ddda867 -r ef939a32de27 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 18:10:04 2013 +0300 @@ -1129,29 +1129,27 @@ static int imapc_connection_ssl_handshaked(const char **error_r, void *context) { struct imapc_connection *conn = context; + const char *error; - if (!conn->client->set.ssl_verify) { - /* skip certificate checks */ - return 0; - } else if (!ssl_iostream_has_valid_client_cert(conn->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(conn->ssl_iostream)) - *error_r = "SSL certificate not received"; - else - *error_r = "Received invalid SSL certificate"; - } else if (ssl_iostream_cert_match_name(conn->ssl_iostream, - conn->client->set.host) < 0) { - *error_r = t_strdup_printf( - "SSL certificate doesn't match expected host name %s", - conn->client->set.host); - } else { + if (ssl_iostream_check_cert_validity(conn->ssl_iostream, + conn->client->set.host, &error) == 0) { if (conn->client->set.debug) { i_debug("imapc(%s): SSL handshake successful", conn->name); } return 0; + } else if (!conn->client->set.ssl_verify) { + if (conn->client->set.debug) { + i_debug("imapc(%s): SSL handshake successful, " + "ignoring invalid certificate: %s", + conn->name, error); + } + return 0; + } else { + conn->handshake_failed = TRUE; + *error_r = error; + return -1; } - conn->handshake_failed = TRUE; - return -1; } static int imapc_connection_ssl_init(struct imapc_connection *conn) diff -r 41c10ddda867 -r ef939a32de27 src/lib-ssl-iostream/iostream-openssl.c --- a/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.c Thu Apr 04 18:10:04 2013 +0300 @@ -9,6 +9,13 @@ static void openssl_iostream_free(struct ssl_iostream *ssl_io); +static void +openssl_iostream_set_error(struct ssl_iostream *ssl_io, const char *str) +{ + i_free(ssl_io->last_error); + ssl_io->last_error = i_strdup(str); +} + static void openssl_info_callback(const SSL *ssl, int where, int ret) { struct ssl_iostream *ssl_io; @@ -86,28 +93,27 @@ int ssl_extidx = SSL_get_ex_data_X509_STORE_CTX_idx(); SSL *ssl; struct ssl_iostream *ssl_io; + char certname[1024]; + X509_NAME *subject; ssl = X509_STORE_CTX_get_ex_data(ctx, ssl_extidx); ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index); ssl_io->cert_received = TRUE; - if (ssl_io->verbose || - (ssl_io->verbose_invalid_cert && !preverify_ok)) { - char buf[1024]; - X509_NAME *subject; - - subject = X509_get_subject_name(ctx->current_cert); - if (subject == NULL || - X509_NAME_oneline(subject, buf, sizeof(buf)) == NULL) - buf[0] = '\0'; - else - buf[sizeof(buf)-1] = '\0'; /* just in case.. */ - if (!preverify_ok) { - i_info("Invalid certificate: %s: %s", - X509_verify_cert_error_string(ctx->error), buf); - } else { - i_info("Valid certificate: %s", buf); - } + subject = X509_get_subject_name(ctx->current_cert); + if (subject == NULL || + X509_NAME_oneline(subject, certname, sizeof(certname)) == NULL) + certname[0] = '\0'; + else + certname[sizeof(certname)-1] = '\0'; /* just in case.. */ + if (!preverify_ok) { + openssl_iostream_set_error(ssl_io, t_strdup_printf( + "Received invalid SSL certificate: %s: %s", + X509_verify_cert_error_string(ctx->error), certname)); + if (ssl_io->verbose_invalid_cert) + i_info("%s", ssl_io->last_error); + } else if (ssl_io->verbose) { + i_info("Received valid SSL certificate: %s", certname); } if (!preverify_ok) { ssl_io->cert_broken = TRUE; @@ -173,7 +179,7 @@ } ssl_io->verbose = set->verbose; - ssl_io->verbose_invalid_cert = set->verbose_invalid_cert; + ssl_io->verbose_invalid_cert = set->verbose_invalid_cert || set->verbose; ssl_io->require_valid_cert = set->require_valid_cert; return 0; } @@ -422,13 +428,6 @@ return 1; } -static void -openssl_iostream_set_error(struct ssl_iostream *ssl_io, const char *str) -{ - i_free(ssl_io->last_error); - ssl_io->last_error = i_strdup(str); -} - static int openssl_iostream_handle_error_full(struct ssl_iostream *ssl_io, int ret, const char *func_name, bool write_error) @@ -545,9 +544,6 @@ /* handshake finished */ (void)openssl_iostream_bio_sync(ssl_io); - i_free_and_null(ssl_io->last_error); - ssl_io->handshaked = TRUE; - if (ssl_io->handshake_callback != NULL) { if (ssl_io->handshake_callback(&error, ssl_io->handshake_context) < 0) { i_assert(error != NULL); @@ -558,6 +554,9 @@ return -1; } } + i_free_and_null(ssl_io->last_error); + ssl_io->handshaked = TRUE; + if (ssl_io->ssl_output != NULL) (void)o_stream_flush(ssl_io->ssl_output); return 1; diff -r 41c10ddda867 -r ef939a32de27 src/lib-ssl-iostream/iostream-ssl.c --- a/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.c Thu Apr 04 18:10:04 2013 +0300 @@ -166,6 +166,27 @@ return ssl_vfuncs->cert_match_name(ssl_io, name); } +int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io, + const char *host, const char **error_r) +{ + if (!ssl_iostream_has_valid_client_cert(ssl_io)) { + if (!ssl_iostream_has_broken_client_cert(ssl_io)) + *error_r = "SSL certificate not received"; + else { + *error_r = t_strdup(ssl_iostream_get_last_error(ssl_io)); + if (*error_r == NULL) + *error_r = "Received invalid SSL certificate"; + } + return -1; + } else if (ssl_iostream_cert_match_name(ssl_io, host) < 0) { + *error_r = t_strdup_printf( + "SSL certificate doesn't match expected host name %s", + host); + return -1; + } + return 0; +} + const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io) { return ssl_vfuncs->get_peer_name(ssl_io); diff -r 41c10ddda867 -r ef939a32de27 src/lib-ssl-iostream/iostream-ssl.h --- a/src/lib-ssl-iostream/iostream-ssl.h Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.h Thu Apr 04 18:10:04 2013 +0300 @@ -51,6 +51,8 @@ bool ssl_iostream_is_handshaked(const struct ssl_iostream *ssl_io); bool ssl_iostream_has_valid_client_cert(const struct ssl_iostream *ssl_io); bool ssl_iostream_has_broken_client_cert(struct ssl_iostream *ssl_io); +int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io, + const char *host, const char **error_r); int ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io, const char *name); const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io); const char *ssl_iostream_get_server_name(struct ssl_iostream *ssl_io); diff -r 41c10ddda867 -r ef939a32de27 src/lib-storage/index/pop3c/pop3c-client.c --- a/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 17:40:30 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 18:10:04 2013 +0300 @@ -412,29 +412,27 @@ static int pop3c_client_ssl_handshaked(const char **error_r, void *context) { struct pop3c_client *client = context; + const char *error; - if (!client->set.ssl_verify) { - /* skip certificate checks */ - return 0; - } else if (!ssl_iostream_has_valid_client_cert(client->ssl_iostream)) { - if (!ssl_iostream_has_broken_client_cert(client->ssl_iostream)) - *error_r = "SSL certificate not received"; - else - *error_r = "Received invalid SSL certificate"; - } else if (ssl_iostream_cert_match_name(client->ssl_iostream, - client->set.host) < 0) { - *error_r = t_strdup_printf( - "SSL certificate doesn't match expected host name %s", - client->set.host); - } else { + if (ssl_iostream_check_cert_validity(client->ssl_iostream, + client->set.host, &error) == 0) { if (client->set.debug) { i_debug("pop3c(%s): SSL handshake successful", client->set.host); } return 0; + } else if (!client->set.ssl_verify) { + if (client->set.debug) { + i_debug("pop3c(%s): SSL handshake successful, " + "ignoring invalid certificate: %s", + client->set.host, error); + } From dovecot at dovecot.org Thu Apr 4 18:18:57 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 18:18:57 +0300 Subject: dovecot-2.2: imapc, pop3c: Don't hide SSL handshake errors. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ec933ef95687 changeset: 16162:ec933ef95687 user: Timo Sirainen date: Thu Apr 04 18:18:50 2013 +0300 description: imapc, pop3c: Don't hide SSL handshake errors. diffstat: src/lib-imap-client/imapc-connection.c | 4 +--- src/lib-storage/index/pop3c/pop3c-client.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diffs (56 lines): diff -r ef939a32de27 -r ec933ef95687 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Thu Apr 04 18:10:04 2013 +0300 +++ b/src/lib-imap-client/imapc-connection.c Thu Apr 04 18:18:50 2013 +0300 @@ -116,7 +116,6 @@ unsigned int idling:1; unsigned int idle_stopping:1; unsigned int idle_plus_waiting:1; - unsigned int handshake_failed:1; }; static int imapc_connection_output(struct imapc_connection *conn); @@ -1112,7 +1111,7 @@ if (conn->ssl_iostream == NULL) { i_error("imapc(%s): Server disconnected unexpectedly", conn->name); - } else if (!conn->handshake_failed) { + } else { errstr = ssl_iostream_get_last_error(conn->ssl_iostream); if (errstr == NULL) { errstr = conn->input->stream_errno == 0 ? "EOF" : @@ -1146,7 +1145,6 @@ } return 0; } else { - conn->handshake_failed = TRUE; *error_r = error; return -1; } diff -r ef939a32de27 -r ec933ef95687 src/lib-storage/index/pop3c/pop3c-client.c --- a/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 18:10:04 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Thu Apr 04 18:18:50 2013 +0300 @@ -61,7 +61,6 @@ const char *input_line; struct istream *dot_input; - unsigned int handshake_failed:1; unsigned int running:1; }; @@ -396,7 +395,7 @@ if (client->ssl_iostream == NULL) { i_error("pop3c(%s): Server disconnected unexpectedly", client->set.host); - } else if (!client->handshake_failed) { + } else { errstr = ssl_iostream_get_last_error(client->ssl_iostream); if (errstr == NULL) { errstr = client->input->stream_errno == 0 ? "EOF" : @@ -429,7 +428,6 @@ } return 0; } else { - client->handshake_failed = TRUE; *error_r = error; return -1; } From dovecot at dovecot.org Thu Apr 4 19:03:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 19:03:36 +0300 Subject: dovecot-2.2: lib-storage: Fixed searching with multiple paramete... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/088481a77a7a changeset: 16163:088481a77a7a user: Timo Sirainen date: Thu Apr 04 19:03:26 2013 +0300 description: lib-storage: Fixed searching with multiple parameters and prefetching. diffstat: src/lib-storage/mail-search.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diffs (25 lines): diff -r ec933ef95687 -r 088481a77a7a src/lib-storage/mail-search.c --- a/src/lib-storage/mail-search.c Thu Apr 04 18:18:50 2013 +0300 +++ b/src/lib-storage/mail-search.c Thu Apr 04 19:03:26 2013 +0300 @@ -852,7 +852,10 @@ void mail_search_args_result_serialize(const struct mail_search_args *args, buffer_t *dest) { - mail_search_args_result_serialize_arg(args->args, dest); + const struct mail_search_arg *arg; + + for (arg = args->args; arg != NULL; arg = arg->next) + mail_search_args_result_serialize_arg(arg, dest); } static void @@ -883,5 +886,8 @@ void mail_search_args_result_deserialize(struct mail_search_args *args, const unsigned char *data, size_t size) { - mail_search_args_result_deserialize_arg(args->args, &data, &size); + struct mail_search_arg *arg; + + for (arg = args->args; arg != NULL; arg = arg->next) + mail_search_args_result_deserialize_arg(arg, &data, &size); } From dovecot at dovecot.org Thu Apr 4 19:18:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 19:18:33 +0300 Subject: dovecot-2.2: lib-mail: quoted_printable_decode*() now returns al... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6821794943a5 changeset: 16164:6821794943a5 user: Timo Sirainen date: Thu Apr 04 19:18:22 2013 +0300 description: lib-mail: quoted_printable_decode*() now returns all newlines as CRLF. This is required by BINARY fetches, since the original data had CRLFs. diffstat: src/lib-mail/quoted-printable.c | 11 +++-------- src/lib-mail/quoted-printable.h | 3 ++- src/lib-mail/test-quoted-printable.c | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diffs (58 lines): diff -r 088481a77a7a -r 6821794943a5 src/lib-mail/quoted-printable.c --- a/src/lib-mail/quoted-printable.c Thu Apr 04 19:03:26 2013 +0300 +++ b/src/lib-mail/quoted-printable.c Thu Apr 04 19:18:22 2013 +0300 @@ -33,7 +33,7 @@ { char hexbuf[3]; size_t src_pos, pos, next; - bool have_cr, errors = FALSE; + bool errors = FALSE; int ret; hexbuf[2] = '\0'; @@ -46,18 +46,13 @@ if (src[src_pos] == '\n') { /* drop trailing whitespace */ pos = src_pos; - if (pos > 0 && src[pos-1] == '\r') { + if (pos > 0 && src[pos-1] == '\r') pos--; - have_cr = TRUE; - } else { - have_cr = FALSE; - } while (pos > 0 && QP_IS_TRAILING_SPACE(src[pos-1])) pos--; buffer_append(dest, src + next, pos - next); next = src_pos+1; - if (have_cr) - buffer_append_c(dest, '\r'); + buffer_append_c(dest, '\r'); buffer_append_c(dest, '\n'); continue; } diff -r 088481a77a7a -r 6821794943a5 src/lib-mail/quoted-printable.h --- a/src/lib-mail/quoted-printable.h Thu Apr 04 19:03:26 2013 +0300 +++ b/src/lib-mail/quoted-printable.h Thu Apr 04 19:18:22 2013 +0300 @@ -3,7 +3,8 @@ /* Translates quoted printable data into binary. dest must be at least the size of src, and may be same as src. Returns 0 if input was valid, -1 if - there were some decoding errors (which were skipped over). + there were some decoding errors (which were skipped over). LFs without + preceding CR are returned as CRLF (but =0A isn't). This function may be called multiple times for parsing the same stream. src_pos is updated to first non-translated character in src. */ diff -r 088481a77a7a -r 6821794943a5 src/lib-mail/test-quoted-printable.c --- a/src/lib-mail/test-quoted-printable.c Thu Apr 04 19:03:26 2013 +0300 +++ b/src/lib-mail/test-quoted-printable.c Thu Apr 04 19:18:22 2013 +0300 @@ -21,7 +21,7 @@ { "foo = \n=01", "foo \001", 0, 0 }, { "foo =\t\r\nbar", "foo bar", 0, 0 }, { "foo =\r\n=01", "foo \001", 0, 0 }, - { "foo \nbar=", "foo\nbar", 1, 0 }, + { "foo \nbar=", "foo\r\nbar", 1, 0 }, { "=0A=0D ", "\n\r", 2, 0 }, { "foo_bar", "foo_bar", 0, 0 }, { "foo=", "foo", 1, 0 }, From dovecot at dovecot.org Thu Apr 4 19:45:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 19:45:38 +0300 Subject: dovecot-2.2: auth: If passdb wasn't used, don't preserve its ext... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/05d2b6003495 changeset: 16165:05d2b6003495 user: Timo Sirainen date: Thu Apr 04 19:45:28 2013 +0300 description: auth: If passdb wasn't used, don't preserve its extra fields in auth request. diffstat: src/auth/auth-request.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 6821794943a5 -r 05d2b6003495 src/auth/auth-request.c --- a/src/auth/auth-request.c Thu Apr 04 19:18:22 2013 +0300 +++ b/src/auth/auth-request.c Thu Apr 04 19:45:28 2013 +0300 @@ -607,7 +607,7 @@ } else { /* this passdb lookup failed, remove any extra fields it set */ - auth_fields_snapshot(request->extra_fields); + auth_fields_rollback(request->extra_fields); } if (*result == PASSDB_RESULT_USER_UNKNOWN) { From dovecot at dovecot.org Thu Apr 4 20:05:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 20:05:45 +0300 Subject: dovecot-2.2: lib-storage: Add \Noinferiors flag to INBOX when su... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/96381ea68124 changeset: 16166:96381ea68124 user: Timo Sirainen date: Thu Apr 04 20:05:37 2013 +0300 description: lib-storage: Add \Noinferiors flag to INBOX when such namespace config is used. diffstat: src/lib-storage/list/mailbox-list-iter.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 05d2b6003495 -r 96381ea68124 src/lib-storage/list/mailbox-list-iter.c --- a/src/lib-storage/list/mailbox-list-iter.c Thu Apr 04 19:45:28 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-iter.c Thu Apr 04 20:05:37 2013 +0300 @@ -594,7 +594,9 @@ if (info != NULL) { if (strcasecmp(info->vname, "INBOX") == 0 && ctx->inbox_list) { /* delay sending INBOX reply. we already saved its - flags at init stage */ + flags at init stage, except for \Noinferiors */ + ctx->inbox_info.flags |= + (info->flags & MAILBOX_NOINFERIORS); return FALSE; } if (strncasecmp(info->vname, "INBOX", 5) == 0 && From dovecot at dovecot.org Thu Apr 4 20:32:39 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 20:32:39 +0300 Subject: dovecot-2.2: ldap auth: Don't access freed memory. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2294f815a4f0 changeset: 16167:2294f815a4f0 user: Timo Sirainen date: Thu Apr 04 20:32:28 2013 +0300 description: ldap auth: Don't access freed memory. diffstat: src/auth/db-ldap.c | 12 ++++++++++++ src/auth/db-ldap.h | 2 ++ 2 files changed, 14 insertions(+), 0 deletions(-) diffs (50 lines): diff -r 96381ea68124 -r 2294f815a4f0 src/auth/db-ldap.c --- a/src/auth/db-ldap.c Thu Apr 04 20:05:37 2013 +0300 +++ b/src/auth/db-ldap.c Thu Apr 04 20:32:28 2013 +0300 @@ -788,6 +788,13 @@ res = NULL; } } + if (res == NULL && !final_result) { + /* wait for the final reply */ + request->failed = TRUE; + return TRUE; + } + if (request->failed) + res = NULL; if (final_result) { conn->pending_count--; aqueue_delete(conn->request_queue, idx); @@ -837,6 +844,7 @@ static void db_ldap_handle_result(struct ldap_connection *conn, LDAPMessage *res) { + struct auth_request *auth_request; struct ldap_request *request; unsigned int idx; int msgid; @@ -854,8 +862,12 @@ ldap_msgfree(res); return; } + /* request is allocated from auth_request's pool */ + auth_request = request->auth_request; + auth_request_ref(auth_request); if (db_ldap_handle_request_result(conn, request, idx, res)) db_ldap_request_free(request, res); + auth_request_unref(&auth_request); } static void ldap_input(struct ldap_connection *conn) diff -r 96381ea68124 -r 2294f815a4f0 src/auth/db-ldap.h --- a/src/auth/db-ldap.h Thu Apr 04 20:05:37 2013 +0300 +++ b/src/auth/db-ldap.h Thu Apr 04 20:32:28 2013 +0300 @@ -101,6 +101,8 @@ /* timestamp when request was created */ time_t create_time; + bool failed; + db_search_callback_t *callback; struct auth_request *auth_request; }; From dovecot at dovecot.org Thu Apr 4 21:19:07 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 21:19:07 +0300 Subject: dovecot-2.2: i_stream_read(): Added assert. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/285e1c6a2115 changeset: 16169:285e1c6a2115 user: Timo Sirainen date: Thu Apr 04 21:18:45 2013 +0300 description: i_stream_read(): Added assert. diffstat: src/lib/istream.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 096ad7cd6e9e -r 285e1c6a2115 src/lib/istream.c --- a/src/lib/istream.c Thu Apr 04 21:18:28 2013 +0300 +++ b/src/lib/istream.c Thu Apr 04 21:18:45 2013 +0300 @@ -133,6 +133,7 @@ old_size = _stream->pos - _stream->skip; ret = _stream->read(_stream); + i_assert(old_size <= _stream->pos - _stream->skip); switch (ret) { case -2: i_assert(_stream->skip != _stream->pos); From dovecot at dovecot.org Thu Apr 4 21:19:07 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 21:19:07 +0300 Subject: dovecot-2.2: istream-chain: Fixed handling small streams that ge... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/096ad7cd6e9e changeset: 16168:096ad7cd6e9e user: Timo Sirainen date: Thu Apr 04 21:18:28 2013 +0300 description: istream-chain: Fixed handling small streams that get merged into same buffer. diffstat: src/lib/istream-chain.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) diffs (40 lines): diff -r 2294f815a4f0 -r 096ad7cd6e9e src/lib/istream-chain.c --- a/src/lib/istream-chain.c Thu Apr 04 20:32:28 2013 +0300 +++ b/src/lib/istream-chain.c Thu Apr 04 21:18:28 2013 +0300 @@ -118,21 +118,24 @@ if (link != NULL && link->stream != NULL) i_stream_seek(link->stream, 0); - /* we already verified that the data size is less than the - maximum buffer size */ - cstream->istream.pos = 0; - if (data_size > 0) { - if (!i_stream_try_alloc(&cstream->istream, data_size, &size)) - i_unreached(); - i_assert(size >= data_size); + if (cstream->istream.buffer == cstream->istream.w_buffer) { + /* we've already buffered the prev_input */ + } else { + /* we already verified that the data size is less than the + maximum buffer size */ + cstream->istream.pos = 0; + if (data_size > 0) { + if (!i_stream_try_alloc(&cstream->istream, data_size, &size)) + i_unreached(); + i_assert(size >= data_size); + } + memcpy(cstream->istream.w_buffer, data, data_size); + cstream->istream.skip = 0; + cstream->istream.pos = data_size; + cstream->prev_stream_left = data_size; } - - memcpy(cstream->istream.w_buffer, data, data_size); i_stream_skip(prev_input, data_size); i_stream_unref(&prev_input); - cstream->istream.skip = 0; - cstream->istream.pos = data_size; - cstream->prev_stream_left = data_size; } static ssize_t i_stream_chain_read(struct istream_private *stream) From dovecot at dovecot.org Thu Apr 4 21:19:07 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 21:19:07 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Don't memcpy() data over itself. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3c84909de2e2 changeset: 16170:3c84909de2e2 user: Timo Sirainen date: Thu Apr 04 21:18:59 2013 +0300 description: lib-imap-urlauth: Don't memcpy() data over itself. diffstat: src/lib-imap-urlauth/imap-urlauth-backend.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diffs (11 lines): diff -r 285e1c6a2115 -r 3c84909de2e2 src/lib-imap-urlauth/imap-urlauth-backend.c --- a/src/lib-imap-urlauth/imap-urlauth-backend.c Thu Apr 04 21:18:45 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-backend.c Thu Apr 04 21:18:59 2013 +0300 @@ -69,7 +69,6 @@ mailbox_get_vname(box)); return -1; } - memcpy(mailbox_key_r, key_buf.data, IMAP_URLAUTH_KEY_LEN); } return 1; } From dovecot at dovecot.org Thu Apr 4 21:23:53 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 21:23:53 +0300 Subject: dovecot-2.2: istream-chain: Fixed memory leak. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a4dae80c419f changeset: 16171:a4dae80c419f user: Timo Sirainen date: Thu Apr 04 21:23:49 2013 +0300 description: istream-chain: Fixed memory leak. diffstat: src/lib/istream-chain.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 3c84909de2e2 -r a4dae80c419f src/lib/istream-chain.c --- a/src/lib/istream-chain.c Thu Apr 04 21:18:59 2013 +0300 +++ b/src/lib/istream-chain.c Thu Apr 04 21:23:49 2013 +0300 @@ -94,6 +94,7 @@ i_free(link); link = next; } + i_free(cstream->istream.w_buffer); } static void i_stream_chain_read_next(struct chain_istream *cstream) From dovecot at dovecot.org Thu Apr 4 21:47:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 21:47:11 +0300 Subject: dovecot-2.2: istream-chain: More fixes to handling merged streams. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/29fdc9ff273d changeset: 16172:29fdc9ff273d user: Timo Sirainen date: Thu Apr 04 21:46:59 2013 +0300 description: istream-chain: More fixes to handling merged streams. diffstat: src/lib/istream-chain.c | 34 ++++++++++++++++++++++------------ 1 files changed, 22 insertions(+), 12 deletions(-) diffs (55 lines): diff -r a4dae80c419f -r 29fdc9ff273d src/lib/istream-chain.c --- a/src/lib/istream-chain.c Thu Apr 04 21:23:49 2013 +0300 +++ b/src/lib/istream-chain.c Thu Apr 04 21:46:59 2013 +0300 @@ -102,7 +102,7 @@ struct istream_chain_link *link = cstream->chain.head; struct istream *prev_input; const unsigned char *data; - size_t data_size, size; + size_t data_size, size, cur_data_pos; i_assert(link != NULL && link->stream != NULL); i_assert(link->stream->eof); @@ -120,21 +120,31 @@ i_stream_seek(link->stream, 0); if (cstream->istream.buffer == cstream->istream.w_buffer) { - /* we've already buffered the prev_input */ + /* we've already buffered some of the prev_input. continue + appending the rest to it. */ + cur_data_pos = cstream->istream.pos - + (cstream->istream.skip + cstream->prev_stream_left); + i_assert(cur_data_pos <= data_size); + data += cur_data_pos; + data_size -= cur_data_pos; } else { - /* we already verified that the data size is less than the - maximum buffer size */ cstream->istream.pos = 0; - if (data_size > 0) { - if (!i_stream_try_alloc(&cstream->istream, data_size, &size)) - i_unreached(); - i_assert(size >= data_size); - } - memcpy(cstream->istream.w_buffer, data, data_size); cstream->istream.skip = 0; - cstream->istream.pos = data_size; - cstream->prev_stream_left = data_size; + cstream->prev_stream_left = 0; } + + /* we already verified that the data size is less than the + maximum buffer size */ + if (data_size > 0) { + if (!i_stream_try_alloc(&cstream->istream, data_size, &size)) + i_unreached(); + i_assert(size >= data_size); + } + memcpy(cstream->istream.w_buffer + cstream->istream.pos, + data, data_size); + cstream->istream.pos += data_size; + cstream->prev_stream_left += data_size; + i_stream_skip(prev_input, data_size); i_stream_unref(&prev_input); } From dovecot at dovecot.org Thu Apr 4 22:09:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 22:09:10 +0300 Subject: dovecot-2.2: istream-chain: Final fixes to handling merged streams. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0f88312ef951 changeset: 16173:0f88312ef951 user: Timo Sirainen date: Thu Apr 04 22:09:02 2013 +0300 description: istream-chain: Final fixes to handling merged streams. diffstat: src/lib/istream-chain.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 29fdc9ff273d -r 0f88312ef951 src/lib/istream-chain.c --- a/src/lib/istream-chain.c Thu Apr 04 21:46:59 2013 +0300 +++ b/src/lib/istream-chain.c Thu Apr 04 22:09:02 2013 +0300 @@ -119,7 +119,7 @@ if (link != NULL && link->stream != NULL) i_stream_seek(link->stream, 0); - if (cstream->istream.buffer == cstream->istream.w_buffer) { + if (cstream->prev_stream_left > 0) { /* we've already buffered some of the prev_input. continue appending the rest to it. */ cur_data_pos = cstream->istream.pos - @@ -145,7 +145,7 @@ cstream->istream.pos += data_size; cstream->prev_stream_left += data_size; - i_stream_skip(prev_input, data_size); + i_stream_skip(prev_input, i_stream_get_data_size(prev_input)); i_stream_unref(&prev_input); } From dovecot at dovecot.org Thu Apr 4 22:52:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 22:52:51 +0300 Subject: dovecot-2.2: lib-storage: Crashfixes for handling shared mailbox... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9891526c2def changeset: 16174:9891526c2def user: Timo Sirainen date: Thu Apr 04 22:49:38 2013 +0300 description: lib-storage: Crashfixes for handling shared mailboxes for nonexistent users. diffstat: src/lib-storage/index/shared/shared-storage.c | 4 +- src/lib-storage/mail-user.c | 30 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diffs (96 lines): diff -r 0f88312ef951 -r 9891526c2def src/lib-storage/index/shared/shared-storage.c --- a/src/lib-storage/index/shared/shared-storage.c Thu Apr 04 22:09:02 2013 +0300 +++ b/src/lib-storage/index/shared/shared-storage.c Thu Apr 04 22:49:38 2013 +0300 @@ -320,8 +320,8 @@ /* We need to create a prefix="" namespace for the owner */ if (mail_namespaces_init_location(owner, str_c(location), &error) < 0) { + /* owner gets freed by namespace deinit */ mail_namespace_destroy(new_ns); - mail_user_unref(&owner); return -1; } @@ -329,8 +329,8 @@ MAIL_STORAGE_FLAG_NO_AUTOVERIFY, &error) < 0) { mailbox_list_set_critical(list, "Namespace '%s': %s", new_ns->prefix, error); + /* owner gets freed by namespace deinit */ mail_namespace_destroy(new_ns); - mail_user_unref(&owner); return -1; } if ((new_ns->flags & NAMESPACE_FLAG_UNUSABLE) == 0 && diff -r 0f88312ef951 -r 9891526c2def src/lib-storage/mail-user.c --- a/src/lib-storage/mail-user.c Thu Apr 04 22:09:02 2013 +0300 +++ b/src/lib-storage/mail-user.c Thu Apr 04 22:49:38 2013 +0300 @@ -70,15 +70,15 @@ return user; } -static int -mail_user_expand_plugins_envs(struct mail_user *user, const char **error_r) +static void +mail_user_expand_plugins_envs(struct mail_user *user) { const char **envs, *home; string_t *str; unsigned int i, count; if (!array_is_created(&user->set->plugin_envs)) - return 0; + return; str = t_str_new(256); envs = array_get_modifiable(&user->set->plugin_envs, &count); @@ -87,17 +87,16 @@ if (user->_home == NULL && var_has_key(envs[i+1], 'h', "home") && mail_user_get_home(user, &home) <= 0) { - *error_r = t_strdup_printf( + user->error = p_strdup_printf(user->pool, "userdb didn't return a home directory, " "but plugin setting %s used it (%%h): %s", envs[i], envs[i+1]); - return -1; + return; } str_truncate(str, 0); var_expand(str, envs[i+1], mail_user_var_expand_table(user)); envs[i+1] = p_strdup(user->pool, str_c(str)); } - return 0; } int mail_user_init(struct mail_user *user, const char **error_r) @@ -115,20 +114,21 @@ user->pool, mail_user_var_expand_table(user)); if (need_home_dir && mail_user_get_home(user, &home) <= 0) { - *error_r = t_strdup_printf( + user->error = p_strdup_printf(user->pool, "userdb didn't return a home directory, " "but %s used it (%%h): %s", key, value); - return -1; } + mail_user_expand_plugins_envs(user); - if (mail_user_expand_plugins_envs(user, error_r) < 0) - return -1; + /* autocreated users for shared mailboxes need to be fully initialized + if they don't exist, since they're going to be used anyway */ + if (user->error == NULL || user->nonexistent) { + mail_set = mail_user_set_get_storage_set(user); + user->mail_debug = mail_set->mail_debug; - mail_set = mail_user_set_get_storage_set(user); - user->mail_debug = mail_set->mail_debug; - - user->initialized = TRUE; - hook_mail_user_created(user); + user->initialized = TRUE; + hook_mail_user_created(user); + } if (user->error != NULL) { *error_r = t_strdup(user->error); From dovecot at dovecot.org Thu Apr 4 23:03:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:03:58 +0300 Subject: dovecot-2.2: imapc: Give an early error message if imapc_list_pr... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e9cab6d5e82a changeset: 16175:e9cab6d5e82a user: Timo Sirainen date: Thu Apr 04 23:03:06 2013 +0300 description: imapc: Give an early error message if imapc_list_prefix ends with separator. diffstat: src/lib-storage/index/imapc/imapc-storage.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (24 lines): diff -r 9891526c2def -r e9cab6d5e82a src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Thu Apr 04 22:49:38 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Thu Apr 04 23:03:06 2013 +0300 @@ -186,6 +186,7 @@ { struct imapc_command *cmd; struct imapc_simple_context sctx; + const char *imapc_list_prefix = storage->set->imapc_list_prefix; imapc_simple_context_init(&sctx, storage); cmd = imapc_client_cmd(storage->client, imapc_simple_callback, &sctx); @@ -202,6 +203,12 @@ *error_r = "LIST didn't return hierarchy separator"; return -1; } + + if (imapc_list_prefix[0] != '\0' && + imapc_list_prefix[strlen(imapc_list_prefix)-1] == storage->list->sep) { + *error_r = "imapc_list_prefix must not end with hierarchy separator"; + return -1; + } return sctx.ret; } From dovecot at dovecot.org Thu Apr 4 23:03:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:03:58 +0300 Subject: dovecot-2.2: imapc: Don't assert-crash when ACL plugin tries to ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bb81deef6b42 changeset: 16176:bb81deef6b42 user: Timo Sirainen date: Thu Apr 04 23:03:30 2013 +0300 description: imapc: Don't assert-crash when ACL plugin tries to lookup "" mailbox. diffstat: src/lib-storage/index/imapc/imapc-list.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r e9cab6d5e82a -r bb81deef6b42 src/lib-storage/index/imapc/imapc-list.c --- a/src/lib-storage/index/imapc/imapc-list.c Thu Apr 04 23:03:06 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-list.c Thu Apr 04 23:03:30 2013 +0300 @@ -193,7 +193,9 @@ const char *prefix = list->storage->set->imapc_list_prefix; unsigned int prefix_len; - if (*prefix != '\0' && strcasecmp(storage_name, "INBOX") != 0) { + if (*storage_name == '\0') { + /* ACL plugin does these lookups */ + } else if (*prefix != '\0' && strcasecmp(storage_name, "INBOX") != 0) { prefix_len = strlen(prefix); i_assert(strncmp(prefix, storage_name, prefix_len) == 0 && storage_name[prefix_len] == list->sep); From dovecot at dovecot.org Thu Apr 4 23:03:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:03:58 +0300 Subject: dovecot-2.2: dsync: Mailbox name fixing didn't work when namespa... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ef0669c017df changeset: 16177:ef0669c017df user: Timo Sirainen date: Thu Apr 04 23:03:47 2013 +0300 description: dsync: Mailbox name fixing didn't work when namespace prefixes were used. diffstat: src/doveadm/dsync/dsync-brain-mailbox-tree.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (19 lines): diff -r bb81deef6b42 -r ef0669c017df src/doveadm/dsync/dsync-brain-mailbox-tree.c --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Thu Apr 04 23:03:30 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Thu Apr 04 23:03:47 2013 +0300 @@ -245,13 +245,14 @@ return; } /* 3) probably some reserved name (e.g. dbox-Mails) */ - str_insert(vname, 0, "_"); + str_insert(vname, ns->prefix_len, "_"); if (dsync_is_valid_name(ns, str_c(vname))) return; /* 4) name is too long? just give up and generate a unique name */ guid_128_generate(guid); str_truncate(vname, 0); + str_append(vname, ns->prefix); str_append(vname, guid_128_to_string(guid)); i_assert(dsync_is_valid_name(ns, str_c(vname))); } From dovecot at dovecot.org Thu Apr 4 23:35:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:35:37 +0300 Subject: dovecot-2.2: replicator: If replicator is unconfigured, fail at ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c67d787164fa changeset: 16179:c67d787164fa user: Timo Sirainen date: Thu Apr 04 23:35:27 2013 +0300 description: replicator: If replicator is unconfigured, fail at startup. diffstat: src/replication/replicator/replicator.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r c32bfc54bc50 -r c67d787164fa src/replication/replicator/replicator.c --- a/src/replication/replicator/replicator.c Thu Apr 04 23:35:08 2013 +0300 +++ b/src/replication/replicator/replicator.c Thu Apr 04 23:35:27 2013 +0300 @@ -123,6 +123,13 @@ i_fatal("Error reading configuration: %s", error); master_service_init_log(master_service, "replicator: "); + /* this check is here mainly so that "doveadm replicator" commands + don't accidentally start an unconfigured replicator */ + if (master_service_get_process_min_avail(master_service) == 0) { + i_fatal("Replicator not configured: " + "service replicator { process_min_avail } must be 1"); + } + restrict_access_by_env(NULL, FALSE); restrict_access_allow_coredumps(TRUE); master_service_init_finish(master_service); From dovecot at dovecot.org Thu Apr 4 23:35:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:35:37 +0300 Subject: dovecot-2.2: lib-master: Added master_service_get_process_min_av... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c32bfc54bc50 changeset: 16178:c32bfc54bc50 user: Timo Sirainen date: Thu Apr 04 23:35:08 2013 +0300 description: lib-master: Added master_service_get_process_min_avail() diffstat: src/lib-master/master-interface.h | 4 ++++ src/lib-master/master-service-private.h | 1 + src/lib-master/master-service.c | 10 ++++++++++ src/lib-master/master-service.h | 2 ++ src/master/service-process.c | 2 ++ 5 files changed, 19 insertions(+), 0 deletions(-) diffs (76 lines): diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-interface.h --- a/src/lib-master/master-interface.h Thu Apr 04 23:03:47 2013 +0300 +++ b/src/lib-master/master-interface.h Thu Apr 04 23:35:08 2013 +0300 @@ -48,6 +48,10 @@ can be created before reaching the limit */ #define MASTER_PROCESS_LIMIT_ENV "PROCESS_LIMIT" +/* getenv(MASTER_PROCESS_MIN_AVAIL_ENV) specifies how many processes of this + type are created at startup and are kept running all the time */ +#define MASTER_PROCESS_MIN_AVAIL_ENV "PROCESS_MIN_AVAIL" + /* getenv(MASTER_SERVICE_COUNT_ENV) specifies how many client connections the process can finish handling before it should kill itself. */ #define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT" diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service-private.h --- a/src/lib-master/master-service-private.h Thu Apr 04 23:03:47 2013 +0300 +++ b/src/lib-master/master-service-private.h Thu Apr 04 23:35:08 2013 +0300 @@ -37,6 +37,7 @@ unsigned int service_count_left; unsigned int total_available_count; unsigned int process_limit; + unsigned int process_min_avail; unsigned int idle_kill_secs; struct master_status master_status; diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service.c --- a/src/lib-master/master-service.c Thu Apr 04 23:03:47 2013 +0300 +++ b/src/lib-master/master-service.c Thu Apr 04 23:35:08 2013 +0300 @@ -216,6 +216,11 @@ count > 0) service->process_limit = count; + value = getenv(MASTER_PROCESS_MIN_AVAIL_ENV); + if (value != NULL && str_to_uint(value, &count) == 0 && + count > 0) + service->process_min_avail = count; + /* set the default service count */ value = getenv(MASTER_SERVICE_COUNT_ENV); if (value != NULL && str_to_uint(value, &count) == 0 && @@ -491,6 +496,11 @@ return service->process_limit; } +unsigned int master_service_get_process_min_avail(struct master_service *service) +{ + return service->process_min_avail; +} + unsigned int master_service_get_idle_kill_secs(struct master_service *service) { return service->idle_kill_secs; diff -r ef0669c017df -r c32bfc54bc50 src/lib-master/master-service.h --- a/src/lib-master/master-service.h Thu Apr 04 23:03:47 2013 +0300 +++ b/src/lib-master/master-service.h Thu Apr 04 23:35:08 2013 +0300 @@ -105,6 +105,8 @@ /* Returns how many processes of this type can be created before reaching the limit. */ unsigned int master_service_get_process_limit(struct master_service *service); +/* Returns service { process_min_avail } */ +unsigned int master_service_get_process_min_avail(struct master_service *service); /* Returns the service's idle_kill timeout in seconds. Normally master handles sending the kill request when the process has no clients, but some services with permanent client connections may need to handle this themselves. */ diff -r ef0669c017df -r c32bfc54bc50 src/master/service-process.c --- a/src/master/service-process.c Thu Apr 04 23:03:47 2013 +0300 +++ b/src/master/service-process.c Thu Apr 04 23:35:08 2013 +0300 @@ -228,6 +228,8 @@ service->client_limit)); env_put(t_strdup_printf(MASTER_PROCESS_LIMIT_ENV"=%u", service->process_limit)); + env_put(t_strdup_printf(MASTER_PROCESS_MIN_AVAIL_ENV"=%u", + service->set->process_min_avail)); env_put(t_strdup_printf(MASTER_SERVICE_IDLE_KILL_ENV"=%u", service->idle_kill)); if (service->set->service_count != 0) { From dovecot at dovecot.org Thu Apr 4 23:57:05 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:57:05 +0300 Subject: dovecot-2.1: quota-status: Added quota_status_(success|nouser|ov... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c7da636a09c4 changeset: 14947:c7da636a09c4 user: Timo Sirainen date: Thu Apr 04 23:56:55 2013 +0300 description: quota-status: Added quota_status_(success|nouser|overquota) settings. diffstat: src/plugins/quota/quota-status.c | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diffs (51 lines): diff -r 2493ec20df8c -r c7da636a09c4 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Tue Apr 02 11:52:36 2013 +0300 +++ b/src/plugins/quota/quota-status.c Thu Apr 04 23:56:55 2013 +0300 @@ -79,7 +79,7 @@ struct mail_storage_service_input input; struct mail_storage_service_user *service_user; struct mail_user *user; - const char *error; + const char *value = NULL, *error; int ret; if (client->recipient == NULL) { @@ -94,21 +94,31 @@ &service_user, &user, &error); restrict_access_allow_coredumps(TRUE); if (ret == 0) { - o_stream_send_str(client->conn.output, - "action=REJECT Unknown user\n\n"); + value = mail_user_plugin_getenv(user, "quota_status_nouser"); + if (value == NULL) + value = "REJECT Unknown user"; } else if (ret > 0) { - if ((ret = quota_check(user, client->size, &error)) > 0) - o_stream_send_str(client->conn.output, "action=OK\n\n"); - else if (ret == 0) { - o_stream_send_str(client->conn.output, t_strdup_printf( - "action=552 5.2.2 %s\n\n", error)); + if ((ret = quota_check(user, client->size, &error)) > 0) { + /* under quota */ + value = mail_user_plugin_getenv(user, "quota_status_success"); + if (value == NULL) + value = "OK"; + } else if (ret == 0) { + /* over quota */ + value = mail_user_plugin_getenv(user, "quota_status_overquota"); + if (value == NULL) + value = t_strdup_printf("action=552 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); } if (ret < 0) { + /* temporary failure */ o_stream_send_str(client->conn.output, t_strdup_printf( "action=DEFER_IF_PERMIT %s\n\n", error)); + } else { + o_stream_send_str(client->conn.output, + t_strdup_printf("action=%s\n\n", value)); } } From dovecot at dovecot.org Thu Apr 4 23:58:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 04 Apr 2013 23:58:51 +0300 Subject: dovecot-2.1: quota-status: Removed duplicate "action=" text from... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/852cfd3e4933 changeset: 14948:852cfd3e4933 user: Timo Sirainen date: Thu Apr 04 23:58:47 2013 +0300 description: quota-status: Removed duplicate "action=" text from overquota messages. diffstat: src/plugins/quota/quota-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c7da636a09c4 -r 852cfd3e4933 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Thu Apr 04 23:56:55 2013 +0300 +++ b/src/plugins/quota/quota-status.c Thu Apr 04 23:58:47 2013 +0300 @@ -107,7 +107,7 @@ /* over quota */ value = mail_user_plugin_getenv(user, "quota_status_overquota"); if (value == NULL) - value = t_strdup_printf("action=552 5.2.2 %s\n\n", error); + value = t_strdup_printf("552 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: Add DOVECOT_PREREQ to src/lib/macros.h - convenienc... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a588b743d695 changeset: 16181:a588b743d695 user: Dennis Schridde date: Sun Oct 30 12:39:53 2011 +0100 description: Add DOVECOT_PREREQ to src/lib/macros.h - convenience macro to test the version of dovecot diffstat: src/lib/macros.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diffs (16 lines): diff -r e294e416f5ba -r a588b743d695 src/lib/macros.h --- a/src/lib/macros.h Sun Oct 30 12:23:28 2011 +0100 +++ b/src/lib/macros.h Sun Oct 30 12:39:53 2011 +0100 @@ -196,4 +196,12 @@ #define i_unreached() \ i_panic("file %s: line %d: unreached", __FILE__, __LINE__) +/* Convenience macros to test the versions of dovecot. */ +#if defined DOVECOT_VERSION_MAJOR && defined DOVECOT_VERSION_MINOR +# define DOVECOT_PREREQ(maj, min) \ + ((DOVECOT_VERSION_MAJOR << 16) + DOVECOT_VERSION_MINOR >= ((maj) << 16) + (min)) +#else +# define DOVECOT_PREREQ(maj, min) 0 #endif + +#endif From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: "Mailbox doesn't exist" error mixed up using storag... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/eece943c7521 changeset: 16182:eece943c7521 user: Timo Sirainen date: Sun Mar 24 12:09:39 2013 +0200 description: "Mailbox doesn't exist" error mixed up using storage and virtual mailbox names. This could have allowed a user to figure out existence of a mailbox without having lookup ACL. diffstat: src/lib-storage/index/cydir/cydir-storage.c | 2 +- src/lib-storage/index/dbox-common/dbox-storage.c | 2 +- src/lib-storage/index/maildir/maildir-storage.c | 2 +- src/lib-storage/index/mbox/mbox-storage.c | 2 +- src/lib-storage/index/pop3c/pop3c-storage.c | 2 +- src/lib-storage/index/raw/raw-storage.c | 2 +- src/lib-storage/list/mailbox-list-delete.c | 8 ++++---- src/lib-storage/list/mailbox-list-fs.c | 4 ++-- src/lib-storage/list/mailbox-list-maildir.c | 4 ++-- src/lib-storage/mailbox-list-private.h | 4 ++++ src/plugins/acl/acl-mailbox.c | 2 +- src/plugins/virtual/virtual-config.c | 2 +- 12 files changed, 20 insertions(+), 16 deletions(-) diffs (191 lines): diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/cydir/cydir-storage.c --- a/src/lib-storage/index/cydir/cydir-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/cydir/cydir-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -68,7 +68,7 @@ /* exists, open it */ } else if (errno == ENOENT) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); return -1; } else if (errno == EACCES) { mail_storage_set_critical(box->storage, "%s", diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/dbox-common/dbox-storage.c --- a/src/lib-storage/index/dbox-common/dbox-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/dbox-common/dbox-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -184,7 +184,7 @@ ; else if (errno == ENOENT || errno == ENAMETOOLONG) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); return -1; } else if (errno == EACCES) { mail_storage_set_critical(box->storage, "%s", diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/maildir/maildir-storage.c --- a/src/lib-storage/index/maildir/maildir-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/maildir/maildir-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -367,7 +367,7 @@ if (errno == ENOENT || errno == ENAMETOOLONG) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); return -1; } else { mail_storage_set_critical(box->storage, diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/mbox/mbox-storage.c --- a/src/lib-storage/index/mbox/mbox-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/mbox/mbox-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -470,7 +470,7 @@ return -1; } else if (ENOTFOUND(errno)) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); return -1; } else if (mail_storage_set_error_from_errno(box->storage)) { return -1; diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/pop3c/pop3c-storage.c --- a/src/lib-storage/index/pop3c/pop3c-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/pop3c/pop3c-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -165,7 +165,7 @@ if (strcmp(box->name, "INBOX") != 0) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); return -1; } diff -r a588b743d695 -r eece943c7521 src/lib-storage/index/raw/raw-storage.c --- a/src/lib-storage/index/raw/raw-storage.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/index/raw/raw-storage.c Sun Mar 24 12:09:39 2013 +0200 @@ -151,7 +151,7 @@ if (ENOTFOUND(errno)) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); } else if (!mail_storage_set_error_from_errno(box->storage)) { mail_storage_set_critical(box->storage, "open(%s) failed: %m", path); diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-delete.c --- a/src/lib-storage/list/mailbox-list-delete.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/list/mailbox-list-delete.c Sun Mar 24 12:09:39 2013 +0200 @@ -68,7 +68,7 @@ continue; } mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); return -1; } if (errno == EXDEV) { @@ -130,7 +130,7 @@ return 0; else if (ENOTFOUND(errno)) { mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); return -1; } else { if (!mailbox_list_set_error_from_errno(list)) { @@ -158,7 +158,7 @@ if (dir == NULL) { if (errno == ENOENT) { mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); } else { if (!mailbox_list_set_error_from_errno(list)) { mailbox_list_set_critical(list, @@ -340,7 +340,7 @@ if (errno == ENOENT) { mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); } else if (errno == EISDIR || errno == EPERM) { /* Solaris */ mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE, diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-fs.c --- a/src/lib-storage/list/mailbox-list-fs.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/list/mailbox-list-fs.c Sun Mar 24 12:09:39 2013 +0200 @@ -393,7 +393,7 @@ if (errno == ENOENT || errno == ENOTDIR) { mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); } else if (errno == ENOTEMPTY || errno == EEXIST) { /* mbox workaround: if only .imap/ directory is preventing the deletion, remove it */ @@ -586,7 +586,7 @@ if (rename(oldpath, newpath) < 0) { if (ENOTFOUND(errno)) { mailbox_list_set_error(oldlist, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname)); + T_MAILBOX_LIST_ERR_NOT_FOUND(oldlist, oldname)); } else if (!mailbox_list_set_error_from_errno(oldlist)) { mailbox_list_set_critical(oldlist, "rename(%s, %s) failed: %m", oldpath, newpath); diff -r a588b743d695 -r eece943c7521 src/lib-storage/list/mailbox-list-maildir.c --- a/src/lib-storage/list/mailbox-list-maildir.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/list/mailbox-list-maildir.c Sun Mar 24 12:09:39 2013 +0200 @@ -428,7 +428,7 @@ "Mailbox exists"); } else if (errno == ENOENT || errno == ENOTDIR) { mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(name)); + T_MAILBOX_LIST_ERR_NOT_FOUND(list, name)); } else { mailbox_list_set_critical(list, "stat(%s) failed: %m", path); } @@ -613,7 +613,7 @@ return -1; if (!found && ret == 0) { mailbox_list_set_error(oldlist, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(oldname)); + T_MAILBOX_LIST_ERR_NOT_FOUND(oldlist, oldname)); return -1; } diff -r a588b743d695 -r eece943c7521 src/lib-storage/mailbox-list-private.h --- a/src/lib-storage/mailbox-list-private.h Sun Oct 30 12:39:53 2011 +0100 +++ b/src/lib-storage/mailbox-list-private.h Sun Mar 24 12:09:39 2013 +0200 @@ -11,6 +11,10 @@ #define MAILBOX_LOG_FILE_NAME "dovecot.mailbox.log" +#define T_MAILBOX_LIST_ERR_NOT_FOUND(list, name) \ + t_strdup_printf(MAIL_ERRSTR_MAILBOX_NOT_FOUND, \ + mailbox_list_get_vname(list, name)) + enum mailbox_log_record_type; struct stat; struct dirent; diff -r a588b743d695 -r eece943c7521 src/plugins/acl/acl-mailbox.c --- a/src/plugins/acl/acl-mailbox.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/plugins/acl/acl-mailbox.c Sun Mar 24 12:09:39 2013 +0200 @@ -159,7 +159,7 @@ MAIL_ERRSTR_NO_PERMISSION); } else if (ret == 0) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); } } diff -r a588b743d695 -r eece943c7521 src/plugins/virtual/virtual-config.c --- a/src/plugins/virtual/virtual-config.c Sun Oct 30 12:39:53 2011 +0100 +++ b/src/plugins/virtual/virtual-config.c Sun Mar 24 12:09:39 2013 +0200 @@ -378,7 +378,7 @@ "Virtual mailbox missing configuration file"); } else if (errno == ENOENT) { mail_storage_set_error(storage, MAIL_ERROR_NOTFOUND, - T_MAIL_ERR_MAILBOX_NOT_FOUND(mbox->box.name)); + T_MAIL_ERR_MAILBOX_NOT_FOUND(mbox->box.vname)); } else { mail_storage_set_critical(storage, "stat(%s) failed: %m", box_path); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: Add macros DOVECOT_VERSION_{MAJOR,MINOR} to config.... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e294e416f5ba changeset: 16180:e294e416f5ba user: Dennis Schridde date: Sun Oct 30 12:23:28 2011 +0100 description: Add macros DOVECOT_VERSION_{MAJOR,MINOR} to config.h to allow version checks in the preprocessor Version number set as PACKAGE_VERSION is assumed to be D.D* with D=digits diffstat: configure.in | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r e511408bd991 -r e294e416f5ba configure.in --- a/configure.in Wed Mar 20 21:13:20 2013 +0200 +++ b/configure.in Sun Oct 30 12:23:28 2011 +0100 @@ -287,6 +287,9 @@ AC_DEFINE_UNQUOTED(DOVECOT_STRING, "$PACKAGE_STRING", Dovecot string) AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", Dovecot version) +AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version]) +AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version]) + AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h inttypes.h \ sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \ sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h sys/fs/quota_common.h \ From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: doveadm, indexer: Don't crash if STATUS_LAST_CACHED... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/73feea4d22aa changeset: 16183:73feea4d22aa user: Timo Sirainen date: Fri Feb 22 10:31:38 2013 +0200 description: doveadm, indexer: Don't crash if STATUS_LAST_CACHED_SEQ lookup fails. (I'm sure I did this change already once, where did it go?..) diffstat: src/doveadm/doveadm-mail-index.c | 6 +++--- src/indexer/master-connection.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diffs (35 lines): diff -r eece943c7521 -r 73feea4d22aa src/doveadm/doveadm-mail-index.c --- a/src/doveadm/doveadm-mail-index.c Sun Mar 24 12:09:39 2013 +0200 +++ b/src/doveadm/doveadm-mail-index.c Fri Feb 22 10:31:38 2013 +0200 @@ -38,10 +38,10 @@ int ret = 0; if (mailbox_get_metadata(box, MAILBOX_METADATA_PRECACHE_FIELDS, - &metadata) < 0) + &metadata) < 0 || + mailbox_get_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ, + &status) < 0) return -1; - mailbox_get_open_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ, - &status); seq = status.last_cached_seq + 1; if (seq > status.messages) { diff -r eece943c7521 -r 73feea4d22aa src/indexer/master-connection.c --- a/src/indexer/master-connection.c Sun Mar 24 12:09:39 2013 +0200 +++ b/src/indexer/master-connection.c Fri Feb 22 10:31:38 2013 +0200 @@ -68,11 +68,10 @@ int ret = 0; if (mailbox_get_metadata(box, MAILBOX_METADATA_PRECACHE_FIELDS, - &metadata) < 0) + &metadata) < 0 || + mailbox_get_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ, + &status) < 0) return -1; - - mailbox_get_open_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ, - &status); seq = status.last_cached_seq + 1; trans = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: doveadm: Added "batch" command to run multiple mail... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8cc28a5a3f4f changeset: 16184:8cc28a5a3f4f user: Timo Sirainen date: Mon Mar 25 16:19:54 2013 +0200 description: doveadm: Added "batch" command to run multiple mail commands. This only makes sense when the commands are run with -A or -u , so that the commands are run for the same user before moving onto the next user. diffstat: src/doveadm/Makefile.am | 1 + src/doveadm/doveadm-mail-batch.c | 162 +++++++++++++++++++++++++++++++++++++++ src/doveadm/doveadm-mail.c | 54 ++++++++---- src/doveadm/doveadm-mail.h | 4 + 4 files changed, 204 insertions(+), 17 deletions(-) diffs (truncated from 304 to 300 lines): diff -r 73feea4d22aa -r 8cc28a5a3f4f src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Fri Feb 22 10:31:38 2013 +0200 +++ b/src/doveadm/Makefile.am Mon Mar 25 16:19:54 2013 +0200 @@ -68,6 +68,7 @@ common = \ doveadm-mail.c \ doveadm-mail-altmove.c \ + doveadm-mail-batch.c \ doveadm-mail-expunge.c \ doveadm-mail-fetch.c \ doveadm-mail-import.c \ diff -r 73feea4d22aa -r 8cc28a5a3f4f src/doveadm/doveadm-mail-batch.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/doveadm/doveadm-mail-batch.c Mon Mar 25 16:19:54 2013 +0200 @@ -0,0 +1,162 @@ +/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "array.h" +#include "doveadm-mail.h" + +#include + +struct batch_cmd_context { + struct doveadm_mail_cmd_context ctx; + ARRAY_DEFINE(commands, struct doveadm_mail_cmd_context *); +}; + +static int cmd_batch_prerun(struct doveadm_mail_cmd_context *_ctx, + struct mail_storage_service_user *service_user, + const char **error_r) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + int ret = 0; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.prerun != NULL && + (*cmdp)->v.prerun(*cmdp, service_user, error_r) < 0) { + ret = -1; + break; + } + } + return ret; +} + +static int cmd_batch_run(struct doveadm_mail_cmd_context *_ctx, + struct mail_user *user) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + int ret = 0; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.run(*cmdp, user) < 0) { + ret = -1; + break; + } + } + return ret; +} + +static void +cmd_batch_add(struct batch_cmd_context *batchctx, + int argc, const char *const *argv) +{ + struct doveadm_mail_cmd_context *subctx; + const struct doveadm_mail_cmd *cmd; + const char *getopt_args; + int c; + + cmd = doveadm_mail_cmd_find_from_argv(argv[0], &argc, &argv); + if (cmd == NULL) { + i_fatal_status(EX_USAGE, "doveadm batch: Unknown subcommand %s", + argv[1]); + } + + subctx = doveadm_mail_cmd_init(cmd, doveadm_settings); + subctx->full_args = argv + 1; + subctx->service_flags |= batchctx->ctx.service_flags; + + optind = 1; + getopt_args = subctx->getopt_args != NULL ? subctx->getopt_args : ""; + while ((c = getopt(argc, (void *)argv, getopt_args)) > 0) { + if (subctx->v.parse_arg == NULL || + !subctx->v.parse_arg(subctx, c)) + doveadm_mail_help(cmd); + } + argv += optind; + if (argv[0] != NULL && cmd->usage_args == NULL) { + i_fatal_status(EX_USAGE, "doveadm %s: Unknown parameter: %s", + cmd->name, argv[0]); + } + subctx->args = argv; + if (subctx->v.preinit != NULL) + subctx->v.preinit(subctx); + array_append(&batchctx->commands, &subctx, 1); +} + +static void +cmd_batch_preinit(struct doveadm_mail_cmd_context *_ctx) +{ + const char *const *args = _ctx->args; + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + ARRAY_TYPE(const_string) sep_args; + const char *sep = args[0]; + unsigned int i, start; + int argc; + const char *const *argv; + + if (sep == NULL || args[1] == NULL) + doveadm_mail_help_name("batch"); + args++; + + p_array_init(&ctx->commands, _ctx->pool, 8); + p_array_init(&sep_args, _ctx->pool, 16); + for (i = start = 0;; i++) { + if (args[i] != NULL && strcmp(args[i], sep) != 0) { + array_append(&sep_args, &args[i], 1); + continue; + } + if (i > start) { + (void)array_append_space(&sep_args); + argc = i - start; + argv = array_idx(&sep_args, start); + cmd_batch_add(ctx, argc, argv); + start = i+1; + } + if (args[i] == NULL) + break; + } + (void)array_append_space(&sep_args); +} + +static void +cmd_batch_init(struct doveadm_mail_cmd_context *_ctx, + const char *const args[] ATTR_UNUSED) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + struct batch_cmd_context *subctx; + + array_foreach(&ctx->commands, cmdp) { + subctx = (struct batch_cmd_context *)*cmdp; + subctx->ctx.storage_service = _ctx->storage_service; + if (subctx->ctx.v.init != NULL) + subctx->ctx.v.init(&subctx->ctx, subctx->ctx.args); + } +} + +static void cmd_batch_deinit(struct doveadm_mail_cmd_context *_ctx) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.deinit != NULL) + (*cmdp)->v.deinit(*cmdp); + } +} + +static struct doveadm_mail_cmd_context *cmd_batch_alloc(void) +{ + struct batch_cmd_context *ctx; + + ctx = doveadm_mail_cmd_alloc(struct batch_cmd_context); + ctx->ctx.v.preinit = cmd_batch_preinit; + ctx->ctx.v.init = cmd_batch_init; + ctx->ctx.v.prerun = cmd_batch_prerun; + ctx->ctx.v.run = cmd_batch_run; + ctx->ctx.v.deinit = cmd_batch_deinit; + return &ctx->ctx; +} + +struct doveadm_mail_cmd cmd_batch = { + cmd_batch_alloc, "batch", " [ [..]]" +}; diff -r 73feea4d22aa -r 8cc28a5a3f4f src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Fri Feb 22 10:31:38 2013 +0200 +++ b/src/doveadm/doveadm-mail.c Mon Mar 25 16:19:54 2013 +0200 @@ -541,59 +541,78 @@ } static bool -doveadm_mail_try_run_multi_word(const struct doveadm_mail_cmd *cmd, - const char *cmdname, int argc, char *argv[]) +doveadm_mail_cmd_try_find_multi_word(const struct doveadm_mail_cmd *cmd, + const char *cmdname, int *argc, + const char *const **argv) { unsigned int len; - if (argc < 2) + if (*argc < 2) return FALSE; + *argc -= 1; + *argv += 1; - len = strlen(argv[1]); - if (strncmp(cmdname, argv[1], len) != 0) + len = strlen((*argv)[0]); + if (strncmp(cmdname, (*argv)[0], len) != 0) return FALSE; if (cmdname[len] == ' ') { /* more args */ - return doveadm_mail_try_run_multi_word(cmd, cmdname + len + 1, - argc - 1, argv + 1); + return doveadm_mail_cmd_try_find_multi_word(cmd, cmdname + len + 1, + argc, argv); } if (cmdname[len] != '\0') return FALSE; /* match */ - doveadm_mail_cmd(cmd, argc - 1, argv + 1); return TRUE; } -bool doveadm_mail_try_run(const char *cmd_name, int argc, char *argv[]) +const struct doveadm_mail_cmd * +doveadm_mail_cmd_find_from_argv(const char *cmd_name, int *argc, + const char *const **argv) { const struct doveadm_mail_cmd *cmd; unsigned int cmd_name_len; + const char *const *orig_argv; + int orig_argc; - i_assert(argc > 0); + i_assert(*argc > 0); cmd_name_len = strlen(cmd_name); array_foreach(&doveadm_mail_cmds, cmd) { - if (strcmp(cmd->name, cmd_name) == 0) { - doveadm_mail_cmd(cmd, argc, argv); - return TRUE; - } + if (strcmp(cmd->name, cmd_name) == 0) + return cmd; /* see if it matches a multi-word command */ if (strncmp(cmd->name, cmd_name, cmd_name_len) == 0 && cmd->name[cmd_name_len] == ' ') { const char *subcmd = cmd->name + cmd_name_len + 1; - if (doveadm_mail_try_run_multi_word(cmd, subcmd, - argc, argv)) - return TRUE; + orig_argc = *argc; + orig_argv = *argv; + if (doveadm_mail_cmd_try_find_multi_word(cmd, subcmd, + argc, argv)) + return cmd; + *argc = orig_argc; + *argv = orig_argv; } } return FALSE; } +bool doveadm_mail_try_run(const char *cmd_name, int argc, char *argv[]) +{ + const struct doveadm_mail_cmd *cmd; + + cmd = doveadm_mail_cmd_find_from_argv(cmd_name, &argc, (void *)&argv); + if (cmd == NULL) + return FALSE; + doveadm_mail_cmd(cmd, argc, argv); + return TRUE; +} + void doveadm_mail_register_cmd(const struct doveadm_mail_cmd *cmd) { /* for now we'll just assume that cmd will be permanently in memory */ @@ -686,6 +705,7 @@ &cmd_mailbox_subscribe, &cmd_mailbox_unsubscribe, &cmd_mailbox_status, + &cmd_batch, &cmd_dsync_backup, &cmd_dsync_mirror, &cmd_dsync_server diff -r 73feea4d22aa -r 8cc28a5a3f4f src/doveadm/doveadm-mail.h --- a/src/doveadm/doveadm-mail.h Fri Feb 22 10:31:38 2013 +0200 +++ b/src/doveadm/doveadm-mail.h Mon Mar 25 16:19:54 2013 +0200 @@ -95,6 +95,9 @@ void doveadm_mail_init(void); void doveadm_mail_deinit(void); +const struct doveadm_mail_cmd * +doveadm_mail_cmd_find_from_argv(const char *cmd_name, int *argc, + const char *const **argv); struct doveadm_mail_cmd_context * doveadm_mail_cmd_init(const struct doveadm_mail_cmd *cmd, const struct doveadm_settings *set); @@ -145,5 +148,6 @@ struct doveadm_mail_cmd cmd_mailbox_subscribe; struct doveadm_mail_cmd cmd_mailbox_unsubscribe; From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: lib-master: Ignore mountpoints under /tmp and /var/... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9d79ef9cf337 changeset: 16186:9d79ef9cf337 user: Timo Sirainen date: Sun Mar 31 11:23:42 2013 +0300 description: lib-master: Ignore mountpoints under /tmp and /var/tmp by default. diffstat: src/lib-master/mountpoint-list.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 87d0c4056b4d -r 9d79ef9cf337 src/lib-master/mountpoint-list.c --- a/src/lib-master/mountpoint-list.c Wed Mar 27 12:51:02 2013 +0200 +++ b/src/lib-master/mountpoint-list.c Sun Mar 31 11:23:42 2013 +0300 @@ -56,6 +56,8 @@ "/sys", "/proc", "/var/run", + "/var/tmp", + "/tmp", "/run", #ifdef __APPLE__ "/Volumes", From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: lib-index: Removed obsolete 16bit size check assert... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/87d0c4056b4d changeset: 16185:87d0c4056b4d user: Timo Sirainen date: Wed Mar 27 12:51:02 2013 +0200 description: lib-index: Removed obsolete 16bit size check asserts from mail_index_update_header_ext() diffstat: src/lib-index/mail-index-transaction-update.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 8cc28a5a3f4f -r 87d0c4056b4d src/lib-index/mail-index-transaction-update.c --- a/src/lib-index/mail-index-transaction-update.c Mon Mar 25 16:19:54 2013 +0200 +++ b/src/lib-index/mail-index-transaction-update.c Wed Mar 27 12:51:02 2013 +0200 @@ -871,8 +871,8 @@ struct mail_index_transaction_ext_hdr_update *hdr; size_t new_size; - i_assert(offset <= (uint16_t)-1 && size <= (uint16_t)-1 && - offset + size <= (uint16_t)-1); + i_assert(offset <= (uint32_t)-1 && size <= (uint32_t)-1 && + offset + size <= (uint32_t)-1); if (!array_is_created(&t->ext_hdr_updates)) i_array_init(&t->ext_hdr_updates, ext_id + 2); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: auth: Renamed userdb_userdb_import to passdb_import... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/963c6f616aa4 changeset: 16188:963c6f616aa4 user: Timo Sirainen date: Sun Mar 31 17:44:34 2013 +0300 description: auth: Renamed userdb_userdb_import to passdb_import, since that's what it really is. diffstat: src/auth/auth-request.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diffs (31 lines): diff -r cd919c490ea6 -r 963c6f616aa4 src/auth/auth-request.c --- a/src/auth/auth-request.c Sun Mar 31 17:40:12 2013 +0300 +++ b/src/auth/auth-request.c Sun Mar 31 17:44:34 2013 +0300 @@ -1243,8 +1243,8 @@ } static void -auth_request_userdb_userdb_import(struct auth_request *request, - const char *args, const char *default_scheme) +auth_request_passdb_import(struct auth_request *request, + const char *args, const char *default_scheme) { const char *key, *value, *const *arg = t_strsplit(args, "\t"); @@ -1301,13 +1301,11 @@ request->passdb_password = NULL; } else if (strcmp(name, "allow_nets") == 0) { auth_request_validate_networks(request, value); + } else if (strcmp(name, "passdb_import") == 0) { + auth_request_passdb_import(request, value, default_scheme); + return; } else if (strncmp(name, "userdb_", 7) == 0) { /* for prefetch userdb */ - if (strcmp(name, "userdb_userdb_import") == 0) { - auth_request_userdb_userdb_import(request, value, - default_scheme); - return; - } if (request->userdb_reply == NULL) auth_request_init_userdb_reply(request); auth_request_set_userdb_field(request, name + 7, value); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: auth: Allow using userdb_userdb_import in passdb qu... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cd919c490ea6 changeset: 16187:cd919c490ea6 user: Timo Sirainen date: Sun Mar 31 17:40:12 2013 +0300 description: auth: Allow using userdb_userdb_import in passdb query to set multiple userdb fields. diffstat: src/auth/auth-request.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diffs (38 lines): diff -r 9d79ef9cf337 -r cd919c490ea6 src/auth/auth-request.c --- a/src/auth/auth-request.c Sun Mar 31 11:23:42 2013 +0300 +++ b/src/auth/auth-request.c Sun Mar 31 17:40:12 2013 +0300 @@ -1242,6 +1242,22 @@ return TRUE; } +static void +auth_request_userdb_userdb_import(struct auth_request *request, + const char *args, const char *default_scheme) +{ + const char *key, *value, *const *arg = t_strsplit(args, "\t"); + + for (; *arg != NULL; arg++) { + value = strchr(*arg, '='); + if (value == NULL) + key = *arg; + else + key = t_strdup_until(*arg, value++); + auth_request_set_field(request, key, value, default_scheme); + } +} + void auth_request_set_field(struct auth_request *request, const char *name, const char *value, const char *default_scheme) @@ -1287,6 +1303,11 @@ auth_request_validate_networks(request, value); } else if (strncmp(name, "userdb_", 7) == 0) { /* for prefetch userdb */ + if (strcmp(name, "userdb_userdb_import") == 0) { + auth_request_userdb_userdb_import(request, value, + default_scheme); + return; + } if (request->userdb_reply == NULL) auth_request_init_userdb_reply(request); auth_request_set_userdb_field(request, name + 7, value); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: auth: Implemented userdb_import and userdb_userdb_i... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/78eb04213251 changeset: 16190:78eb04213251 user: Timo Sirainen date: Sun Mar 31 18:03:50 2013 +0300 description: auth: Implemented userdb_import and userdb_userdb_import fields. diffstat: src/auth/auth-request.c | 42 +++++++++++++++++++++++++++++++++++------- 1 files changed, 35 insertions(+), 7 deletions(-) diffs (78 lines): diff -r 00de06c6cc21 -r 78eb04213251 src/auth/auth-request.c --- a/src/auth/auth-request.c Sun Mar 31 17:47:52 2013 +0300 +++ b/src/auth/auth-request.c Sun Mar 31 18:03:50 2013 +0300 @@ -1243,13 +1243,15 @@ } static void -auth_request_passdb_import(struct auth_request *request, - const char *args, const char *default_scheme) +auth_request_passdb_import(struct auth_request *request, const char *args, + const char *key_prefix, const char *default_scheme) { - const char *const *arg; + const char *const *arg, *field; - for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) - auth_request_set_field_keyvalue(request, *arg, default_scheme); + for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) { + field = t_strconcat(key_prefix, *arg, NULL); + auth_request_set_field_keyvalue(request, field, default_scheme); + } } void auth_request_set_field(struct auth_request *request, @@ -1296,10 +1298,18 @@ } else if (strcmp(name, "allow_nets") == 0) { auth_request_validate_networks(request, value); } else if (strcmp(name, "passdb_import") == 0) { - auth_request_passdb_import(request, value, default_scheme); + auth_request_passdb_import(request, value, "", default_scheme); return; } else if (strncmp(name, "userdb_", 7) == 0) { /* for prefetch userdb */ + if (strcmp(name, "userdb_userdb_import") == 0) { + /* we need can't put the whole userdb_userdb_import + value to extra_cache_fields or it doesn't work + properly. so handle this explicitly. */ + auth_request_passdb_import(request, value, + "userdb_", default_scheme); + return; + } if (request->userdb_reply == NULL) auth_request_init_userdb_reply(request); auth_request_set_userdb_field(request, name + 7, value); @@ -1380,6 +1390,24 @@ } } +static void +auth_request_userdb_import(struct auth_request *request, const char *args) +{ + const char *key, *value, *const *arg; + + for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) { + value = strchr(*arg, '='); + if (value == NULL) { + key = *arg; + value = ""; + } else { + key = t_strdup_until(*arg, value); + value++; + } + auth_request_set_userdb_field(request, key, value); + } +} + void auth_request_set_userdb_field(struct auth_request *request, const char *name, const char *value) { @@ -1409,7 +1437,7 @@ auth_request_set_uidgid_file(request, value); return; } else if (strcmp(name, "userdb_import") == 0) { - auth_stream_reply_import(request->userdb_reply, value); + auth_request_userdb_import(request, value); return; } else if (strcmp(name, "system_user") == 0) { /* FIXME: the system_user is for backwards compatibility */ From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: auth: Fixed passdb_import not to crash when =value ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/00de06c6cc21 changeset: 16189:00de06c6cc21 user: Timo Sirainen date: Sun Mar 31 17:47:52 2013 +0300 description: auth: Fixed passdb_import not to crash when =value isn't given. diffstat: src/auth/auth-request.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diffs (23 lines): diff -r 963c6f616aa4 -r 00de06c6cc21 src/auth/auth-request.c --- a/src/auth/auth-request.c Sun Mar 31 17:44:34 2013 +0300 +++ b/src/auth/auth-request.c Sun Mar 31 17:47:52 2013 +0300 @@ -1246,16 +1246,10 @@ auth_request_passdb_import(struct auth_request *request, const char *args, const char *default_scheme) { - const char *key, *value, *const *arg = t_strsplit(args, "\t"); + const char *const *arg; - for (; *arg != NULL; arg++) { - value = strchr(*arg, '='); - if (value == NULL) - key = *arg; - else - key = t_strdup_until(*arg, value++); - auth_request_set_field(request, key, value, default_scheme); - } + for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) + auth_request_set_field_keyvalue(request, *arg, default_scheme); } void auth_request_set_field(struct auth_request *request, From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: lib-index: Backported MAIL_TRANSACTION_ATTRIBUTE_UP... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b2fad9b21e60 changeset: 16191:b2fad9b21e60 user: Timo Sirainen date: Tue Apr 02 11:32:24 2013 +0300 description: lib-index: Backported MAIL_TRANSACTION_ATTRIBUTE_UPDATE from v2.2 diffstat: src/doveadm/doveadm-dump-log.c | 14 ++++++++++++++ src/lib-index/mail-index-modseq.c | 4 +++- src/lib-index/mail-index-sync-update.c | 5 +++++ src/lib-index/mail-transaction-log.h | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) diffs (93 lines): diff -r 78eb04213251 -r b2fad9b21e60 src/doveadm/doveadm-dump-log.c --- a/src/doveadm/doveadm-dump-log.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/doveadm/doveadm-dump-log.c Tue Apr 02 11:32:24 2013 +0300 @@ -52,6 +52,7 @@ case MAIL_TRANSACTION_FLAG_UPDATE: case MAIL_TRANSACTION_KEYWORD_UPDATE: case MAIL_TRANSACTION_KEYWORD_RESET: + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: /* these changes increase modseq */ return TRUE; } @@ -114,6 +115,9 @@ case MAIL_TRANSACTION_BOUNDARY: name = "boundary"; break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + name = "attribute-update"; + break; default: name = t_strdup_printf("unknown: %x", type); break; @@ -413,6 +417,16 @@ printf(" - size=%u\n", rec->size); break; } + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: { + const char *keys = data; + unsigned int i; + + for (i = 0; i < size && keys[i] != '\0'; ) { + printf(" - %s\n", keys+i); + i += strlen(keys+i) + 1; + } + break; + } default: break; } diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-index-modseq.c --- a/src/lib-index/mail-index-modseq.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-index-modseq.c Tue Apr 02 11:32:24 2013 +0300 @@ -375,12 +375,14 @@ array_create_from_buffer(&uids, &uid_buf, sizeof(struct mail_transaction_keyword_reset)); break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + break; default: return; } /* update modseqs */ - count = array_count(&uids); + count = array_is_created(&uids) ? array_count(&uids) : 0; for (i = 0; i < count; i++) { rec = array_idx(&uids, i); if (mail_index_lookup_seq_range(ctx->view, rec->seq1, rec->seq2, diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-index-sync-update.c --- a/src/lib-index/mail-index-sync-update.c Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-index-sync-update.c Tue Apr 02 11:32:24 2013 +0300 @@ -523,6 +523,7 @@ const struct mail_transaction_header *hdr, const void *data) { + uint64_t modseq; int ret = 0; switch (hdr->type & MAIL_TRANSACTION_TYPE_MASK) { @@ -804,6 +805,10 @@ break; case MAIL_TRANSACTION_BOUNDARY: break; + case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: + modseq = mail_transaction_log_view_get_prev_modseq(ctx->view->log_view); + mail_index_modseq_update_highest(ctx->modseq_ctx, modseq); + break; default: mail_index_sync_set_corrupted(ctx, "Unknown transaction record type 0x%x", diff -r 78eb04213251 -r b2fad9b21e60 src/lib-index/mail-transaction-log.h --- a/src/lib-index/mail-transaction-log.h Sun Mar 31 18:03:50 2013 +0300 +++ b/src/lib-index/mail-transaction-log.h Tue Apr 02 11:32:24 2013 +0300 @@ -44,8 +44,9 @@ MAIL_TRANSACTION_INDEX_DELETED = 0x00020000, MAIL_TRANSACTION_INDEX_UNDELETED = 0x00040000, MAIL_TRANSACTION_BOUNDARY = 0x00080000, + MAIL_TRANSACTION_ATTRIBUTE_UPDATE = 0x00100000, - MAIL_TRANSACTION_TYPE_MASK = 0x000fffff, + MAIL_TRANSACTION_TYPE_MASK = 0x0fffffff, #define MAIL_TRANSACTION_EXT_MASK \ (MAIL_TRANSACTION_EXT_INTRO | MAIL_TRANSACTION_EXT_RESET | \ From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: quota-status: If size parameter is given, use it to... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2493ec20df8c changeset: 16192:2493ec20df8c user: Timo Sirainen date: Tue Apr 02 11:52:36 2013 +0300 description: quota-status: If size parameter is given, use it to check quota. diffstat: src/plugins/quota/quota-status.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diffs (50 lines): diff -r b2fad9b21e60 -r 2493ec20df8c src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Tue Apr 02 11:32:24 2013 +0300 +++ b/src/plugins/quota/quota-status.c Tue Apr 02 11:52:36 2013 +0300 @@ -21,6 +21,7 @@ struct connection conn; char *recipient; + uoff_t size; }; static enum quota_protocol protocol; @@ -42,7 +43,8 @@ i_free_and_null(client->recipient); } -static int quota_check(struct mail_user *user, const char **error_r) +static int +quota_check(struct mail_user *user, uoff_t mail_size, const char **error_r) { struct quota_user *quser = QUOTA_USER_CONTEXT(user); struct mail_namespace *ns; @@ -60,7 +62,7 @@ box = mailbox_alloc(ns->list, "INBOX", 0); ctx = quota_transaction_begin(box); - ret = quota_test_alloc(ctx, 1, &too_large); + ret = quota_test_alloc(ctx, I_MAX(1, mail_size), &too_large); quota_transaction_rollback(&ctx); mailbox_free(&box); @@ -95,7 +97,7 @@ o_stream_send_str(client->conn.output, "action=REJECT Unknown user\n\n"); } else if (ret > 0) { - if ((ret = quota_check(user, &error)) > 0) + if ((ret = quota_check(user, client->size, &error)) > 0) o_stream_send_str(client->conn.output, "action=OK\n\n"); else if (ret == 0) { o_stream_send_str(client->conn.output, t_strdup_printf( @@ -124,6 +126,10 @@ if (client->recipient == NULL && strncmp(line, "recipient=", 10) == 0) client->recipient = i_strdup(line + 10); + else if (strncmp(line, "size=", 5) == 0) { + if (str_to_uoff(line+5, &client->size) < 0) + client->size = 0; + } return 1; } From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: quota-status: Added quota_status_(success|nouser|ov... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c7da636a09c4 changeset: 16193:c7da636a09c4 user: Timo Sirainen date: Thu Apr 04 23:56:55 2013 +0300 description: quota-status: Added quota_status_(success|nouser|overquota) settings. diffstat: src/plugins/quota/quota-status.c | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diffs (51 lines): diff -r 2493ec20df8c -r c7da636a09c4 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Tue Apr 02 11:52:36 2013 +0300 +++ b/src/plugins/quota/quota-status.c Thu Apr 04 23:56:55 2013 +0300 @@ -79,7 +79,7 @@ struct mail_storage_service_input input; struct mail_storage_service_user *service_user; struct mail_user *user; - const char *error; + const char *value = NULL, *error; int ret; if (client->recipient == NULL) { @@ -94,21 +94,31 @@ &service_user, &user, &error); restrict_access_allow_coredumps(TRUE); if (ret == 0) { - o_stream_send_str(client->conn.output, - "action=REJECT Unknown user\n\n"); + value = mail_user_plugin_getenv(user, "quota_status_nouser"); + if (value == NULL) + value = "REJECT Unknown user"; } else if (ret > 0) { - if ((ret = quota_check(user, client->size, &error)) > 0) - o_stream_send_str(client->conn.output, "action=OK\n\n"); - else if (ret == 0) { - o_stream_send_str(client->conn.output, t_strdup_printf( - "action=552 5.2.2 %s\n\n", error)); + if ((ret = quota_check(user, client->size, &error)) > 0) { + /* under quota */ + value = mail_user_plugin_getenv(user, "quota_status_success"); + if (value == NULL) + value = "OK"; + } else if (ret == 0) { + /* over quota */ + value = mail_user_plugin_getenv(user, "quota_status_overquota"); + if (value == NULL) + value = t_strdup_printf("action=552 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); } if (ret < 0) { + /* temporary failure */ o_stream_send_str(client->conn.output, t_strdup_printf( "action=DEFER_IF_PERMIT %s\n\n", error)); + } else { + o_stream_send_str(client->conn.output, + t_strdup_printf("action=%s\n\n", value)); } } From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: quota-status: Removed duplicate "action=" text from... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/852cfd3e4933 changeset: 16194:852cfd3e4933 user: Timo Sirainen date: Thu Apr 04 23:58:47 2013 +0300 description: quota-status: Removed duplicate "action=" text from overquota messages. diffstat: src/plugins/quota/quota-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c7da636a09c4 -r 852cfd3e4933 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Thu Apr 04 23:56:55 2013 +0300 +++ b/src/plugins/quota/quota-status.c Thu Apr 04 23:58:47 2013 +0300 @@ -107,7 +107,7 @@ /* over quota */ value = mail_user_plugin_getenv(user, "quota_status_overquota"); if (value == NULL) - value = t_strdup_printf("action=552 5.2.2 %s\n\n", error); + value = t_strdup_printf("552 5.2.2 %s\n\n", error); } mail_user_unref(&user); mail_storage_service_user_free(&service_user); From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: Released v2.1.16. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/582108c190f8 changeset: 16195:582108c190f8 user: Timo Sirainen date: Fri Apr 05 00:08:36 2013 +0300 description: Released v2.1.16. diffstat: NEWS | 12 ++++++++++++ configure.in | 2 +- 2 files changed, 13 insertions(+), 1 deletions(-) diffs (29 lines): diff -r 852cfd3e4933 -r 582108c190f8 NEWS --- a/NEWS Thu Apr 04 23:58:47 2013 +0300 +++ b/NEWS Fri Apr 05 00:08:36 2013 +0300 @@ -1,3 +1,15 @@ +v2.1.16 2013-04-04 Timo Sirainen + + + Added quota-status policy service for Postfix + + Added "doveadm batch" command to run multiple commands before moving + onto the next user (useful only with -A and -u ) + + Added forwards compatibility for v2.2 index files + - mdbox: Index rebuilding crashed in some situations + - Fixed a race condition with setting \Recent flags + - Fixed a crash when decoding a specific message (decoding is done + for SEARCH TEXT/BODY and with full text search indexing, so this + couldn't fully DoS a user) + v2.1.15 2013-02-08 Timo Sirainen - v2.1.14: dovecot.index.cache fixes caused it to use more disk I/O diff -r 852cfd3e4933 -r 582108c190f8 configure.in --- a/configure.in Thu Apr 04 23:58:47 2013 +0300 +++ b/configure.in Fri Apr 05 00:08:36 2013 +0300 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.15],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.16],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: Added tag 2.1.16 for changeset 582108c190f8 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9fbc51f4448b changeset: 16196:9fbc51f4448b user: Timo Sirainen date: Fri Apr 05 00:08:37 2013 +0300 description: Added tag 2.1.16 for changeset 582108c190f8 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 582108c190f8 -r 9fbc51f4448b .hgtags --- a/.hgtags Fri Apr 05 00:08:36 2013 +0300 +++ b/.hgtags Fri Apr 05 00:08:37 2013 +0300 @@ -92,3 +92,4 @@ cf9d62fd0b143efa8e49fac998eb78a648cdd8a9 2.1.13 b314c97d4bbffd01b20f8492592aa422c13e3d55 2.1.14 fc75811f3c08d80ed339cbb4d37c66f549542ba7 2.1.15 +582108c190f88597c5215279cb66f74673144c9b 2.1.16 From dovecot at dovecot.org Fri Apr 5 00:13:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:33 +0300 Subject: dovecot-2.2: Added signature for changeset 582108c190f8 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c42846219939 changeset: 16197:c42846219939 user: Timo Sirainen date: Fri Apr 05 00:08:40 2013 +0300 description: Added signature for changeset 582108c190f8 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 9fbc51f4448b -r c42846219939 .hgsigs --- a/.hgsigs Fri Apr 05 00:08:37 2013 +0300 +++ b/.hgsigs Fri Apr 05 00:08:40 2013 +0300 @@ -55,3 +55,4 @@ cf9d62fd0b143efa8e49fac998eb78a648cdd8a9 0 iEYEABECAAYFAlDqjXUACgkQyUhSUUBViskUEwCfYTWHeDmPr8HfxSBQN17SD5IwDygAnROhb3IVTm9niDun4gxPxbHLo/Pe b314c97d4bbffd01b20f8492592aa422c13e3d55 0 iEYEABECAAYFAlEJlGMACgkQyUhSUUBVismNdQCgggPP/dt1duU1CMYfkpE4Kyc9Ju0An0kphokRqrtppkeqg7pF1JR01Mgq fc75811f3c08d80ed339cbb4d37c66f549542ba7 0 iEYEABECAAYFAlEU+CEACgkQyUhSUUBViskh9QCgnqPHUkNvtOioWxo4W7fXjCFLVAwAnR9Z26jgBpoejXDkgwT07wdfYiL3 +582108c190f88597c5215279cb66f74673144c9b 0 iEUEABECAAYFAlFd69UACgkQyUhSUUBVisk/aQCYyYU9JcDM3SrTZu1oJuS26IAnZACeM400zLRROTaM6QYBVKTqTnfpuBY= From dovecot at dovecot.org Fri Apr 5 00:13:34 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:13:34 +0300 Subject: dovecot-2.2: Merged changes from v2.1 tree. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/249305f71c73 changeset: 16198:249305f71c73 user: Timo Sirainen date: Fri Apr 05 00:13:16 2013 +0300 description: Merged changes from v2.1 tree. diffstat: .hgsigs | 1 + .hgtags | 1 + configure.ac | 3 + src/auth/auth-request.c | 43 +++++- src/doveadm/Makefile.am | 1 + src/doveadm/doveadm-mail-batch.c | 162 +++++++++++++++++++++++ src/doveadm/doveadm-mail.c | 54 +++++-- src/doveadm/doveadm-mail.h | 4 + src/lib-index/mail-index-transaction-update.c | 4 +- src/lib-master/mountpoint-list.c | 2 + src/lib-storage/index/cydir/cydir-storage.c | 2 +- src/lib-storage/index/dbox-common/dbox-storage.c | 2 +- src/lib-storage/index/maildir/maildir-storage.c | 2 +- src/lib-storage/index/mbox/mbox-storage.c | 2 +- src/lib-storage/index/pop3c/pop3c-storage.c | 2 +- src/lib-storage/index/raw/raw-storage.c | 2 +- src/lib-storage/list/mailbox-list-delete.c | 8 +- src/lib-storage/list/mailbox-list-fs.c | 4 +- src/lib-storage/list/mailbox-list-maildir.c | 4 +- src/lib-storage/mailbox-list-private.h | 4 + src/lib/macros.h | 8 + src/plugins/acl/acl-mailbox.c | 2 +- src/plugins/quota/quota-status.c | 36 +++- src/plugins/virtual/virtual-config.c | 2 +- 24 files changed, 309 insertions(+), 46 deletions(-) diffs (truncated from 735 to 300 lines): diff -r c67d787164fa -r 249305f71c73 .hgsigs --- a/.hgsigs Thu Apr 04 23:35:27 2013 +0300 +++ b/.hgsigs Fri Apr 05 00:13:16 2013 +0300 @@ -58,6 +58,7 @@ b314c97d4bbffd01b20f8492592aa422c13e3d55 0 iEYEABECAAYFAlEJlGMACgkQyUhSUUBVismNdQCgggPP/dt1duU1CMYfkpE4Kyc9Ju0An0kphokRqrtppkeqg7pF1JR01Mgq fc75811f3c08d80ed339cbb4d37c66f549542ba7 0 iEYEABECAAYFAlEU+CEACgkQyUhSUUBViskh9QCgnqPHUkNvtOioWxo4W7fXjCFLVAwAnR9Z26jgBpoejXDkgwT07wdfYiL3 018de2aa893a040256cb8cd92b1fc9f3f2bbd09f 0 iEYEABECAAYFAlEmOJEACgkQyUhSUUBVismawgCfbfY6KuH+/AauPkRZs4ish20YeV8Ani5DMLh02DUyJvDIpVPJMmTn2Mu/ +582108c190f88597c5215279cb66f74673144c9b 0 iEUEABECAAYFAlFd69UACgkQyUhSUUBVisk/aQCYyYU9JcDM3SrTZu1oJuS26IAnZACeM400zLRROTaM6QYBVKTqTnfpuBY= 508d46f858153c85ae777e87e1c5143a534a51fe 0 iEYEABECAAYFAlErhDkACgkQyUhSUUBViskRdwCeJ61F0qLZ/3xxIQruTujzo0AEWK0An3PH7nkTY7ouyBdUr0QCra5KLXEZ e62fa121f4a2db3348fd79bb176dd363cc1224bf 0 iEYEABECAAYFAlErsAwACgkQyUhSUUBVismarACbBffm3XY21sfkTsbmF8o8udtRZk4An0ofYy2VminZ3S8EFApHymk/UpNv 11bd79bf4866b0d728b25717134a6ba972505746 0 iEYEABECAAYFAlFKFqsACgkQyUhSUUBVismbSwCdHgMYWjcwcTM7fD4v6wTd/8/8ZEsAn2THId1zYspMTEMtDg0rlrvjlht4 diff -r c67d787164fa -r 249305f71c73 .hgtags --- a/.hgtags Thu Apr 04 23:35:27 2013 +0300 +++ b/.hgtags Fri Apr 05 00:13:16 2013 +0300 @@ -95,6 +95,7 @@ b314c97d4bbffd01b20f8492592aa422c13e3d55 2.1.14 fc75811f3c08d80ed339cbb4d37c66f549542ba7 2.1.15 018de2aa893a040256cb8cd92b1fc9f3f2bbd09f 2.2.beta2 +582108c190f88597c5215279cb66f74673144c9b 2.1.16 508d46f858153c85ae777e87e1c5143a534a51fe 2.2.rc1 e62fa121f4a2db3348fd79bb176dd363cc1224bf 2.2.rc2 11bd79bf4866b0d728b25717134a6ba972505746 2.2.rc3 diff -r c67d787164fa -r 249305f71c73 configure.ac --- a/configure.ac Thu Apr 04 23:35:27 2013 +0300 +++ b/configure.ac Fri Apr 05 00:13:16 2013 +0300 @@ -297,6 +297,9 @@ AC_DEFINE_UNQUOTED(DOVECOT_STRING, "$PACKAGE_STRING", Dovecot string) AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", Dovecot version) +AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version]) +AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version]) + AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h inttypes.h \ sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \ sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h \ diff -r c67d787164fa -r 249305f71c73 src/auth/auth-request.c --- a/src/auth/auth-request.c Thu Apr 04 23:35:27 2013 +0300 +++ b/src/auth/auth-request.c Fri Apr 05 00:13:16 2013 +0300 @@ -1304,6 +1304,18 @@ return TRUE; } +static void +auth_request_passdb_import(struct auth_request *request, const char *args, + const char *key_prefix, const char *default_scheme) +{ + const char *const *arg, *field; + + for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) { + field = t_strconcat(key_prefix, *arg, NULL); + auth_request_set_field_keyvalue(request, field, default_scheme); + } +} + void auth_request_set_field(struct auth_request *request, const char *name, const char *value, const char *default_scheme) @@ -1350,6 +1362,17 @@ request->passdb_password = NULL; auth_fields_add(request->extra_fields, name, value, 0); return; + } else if (strcmp(name, "passdb_import") == 0) { + auth_request_passdb_import(request, value, "", default_scheme); + return; + if (strcmp(name, "userdb_userdb_import") == 0) { + /* we need can't put the whole userdb_userdb_import + value to extra_cache_fields or it doesn't work + properly. so handle this explicitly. */ + auth_request_passdb_import(request, value, + "userdb_", default_scheme); + return; + } } else { /* these fields are returned to client */ auth_fields_add(request->extra_fields, name, value, 0); @@ -1422,6 +1445,24 @@ } } +static void +auth_request_userdb_import(struct auth_request *request, const char *args) +{ + const char *key, *value, *const *arg; + + for (arg = t_strsplit(args, "\t"); *arg != NULL; arg++) { + value = strchr(*arg, '='); + if (value == NULL) { + key = *arg; + value = ""; + } else { + key = t_strdup_until(*arg, value); + value++; + } + auth_request_set_userdb_field(request, key, value); + } +} + void auth_request_set_userdb_field(struct auth_request *request, const char *name, const char *value) { @@ -1451,7 +1492,7 @@ auth_request_set_uidgid_file(request, value); return; } else if (strcmp(name, "userdb_import") == 0) { - auth_fields_import(request->userdb_reply, value, 0); + auth_request_userdb_import(request, value); return; } else if (strcmp(name, "system_user") == 0) { /* FIXME: the system_user is for backwards compatibility */ diff -r c67d787164fa -r 249305f71c73 src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Thu Apr 04 23:35:27 2013 +0300 +++ b/src/doveadm/Makefile.am Fri Apr 05 00:13:16 2013 +0300 @@ -61,6 +61,7 @@ common = \ doveadm-mail.c \ doveadm-mail-altmove.c \ + doveadm-mail-batch.c \ doveadm-mail-expunge.c \ doveadm-mail-fetch.c \ doveadm-mail-import.c \ diff -r c67d787164fa -r 249305f71c73 src/doveadm/doveadm-mail-batch.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/doveadm/doveadm-mail-batch.c Fri Apr 05 00:13:16 2013 +0300 @@ -0,0 +1,162 @@ +/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "array.h" +#include "doveadm-mail.h" + +#include + +struct batch_cmd_context { + struct doveadm_mail_cmd_context ctx; + ARRAY(struct doveadm_mail_cmd_context *) commands; +}; + +static int cmd_batch_prerun(struct doveadm_mail_cmd_context *_ctx, + struct mail_storage_service_user *service_user, + const char **error_r) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + int ret = 0; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.prerun != NULL && + (*cmdp)->v.prerun(*cmdp, service_user, error_r) < 0) { + ret = -1; + break; + } + } + return ret; +} + +static int cmd_batch_run(struct doveadm_mail_cmd_context *_ctx, + struct mail_user *user) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + int ret = 0; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.run(*cmdp, user) < 0) { + ret = -1; + break; + } + } + return ret; +} + +static void +cmd_batch_add(struct batch_cmd_context *batchctx, + int argc, const char *const *argv) +{ + struct doveadm_mail_cmd_context *subctx; + const struct doveadm_mail_cmd *cmd; + const char *getopt_args; + int c; + + cmd = doveadm_mail_cmd_find_from_argv(argv[0], &argc, &argv); + if (cmd == NULL) { + i_fatal_status(EX_USAGE, "doveadm batch: Unknown subcommand %s", + argv[1]); + } + + subctx = doveadm_mail_cmd_init(cmd, doveadm_settings); + subctx->full_args = argv + 1; + subctx->service_flags |= batchctx->ctx.service_flags; + + optind = 1; + getopt_args = subctx->getopt_args != NULL ? subctx->getopt_args : ""; + while ((c = getopt(argc, (void *)argv, getopt_args)) > 0) { + if (subctx->v.parse_arg == NULL || + !subctx->v.parse_arg(subctx, c)) + doveadm_mail_help(cmd); + } + argv += optind; + if (argv[0] != NULL && cmd->usage_args == NULL) { + i_fatal_status(EX_USAGE, "doveadm %s: Unknown parameter: %s", + cmd->name, argv[0]); + } + subctx->args = argv; + if (subctx->v.preinit != NULL) + subctx->v.preinit(subctx); + array_append(&batchctx->commands, &subctx, 1); +} + +static void +cmd_batch_preinit(struct doveadm_mail_cmd_context *_ctx) +{ + const char *const *args = _ctx->args; + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + ARRAY_TYPE(const_string) sep_args; + const char *sep = args[0]; + unsigned int i, start; + int argc; + const char *const *argv; + + if (sep == NULL || args[1] == NULL) + doveadm_mail_help_name("batch"); + args++; + + p_array_init(&ctx->commands, _ctx->pool, 8); + p_array_init(&sep_args, _ctx->pool, 16); + for (i = start = 0;; i++) { + if (args[i] != NULL && strcmp(args[i], sep) != 0) { + array_append(&sep_args, &args[i], 1); + continue; + } + if (i > start) { + (void)array_append_space(&sep_args); + argc = i - start; + argv = array_idx(&sep_args, start); + cmd_batch_add(ctx, argc, argv); + start = i+1; + } + if (args[i] == NULL) + break; + } + (void)array_append_space(&sep_args); +} + +static void +cmd_batch_init(struct doveadm_mail_cmd_context *_ctx, + const char *const args[] ATTR_UNUSED) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + struct batch_cmd_context *subctx; + + array_foreach(&ctx->commands, cmdp) { + subctx = (struct batch_cmd_context *)*cmdp; + subctx->ctx.storage_service = _ctx->storage_service; + if (subctx->ctx.v.init != NULL) + subctx->ctx.v.init(&subctx->ctx, subctx->ctx.args); + } +} + +static void cmd_batch_deinit(struct doveadm_mail_cmd_context *_ctx) +{ + struct batch_cmd_context *ctx = (struct batch_cmd_context *)_ctx; + struct doveadm_mail_cmd_context *const *cmdp; + + array_foreach(&ctx->commands, cmdp) { + if ((*cmdp)->v.deinit != NULL) + (*cmdp)->v.deinit(*cmdp); + } +} + +static struct doveadm_mail_cmd_context *cmd_batch_alloc(void) +{ + struct batch_cmd_context *ctx; + + ctx = doveadm_mail_cmd_alloc(struct batch_cmd_context); + ctx->ctx.v.preinit = cmd_batch_preinit; + ctx->ctx.v.init = cmd_batch_init; + ctx->ctx.v.prerun = cmd_batch_prerun; + ctx->ctx.v.run = cmd_batch_run; + ctx->ctx.v.deinit = cmd_batch_deinit; + return &ctx->ctx; +} + +struct doveadm_mail_cmd cmd_batch = { + cmd_batch_alloc, "batch", " [ [..]]" +}; diff -r c67d787164fa -r 249305f71c73 src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Thu Apr 04 23:35:27 2013 +0300 +++ b/src/doveadm/doveadm-mail.c Fri Apr 05 00:13:16 2013 +0300 @@ -539,59 +539,78 @@ } static bool -doveadm_mail_try_run_multi_word(const struct doveadm_mail_cmd *cmd, - const char *cmdname, int argc, char *argv[]) +doveadm_mail_cmd_try_find_multi_word(const struct doveadm_mail_cmd *cmd, + const char *cmdname, int *argc, + const char *const **argv) { unsigned int len; From dovecot at dovecot.org Fri Apr 5 00:17:05 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:17:05 +0300 Subject: dovecot-2.1: Released v2.1.16. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/582108c190f8 changeset: 14949:582108c190f8 user: Timo Sirainen date: Fri Apr 05 00:08:36 2013 +0300 description: Released v2.1.16. diffstat: NEWS | 12 ++++++++++++ configure.in | 2 +- 2 files changed, 13 insertions(+), 1 deletions(-) diffs (29 lines): diff -r 852cfd3e4933 -r 582108c190f8 NEWS --- a/NEWS Thu Apr 04 23:58:47 2013 +0300 +++ b/NEWS Fri Apr 05 00:08:36 2013 +0300 @@ -1,3 +1,15 @@ +v2.1.16 2013-04-04 Timo Sirainen + + + Added quota-status policy service for Postfix + + Added "doveadm batch" command to run multiple commands before moving + onto the next user (useful only with -A and -u ) + + Added forwards compatibility for v2.2 index files + - mdbox: Index rebuilding crashed in some situations + - Fixed a race condition with setting \Recent flags + - Fixed a crash when decoding a specific message (decoding is done + for SEARCH TEXT/BODY and with full text search indexing, so this + couldn't fully DoS a user) + v2.1.15 2013-02-08 Timo Sirainen - v2.1.14: dovecot.index.cache fixes caused it to use more disk I/O diff -r 852cfd3e4933 -r 582108c190f8 configure.in --- a/configure.in Thu Apr 04 23:58:47 2013 +0300 +++ b/configure.in Fri Apr 05 00:08:36 2013 +0300 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.15],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.16],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Fri Apr 5 00:17:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:17:06 +0300 Subject: dovecot-2.1: Added tag 2.1.16 for changeset 582108c190f8 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/9fbc51f4448b changeset: 14950:9fbc51f4448b user: Timo Sirainen date: Fri Apr 05 00:08:37 2013 +0300 description: Added tag 2.1.16 for changeset 582108c190f8 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 582108c190f8 -r 9fbc51f4448b .hgtags --- a/.hgtags Fri Apr 05 00:08:36 2013 +0300 +++ b/.hgtags Fri Apr 05 00:08:37 2013 +0300 @@ -92,3 +92,4 @@ cf9d62fd0b143efa8e49fac998eb78a648cdd8a9 2.1.13 b314c97d4bbffd01b20f8492592aa422c13e3d55 2.1.14 fc75811f3c08d80ed339cbb4d37c66f549542ba7 2.1.15 +582108c190f88597c5215279cb66f74673144c9b 2.1.16 From dovecot at dovecot.org Fri Apr 5 00:17:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:17:06 +0300 Subject: dovecot-2.1: Added signature for changeset 582108c190f8 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c42846219939 changeset: 14951:c42846219939 user: Timo Sirainen date: Fri Apr 05 00:08:40 2013 +0300 description: Added signature for changeset 582108c190f8 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 9fbc51f4448b -r c42846219939 .hgsigs --- a/.hgsigs Fri Apr 05 00:08:37 2013 +0300 +++ b/.hgsigs Fri Apr 05 00:08:40 2013 +0300 @@ -55,3 +55,4 @@ cf9d62fd0b143efa8e49fac998eb78a648cdd8a9 0 iEYEABECAAYFAlDqjXUACgkQyUhSUUBViskUEwCfYTWHeDmPr8HfxSBQN17SD5IwDygAnROhb3IVTm9niDun4gxPxbHLo/Pe b314c97d4bbffd01b20f8492592aa422c13e3d55 0 iEYEABECAAYFAlEJlGMACgkQyUhSUUBVismNdQCgggPP/dt1duU1CMYfkpE4Kyc9Ju0An0kphokRqrtppkeqg7pF1JR01Mgq fc75811f3c08d80ed339cbb4d37c66f549542ba7 0 iEYEABECAAYFAlEU+CEACgkQyUhSUUBViskh9QCgnqPHUkNvtOioWxo4W7fXjCFLVAwAnR9Z26jgBpoejXDkgwT07wdfYiL3 +582108c190f88597c5215279cb66f74673144c9b 0 iEUEABECAAYFAlFd69UACgkQyUhSUUBVisk/aQCYyYU9JcDM3SrTZu1oJuS26IAnZACeM400zLRROTaM6QYBVKTqTnfpuBY= From dovecot at dovecot.org Fri Apr 5 00:34:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:34:17 +0300 Subject: dovecot-2.2: Released v2.2.rc4. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/92c88eca562d changeset: 16199:92c88eca562d user: Timo Sirainen date: Fri Apr 05 00:24:36 2013 +0300 description: Released v2.2.rc4. diffstat: NEWS | 7 +++++++ TODO | 14 ++++++++++++++ configure.ac | 2 +- 3 files changed, 22 insertions(+), 1 deletions(-) diffs (50 lines): diff -r 249305f71c73 -r 92c88eca562d NEWS --- a/NEWS Fri Apr 05 00:13:16 2013 +0300 +++ b/NEWS Fri Apr 05 00:24:36 2013 +0300 @@ -1,3 +1,10 @@ +v2.2.rc4 2013-04-05 Timo Sirainen + + + Added "doveadm replicator" commands + - Larger changes to lib-http and lib-ssl-iostream error handling. + The API caller can now get the exact error message as a string. + - Various bugfixes to LDAP changes in rc3 + v2.2.rc3 2013-03-20 Timo Sirainen + dsync: Support syncing ACLs (and Sieve scripts with Pigeonhole) diff -r 249305f71c73 -r 92c88eca562d TODO --- a/TODO Fri Apr 05 00:13:16 2013 +0300 +++ b/TODO Fri Apr 05 00:24:36 2013 +0300 @@ -1,6 +1,20 @@ + - dsync: delete foo, rename bar foo -> foo, foo-temp-1 + - dsync+imapc: + - half-sync [-1], which is the same as normal sync except the other side + doesn't do anything (so when migrating from imapc, don't push changes + back to it) + - mailbox list could be synced pretty optimally by ignoring + (name, uidvalidity) matches. for the left if uidvalidities are unique + and can be matched -> rename mailbox. + - GUID-less sync could optionally use just rfc822.size [and internaldate] + to match messages. + + - lib-ssl-iostream: ssl_get_last_error() should return also syscall errors + instead of being NULL. most importantly handle handshake code. - if transaction log file corruption is noticed, make sure new dovecot.index snapshot gets written and don't mark the whole file corrupted.. rather maybe just rotate and truncate it + - mdbox: purging in alt storage could create files back to alt storage - LAYOUT=index: - force-resync should fix the index, finding any missing mailboxes, same for when internally detecting the error diff -r 249305f71c73 -r 92c88eca562d configure.ac --- a/configure.ac Fri Apr 05 00:13:16 2013 +0300 +++ b/configure.ac Fri Apr 05 00:24:36 2013 +0300 @@ -2,7 +2,7 @@ # 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.rc3],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.2.rc4],[dovecot at dovecot.org]) AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Fri Apr 5 00:34:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:34:17 +0300 Subject: dovecot-2.2: Added tag 2.2.rc4 for changeset 92c88eca562d Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/53082e1f3ae8 changeset: 16200:53082e1f3ae8 user: Timo Sirainen date: Fri Apr 05 00:24:36 2013 +0300 description: Added tag 2.2.rc4 for changeset 92c88eca562d diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 92c88eca562d -r 53082e1f3ae8 .hgtags --- a/.hgtags Fri Apr 05 00:24:36 2013 +0300 +++ b/.hgtags Fri Apr 05 00:24:36 2013 +0300 @@ -99,3 +99,4 @@ 508d46f858153c85ae777e87e1c5143a534a51fe 2.2.rc1 e62fa121f4a2db3348fd79bb176dd363cc1224bf 2.2.rc2 11bd79bf4866b0d728b25717134a6ba972505746 2.2.rc3 +92c88eca562d45a55b65e45eb9bb937292b20595 2.2.rc4 From dovecot at dovecot.org Fri Apr 5 00:34:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 00:34:17 +0300 Subject: dovecot-2.2: Added signature for changeset 92c88eca562d Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4f62a9a86a97 changeset: 16201:4f62a9a86a97 user: Timo Sirainen date: Fri Apr 05 00:24:39 2013 +0300 description: Added signature for changeset 92c88eca562d diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 53082e1f3ae8 -r 4f62a9a86a97 .hgsigs --- a/.hgsigs Fri Apr 05 00:24:36 2013 +0300 +++ b/.hgsigs Fri Apr 05 00:24:39 2013 +0300 @@ -62,3 +62,4 @@ 508d46f858153c85ae777e87e1c5143a534a51fe 0 iEYEABECAAYFAlErhDkACgkQyUhSUUBViskRdwCeJ61F0qLZ/3xxIQruTujzo0AEWK0An3PH7nkTY7ouyBdUr0QCra5KLXEZ e62fa121f4a2db3348fd79bb176dd363cc1224bf 0 iEYEABECAAYFAlErsAwACgkQyUhSUUBVismarACbBffm3XY21sfkTsbmF8o8udtRZk4An0ofYy2VminZ3S8EFApHymk/UpNv 11bd79bf4866b0d728b25717134a6ba972505746 0 iEYEABECAAYFAlFKFqsACgkQyUhSUUBVismbSwCdHgMYWjcwcTM7fD4v6wTd/8/8ZEsAn2THId1zYspMTEMtDg0rlrvjlht4 +92c88eca562d45a55b65e45eb9bb937292b20595 0 iEYEABECAAYFAlFd75QACgkQyUhSUUBVismY8ACeI2egJAQjbspR/2ioZ85G+NbekuwAoIy2pl+wrSDOhwt9Qd4D72Q9I4ag From dovecot at dovecot.org Fri Apr 5 12:25:41 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 12:25:41 +0300 Subject: dovecot-2.2: dsync: Fixes to location parameter handling. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/831351968d3a changeset: 16202:831351968d3a user: Timo Sirainen date: Fri Apr 05 12:25:29 2013 +0300 description: dsync: Fixes to location parameter handling. diffstat: src/doveadm/dsync/doveadm-dsync.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diffs (36 lines): diff -r 4f62a9a86a97 -r 831351968d3a src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Fri Apr 05 00:24:39 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Fri Apr 05 12:25:29 2013 +0300 @@ -687,7 +687,7 @@ const char **error_r) { struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx; - const char *local_location = NULL, *const *remote_cmd_args = NULL; + const char *const *remote_cmd_args = NULL; const struct mail_user_settings *user_set; const struct mail_storage_settings *mail_set; const char *username = ""; @@ -710,7 +710,6 @@ _ctx->exit_code = DOVEADM_EX_NOTFOUND; return -1; } - local_location = ctx->local_location; } else { /* if we're executing remotely, give -u parameter if we also did a userdb lookup. */ @@ -721,13 +720,13 @@ /* it's a mail_location */ if (_ctx->args[1] != NULL) doveadm_mail_help_name(_ctx->cmd->name); + ctx->local_location = _ctx->args[0]; ctx->local_location_from_arg = TRUE; - local_location = _ctx->args[0]; } } if (remote_cmd_args == NULL && ctx->local_location != NULL) { - if (parse_location(ctx, mail_set, local_location, + if (parse_location(ctx, mail_set, ctx->local_location, &remote_cmd_args, error_r) < 0) return -1; } From dovecot at dovecot.org Fri Apr 5 12:27:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 12:27:06 +0300 Subject: dovecot-2.2: layout=index: Don't crash on mailbox_update() if th... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9c3bf2cb62e8 changeset: 16203:9c3bf2cb62e8 user: Timo Sirainen date: Fri Apr 05 12:26:57 2013 +0300 description: layout=index: Don't crash on mailbox_update() if the mailbox path couldn't be found. diffstat: src/lib-storage/list/mailbox-list-index-backend.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 831351968d3a -r 9c3bf2cb62e8 src/lib-storage/list/mailbox-list-index-backend.c --- a/src/lib-storage/list/mailbox-list-index-backend.c Fri Apr 05 12:25:29 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index-backend.c Fri Apr 05 12:26:57 2013 +0300 @@ -337,7 +337,7 @@ return -1; /* rename the directory */ - if (!guid_128_is_empty(update->mailbox_guid) && + if (!guid_128_is_empty(update->mailbox_guid) && old_path != NULL && mailbox_list_set_get_root_path(&box->list->set, MAILBOX_LIST_PATH_TYPE_MAILBOX, &root_dir)) { From dovecot at dovecot.org Fri Apr 5 13:19:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 13:19:25 +0300 Subject: dovecot-2.2: quota-status: Unknown recipients caused a crash. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b6f69bdcf63f changeset: 16204:b6f69bdcf63f user: Timo Sirainen date: Fri Apr 05 13:19:17 2013 +0300 description: quota-status: Unknown recipients caused a crash. diffstat: src/plugins/quota/quota-status.c | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diffs (72 lines): diff -r 9c3bf2cb62e8 -r b6f69bdcf63f src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Fri Apr 05 12:26:57 2013 +0300 +++ b/src/plugins/quota/quota-status.c Fri Apr 05 13:19:17 2013 +0300 @@ -5,6 +5,7 @@ #include "connection.h" #include "restrict-access.h" #include "master-service.h" +#include "master-service-settings.h" #include "mail-namespace.h" #include "mail-storage.h" #include "mail-storage-settings.h" @@ -27,6 +28,7 @@ static enum quota_protocol protocol; static struct mail_storage_service_ctx *storage_service; static struct connection_list *clients; +static char *nouser_reply; static void client_connected(struct master_service_connection *conn) { @@ -94,9 +96,7 @@ &service_user, &user, &error); restrict_access_allow_coredumps(TRUE); if (ret == 0) { - value = mail_user_plugin_getenv(user, "quota_status_nouser"); - if (value == NULL) - value = "REJECT Unknown user"; + value = nouser_reply; } else if (ret > 0) { if ((ret = quota_check(user, client->size, &error)) > 0) { /* under quota */ @@ -173,16 +173,41 @@ static void main_init(void) { + struct mail_storage_service_input input; + const struct setting_parser_info *user_info; + const struct setting_parser_context *set_parser; + const struct mail_user_settings *user_set; + const char *value, *error; + pool_t pool; + clients = connection_list_init(&client_set, &client_vfuncs); storage_service = mail_storage_service_init(master_service, NULL, MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP | MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP | MAIL_STORAGE_SERVICE_FLAG_ENABLE_CORE_DUMPS | MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR); + + memset(&input, 0, sizeof(input)); + input.service = "quota-status"; + input.module = "mail"; + input.username = ""; + + pool = pool_alloconly_create("service all settings", 4096); + if (mail_storage_service_read_settings(storage_service, &input, pool, + &user_info, &set_parser, + &error) < 0) + i_fatal("%s", error); + user_set = master_service_settings_parser_get_others(master_service, + set_parser)[0]; + value = mail_user_set_plugin_getenv(user_set, "quota_status_nouser"); + nouser_reply = value != NULL ? i_strdup(value) : + i_strdup("REJECT Unknown user"); + pool_unref(&pool); } static void main_deinit(void) { + i_free(nouser_reply); connection_list_deinit(&clients); mail_storage_service_deinit(&storage_service); } From dovecot at dovecot.org Fri Apr 5 13:21:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 13:21:47 +0300 Subject: dovecot-2.1: quota-status: Unknown recipients caused a crash. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c6b4a639cae1 changeset: 14952:c6b4a639cae1 user: Timo Sirainen date: Fri Apr 05 13:21:40 2013 +0300 description: quota-status: Unknown recipients caused a crash. diffstat: src/plugins/quota/Makefile.am | 1 + src/plugins/quota/quota-status.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diffs (84 lines): diff -r c42846219939 -r c6b4a639cae1 src/plugins/quota/Makefile.am --- a/src/plugins/quota/Makefile.am Fri Apr 05 00:08:40 2013 +0300 +++ b/src/plugins/quota/Makefile.am Fri Apr 05 13:21:40 2013 +0300 @@ -5,6 +5,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/lib-settings \ -I$(top_srcdir)/src/lib-master \ -I$(top_srcdir)/src/lib-dict \ -I$(top_srcdir)/src/lib-index \ diff -r c42846219939 -r c6b4a639cae1 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Fri Apr 05 00:08:40 2013 +0300 +++ b/src/plugins/quota/quota-status.c Fri Apr 05 13:21:40 2013 +0300 @@ -4,7 +4,9 @@ #include "ostream.h" #include "connection.h" #include "restrict-access.h" +#include "settings-parser.h" #include "master-service.h" +#include "master-service-settings.h" #include "mail-namespace.h" #include "mail-storage.h" #include "mail-storage-settings.h" @@ -27,6 +29,7 @@ static enum quota_protocol protocol; static struct mail_storage_service_ctx *storage_service; static struct connection_list *clients; +static char *nouser_reply; static void client_connected(struct master_service_connection *conn) { @@ -94,9 +97,7 @@ &service_user, &user, &error); restrict_access_allow_coredumps(TRUE); if (ret == 0) { - value = mail_user_plugin_getenv(user, "quota_status_nouser"); - if (value == NULL) - value = "REJECT Unknown user"; + value = nouser_reply; } else if (ret > 0) { if ((ret = quota_check(user, client->size, &error)) > 0) { /* under quota */ @@ -173,16 +174,40 @@ static void main_init(void) { + struct mail_storage_service_input input; + const struct setting_parser_info *user_info; + const struct setting_parser_context *set_parser; + const struct mail_user_settings *user_set; + const char *value, *error; + pool_t pool; + clients = connection_list_init(&client_set, &client_vfuncs); storage_service = mail_storage_service_init(master_service, NULL, MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP | MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP | MAIL_STORAGE_SERVICE_FLAG_ENABLE_CORE_DUMPS | MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR); + + memset(&input, 0, sizeof(input)); + input.service = "quota-status"; + input.module = "mail"; + input.username = ""; + + pool = pool_alloconly_create("service all settings", 4096); + if (mail_storage_service_read_settings(storage_service, &input, pool, + &user_info, &set_parser, + &error) < 0) + i_fatal("%s", error); + user_set = settings_parser_get_list(set_parser)[1]; + value = mail_user_set_plugin_getenv(user_set, "quota_status_nouser"); + nouser_reply = value != NULL ? i_strdup(value) : + i_strdup("REJECT Unknown user"); + pool_unref(&pool); } static void main_deinit(void) { + i_free(nouser_reply); connection_list_deinit(&clients); mail_storage_service_deinit(&storage_service); } From dovecot at dovecot.org Fri Apr 5 14:06:05 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 14:06:05 +0300 Subject: dovecot-2.2: doveadm batch: Fixed handling subcommand parameters... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2918bfacf565 changeset: 16205:2918bfacf565 user: Timo Sirainen date: Fri Apr 05 14:05:54 2013 +0300 description: doveadm batch: Fixed handling subcommand parameters and errors. diffstat: src/doveadm/doveadm-mail-batch.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (26 lines): diff -r b6f69bdcf63f -r 2918bfacf565 src/doveadm/doveadm-mail-batch.c --- a/src/doveadm/doveadm-mail-batch.c Fri Apr 05 13:19:17 2013 +0300 +++ b/src/doveadm/doveadm-mail-batch.c Fri Apr 05 14:05:54 2013 +0300 @@ -37,10 +37,14 @@ int ret = 0; array_foreach(&ctx->commands, cmdp) { + (*cmdp)->cur_mail_user = user; if ((*cmdp)->v.run(*cmdp, user) < 0) { + i_assert((*cmdp)->exit_code != 0); + _ctx->exit_code = (*cmdp)->exit_code; ret = -1; break; } + (*cmdp)->cur_mail_user = NULL; } return ret; } @@ -149,6 +153,7 @@ struct batch_cmd_context *ctx; ctx = doveadm_mail_cmd_alloc(struct batch_cmd_context); + ctx->ctx.getopt_args = "+"; /* disable processing -args in the middle */ ctx->ctx.v.preinit = cmd_batch_preinit; ctx->ctx.v.init = cmd_batch_init; ctx->ctx.v.prerun = cmd_batch_prerun; From dovecot at dovecot.org Fri Apr 5 15:17:35 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 15:17:35 +0300 Subject: dovecot-2.2: Make static analyzer happier. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/83568daabff6 changeset: 16206:83568daabff6 user: Timo Sirainen date: Fri Apr 05 15:17:30 2013 +0300 description: Make static analyzer happier. diffstat: src/doveadm/dsync/doveadm-dsync.c | 2 +- src/doveadm/dsync/dsync-mailbox-export.c | 6 ++---- src/doveadm/dsync/dsync-mailbox-import.c | 2 ++ src/lib-http/http-client-request.c | 2 ++ src/lib/test-json-parser.c | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diffs (66 lines): diff -r 2918bfacf565 -r 83568daabff6 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Fri Apr 05 15:17:30 2013 +0300 @@ -450,7 +450,7 @@ struct mail_namespace *sync_ns = NULL; enum dsync_brain_flags brain_flags; bool remote_errors_logged = FALSE; - int status, ret = 0; + int status = 0, ret = 0; user->admin = TRUE; user->dsyncing = TRUE; diff -r 2918bfacf565 -r 83568daabff6 src/doveadm/dsync/dsync-mailbox-export.c --- a/src/doveadm/dsync/dsync-mailbox-export.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-export.c Fri Apr 05 15:17:30 2013 +0300 @@ -481,13 +481,11 @@ static int dsync_mailbox_export_iter_next_nonexistent_attr(struct dsync_mailbox_exporter *exporter) { - HASH_TABLE_TYPE(dsync_attr_change) attr_changes; struct dsync_mailbox_attribute *attr; struct mail_attribute_value value; - attr_changes = dsync_transaction_log_scan_get_attr_hash(exporter->log_scan); - - while (hash_table_iterate(exporter->attr_change_iter, attr_changes, + while (hash_table_iterate(exporter->attr_change_iter, + dsync_transaction_log_scan_get_attr_hash(exporter->log_scan), &attr, &attr)) { if (attr->exported || !attr->deleted) continue; diff -r 2918bfacf565 -r 83568daabff6 src/doveadm/dsync/dsync-mailbox-import.c --- a/src/doveadm/dsync/dsync-mailbox-import.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Fri Apr 05 15:17:30 2013 +0300 @@ -1656,6 +1656,8 @@ const char *request_guid = NULL; uint32_t request_uid = 0; + i_assert(all_newmails != NULL); + /* get the list of the current local UIDs and the wanted UIDs. find the first remote instance that we can request in case there are no local instances */ diff -r 2918bfacf565 -r 83568daabff6 src/lib-http/http-client-request.c --- a/src/lib-http/http-client-request.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/lib-http/http-client-request.c Fri Apr 05 15:17:30 2013 +0300 @@ -218,6 +218,8 @@ static void http_client_request_finish_payload_out(struct http_client_request *req) { + i_assert(req->conn != NULL); + if (req->payload_output != NULL) { o_stream_unref(&req->payload_output); req->payload_output = NULL; diff -r 2918bfacf565 -r 83568daabff6 src/lib/test-json-parser.c --- a/src/lib/test-json-parser.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/lib/test-json-parser.c Fri Apr 05 15:17:30 2013 +0300 @@ -128,6 +128,7 @@ test_istream_set_size(input, i); for (;;) { + value = NULL; if (pos < N_ELEMENTS(json_output) && json_output[pos].type == (enum json_type)TYPE_SKIP) { json_parse_skip_next(parser); From dovecot at dovecot.org Fri Apr 5 15:44:49 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 15:44:49 +0300 Subject: dovecot-2.2: imap: Fixed RESETKEY command to not return failure ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c4a017da9b3e changeset: 16207:c4a017da9b3e user: Timo Sirainen date: Fri Apr 05 15:44:32 2013 +0300 description: imap: Fixed RESETKEY command to not return failure when it actually succeeded. diffstat: src/imap/cmd-resetkey.c | 11 +++-------- src/lib-imap-urlauth/imap-urlauth-backend.c | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diffs (56 lines): diff -r 83568daabff6 -r c4a017da9b3e src/imap/cmd-resetkey.c --- a/src/imap/cmd-resetkey.c Fri Apr 05 15:17:30 2013 +0300 +++ b/src/imap/cmd-resetkey.c Fri Apr 05 15:44:32 2013 +0300 @@ -7,7 +7,7 @@ static bool cmd_resetkey_all(struct client_command_context *cmd) { - if (imap_urlauth_reset_all_keys(cmd->client->urlauth_ctx) <= 0) { + if (imap_urlauth_reset_all_keys(cmd->client->urlauth_ctx) < 0) { client_send_internal_error(cmd); return TRUE; } @@ -23,7 +23,6 @@ struct mail_namespace *ns; enum mailbox_flags flags = MAILBOX_FLAG_READONLY; struct mailbox *box; - int ret; /* check mechanism arguments (we support only INTERNAL mechanism) */ while (!IMAP_ARG_IS_EOL(mech_args)) { @@ -57,12 +56,8 @@ } /* check urlauth environment and reset requested key */ - ret = imap_urlauth_reset_mailbox_key(cmd->client->urlauth_ctx, box); - if (ret <= 0) { - if (ret < 0) - client_send_internal_error(cmd); - else - client_send_storage_error(cmd, mailbox_get_storage(box)); + if (imap_urlauth_reset_mailbox_key(cmd->client->urlauth_ctx, box) < 0) { + client_send_internal_error(cmd); mailbox_free(&box); return TRUE; } diff -r 83568daabff6 -r c4a017da9b3e src/lib-imap-urlauth/imap-urlauth-backend.c --- a/src/lib-imap-urlauth/imap-urlauth-backend.c Fri Apr 05 15:17:30 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-backend.c Fri Apr 05 15:44:32 2013 +0300 @@ -95,7 +95,7 @@ t = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_EXTERNAL); ret = mailbox_attribute_unset(t, MAIL_ATTRIBUTE_TYPE_PRIVATE, - IMAP_URLAUTH_KEY) < 0 ? -1 : 1; + IMAP_URLAUTH_KEY); if (mailbox_transaction_commit(&t) < 0) ret = -1; return ret; @@ -114,7 +114,7 @@ mailbox_get_vname(box), errstr); return -1; } - return imap_urlauth_backend_reset_mailbox_key(box) < 0 ? -1 : 0; + return imap_urlauth_backend_reset_mailbox_key(box); } int imap_urlauth_backend_reset_all_keys(struct mail_user *user) From dovecot at dovecot.org Fri Apr 5 16:38:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 16:38:06 +0300 Subject: dovecot-2.2: lib-index: Add timestamps and value lengths to attr... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1ef57aca7d2f changeset: 16208:1ef57aca7d2f user: Timo Sirainen date: Fri Apr 05 16:37:45 2013 +0300 description: lib-index: Add timestamps and value lengths to attribute change records in transaction log. The timestamps will be useful for dsync, and value lengths will be useful for metadata quota. diffstat: src/doveadm/doveadm-dump-log.c | 29 ++++++++++++++++++++++++- src/lib-index/mail-index-transaction-export.c | 5 ++++ src/lib-index/mail-index-transaction-private.h | 1 + src/lib-index/mail-index-transaction-update.c | 27 ++++++++++++++++++----- src/lib-index/mail-index.h | 5 ++- src/lib-storage/index/index-attribute.c | 7 ++++- src/plugins/acl/acl-mailbox.c | 9 ++++++- 7 files changed, 69 insertions(+), 14 deletions(-) diffs (211 lines): diff -r c4a017da9b3e -r 1ef57aca7d2f src/doveadm/doveadm-dump-log.c --- a/src/doveadm/doveadm-dump-log.c Fri Apr 05 15:44:32 2013 +0300 +++ b/src/doveadm/doveadm-dump-log.c Fri Apr 05 16:37:45 2013 +0300 @@ -421,12 +421,37 @@ } case MAIL_TRANSACTION_ATTRIBUTE_UPDATE: { const char *keys = data; - unsigned int i; + const uint32_t *extra; + unsigned int i, extra_pos, extra_count = 0; for (i = 0; i < size && keys[i] != '\0'; ) { - printf(" - %s\n", keys+i); + if (keys[i] == '+') + extra_count++; + extra_count++; i += strlen(keys+i) + 1; } + if (i % sizeof(uint32_t) != 0) + i += sizeof(uint32_t) - i%sizeof(uint32_t); + extra = (const void *)(keys+i); + + if ((size-i) != extra_count*sizeof(uint32_t)) { + printf(" - broken entry\n"); + break; + } + + extra_pos = 0; + for (i = 0; i < size && keys[i] != '\0'; ) { + printf(" - %s: %s/%s : timestamp=%s", + keys[i] == '+' ? "add" : keys[i] == '-' ? "remove" : "?", + keys[i+1] == 'p' ? "private" : + keys[i+1] == 's' ? "shared" : "?error?", + keys+i+2, unixdate2str(extra[extra_pos++])); + if (keys[i] == '+') + printf(" value_len=%u", extra[extra_pos++]); + printf("\n"); + i += strlen(keys+i) + 1; + } + break; } default: diff -r c4a017da9b3e -r 1ef57aca7d2f src/lib-index/mail-index-transaction-export.c --- a/src/lib-index/mail-index-transaction-export.c Fri Apr 05 15:44:32 2013 +0300 +++ b/src/lib-index/mail-index-transaction-export.c Fri Apr 05 16:37:45 2013 +0300 @@ -399,6 +399,11 @@ buffer_append_zero(t->attribute_updates, 4 - t->attribute_updates->used % 4); } + /* append the timestamp and value lengths */ + buffer_append(t->attribute_updates, + t->attribute_updates_suffix->data, + t->attribute_updates_suffix->used); + i_assert(t->attribute_updates->used % 4 == 0); log_append_buffer(&ctx, t->attribute_updates, MAIL_TRANSACTION_ATTRIBUTE_UPDATE); } diff -r c4a017da9b3e -r 1ef57aca7d2f src/lib-index/mail-index-transaction-private.h --- a/src/lib-index/mail-index-transaction-private.h Fri Apr 05 15:44:32 2013 +0300 +++ b/src/lib-index/mail-index-transaction-private.h Fri Apr 05 16:37:45 2013 +0300 @@ -71,6 +71,7 @@ ARRAY(struct mail_index_transaction_keyword_update) keyword_updates; buffer_t *attribute_updates; /* [+-][ps]key\0.. */ + buffer_t *attribute_updates_suffix; /* [].. */ uint64_t min_highest_modseq; uint64_t max_modseq; diff -r c4a017da9b3e -r 1ef57aca7d2f src/lib-index/mail-index-transaction-update.c --- a/src/lib-index/mail-index-transaction-update.c Fri Apr 05 15:44:32 2013 +0300 +++ b/src/lib-index/mail-index-transaction-update.c Fri Apr 05 16:37:45 2013 +0300 @@ -78,6 +78,8 @@ array_free(&t->ext_reset_atomic); if (t->attribute_updates != NULL) buffer_free(&t->attribute_updates); + if (t->attribute_updates_suffix != NULL) + buffer_free(&t->attribute_updates_suffix); t->first_new_seq = mail_index_view_get_messages_count(t->view)+1; t->last_new_seq = 0; @@ -652,26 +654,39 @@ static void mail_index_attribute_set_full(struct mail_index_transaction *t, - const char *key, bool pvt, char prefix) + const char *key, bool pvt, char prefix, + time_t timestamp, uint32_t value_len) { - if (t->attribute_updates == NULL) + uint32_t ts = timestamp; + + if (t->attribute_updates == NULL) { t->attribute_updates = buffer_create_dynamic(default_pool, 64); + t->attribute_updates_suffix = buffer_create_dynamic(default_pool, 64); + } buffer_append_c(t->attribute_updates, prefix); buffer_append_c(t->attribute_updates, pvt ? 'p' : 's'); buffer_append(t->attribute_updates, key, strlen(key)+1); + + buffer_append(t->attribute_updates_suffix, &ts, sizeof(ts)); + if (prefix == '+') { + buffer_append(t->attribute_updates_suffix, + &value_len, sizeof(value_len)); + } t->log_updates = TRUE; } void mail_index_attribute_set(struct mail_index_transaction *t, - bool pvt, const char *key) + bool pvt, const char *key, + time_t timestamp, uint32_t value_len) { - mail_index_attribute_set_full(t, key, pvt, '+'); + mail_index_attribute_set_full(t, key, pvt, '+', timestamp, value_len); } void mail_index_attribute_unset(struct mail_index_transaction *t, - bool pvt, const char *key) + bool pvt, const char *key, + time_t timestamp) { - mail_index_attribute_set_full(t, key, pvt, '-'); + mail_index_attribute_set_full(t, key, pvt, '-', timestamp, 0); } void mail_index_update_header(struct mail_index_transaction *t, diff -r c4a017da9b3e -r 1ef57aca7d2f src/lib-index/mail-index.h --- a/src/lib-index/mail-index.h Fri Apr 05 15:44:32 2013 +0300 +++ b/src/lib-index/mail-index.h Fri Apr 05 16:37:45 2013 +0300 @@ -468,10 +468,11 @@ change gets assigned its own modseq and any log readers can find out about this change. */ void mail_index_attribute_set(struct mail_index_transaction *t, - bool pvt, const char *key); + bool pvt, const char *key, + time_t timestamp, uint32_t value_len); /* Attribute was deleted. */ void mail_index_attribute_unset(struct mail_index_transaction *t, - bool pvt, const char *key); + bool pvt, const char *key, time_t timestamp); /* Update message's modseq to be at least min_modseq. */ void mail_index_update_modseq(struct mail_index_transaction *t, uint32_t seq, uint64_t min_modseq); diff -r c4a017da9b3e -r 1ef57aca7d2f src/lib-storage/index/index-attribute.c --- a/src/lib-storage/index/index-attribute.c Fri Apr 05 15:44:32 2013 +0300 +++ b/src/lib-storage/index/index-attribute.c Fri Apr 05 16:37:45 2013 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2013 Dovecot authors, see the included COPYING file */ #include "lib.h" +#include "ioloop.h" #include "dict.h" #include "index-storage.h" @@ -179,6 +180,7 @@ struct dict_transaction_context *dtrans; const char *mailbox_prefix; bool pvt = type == MAIL_ATTRIBUTE_TYPE_PRIVATE; + time_t ts = value->last_change != 0 ? value->last_change : ioloop_time; int ret = 0; if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT, @@ -202,10 +204,11 @@ ret = -1; } else if (value_str != NULL) { dict_set(dtrans, prefixed_key, value_str); - mail_index_attribute_set(t->itrans, pvt, key); + mail_index_attribute_set(t->itrans, pvt, key, + ts, strlen(value_str)); } else { dict_unset(dtrans, prefixed_key); - mail_index_attribute_unset(t->itrans, pvt, key); + mail_index_attribute_unset(t->itrans, pvt, key, ts); } } T_END; return ret; diff -r c4a017da9b3e -r 1ef57aca7d2f src/plugins/acl/acl-mailbox.c --- a/src/plugins/acl/acl-mailbox.c Fri Apr 05 15:44:32 2013 +0300 +++ b/src/plugins/acl/acl-mailbox.c Fri Apr 05 16:37:45 2013 +0300 @@ -6,6 +6,7 @@ problem actually exists when opening read-only mailboxes. */ #include "lib.h" #include "array.h" +#include "ioloop.h" #include "istream.h" #include "mailbox-list-private.h" #include "acl-api-private.h" @@ -620,6 +621,8 @@ { struct acl_object *aclobj; const char *key; + time_t ts = update->last_change != 0 ? + update->last_change : ioloop_time; key = t_strdup_printf(MAILBOX_ATTRIBUTE_PREFIX_ACL"%s", acl_rights_get_id(&update->rights)); @@ -629,9 +632,11 @@ return -1; } + /* FIXME: figure out some value lengths, so maybe some day + quota could apply to ACLs as well. */ if (acl_mailbox_update_removed_id(aclobj, update)) - mail_index_attribute_unset(t->itrans, FALSE, key); + mail_index_attribute_unset(t->itrans, FALSE, key, ts); else - mail_index_attribute_set(t->itrans, FALSE, key); + mail_index_attribute_set(t->itrans, FALSE, key, ts, 0); return 0; } From dovecot at dovecot.org Fri Apr 5 19:03:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 19:03:10 +0300 Subject: dovecot-2.2: lib-http: Fixed moving delayed request error timeou... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e342046d25ca changeset: 16209:e342046d25ca user: Timo Sirainen date: Fri Apr 05 19:03:05 2013 +0300 description: lib-http: Fixed moving delayed request error timeouts between ioloops. diffstat: src/lib-http/http-client.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diffs (28 lines): diff -r 1ef57aca7d2f -r e342046d25ca src/lib-http/http-client.c --- a/src/lib-http/http-client.c Fri Apr 05 16:37:45 2013 +0300 +++ b/src/lib-http/http-client.c Fri Apr 05 19:03:05 2013 +0300 @@ -132,6 +132,7 @@ void http_client_switch_ioloop(struct http_client *client) { struct connection *_conn = client->conn_list->connections; + struct http_client_host *host; /* move connections */ /* FIXME: we wouldn't necessarily need to switch all of them @@ -144,13 +145,9 @@ http_client_connection_switch_ioloop(conn); } - /* move dns lookups */ - if (client->set.dns_client_socket_path != '\0') { - struct http_client_host *host; - - for (host = client->hosts_list; host != NULL; host = host->next) - http_client_host_switch_ioloop(host); - } + /* move dns lookups and delayed requests */ + for (host = client->hosts_list; host != NULL; host = host->next) + http_client_host_switch_ioloop(host); } void http_client_wait(struct http_client *client) From pigeonhole at rename-it.nl Fri Apr 5 19:19:19 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 05 Apr 2013 18:19:19 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Adjusted to Dovecot API c... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/3514cbec0e06 changeset: 1738:3514cbec0e06 user: Stephan Bosch date: Fri Apr 05 18:08:19 2013 +0200 description: doveadm-sieve: Adjusted to Dovecot API change. diffstat: src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (34 lines): diff -r 097d68a9dd32 -r 3514cbec0e06 src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Wed Apr 03 00:08:05 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Fri Apr 05 18:08:19 2013 +0200 @@ -1,6 +1,7 @@ /* Copyright (c) 2013 Dovecot authors, see the included COPYING file */ #include "lib.h" +#include "ioloop.h" #include "istream.h" #include "sieve-script.h" #include "sieve-script-file.h" @@ -310,6 +311,7 @@ const struct mail_attribute_value *value) { union mailbox_module_context *sbox = SIEVE_MAIL_CONTEXT(t->box); + time_t ts = value->last_change != 0 ? value->last_change : ioloop_time; if (t->box->storage->user->admin && type == MAIL_ATTRIBUTE_TYPE_PRIVATE && @@ -317,10 +319,12 @@ strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE)) == 0) { if (sieve_attribute_set_sieve(t->box->storage, key, value) < 0) return -1; + /* FIXME: set value len to sieve script size / active name + length */ if (value->value != NULL || value->value_stream != NULL) - mail_index_attribute_set(t->itrans, TRUE, key); + mail_index_attribute_set(t->itrans, TRUE, key, ts, 0); else - mail_index_attribute_unset(t->itrans, TRUE, key); + mail_index_attribute_unset(t->itrans, TRUE, key, ts); return 0; } return sbox->super.attribute_set(t, type, key, value); From dovecot at dovecot.org Fri Apr 5 19:27:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 19:27:52 +0300 Subject: dovecot-2.2: example-config: Added ssl_client_ca_dir setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fa860c46d794 changeset: 16210:fa860c46d794 user: Timo Sirainen date: Fri Apr 05 19:27:41 2013 +0300 description: example-config: Added ssl_client_ca_dir setting. diffstat: doc/example-config/conf.d/10-ssl.conf | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (16 lines): diff -r e342046d25ca -r fa860c46d794 doc/example-config/conf.d/10-ssl.conf --- a/doc/example-config/conf.d/10-ssl.conf Fri Apr 05 19:03:05 2013 +0300 +++ b/doc/example-config/conf.d/10-ssl.conf Fri Apr 05 19:27:41 2013 +0300 @@ -26,6 +26,12 @@ # Require that CRL check succeeds for client certificates. #ssl_require_crl = yes +# Directory for trusted SSL CA certificates. These are used only when Dovecot +# needs to act as an SSL client (e.g. imapc backend). The directory is usually +# /etc/ssl/certs in Debian-based systems and /etc/pki/tls/certs in RedHat-based +# systems. +#ssl_client_ca_dir = + # Request client to send a certificate. If you also want to require it, set # auth_ssl_require_client_cert=yes in auth section. #ssl_verify_client_cert = no From dovecot at dovecot.org Fri Apr 5 21:08:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 21:08:18 +0300 Subject: dovecot-2.2: Released v2.2.rc5. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9446df6da5a8 changeset: 16211:9446df6da5a8 user: Timo Sirainen date: Fri Apr 05 21:03:16 2013 +0300 description: Released v2.2.rc5. diffstat: NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diffs (23 lines): diff -r fa860c46d794 -r 9446df6da5a8 NEWS --- a/NEWS Fri Apr 05 19:27:41 2013 +0300 +++ b/NEWS Fri Apr 05 21:03:16 2013 +0300 @@ -1,3 +1,7 @@ +v2.2.rc5 2013-04-05 Timo Sirainen + + - A few small random fixes + v2.2.rc4 2013-04-05 Timo Sirainen + Added "doveadm replicator" commands diff -r fa860c46d794 -r 9446df6da5a8 configure.ac --- a/configure.ac Fri Apr 05 19:27:41 2013 +0300 +++ b/configure.ac Fri Apr 05 21:03:16 2013 +0300 @@ -2,7 +2,7 @@ # 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.rc4],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.2.rc5],[dovecot at dovecot.org]) AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Fri Apr 5 21:08:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 21:08:18 +0300 Subject: dovecot-2.2: Added signature for changeset 9446df6da5a8 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e8ea4aacf329 changeset: 16213:e8ea4aacf329 user: Timo Sirainen date: Fri Apr 05 21:03:20 2013 +0300 description: Added signature for changeset 9446df6da5a8 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r d63e1bf77774 -r e8ea4aacf329 .hgsigs --- a/.hgsigs Fri Apr 05 21:03:16 2013 +0300 +++ b/.hgsigs Fri Apr 05 21:03:20 2013 +0300 @@ -63,3 +63,4 @@ e62fa121f4a2db3348fd79bb176dd363cc1224bf 0 iEYEABECAAYFAlErsAwACgkQyUhSUUBVismarACbBffm3XY21sfkTsbmF8o8udtRZk4An0ofYy2VminZ3S8EFApHymk/UpNv 11bd79bf4866b0d728b25717134a6ba972505746 0 iEYEABECAAYFAlFKFqsACgkQyUhSUUBVismbSwCdHgMYWjcwcTM7fD4v6wTd/8/8ZEsAn2THId1zYspMTEMtDg0rlrvjlht4 92c88eca562d45a55b65e45eb9bb937292b20595 0 iEYEABECAAYFAlFd75QACgkQyUhSUUBVismY8ACeI2egJAQjbspR/2ioZ85G+NbekuwAoIy2pl+wrSDOhwt9Qd4D72Q9I4ag +9446df6da5a89ae94653362ef4d4ea154272cd3e 0 iEYEABECAAYFAlFfEeQACgkQyUhSUUBViskn8QCfW8C5xr/OuOSQNuLchv9HJduncaEAnici8NhTmN7G9qwReXnLqcdrC1Tc From dovecot at dovecot.org Fri Apr 5 21:08:18 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 21:08:18 +0300 Subject: dovecot-2.2: Added tag 2.2.rc5 for changeset 9446df6da5a8 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d63e1bf77774 changeset: 16212:d63e1bf77774 user: Timo Sirainen date: Fri Apr 05 21:03:16 2013 +0300 description: Added tag 2.2.rc5 for changeset 9446df6da5a8 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 9446df6da5a8 -r d63e1bf77774 .hgtags --- a/.hgtags Fri Apr 05 21:03:16 2013 +0300 +++ b/.hgtags Fri Apr 05 21:03:16 2013 +0300 @@ -100,3 +100,4 @@ e62fa121f4a2db3348fd79bb176dd363cc1224bf 2.2.rc2 11bd79bf4866b0d728b25717134a6ba972505746 2.2.rc3 92c88eca562d45a55b65e45eb9bb937292b20595 2.2.rc4 +9446df6da5a89ae94653362ef4d4ea154272cd3e 2.2.rc5 From dovecot at dovecot.org Fri Apr 5 21:57:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Apr 2013 21:57:23 +0300 Subject: dovecot-2.2: fs-metawrap: Fixed fs_copy_finish_async() wrapping Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c24783148d78 changeset: 16214:c24783148d78 user: Timo Sirainen date: Fri Apr 05 21:57:11 2013 +0300 description: fs-metawrap: Fixed fs_copy_finish_async() wrapping diffstat: src/lib-fs/fs-metawrap.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (18 lines): diff -r e8ea4aacf329 -r c24783148d78 src/lib-fs/fs-metawrap.c --- a/src/lib-fs/fs-metawrap.c Fri Apr 05 21:03:20 2013 +0300 +++ b/src/lib-fs/fs-metawrap.c Fri Apr 05 21:57:11 2013 +0300 @@ -368,8 +368,12 @@ struct metawrap_fs_file *src = (struct metawrap_fs_file *)_src; struct metawrap_fs_file *dest = (struct metawrap_fs_file *)_dest; - if (!dest->fs->wrap_metadata) - return fs_copy(src->super, dest->super); + if (!dest->fs->wrap_metadata) { + if (_src != NULL) + return fs_copy(src->super, dest->super); + else + return fs_copy_finish_async(dest->super); + } return fs_default_copy(_src, _dest); } From pigeonhole at rename-it.nl Sat Apr 6 17:55:05 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 06 Apr 2013 16:55:05 +0200 Subject: dovecot-2.1-pigeonhole: Updated copyright notices to include the... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/850cdbcf7976 changeset: 1681:850cdbcf7976 user: Stephan Bosch date: Sat Apr 06 16:54:57 2013 +0200 description: Updated copyright notices to include the year 2013. diffstat: src/lib-managesieve/managesieve-arg.c | 2 +- src/lib-managesieve/managesieve-arg.h | 2 +- src/lib-managesieve/managesieve-parser.c | 2 +- src/lib-managesieve/managesieve-parser.h | 2 +- src/lib-managesieve/managesieve-quote.c | 2 +- src/lib-managesieve/managesieve-quote.h | 2 +- src/lib-sieve-tool/mail-raw.c | 2 +- src/lib-sieve-tool/mail-raw.h | 2 +- src/lib-sieve-tool/sieve-tool.c | 2 +- src/lib-sieve-tool/sieve-tool.h | 2 +- src/lib-sieve/cmd-discard.c | 2 +- src/lib-sieve/cmd-if.c | 2 +- src/lib-sieve/cmd-keep.c | 2 +- src/lib-sieve/cmd-redirect.c | 2 +- src/lib-sieve/cmd-require.c | 2 +- src/lib-sieve/cmd-stop.c | 2 +- src/lib-sieve/cmp-i-ascii-casemap.c | 2 +- src/lib-sieve/cmp-i-octet.c | 2 +- src/lib-sieve/edit-mail.c | 2 +- src/lib-sieve/edit-mail.h | 2 +- src/lib-sieve/ext-encoded-character.c | 2 +- src/lib-sieve/ext-envelope.c | 2 +- src/lib-sieve/ext-fileinto.c | 2 +- src/lib-sieve/ext-reject.c | 2 +- src/lib-sieve/mcht-contains.c | 2 +- src/lib-sieve/mcht-is.c | 2 +- src/lib-sieve/mcht-matches.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.h | 2 +- src/lib-sieve/plugins/body/ext-body.c | 2 +- src/lib-sieve/plugins/body/tst-body.c | 2 +- src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c | 2 +- src/lib-sieve/plugins/copy/ext-copy.c | 2 +- src/lib-sieve/plugins/copy/sieve-ext-copy.h | 2 +- src/lib-sieve/plugins/date/ext-date-common.c | 2 +- src/lib-sieve/plugins/date/ext-date-common.h | 2 +- src/lib-sieve/plugins/date/ext-date.c | 2 +- src/lib-sieve/plugins/date/tst-date.c | 2 +- src/lib-sieve/plugins/editheader/cmd-addheader.c | 2 +- src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-limits.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader.c | 2 +- src/lib-sieve/plugins/enotify/cmd-notify.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-limits.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify.c | 2 +- src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.h | 2 +- src/lib-sieve/plugins/enotify/sieve-ext-enotify.h | 2 +- src/lib-sieve/plugins/enotify/tst-notify-method-capability.c | 2 +- src/lib-sieve/plugins/enotify/tst-valid-notify-method.c | 2 +- src/lib-sieve/plugins/enotify/vmodf-encodeurl.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.h | 2 +- src/lib-sieve/plugins/environment/ext-environment.c | 2 +- src/lib-sieve/plugins/environment/sieve-ext-environment.h | 2 +- src/lib-sieve/plugins/environment/tst-environment.c | 2 +- src/lib-sieve/plugins/ihave/cmd-error.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave.c | 2 +- src/lib-sieve/plugins/ihave/tst-ihave.c | 2 +- src/lib-sieve/plugins/imap4flags/cmd-flag.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.h | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imapflags.c | 2 +- src/lib-sieve/plugins/imap4flags/tag-flags.c | 2 +- src/lib-sieve/plugins/imap4flags/tst-hasflag.c | 2 +- src/lib-sieve/plugins/include/cmd-global.c | 2 +- src/lib-sieve/plugins/include/cmd-include.c | 2 +- src/lib-sieve/plugins/include/cmd-return.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.h | 2 +- src/lib-sieve/plugins/include/ext-include-common.c | 2 +- src/lib-sieve/plugins/include/ext-include-common.h | 2 +- src/lib-sieve/plugins/include/ext-include-limits.h | 2 +- src/lib-sieve/plugins/include/ext-include-variables.c | 2 +- src/lib-sieve/plugins/include/ext-include-variables.h | 2 +- src/lib-sieve/plugins/include/ext-include.c | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox-common.h | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox.c | 2 +- src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 2 +- src/lib-sieve/plugins/mailbox/tst-mailboxexists.c | 2 +- src/lib-sieve/plugins/notify/cmd-denotify.c | 2 +- src/lib-sieve/plugins/notify/cmd-notify.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.h | 2 +- src/lib-sieve/plugins/notify/ext-notify-limits.h | 2 +- src/lib-sieve/plugins/notify/ext-notify.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.h | 2 +- src/lib-sieve/plugins/regex/ext-regex.c | 2 +- src/lib-sieve/plugins/regex/mcht-regex.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.h | 2 +- src/lib-sieve/plugins/relational/ext-relational.c | 2 +- src/lib-sieve/plugins/relational/mcht-count.c | 2 +- src/lib-sieve/plugins/relational/mcht-value.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.h | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest.c | 2 +- src/lib-sieve/plugins/spamvirustest/tst-spamvirustest.c | 2 +- src/lib-sieve/plugins/subaddress/ext-subaddress.c | 2 +- src/lib-sieve/plugins/vacation/cmd-vacation.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.h | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-seconds.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation.c | 2 +- src/lib-sieve/plugins/variables/cmd-set.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-limits.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.h | 2 +- src/lib-sieve/plugins/variables/ext-variables.c | 2 +- src/lib-sieve/plugins/variables/sieve-ext-variables.h | 2 +- src/lib-sieve/plugins/variables/tst-string.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/cmd-debug-log.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/tst-duplicate.c | 2 +- src/lib-sieve/rfc2822.c | 2 +- src/lib-sieve/rfc2822.h | 2 +- src/lib-sieve/sieve-actions.c | 2 +- src/lib-sieve/sieve-actions.h | 2 +- src/lib-sieve/sieve-address-parts.c | 2 +- src/lib-sieve/sieve-address-parts.h | 2 +- src/lib-sieve/sieve-address.c | 2 +- src/lib-sieve/sieve-address.h | 2 +- src/lib-sieve/sieve-ast.c | 2 +- src/lib-sieve/sieve-ast.h | 2 +- src/lib-sieve/sieve-binary-code.c | 2 +- src/lib-sieve/sieve-binary-debug.c | 2 +- src/lib-sieve/sieve-binary-dumper.c | 2 +- src/lib-sieve/sieve-binary-dumper.h | 2 +- src/lib-sieve/sieve-binary-file.c | 2 +- src/lib-sieve/sieve-binary-private.h | 2 +- src/lib-sieve/sieve-binary.c | 2 +- src/lib-sieve/sieve-binary.h | 2 +- src/lib-sieve/sieve-code-dumper.c | 2 +- src/lib-sieve/sieve-code-dumper.h | 2 +- src/lib-sieve/sieve-code.c | 2 +- src/lib-sieve/sieve-code.h | 2 +- src/lib-sieve/sieve-commands.c | 2 +- src/lib-sieve/sieve-commands.h | 2 +- src/lib-sieve/sieve-common.h | 2 +- src/lib-sieve/sieve-comparators.c | 2 +- src/lib-sieve/sieve-comparators.h | 2 +- src/lib-sieve/sieve-config.h | 2 +- src/lib-sieve/sieve-dump.h | 2 +- src/lib-sieve/sieve-error-private.h | 2 +- src/lib-sieve/sieve-error.c | 2 +- src/lib-sieve/sieve-error.h | 2 +- src/lib-sieve/sieve-extensions.c | 2 +- src/lib-sieve/sieve-extensions.h | 2 +- src/lib-sieve/sieve-generator.c | 2 +- src/lib-sieve/sieve-generator.h | 2 +- src/lib-sieve/sieve-interpreter.c | 2 +- src/lib-sieve/sieve-interpreter.h | 2 +- src/lib-sieve/sieve-lexer.c | 2 +- src/lib-sieve/sieve-lexer.h | 2 +- src/lib-sieve/sieve-limits.h | 2 +- src/lib-sieve/sieve-match-types.c | 2 +- src/lib-sieve/sieve-match-types.h | 2 +- src/lib-sieve/sieve-match.c | 2 +- src/lib-sieve/sieve-match.h | 2 +- src/lib-sieve/sieve-message.c | 2 +- src/lib-sieve/sieve-message.h | 2 +- src/lib-sieve/sieve-objects.c | 2 +- src/lib-sieve/sieve-objects.h | 2 +- src/lib-sieve/sieve-parser.c | 2 +- src/lib-sieve/sieve-parser.h | 2 +- src/lib-sieve/sieve-plugins.c | 2 +- src/lib-sieve/sieve-plugins.h | 2 +- src/lib-sieve/sieve-result.c | 2 +- src/lib-sieve/sieve-result.h | 2 +- src/lib-sieve/sieve-runtime-trace.c | 2 +- src/lib-sieve/sieve-runtime-trace.h | 2 +- src/lib-sieve/sieve-runtime.h | 2 +- src/lib-sieve/sieve-script-dict.c | 2 +- src/lib-sieve/sieve-script-file.c | 2 +- src/lib-sieve/sieve-script-file.h | 2 +- src/lib-sieve/sieve-script-private.h | 2 +- src/lib-sieve/sieve-script.c | 2 +- src/lib-sieve/sieve-script.h | 2 +- src/lib-sieve/sieve-settings.c | 2 +- src/lib-sieve/sieve-settings.h | 2 +- src/lib-sieve/sieve-smtp.c | 2 +- src/lib-sieve/sieve-smtp.h | 2 +- src/lib-sieve/sieve-stringlist.c | 2 +- src/lib-sieve/sieve-stringlist.h | 2 +- src/lib-sieve/sieve-types.h | 2 +- src/lib-sieve/sieve-validator.c | 2 +- src/lib-sieve/sieve-validator.h | 2 +- src/lib-sieve/sieve.c | 2 +- src/lib-sieve/sieve.h | 2 +- src/lib-sieve/tst-address.c | 2 +- src/lib-sieve/tst-allof.c | 2 +- src/lib-sieve/tst-anyof.c | 2 +- src/lib-sieve/tst-exists.c | 2 +- src/lib-sieve/tst-header.c | 2 +- src/lib-sieve/tst-not.c | 2 +- src/lib-sieve/tst-size.c | 2 +- src/lib-sieve/tst-truefalse.c | 2 +- src/lib-sievestorage/sieve-storage-list.c | 2 +- src/lib-sievestorage/sieve-storage-list.h | 2 +- src/lib-sievestorage/sieve-storage-private.h | 2 +- src/lib-sievestorage/sieve-storage-quota.c | 2 +- src/lib-sievestorage/sieve-storage-quota.h | 2 +- src/lib-sievestorage/sieve-storage-save.c | 2 +- src/lib-sievestorage/sieve-storage-save.h | 2 +- src/lib-sievestorage/sieve-storage-script.c | 2 +- src/lib-sievestorage/sieve-storage-script.h | 2 +- src/lib-sievestorage/sieve-storage.c | 2 +- src/lib-sievestorage/sieve-storage.h | 2 +- src/managesieve-login/client-authenticate.c | 2 +- src/managesieve-login/client-authenticate.h | 2 +- src/managesieve-login/client.c | 2 +- src/managesieve-login/client.h | 2 +- src/managesieve-login/managesieve-login-settings-plugin.c | 2 +- src/managesieve-login/managesieve-login-settings-plugin.h | 2 +- src/managesieve-login/managesieve-login-settings.c | 2 +- src/managesieve-login/managesieve-login-settings.h | 2 +- src/managesieve-login/managesieve-proxy.c | 2 +- src/managesieve-login/managesieve-proxy.h | 2 +- src/managesieve/cmd-capability.c | 2 +- src/managesieve/cmd-deletescript.c | 2 +- src/managesieve/cmd-getscript.c | 2 +- src/managesieve/cmd-havespace.c | 2 +- src/managesieve/cmd-listscripts.c | 2 +- src/managesieve/cmd-logout.c | 2 +- src/managesieve/cmd-noop.c | 2 +- src/managesieve/cmd-putscript.c | 2 +- src/managesieve/cmd-renamescript.c | 2 +- src/managesieve/cmd-setactive.c | 2 +- src/managesieve/main.c | 2 +- src/managesieve/managesieve-capabilities.c | 2 +- src/managesieve/managesieve-capabilities.h | 2 +- src/managesieve/managesieve-client.c | 2 +- src/managesieve/managesieve-client.h | 2 +- src/managesieve/managesieve-commands.c | 2 +- src/managesieve/managesieve-commands.h | 2 +- src/managesieve/managesieve-common.h | 2 +- src/managesieve/managesieve-quota.c | 2 +- src/managesieve/managesieve-quota.h | 2 +- src/managesieve/managesieve-settings.c | 2 +- src/managesieve/managesieve-settings.h | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.c | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.h | 2 +- src/sieve-tools/sieve-dump.c | 2 +- src/sieve-tools/sieve-filter.c | 2 +- src/sieve-tools/sieve-test.c | 2 +- src/sieve-tools/sievec.c | 2 +- src/testsuite/cmd-test-binary.c | 2 +- src/testsuite/cmd-test-config.c | 2 +- src/testsuite/cmd-test-fail.c | 2 +- src/testsuite/cmd-test-mailbox.c | 2 +- src/testsuite/cmd-test-message.c | 2 +- src/testsuite/cmd-test-result.c | 2 +- src/testsuite/cmd-test-set.c | 2 +- src/testsuite/cmd-test.c | 2 +- src/testsuite/ext-testsuite.c | 2 +- src/testsuite/testsuite-arguments.c | 2 +- src/testsuite/testsuite-arguments.h | 2 +- src/testsuite/testsuite-binary.c | 2 +- src/testsuite/testsuite-binary.h | 2 +- src/testsuite/testsuite-common.c | 2 +- src/testsuite/testsuite-common.h | 2 +- src/testsuite/testsuite-log.c | 2 +- src/testsuite/testsuite-log.h | 2 +- src/testsuite/testsuite-mailstore.c | 2 +- src/testsuite/testsuite-mailstore.h | 2 +- src/testsuite/testsuite-message.c | 2 +- src/testsuite/testsuite-message.h | 2 +- src/testsuite/testsuite-objects.c | 2 +- src/testsuite/testsuite-objects.h | 2 +- src/testsuite/testsuite-result.c | 2 +- src/testsuite/testsuite-result.h | 2 +- src/testsuite/testsuite-script.c | 2 +- src/testsuite/testsuite-script.h | 2 +- src/testsuite/testsuite-settings.c | 2 +- src/testsuite/testsuite-settings.h | 2 +- src/testsuite/testsuite-smtp.c | 2 +- src/testsuite/testsuite-smtp.h | 2 +- src/testsuite/testsuite-substitutions.c | 2 +- src/testsuite/testsuite-substitutions.h | 2 +- src/testsuite/testsuite-variables.c | 2 +- src/testsuite/testsuite-variables.h | 2 +- src/testsuite/testsuite.c | 2 +- src/testsuite/tst-test-error.c | 2 +- src/testsuite/tst-test-multiscript.c | 2 +- src/testsuite/tst-test-result-action.c | 2 +- src/testsuite/tst-test-result-execute.c | 2 +- src/testsuite/tst-test-script-compile.c | 2 +- src/testsuite/tst-test-script-run.c | 2 +- 315 files changed, 315 insertions(+), 315 deletions(-) diffs (truncated from 2835 to 300 lines): diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-arg.c --- a/src/lib-managesieve/managesieve-arg.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-arg.h --- a/src/lib-managesieve/managesieve-arg.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_ARG_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-discard.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-if.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-keep.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-redirect.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-require.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-stop.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmp-i-octet.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/edit-mail.h --- a/src/lib-sieve/edit-mail.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/edit-mail.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __EDIT_MAIL_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-encoded-character.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension encoded-character diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-envelope.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension envelope diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-fileinto.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension fileinto diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-reject.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension reject diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-contains.c --- a/src/lib-sieve/mcht-contains.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-contains.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':contains' diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-is.c --- a/src/lib-sieve/mcht-is.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-is.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':is': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-matches.c --- a/src/lib-sieve/mcht-matches.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-matches.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':matches' diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body-common.c --- a/src/lib-sieve/plugins/body/ext-body-common.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body-common.h --- a/src/lib-sieve/plugins/body/ext-body-common.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __EXT_BODY_COMMON_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body.c --- a/src/lib-sieve/plugins/body/ext-body.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension body diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/tst-body.c --- a/src/lib-sieve/plugins/body/tst-body.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/tst-body.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-extensions.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c --- a/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension comparator-i;ascii-numeric diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/copy/ext-copy.c --- a/src/lib-sieve/plugins/copy/ext-copy.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/copy/ext-copy.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension copy diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/copy/sieve-ext-copy.h --- a/src/lib-sieve/plugins/copy/sieve-ext-copy.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/copy/sieve-ext-copy.h Sat Apr 06 16:54:57 2013 +0200 From dovecot at dovecot.org Sat Apr 6 20:44:48 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 06 Apr 2013 20:44:48 +0300 Subject: dovecot-2.2: lib-index: Added missing NUL separator to attribute... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/edbfb39bc10d changeset: 16215:edbfb39bc10d user: Timo Sirainen date: Sat Apr 06 20:44:38 2013 +0300 description: lib-index: Added missing NUL separator to attribute-update transaction log record. diffstat: src/lib-index/mail-index-transaction-export.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r c24783148d78 -r edbfb39bc10d src/lib-index/mail-index-transaction-export.c --- a/src/lib-index/mail-index-transaction-export.c Fri Apr 05 21:57:11 2013 +0300 +++ b/src/lib-index/mail-index-transaction-export.c Sat Apr 06 20:44:38 2013 +0300 @@ -394,6 +394,7 @@ MAIL_TRANSACTION_HEADER_UPDATE); } if (t->attribute_updates != NULL) { + buffer_append_c(t->attribute_updates, '\0'); /* need to have 32bit alignment */ if (t->attribute_updates->used % 4 != 0) { buffer_append_zero(t->attribute_updates, From dovecot at dovecot.org Sat Apr 6 21:01:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 06 Apr 2013 21:01:45 +0300 Subject: dovecot-2.2: replicator: Don't create replicator-doveadm socket ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9824f8df62a3 changeset: 16216:9824f8df62a3 user: Timo Sirainen date: Sat Apr 06 21:01:41 2013 +0300 description: replicator: Don't create replicator-doveadm socket by default. Also removed the service replicator { process_min_avail=1 } requirement. This new way allows replicator to give a flag to dsync so it will try to notify the replicator process when user gets synced, which can be silently ignored even if it fails (replica server doesn't need to have replicator or even Dovecot itself running). diffstat: src/replication/replicator/replicator-settings.c | 2 +- src/replication/replicator/replicator.c | 7 ------- 2 files changed, 1 insertions(+), 8 deletions(-) diffs (29 lines): diff -r edbfb39bc10d -r 9824f8df62a3 src/replication/replicator/replicator-settings.c --- a/src/replication/replicator/replicator-settings.c Sat Apr 06 20:44:38 2013 +0300 +++ b/src/replication/replicator/replicator-settings.c Sat Apr 06 21:01:41 2013 +0300 @@ -9,7 +9,7 @@ /* */ static struct file_listener_settings replicator_unix_listeners_array[] = { { "replicator", 0600, "$default_internal_user", "" }, - { "replicator-doveadm", 0600, "$default_internal_user", "" } + { "replicator-doveadm", 0, "$default_internal_user", "" } }; static struct file_listener_settings *replicator_unix_listeners[] = { &replicator_unix_listeners_array[0], diff -r edbfb39bc10d -r 9824f8df62a3 src/replication/replicator/replicator.c --- a/src/replication/replicator/replicator.c Sat Apr 06 20:44:38 2013 +0300 +++ b/src/replication/replicator/replicator.c Sat Apr 06 21:01:41 2013 +0300 @@ -123,13 +123,6 @@ i_fatal("Error reading configuration: %s", error); master_service_init_log(master_service, "replicator: "); - /* this check is here mainly so that "doveadm replicator" commands - don't accidentally start an unconfigured replicator */ - if (master_service_get_process_min_avail(master_service) == 0) { - i_fatal("Replicator not configured: " - "service replicator { process_min_avail } must be 1"); - } - restrict_access_by_env(NULL, FALSE); restrict_access_allow_coredumps(TRUE); master_service_init_finish(master_service); From pigeonhole at rename-it.nl Sat Apr 6 23:37:57 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 06 Apr 2013 22:37:57 +0200 Subject: dovecot-2.1-pigeonhole: Added tag 0.3.4 for changeset 493202676845 Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/c318f65361af changeset: 1683:c318f65361af user: Stephan Bosch date: Sat Apr 06 22:37:39 2013 +0200 description: Added tag 0.3.4 for changeset 493202676845 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 493202676845 -r c318f65361af .hgtags --- a/.hgtags Sat Apr 06 22:37:02 2013 +0200 +++ b/.hgtags Sat Apr 06 22:37:39 2013 +0200 @@ -13,3 +13,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0.3.1 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 +4932026768454443d87d2e6445552b331589dbb1 0.3.4 From pigeonhole at rename-it.nl Sat Apr 6 23:37:57 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 06 Apr 2013 22:37:57 +0200 Subject: dovecot-2.1-pigeonhole: Released v0.3.4 for Dovecot v2.1.16. Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/493202676845 changeset: 1682:493202676845 user: Stephan Bosch date: Sat Apr 06 22:37:02 2013 +0200 description: Released v0.3.4 for Dovecot v2.1.16. diffstat: NEWS | 29 +++++++++++++++++++++++++++++ TODO | 26 +++++++++++++------------- configure.in | 2 +- 3 files changed, 43 insertions(+), 14 deletions(-) diffs (83 lines): diff -r 850cdbcf7976 -r 493202676845 NEWS --- a/NEWS Sat Apr 06 16:54:57 2013 +0200 +++ b/NEWS Sat Apr 06 22:37:02 2013 +0200 @@ -1,3 +1,32 @@ +v0.3.4 06-04-2013 Stephan Bosch + + * Changed error handling to be less of a nuisance for administrators. Strictly + user-caused errors are only reported in user log. Some errors are logged as + info instead. + * Sieve: Changed behavior of redirect in case of a duplicate message delivery + or a mail loop. If a duplicate is detected the implicit keep is canceled, + as though the redirect was successful. This prevents getting local + deliveries. The original SMTP recipient is used when it is available to + augment the entry in the LDA duplicate database. This way, duplicates are + only detected when (initially) addressed to the same recipient. + + Sieve vnd.dovecot.duplicate extension: added new features to the duplicate + test, making it possible to manually compose the key value for duplicate + checking. This extension is in the process of being standardized + (https://tools.ietf.org/html/draft-bosch-sieve-duplicate-01). + + Sieve date extension: generate warning when invalid date part is specified. + - Sieve editheader extension: fixed crash occuring when addheader :last was + used. + - Sieve include extension: fixed missing error cleanup that caused a resource + leak. + - Sieve vacation extension: fixed determination of From: address for when + sieve_vacation_dont_check_recipient is active. + - Sieve tools: the -D option wasn't enabled and documented for all tools. + - Siev dict script storage: fixed potential segfault occuring when dict + initialization fails. + - ManageSieve: fixed bug in skipping of CRLF at end of AUTHENTICATE command. + - ManageSieve: fixed handling of unkown commands pre-login. + - Fixed compile on Mageia Linux. + v0.3.3 18-09-2012 Stephan Bosch - Fixed compile against installed Dovecot headers. This was broken by the diff -r 850cdbcf7976 -r 493202676845 TODO --- a/TODO Sat Apr 06 16:54:57 2013 +0200 +++ b/TODO Sat Apr 06 22:37:02 2013 +0200 @@ -1,21 +1,21 @@ -Current activities: +Active development is moved to Pigeonhole v0.4 for Dovecot v2.2. The v0.3.x +series for Dovecot v2.1 is maintained for bug fixes and small updates. Check +http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/TODO for the most +up-to-date TODO list. + +Parallel plugin-based efforts: + +* Implement enotify xmpp method as a plugin. +* Implement metadata and servermetadata extensions as a plugin. + - Compiles against dovecot metadata plugin, as currently developed by + Dennis Schridde. + +Open TODO issues for this revision: * Implement generic Sieve script object that abstracts from its location and add support for retrieving scripts from dict database. - Implement infrastructure for loading a sequence of global scripts from a database (for sieve_before/sieve_after). - -Parallel plugin-based efforts: - -* Implement plugin to pipe messages to external programs. Will probably be - merged with the main tree eventually. -* Implement enotify xmpp method as a plugin. -* Implement metadata and servermetadata extensions as a plugin. - - Compiles against dovecot metadata plugin, as currently developed by - Dennis Schridde. - -Next (mostly in order of descending priority/precedence): - * Make the sieve storage a base class with (possibly) various implementations, just like mail-storage. This aims to provide support for alternate types of script storage like LDAP or SQL database. diff -r 850cdbcf7976 -r 493202676845 configure.in --- a/configure.in Sat Apr 06 16:54:57 2013 +0200 +++ b/configure.in Sat Apr 06 22:37:02 2013 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Pigeonhole], [0.3.3], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) +AC_INIT([Pigeonhole], [0.3.4], [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 Sat Apr 6 23:39:24 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 06 Apr 2013 22:39:24 +0200 Subject: dovecot-2.1-pigeonhole: Added signature for changeset 493202676845 Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/e3700924ac8c changeset: 1684:e3700924ac8c user: Stephan Bosch date: Sat Apr 06 22:37:46 2013 +0200 description: Added signature for changeset 493202676845 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r c318f65361af -r e3700924ac8c .hgsigs --- a/.hgsigs Sat Apr 06 22:37:39 2013 +0200 +++ b/.hgsigs Sat Apr 06 22:37:46 2013 +0200 @@ -7,3 +7,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0 iQEcBAABAgAGBQJPwAS+AAoJEATWKx49+7T0ngIH/R+teyHN4Pdv4bFTkder85rxy4bzPDzlV9gGlhuKuRBtI8F7CKKWLEP/ESPdtZbMmsNj9k104q2U9pgUfkYrVKL4lrk3hlz44o8Smpwp/xrxyNY8/OuBof0LvyXjp7unHAvvAWFiEmeTpJMmSu77xE8wsEqZowHi8/Igh3lrQ3U129VP1xWr1mvnvQdMQk9TTMK3T38H9kUrz2CRdOWjJbxAA4rLyozGLqWUeSKepUcwAGANd35k8pNLYiONlGU8NZsQyzS2dfOl0TeolgqZn+UkmM9FZFFnD40WU8zPft0nK4g8cFZGObX4fsPyK03EAnR7BXd1BKdmr7jdppAnSvQ= 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= From pigeonhole at rename-it.nl Sun Apr 7 01:33:49 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:33:49 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Fixed handling of non-lin... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1a06d4b9483c changeset: 1739:1a06d4b9483c user: Stephan Bosch date: Sun Apr 07 00:33:41 2013 +0200 description: doveadm-sieve: Fixed handling of non-link active script. Unsetting the normal active script attribute would 'rescue' the non-link script and turn it into a symlink. diffstat: src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 3514cbec0e06 -r 1a06d4b9483c src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Fri Apr 05 18:08:19 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Sun Apr 07 00:33:41 2013 +0200 @@ -153,6 +153,15 @@ if (mailbox_attribute_value_to_string(storage, value, &scriptname) < 0) return -1; if (scriptname == NULL) { + /* don't affect non-link active script */ + if ((ret=sieve_storage_active_script_is_no_link(svstorage)) != 0) { + if (ret < 0) { + mail_storage_set_internal_error(storage); + return -1; + } + return 0; + } + /* deactivate current script */ if (sieve_storage_deactivate(svstorage) < 0) { mail_storage_set_critical(storage, From pigeonhole at rename-it.nl Sun Apr 7 01:41:27 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:41:27 +0200 Subject: dovecot-2.2-pigeonhole: Added signature for changeset 493202676845 Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/e3700924ac8c changeset: 1743:e3700924ac8c user: Stephan Bosch date: Sat Apr 06 22:37:46 2013 +0200 description: Added signature for changeset 493202676845 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r c318f65361af -r e3700924ac8c .hgsigs --- a/.hgsigs Sat Apr 06 22:37:39 2013 +0200 +++ b/.hgsigs Sat Apr 06 22:37:46 2013 +0200 @@ -7,3 +7,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0 iQEcBAABAgAGBQJPwAS+AAoJEATWKx49+7T0ngIH/R+teyHN4Pdv4bFTkder85rxy4bzPDzlV9gGlhuKuRBtI8F7CKKWLEP/ESPdtZbMmsNj9k104q2U9pgUfkYrVKL4lrk3hlz44o8Smpwp/xrxyNY8/OuBof0LvyXjp7unHAvvAWFiEmeTpJMmSu77xE8wsEqZowHi8/Igh3lrQ3U129VP1xWr1mvnvQdMQk9TTMK3T38H9kUrz2CRdOWjJbxAA4rLyozGLqWUeSKepUcwAGANd35k8pNLYiONlGU8NZsQyzS2dfOl0TeolgqZn+UkmM9FZFFnD40WU8zPft0nK4g8cFZGObX4fsPyK03EAnR7BXd1BKdmr7jdppAnSvQ= 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= From pigeonhole at rename-it.nl Sun Apr 7 01:41:27 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:41:27 +0200 Subject: dovecot-2.2-pigeonhole: Added tag 0.3.4 for changeset 493202676845 Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/c318f65361af changeset: 1742:c318f65361af user: Stephan Bosch date: Sat Apr 06 22:37:39 2013 +0200 description: Added tag 0.3.4 for changeset 493202676845 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 493202676845 -r c318f65361af .hgtags --- a/.hgtags Sat Apr 06 22:37:02 2013 +0200 +++ b/.hgtags Sat Apr 06 22:37:39 2013 +0200 @@ -13,3 +13,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0.3.1 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 +4932026768454443d87d2e6445552b331589dbb1 0.3.4 From pigeonhole at rename-it.nl Sun Apr 7 01:41:27 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:41:27 +0200 Subject: dovecot-2.2-pigeonhole: Updated copyright notices to include the... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/850cdbcf7976 changeset: 1740:850cdbcf7976 user: Stephan Bosch date: Sat Apr 06 16:54:57 2013 +0200 description: Updated copyright notices to include the year 2013. diffstat: src/lib-managesieve/managesieve-arg.c | 2 +- src/lib-managesieve/managesieve-arg.h | 2 +- src/lib-managesieve/managesieve-parser.c | 2 +- src/lib-managesieve/managesieve-parser.h | 2 +- src/lib-managesieve/managesieve-quote.c | 2 +- src/lib-managesieve/managesieve-quote.h | 2 +- src/lib-sieve-tool/mail-raw.c | 2 +- src/lib-sieve-tool/mail-raw.h | 2 +- src/lib-sieve-tool/sieve-tool.c | 2 +- src/lib-sieve-tool/sieve-tool.h | 2 +- src/lib-sieve/cmd-discard.c | 2 +- src/lib-sieve/cmd-if.c | 2 +- src/lib-sieve/cmd-keep.c | 2 +- src/lib-sieve/cmd-redirect.c | 2 +- src/lib-sieve/cmd-require.c | 2 +- src/lib-sieve/cmd-stop.c | 2 +- src/lib-sieve/cmp-i-ascii-casemap.c | 2 +- src/lib-sieve/cmp-i-octet.c | 2 +- src/lib-sieve/edit-mail.c | 2 +- src/lib-sieve/edit-mail.h | 2 +- src/lib-sieve/ext-encoded-character.c | 2 +- src/lib-sieve/ext-envelope.c | 2 +- src/lib-sieve/ext-fileinto.c | 2 +- src/lib-sieve/ext-reject.c | 2 +- src/lib-sieve/mcht-contains.c | 2 +- src/lib-sieve/mcht-is.c | 2 +- src/lib-sieve/mcht-matches.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.h | 2 +- src/lib-sieve/plugins/body/ext-body.c | 2 +- src/lib-sieve/plugins/body/tst-body.c | 2 +- src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c | 2 +- src/lib-sieve/plugins/copy/ext-copy.c | 2 +- src/lib-sieve/plugins/copy/sieve-ext-copy.h | 2 +- src/lib-sieve/plugins/date/ext-date-common.c | 2 +- src/lib-sieve/plugins/date/ext-date-common.h | 2 +- src/lib-sieve/plugins/date/ext-date.c | 2 +- src/lib-sieve/plugins/date/tst-date.c | 2 +- src/lib-sieve/plugins/editheader/cmd-addheader.c | 2 +- src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-limits.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader.c | 2 +- src/lib-sieve/plugins/enotify/cmd-notify.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-limits.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify.c | 2 +- src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.h | 2 +- src/lib-sieve/plugins/enotify/sieve-ext-enotify.h | 2 +- src/lib-sieve/plugins/enotify/tst-notify-method-capability.c | 2 +- src/lib-sieve/plugins/enotify/tst-valid-notify-method.c | 2 +- src/lib-sieve/plugins/enotify/vmodf-encodeurl.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.h | 2 +- src/lib-sieve/plugins/environment/ext-environment.c | 2 +- src/lib-sieve/plugins/environment/sieve-ext-environment.h | 2 +- src/lib-sieve/plugins/environment/tst-environment.c | 2 +- src/lib-sieve/plugins/ihave/cmd-error.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave.c | 2 +- src/lib-sieve/plugins/ihave/tst-ihave.c | 2 +- src/lib-sieve/plugins/imap4flags/cmd-flag.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.h | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imapflags.c | 2 +- src/lib-sieve/plugins/imap4flags/tag-flags.c | 2 +- src/lib-sieve/plugins/imap4flags/tst-hasflag.c | 2 +- src/lib-sieve/plugins/include/cmd-global.c | 2 +- src/lib-sieve/plugins/include/cmd-include.c | 2 +- src/lib-sieve/plugins/include/cmd-return.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.h | 2 +- src/lib-sieve/plugins/include/ext-include-common.c | 2 +- src/lib-sieve/plugins/include/ext-include-common.h | 2 +- src/lib-sieve/plugins/include/ext-include-limits.h | 2 +- src/lib-sieve/plugins/include/ext-include-variables.c | 2 +- src/lib-sieve/plugins/include/ext-include-variables.h | 2 +- src/lib-sieve/plugins/include/ext-include.c | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox-common.h | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox.c | 2 +- src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 2 +- src/lib-sieve/plugins/mailbox/tst-mailboxexists.c | 2 +- src/lib-sieve/plugins/notify/cmd-denotify.c | 2 +- src/lib-sieve/plugins/notify/cmd-notify.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.h | 2 +- src/lib-sieve/plugins/notify/ext-notify-limits.h | 2 +- src/lib-sieve/plugins/notify/ext-notify.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.h | 2 +- src/lib-sieve/plugins/regex/ext-regex.c | 2 +- src/lib-sieve/plugins/regex/mcht-regex.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.h | 2 +- src/lib-sieve/plugins/relational/ext-relational.c | 2 +- src/lib-sieve/plugins/relational/mcht-count.c | 2 +- src/lib-sieve/plugins/relational/mcht-value.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.h | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest.c | 2 +- src/lib-sieve/plugins/spamvirustest/tst-spamvirustest.c | 2 +- src/lib-sieve/plugins/subaddress/ext-subaddress.c | 2 +- src/lib-sieve/plugins/vacation/cmd-vacation.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.h | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-seconds.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation.c | 2 +- src/lib-sieve/plugins/variables/cmd-set.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-limits.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.h | 2 +- src/lib-sieve/plugins/variables/ext-variables.c | 2 +- src/lib-sieve/plugins/variables/sieve-ext-variables.h | 2 +- src/lib-sieve/plugins/variables/tst-string.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/cmd-debug-log.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/tst-duplicate.c | 2 +- src/lib-sieve/rfc2822.c | 2 +- src/lib-sieve/rfc2822.h | 2 +- src/lib-sieve/sieve-actions.c | 2 +- src/lib-sieve/sieve-actions.h | 2 +- src/lib-sieve/sieve-address-parts.c | 2 +- src/lib-sieve/sieve-address-parts.h | 2 +- src/lib-sieve/sieve-address.c | 2 +- src/lib-sieve/sieve-address.h | 2 +- src/lib-sieve/sieve-ast.c | 2 +- src/lib-sieve/sieve-ast.h | 2 +- src/lib-sieve/sieve-binary-code.c | 2 +- src/lib-sieve/sieve-binary-debug.c | 2 +- src/lib-sieve/sieve-binary-dumper.c | 2 +- src/lib-sieve/sieve-binary-dumper.h | 2 +- src/lib-sieve/sieve-binary-file.c | 2 +- src/lib-sieve/sieve-binary-private.h | 2 +- src/lib-sieve/sieve-binary.c | 2 +- src/lib-sieve/sieve-binary.h | 2 +- src/lib-sieve/sieve-code-dumper.c | 2 +- src/lib-sieve/sieve-code-dumper.h | 2 +- src/lib-sieve/sieve-code.c | 2 +- src/lib-sieve/sieve-code.h | 2 +- src/lib-sieve/sieve-commands.c | 2 +- src/lib-sieve/sieve-commands.h | 2 +- src/lib-sieve/sieve-common.h | 2 +- src/lib-sieve/sieve-comparators.c | 2 +- src/lib-sieve/sieve-comparators.h | 2 +- src/lib-sieve/sieve-config.h | 2 +- src/lib-sieve/sieve-dump.h | 2 +- src/lib-sieve/sieve-error-private.h | 2 +- src/lib-sieve/sieve-error.c | 2 +- src/lib-sieve/sieve-error.h | 2 +- src/lib-sieve/sieve-extensions.c | 2 +- src/lib-sieve/sieve-extensions.h | 2 +- src/lib-sieve/sieve-generator.c | 2 +- src/lib-sieve/sieve-generator.h | 2 +- src/lib-sieve/sieve-interpreter.c | 2 +- src/lib-sieve/sieve-interpreter.h | 2 +- src/lib-sieve/sieve-lexer.c | 2 +- src/lib-sieve/sieve-lexer.h | 2 +- src/lib-sieve/sieve-limits.h | 2 +- src/lib-sieve/sieve-match-types.c | 2 +- src/lib-sieve/sieve-match-types.h | 2 +- src/lib-sieve/sieve-match.c | 2 +- src/lib-sieve/sieve-match.h | 2 +- src/lib-sieve/sieve-message.c | 2 +- src/lib-sieve/sieve-message.h | 2 +- src/lib-sieve/sieve-objects.c | 2 +- src/lib-sieve/sieve-objects.h | 2 +- src/lib-sieve/sieve-parser.c | 2 +- src/lib-sieve/sieve-parser.h | 2 +- src/lib-sieve/sieve-plugins.c | 2 +- src/lib-sieve/sieve-plugins.h | 2 +- src/lib-sieve/sieve-result.c | 2 +- src/lib-sieve/sieve-result.h | 2 +- src/lib-sieve/sieve-runtime-trace.c | 2 +- src/lib-sieve/sieve-runtime-trace.h | 2 +- src/lib-sieve/sieve-runtime.h | 2 +- src/lib-sieve/sieve-script-dict.c | 2 +- src/lib-sieve/sieve-script-file.c | 2 +- src/lib-sieve/sieve-script-file.h | 2 +- src/lib-sieve/sieve-script-private.h | 2 +- src/lib-sieve/sieve-script.c | 2 +- src/lib-sieve/sieve-script.h | 2 +- src/lib-sieve/sieve-settings.c | 2 +- src/lib-sieve/sieve-settings.h | 2 +- src/lib-sieve/sieve-smtp.c | 2 +- src/lib-sieve/sieve-smtp.h | 2 +- src/lib-sieve/sieve-stringlist.c | 2 +- src/lib-sieve/sieve-stringlist.h | 2 +- src/lib-sieve/sieve-types.h | 2 +- src/lib-sieve/sieve-validator.c | 2 +- src/lib-sieve/sieve-validator.h | 2 +- src/lib-sieve/sieve.c | 2 +- src/lib-sieve/sieve.h | 2 +- src/lib-sieve/tst-address.c | 2 +- src/lib-sieve/tst-allof.c | 2 +- src/lib-sieve/tst-anyof.c | 2 +- src/lib-sieve/tst-exists.c | 2 +- src/lib-sieve/tst-header.c | 2 +- src/lib-sieve/tst-not.c | 2 +- src/lib-sieve/tst-size.c | 2 +- src/lib-sieve/tst-truefalse.c | 2 +- src/lib-sievestorage/sieve-storage-list.c | 2 +- src/lib-sievestorage/sieve-storage-list.h | 2 +- src/lib-sievestorage/sieve-storage-private.h | 2 +- src/lib-sievestorage/sieve-storage-quota.c | 2 +- src/lib-sievestorage/sieve-storage-quota.h | 2 +- src/lib-sievestorage/sieve-storage-save.c | 2 +- src/lib-sievestorage/sieve-storage-save.h | 2 +- src/lib-sievestorage/sieve-storage-script.c | 2 +- src/lib-sievestorage/sieve-storage-script.h | 2 +- src/lib-sievestorage/sieve-storage.c | 2 +- src/lib-sievestorage/sieve-storage.h | 2 +- src/managesieve-login/client-authenticate.c | 2 +- src/managesieve-login/client-authenticate.h | 2 +- src/managesieve-login/client.c | 2 +- src/managesieve-login/client.h | 2 +- src/managesieve-login/managesieve-login-settings-plugin.c | 2 +- src/managesieve-login/managesieve-login-settings-plugin.h | 2 +- src/managesieve-login/managesieve-login-settings.c | 2 +- src/managesieve-login/managesieve-login-settings.h | 2 +- src/managesieve-login/managesieve-proxy.c | 2 +- src/managesieve-login/managesieve-proxy.h | 2 +- src/managesieve/cmd-capability.c | 2 +- src/managesieve/cmd-deletescript.c | 2 +- src/managesieve/cmd-getscript.c | 2 +- src/managesieve/cmd-havespace.c | 2 +- src/managesieve/cmd-listscripts.c | 2 +- src/managesieve/cmd-logout.c | 2 +- src/managesieve/cmd-noop.c | 2 +- src/managesieve/cmd-putscript.c | 2 +- src/managesieve/cmd-renamescript.c | 2 +- src/managesieve/cmd-setactive.c | 2 +- src/managesieve/main.c | 2 +- src/managesieve/managesieve-capabilities.c | 2 +- src/managesieve/managesieve-capabilities.h | 2 +- src/managesieve/managesieve-client.c | 2 +- src/managesieve/managesieve-client.h | 2 +- src/managesieve/managesieve-commands.c | 2 +- src/managesieve/managesieve-commands.h | 2 +- src/managesieve/managesieve-common.h | 2 +- src/managesieve/managesieve-quota.c | 2 +- src/managesieve/managesieve-quota.h | 2 +- src/managesieve/managesieve-settings.c | 2 +- src/managesieve/managesieve-settings.h | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.c | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.h | 2 +- src/sieve-tools/sieve-dump.c | 2 +- src/sieve-tools/sieve-filter.c | 2 +- src/sieve-tools/sieve-test.c | 2 +- src/sieve-tools/sievec.c | 2 +- src/testsuite/cmd-test-binary.c | 2 +- src/testsuite/cmd-test-config.c | 2 +- src/testsuite/cmd-test-fail.c | 2 +- src/testsuite/cmd-test-mailbox.c | 2 +- src/testsuite/cmd-test-message.c | 2 +- src/testsuite/cmd-test-result.c | 2 +- src/testsuite/cmd-test-set.c | 2 +- src/testsuite/cmd-test.c | 2 +- src/testsuite/ext-testsuite.c | 2 +- src/testsuite/testsuite-arguments.c | 2 +- src/testsuite/testsuite-arguments.h | 2 +- src/testsuite/testsuite-binary.c | 2 +- src/testsuite/testsuite-binary.h | 2 +- src/testsuite/testsuite-common.c | 2 +- src/testsuite/testsuite-common.h | 2 +- src/testsuite/testsuite-log.c | 2 +- src/testsuite/testsuite-log.h | 2 +- src/testsuite/testsuite-mailstore.c | 2 +- src/testsuite/testsuite-mailstore.h | 2 +- src/testsuite/testsuite-message.c | 2 +- src/testsuite/testsuite-message.h | 2 +- src/testsuite/testsuite-objects.c | 2 +- src/testsuite/testsuite-objects.h | 2 +- src/testsuite/testsuite-result.c | 2 +- src/testsuite/testsuite-result.h | 2 +- src/testsuite/testsuite-script.c | 2 +- src/testsuite/testsuite-script.h | 2 +- src/testsuite/testsuite-settings.c | 2 +- src/testsuite/testsuite-settings.h | 2 +- src/testsuite/testsuite-smtp.c | 2 +- src/testsuite/testsuite-smtp.h | 2 +- src/testsuite/testsuite-substitutions.c | 2 +- src/testsuite/testsuite-substitutions.h | 2 +- src/testsuite/testsuite-variables.c | 2 +- src/testsuite/testsuite-variables.h | 2 +- src/testsuite/testsuite.c | 2 +- src/testsuite/tst-test-error.c | 2 +- src/testsuite/tst-test-multiscript.c | 2 +- src/testsuite/tst-test-result-action.c | 2 +- src/testsuite/tst-test-result-execute.c | 2 +- src/testsuite/tst-test-script-compile.c | 2 +- src/testsuite/tst-test-script-run.c | 2 +- 315 files changed, 315 insertions(+), 315 deletions(-) diffs (truncated from 2835 to 300 lines): diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-arg.c --- a/src/lib-managesieve/managesieve-arg.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-arg.h --- a/src/lib-managesieve/managesieve-arg.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_ARG_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-discard.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-if.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-keep.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-redirect.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-require.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmd-stop.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/cmp-i-octet.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/edit-mail.h --- a/src/lib-sieve/edit-mail.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/edit-mail.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __EDIT_MAIL_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-encoded-character.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension encoded-character diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-envelope.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension envelope diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-fileinto.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension fileinto diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/ext-reject.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension reject diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-contains.c --- a/src/lib-sieve/mcht-contains.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-contains.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':contains' diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-is.c --- a/src/lib-sieve/mcht-is.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-is.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':is': diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/mcht-matches.c --- a/src/lib-sieve/mcht-matches.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/mcht-matches.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Match-type ':matches' diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body-common.c --- a/src/lib-sieve/plugins/body/ext-body-common.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body-common.h --- a/src/lib-sieve/plugins/body/ext-body-common.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.h Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __EXT_BODY_COMMON_H diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/ext-body.c --- a/src/lib-sieve/plugins/body/ext-body.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/ext-body.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension body diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/body/tst-body.c --- a/src/lib-sieve/plugins/body/tst-body.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/body/tst-body.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-extensions.h" diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c --- a/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension comparator-i;ascii-numeric diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/copy/ext-copy.c --- a/src/lib-sieve/plugins/copy/ext-copy.c Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/copy/ext-copy.c Sat Apr 06 16:54:57 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension copy diff -r 5860cbaaffaa -r 850cdbcf7976 src/lib-sieve/plugins/copy/sieve-ext-copy.h --- a/src/lib-sieve/plugins/copy/sieve-ext-copy.h Tue Apr 02 23:09:14 2013 +0200 +++ b/src/lib-sieve/plugins/copy/sieve-ext-copy.h Sat Apr 06 16:54:57 2013 +0200 From pigeonhole at rename-it.nl Sun Apr 7 01:41:28 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:41:28 +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/f4b4676a2784 changeset: 1744:f4b4676a2784 user: Stephan Bosch date: Sun Apr 07 00:41:19 2013 +0200 description: Merged changes from Pigeonhole v0.3 tree. diffstat: .hgsigs | 1 + .hgtags | 1 + NEWS | 29 ++++++++++ TODO | 26 ++++---- src/lib-managesieve/managesieve-arg.c | 2 +- src/lib-managesieve/managesieve-arg.h | 2 +- src/lib-managesieve/managesieve-parser.c | 2 +- src/lib-managesieve/managesieve-parser.h | 2 +- src/lib-managesieve/managesieve-quote.c | 2 +- src/lib-managesieve/managesieve-quote.h | 2 +- src/lib-sieve-tool/mail-raw.c | 2 +- src/lib-sieve-tool/mail-raw.h | 2 +- src/lib-sieve-tool/sieve-tool.c | 2 +- src/lib-sieve-tool/sieve-tool.h | 2 +- src/lib-sieve/cmd-discard.c | 2 +- src/lib-sieve/cmd-if.c | 2 +- src/lib-sieve/cmd-keep.c | 2 +- src/lib-sieve/cmd-redirect.c | 2 +- src/lib-sieve/cmd-require.c | 2 +- src/lib-sieve/cmd-stop.c | 2 +- src/lib-sieve/cmp-i-ascii-casemap.c | 2 +- src/lib-sieve/cmp-i-octet.c | 2 +- src/lib-sieve/edit-mail.c | 2 +- src/lib-sieve/edit-mail.h | 2 +- src/lib-sieve/ext-encoded-character.c | 2 +- src/lib-sieve/ext-envelope.c | 2 +- src/lib-sieve/ext-fileinto.c | 2 +- src/lib-sieve/ext-reject.c | 2 +- src/lib-sieve/mcht-contains.c | 2 +- src/lib-sieve/mcht-is.c | 2 +- src/lib-sieve/mcht-matches.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.c | 2 +- src/lib-sieve/plugins/body/ext-body-common.h | 2 +- src/lib-sieve/plugins/body/ext-body.c | 2 +- src/lib-sieve/plugins/body/tst-body.c | 2 +- src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c | 2 +- src/lib-sieve/plugins/copy/ext-copy.c | 2 +- src/lib-sieve/plugins/copy/sieve-ext-copy.h | 2 +- src/lib-sieve/plugins/date/ext-date-common.c | 2 +- src/lib-sieve/plugins/date/ext-date-common.h | 2 +- src/lib-sieve/plugins/date/ext-date.c | 2 +- src/lib-sieve/plugins/date/tst-date.c | 2 +- src/lib-sieve/plugins/editheader/cmd-addheader.c | 2 +- src/lib-sieve/plugins/editheader/cmd-deleteheader.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.c | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-common.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader-limits.h | 2 +- src/lib-sieve/plugins/editheader/ext-editheader.c | 2 +- src/lib-sieve/plugins/enotify/cmd-notify.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.c | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-common.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify-limits.h | 2 +- src/lib-sieve/plugins/enotify/ext-enotify.c | 2 +- src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.c | 2 +- src/lib-sieve/plugins/enotify/mailto/uri-mailto.h | 2 +- src/lib-sieve/plugins/enotify/sieve-ext-enotify.h | 2 +- src/lib-sieve/plugins/enotify/tst-notify-method-capability.c | 2 +- src/lib-sieve/plugins/enotify/tst-valid-notify-method.c | 2 +- src/lib-sieve/plugins/enotify/vmodf-encodeurl.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.c | 2 +- src/lib-sieve/plugins/environment/ext-environment-common.h | 2 +- src/lib-sieve/plugins/environment/ext-environment.c | 2 +- src/lib-sieve/plugins/environment/sieve-ext-environment.h | 2 +- src/lib-sieve/plugins/environment/tst-environment.c | 2 +- src/lib-sieve/plugins/ihave/cmd-error.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-binary.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.c | 2 +- src/lib-sieve/plugins/ihave/ext-ihave-common.h | 2 +- src/lib-sieve/plugins/ihave/ext-ihave.c | 2 +- src/lib-sieve/plugins/ihave/tst-ihave.c | 2 +- src/lib-sieve/plugins/imap4flags/cmd-flag.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags-common.h | 2 +- src/lib-sieve/plugins/imap4flags/ext-imap4flags.c | 2 +- src/lib-sieve/plugins/imap4flags/ext-imapflags.c | 2 +- src/lib-sieve/plugins/imap4flags/tag-flags.c | 2 +- src/lib-sieve/plugins/imap4flags/tst-hasflag.c | 2 +- src/lib-sieve/plugins/include/cmd-global.c | 2 +- src/lib-sieve/plugins/include/cmd-include.c | 2 +- src/lib-sieve/plugins/include/cmd-return.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.c | 2 +- src/lib-sieve/plugins/include/ext-include-binary.h | 2 +- src/lib-sieve/plugins/include/ext-include-common.c | 2 +- src/lib-sieve/plugins/include/ext-include-common.h | 2 +- src/lib-sieve/plugins/include/ext-include-limits.h | 2 +- src/lib-sieve/plugins/include/ext-include-variables.c | 2 +- src/lib-sieve/plugins/include/ext-include-variables.h | 2 +- src/lib-sieve/plugins/include/ext-include.c | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox-common.h | 2 +- src/lib-sieve/plugins/mailbox/ext-mailbox.c | 2 +- src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 2 +- src/lib-sieve/plugins/mailbox/tst-mailboxexists.c | 2 +- src/lib-sieve/plugins/notify/cmd-denotify.c | 2 +- src/lib-sieve/plugins/notify/cmd-notify.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.c | 2 +- src/lib-sieve/plugins/notify/ext-notify-common.h | 2 +- src/lib-sieve/plugins/notify/ext-notify-limits.h | 2 +- src/lib-sieve/plugins/notify/ext-notify.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.c | 2 +- src/lib-sieve/plugins/regex/ext-regex-common.h | 2 +- src/lib-sieve/plugins/regex/ext-regex.c | 2 +- src/lib-sieve/plugins/regex/mcht-regex.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.c | 2 +- src/lib-sieve/plugins/relational/ext-relational-common.h | 2 +- src/lib-sieve/plugins/relational/ext-relational.c | 2 +- src/lib-sieve/plugins/relational/mcht-count.c | 2 +- src/lib-sieve/plugins/relational/mcht-value.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.c | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest-common.h | 2 +- src/lib-sieve/plugins/spamvirustest/ext-spamvirustest.c | 2 +- src/lib-sieve/plugins/spamvirustest/tst-spamvirustest.c | 2 +- src/lib-sieve/plugins/subaddress/ext-subaddress.c | 2 +- src/lib-sieve/plugins/vacation/cmd-vacation.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-common.h | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-seconds.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation.c | 2 +- src/lib-sieve/plugins/variables/cmd-set.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-arguments.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-dump.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-limits.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-modifiers.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-name.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-namespaces.h | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-operands.h | 2 +- src/lib-sieve/plugins/variables/ext-variables.c | 2 +- src/lib-sieve/plugins/variables/sieve-ext-variables.h | 2 +- src/lib-sieve/plugins/variables/tst-string.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/cmd-debug-log.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.h | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate.c | 2 +- src/lib-sieve/plugins/vnd.dovecot/duplicate/tst-duplicate.c | 2 +- src/lib-sieve/rfc2822.c | 2 +- src/lib-sieve/rfc2822.h | 2 +- src/lib-sieve/sieve-actions.c | 2 +- src/lib-sieve/sieve-actions.h | 2 +- src/lib-sieve/sieve-address-parts.c | 2 +- src/lib-sieve/sieve-address-parts.h | 2 +- src/lib-sieve/sieve-address.c | 2 +- src/lib-sieve/sieve-address.h | 2 +- src/lib-sieve/sieve-ast.c | 2 +- src/lib-sieve/sieve-ast.h | 2 +- src/lib-sieve/sieve-binary-code.c | 2 +- src/lib-sieve/sieve-binary-debug.c | 2 +- src/lib-sieve/sieve-binary-dumper.c | 2 +- src/lib-sieve/sieve-binary-dumper.h | 2 +- src/lib-sieve/sieve-binary-file.c | 2 +- src/lib-sieve/sieve-binary-private.h | 2 +- src/lib-sieve/sieve-binary.c | 2 +- src/lib-sieve/sieve-binary.h | 2 +- src/lib-sieve/sieve-code-dumper.c | 2 +- src/lib-sieve/sieve-code-dumper.h | 2 +- src/lib-sieve/sieve-code.c | 2 +- src/lib-sieve/sieve-code.h | 2 +- src/lib-sieve/sieve-commands.c | 2 +- src/lib-sieve/sieve-commands.h | 2 +- src/lib-sieve/sieve-common.h | 2 +- src/lib-sieve/sieve-comparators.c | 2 +- src/lib-sieve/sieve-comparators.h | 2 +- src/lib-sieve/sieve-config.h | 2 +- src/lib-sieve/sieve-dump.h | 2 +- src/lib-sieve/sieve-error-private.h | 2 +- src/lib-sieve/sieve-error.c | 2 +- src/lib-sieve/sieve-error.h | 2 +- src/lib-sieve/sieve-extensions.c | 2 +- src/lib-sieve/sieve-extensions.h | 2 +- src/lib-sieve/sieve-generator.c | 2 +- src/lib-sieve/sieve-generator.h | 2 +- src/lib-sieve/sieve-interpreter.c | 2 +- src/lib-sieve/sieve-interpreter.h | 2 +- src/lib-sieve/sieve-lexer.c | 2 +- src/lib-sieve/sieve-lexer.h | 2 +- src/lib-sieve/sieve-limits.h | 2 +- src/lib-sieve/sieve-match-types.c | 2 +- src/lib-sieve/sieve-match-types.h | 2 +- src/lib-sieve/sieve-match.c | 2 +- src/lib-sieve/sieve-match.h | 2 +- src/lib-sieve/sieve-message.c | 2 +- src/lib-sieve/sieve-message.h | 2 +- src/lib-sieve/sieve-objects.c | 2 +- src/lib-sieve/sieve-objects.h | 2 +- src/lib-sieve/sieve-parser.c | 2 +- src/lib-sieve/sieve-parser.h | 2 +- src/lib-sieve/sieve-plugins.c | 2 +- src/lib-sieve/sieve-plugins.h | 2 +- src/lib-sieve/sieve-result.c | 2 +- src/lib-sieve/sieve-result.h | 2 +- src/lib-sieve/sieve-runtime-trace.c | 2 +- src/lib-sieve/sieve-runtime-trace.h | 2 +- src/lib-sieve/sieve-runtime.h | 2 +- src/lib-sieve/sieve-script-dict.c | 2 +- src/lib-sieve/sieve-script-file.c | 2 +- src/lib-sieve/sieve-script-file.h | 2 +- src/lib-sieve/sieve-script-private.h | 2 +- src/lib-sieve/sieve-script.c | 2 +- src/lib-sieve/sieve-script.h | 2 +- src/lib-sieve/sieve-settings.c | 2 +- src/lib-sieve/sieve-settings.h | 2 +- src/lib-sieve/sieve-smtp.c | 2 +- src/lib-sieve/sieve-smtp.h | 2 +- src/lib-sieve/sieve-stringlist.c | 2 +- src/lib-sieve/sieve-stringlist.h | 2 +- src/lib-sieve/sieve-types.h | 2 +- src/lib-sieve/sieve-validator.c | 2 +- src/lib-sieve/sieve-validator.h | 2 +- src/lib-sieve/sieve.c | 2 +- src/lib-sieve/sieve.h | 2 +- src/lib-sieve/tst-address.c | 2 +- src/lib-sieve/tst-allof.c | 2 +- src/lib-sieve/tst-anyof.c | 2 +- src/lib-sieve/tst-exists.c | 2 +- src/lib-sieve/tst-header.c | 2 +- src/lib-sieve/tst-not.c | 2 +- src/lib-sieve/tst-size.c | 2 +- src/lib-sieve/tst-truefalse.c | 2 +- src/lib-sievestorage/sieve-storage-list.c | 2 +- src/lib-sievestorage/sieve-storage-list.h | 2 +- src/lib-sievestorage/sieve-storage-private.h | 2 +- src/lib-sievestorage/sieve-storage-quota.c | 2 +- src/lib-sievestorage/sieve-storage-quota.h | 2 +- src/lib-sievestorage/sieve-storage-save.c | 2 +- src/lib-sievestorage/sieve-storage-save.h | 2 +- src/lib-sievestorage/sieve-storage-script.c | 2 +- src/lib-sievestorage/sieve-storage-script.h | 2 +- src/lib-sievestorage/sieve-storage.c | 2 +- src/lib-sievestorage/sieve-storage.h | 2 +- src/managesieve-login/client-authenticate.c | 2 +- src/managesieve-login/client-authenticate.h | 2 +- src/managesieve-login/client.c | 2 +- src/managesieve-login/client.h | 2 +- src/managesieve-login/managesieve-login-settings-plugin.c | 2 +- src/managesieve-login/managesieve-login-settings-plugin.h | 2 +- src/managesieve-login/managesieve-login-settings.c | 2 +- src/managesieve-login/managesieve-login-settings.h | 2 +- src/managesieve-login/managesieve-proxy.c | 2 +- src/managesieve-login/managesieve-proxy.h | 2 +- src/managesieve/cmd-capability.c | 2 +- src/managesieve/cmd-deletescript.c | 2 +- src/managesieve/cmd-getscript.c | 2 +- src/managesieve/cmd-havespace.c | 2 +- src/managesieve/cmd-listscripts.c | 2 +- src/managesieve/cmd-logout.c | 2 +- src/managesieve/cmd-noop.c | 2 +- src/managesieve/cmd-putscript.c | 2 +- src/managesieve/cmd-renamescript.c | 2 +- src/managesieve/cmd-setactive.c | 2 +- src/managesieve/main.c | 2 +- src/managesieve/managesieve-capabilities.c | 2 +- src/managesieve/managesieve-capabilities.h | 2 +- src/managesieve/managesieve-client.c | 2 +- src/managesieve/managesieve-client.h | 2 +- src/managesieve/managesieve-commands.c | 2 +- src/managesieve/managesieve-commands.h | 2 +- src/managesieve/managesieve-common.h | 2 +- src/managesieve/managesieve-quota.c | 2 +- src/managesieve/managesieve-quota.h | 2 +- src/managesieve/managesieve-settings.c | 2 +- src/managesieve/managesieve-settings.h | 2 +- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 3 +- src/plugins/lda-sieve/lda-sieve-plugin.c | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.h | 2 +- src/sieve-tools/sieve-dump.c | 2 +- src/sieve-tools/sieve-filter.c | 2 +- src/sieve-tools/sieve-test.c | 2 +- src/sieve-tools/sievec.c | 2 +- src/testsuite/cmd-test-binary.c | 2 +- src/testsuite/cmd-test-config.c | 2 +- src/testsuite/cmd-test-fail.c | 2 +- src/testsuite/cmd-test-mailbox.c | 2 +- src/testsuite/cmd-test-message.c | 2 +- src/testsuite/cmd-test-result.c | 2 +- src/testsuite/cmd-test-set.c | 2 +- src/testsuite/cmd-test.c | 2 +- src/testsuite/ext-testsuite.c | 2 +- src/testsuite/testsuite-arguments.c | 2 +- src/testsuite/testsuite-arguments.h | 2 +- src/testsuite/testsuite-binary.c | 2 +- src/testsuite/testsuite-binary.h | 2 +- src/testsuite/testsuite-common.c | 2 +- src/testsuite/testsuite-common.h | 2 +- src/testsuite/testsuite-log.c | 2 +- src/testsuite/testsuite-log.h | 2 +- src/testsuite/testsuite-mailstore.c | 2 +- src/testsuite/testsuite-mailstore.h | 2 +- src/testsuite/testsuite-message.c | 2 +- src/testsuite/testsuite-message.h | 2 +- src/testsuite/testsuite-objects.c | 2 +- src/testsuite/testsuite-objects.h | 2 +- src/testsuite/testsuite-result.c | 2 +- src/testsuite/testsuite-result.h | 2 +- src/testsuite/testsuite-script.c | 2 +- src/testsuite/testsuite-script.h | 2 +- src/testsuite/testsuite-settings.c | 2 +- src/testsuite/testsuite-settings.h | 2 +- src/testsuite/testsuite-smtp.c | 2 +- src/testsuite/testsuite-smtp.h | 2 +- src/testsuite/testsuite-substitutions.c | 2 +- src/testsuite/testsuite-substitutions.h | 2 +- src/testsuite/testsuite-variables.c | 2 +- src/testsuite/testsuite-variables.h | 2 +- src/testsuite/testsuite.c | 2 +- src/testsuite/tst-test-error.c | 2 +- src/testsuite/tst-test-multiscript.c | 2 +- src/testsuite/tst-test-result-action.c | 2 +- src/testsuite/tst-test-result-execute.c | 2 +- src/testsuite/tst-test-script-compile.c | 2 +- src/testsuite/tst-test-script-run.c | 2 +- 320 files changed, 361 insertions(+), 329 deletions(-) diffs (truncated from 2935 to 300 lines): diff -r 1a06d4b9483c -r f4b4676a2784 .hgsigs --- a/.hgsigs Sun Apr 07 00:33:41 2013 +0200 +++ b/.hgsigs Sun Apr 07 00:41:19 2013 +0200 @@ -7,3 +7,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0 iQEcBAABAgAGBQJPwAS+AAoJEATWKx49+7T0ngIH/R+teyHN4Pdv4bFTkder85rxy4bzPDzlV9gGlhuKuRBtI8F7CKKWLEP/ESPdtZbMmsNj9k104q2U9pgUfkYrVKL4lrk3hlz44o8Smpwp/xrxyNY8/OuBof0LvyXjp7unHAvvAWFiEmeTpJMmSu77xE8wsEqZowHi8/Igh3lrQ3U129VP1xWr1mvnvQdMQk9TTMK3T38H9kUrz2CRdOWjJbxAA4rLyozGLqWUeSKepUcwAGANd35k8pNLYiONlGU8NZsQyzS2dfOl0TeolgqZn+UkmM9FZFFnD40WU8zPft0nK4g8cFZGObX4fsPyK03EAnR7BXd1BKdmr7jdppAnSvQ= 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= diff -r 1a06d4b9483c -r f4b4676a2784 .hgtags --- a/.hgtags Sun Apr 07 00:33:41 2013 +0200 +++ b/.hgtags Sun Apr 07 00:41:19 2013 +0200 @@ -13,3 +13,4 @@ e9ed5d5cef4b3b27ac5d980b3e4aeadaabeeeae2 0.3.1 265061e0d3f4b3d8f9e4f0fc0b978cd51f84690d 0.3.2 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3 +4932026768454443d87d2e6445552b331589dbb1 0.3.4 diff -r 1a06d4b9483c -r f4b4676a2784 NEWS --- a/NEWS Sun Apr 07 00:33:41 2013 +0200 +++ b/NEWS Sun Apr 07 00:41:19 2013 +0200 @@ -1,3 +1,32 @@ +v0.3.4 06-04-2013 Stephan Bosch + + * Changed error handling to be less of a nuisance for administrators. Strictly + user-caused errors are only reported in user log. Some errors are logged as + info instead. + * Sieve: Changed behavior of redirect in case of a duplicate message delivery + or a mail loop. If a duplicate is detected the implicit keep is canceled, + as though the redirect was successful. This prevents getting local + deliveries. The original SMTP recipient is used when it is available to + augment the entry in the LDA duplicate database. This way, duplicates are + only detected when (initially) addressed to the same recipient. + + Sieve vnd.dovecot.duplicate extension: added new features to the duplicate + test, making it possible to manually compose the key value for duplicate + checking. This extension is in the process of being standardized + (https://tools.ietf.org/html/draft-bosch-sieve-duplicate-01). + + Sieve date extension: generate warning when invalid date part is specified. + - Sieve editheader extension: fixed crash occuring when addheader :last was + used. + - Sieve include extension: fixed missing error cleanup that caused a resource + leak. + - Sieve vacation extension: fixed determination of From: address for when + sieve_vacation_dont_check_recipient is active. + - Sieve tools: the -D option wasn't enabled and documented for all tools. + - Siev dict script storage: fixed potential segfault occuring when dict + initialization fails. + - ManageSieve: fixed bug in skipping of CRLF at end of AUTHENTICATE command. + - ManageSieve: fixed handling of unkown commands pre-login. + - Fixed compile on Mageia Linux. + v0.3.3 18-09-2012 Stephan Bosch - Fixed compile against installed Dovecot headers. This was broken by the diff -r 1a06d4b9483c -r f4b4676a2784 TODO --- a/TODO Sun Apr 07 00:33:41 2013 +0200 +++ b/TODO Sun Apr 07 00:41:19 2013 +0200 @@ -1,21 +1,21 @@ -Current activities: +Active development is moved to Pigeonhole v0.4 for Dovecot v2.2. The v0.3.x +series for Dovecot v2.1 is maintained for bug fixes and small updates. Check +http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/TODO for the most +up-to-date TODO list. + +Parallel plugin-based efforts: + +* Implement enotify xmpp method as a plugin. +* Implement metadata and servermetadata extensions as a plugin. + - Compiles against dovecot metadata plugin, as currently developed by + Dennis Schridde. + +Open TODO issues for this revision: * Implement generic Sieve script object that abstracts from its location and add support for retrieving scripts from dict database. - Implement infrastructure for loading a sequence of global scripts from a database (for sieve_before/sieve_after). - -Parallel plugin-based efforts: - -* Implement plugin to pipe messages to external programs. Will probably be - merged with the main tree eventually. -* Implement enotify xmpp method as a plugin. -* Implement metadata and servermetadata extensions as a plugin. - - Compiles against dovecot metadata plugin, as currently developed by - Dennis Schridde. - -Next (mostly in order of descending priority/precedence): - * Make the sieve storage a base class with (possibly) various implementations, just like mail-storage. This aims to provide support for alternate types of script storage like LDAP or SQL database. diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-arg.c --- a/src/lib-managesieve/managesieve-arg.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-arg.h --- a/src/lib-managesieve/managesieve-arg.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-arg.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_ARG_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-parser.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-managesieve/managesieve-quote.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve-tool/mail-raw.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-discard.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-if.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-keep.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-redirect.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-require.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmd-stop.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/cmp-i-octet.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/edit-mail.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/edit-mail.h --- a/src/lib-sieve/edit-mail.h Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/edit-mail.h Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ #ifndef __EDIT_MAIL_H diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/ext-encoded-character.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension encoded-character diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/ext-envelope.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension envelope diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/ext-fileinto.c Sun Apr 07 00:41:19 2013 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file */ /* Extension fileinto diff -r 1a06d4b9483c -r f4b4676a2784 src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Sun Apr 07 00:33:41 2013 +0200 +++ b/src/lib-sieve/ext-reject.c Sun Apr 07 00:41:19 2013 +0200 From pigeonhole at rename-it.nl Sun Apr 7 01:41:27 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:41:27 +0200 Subject: dovecot-2.2-pigeonhole: Released v0.3.4 for Dovecot v2.1.16. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/493202676845 changeset: 1741:493202676845 user: Stephan Bosch date: Sat Apr 06 22:37:02 2013 +0200 description: Released v0.3.4 for Dovecot v2.1.16. diffstat: NEWS | 29 +++++++++++++++++++++++++++++ TODO | 26 +++++++++++++------------- configure.in | 2 +- 3 files changed, 43 insertions(+), 14 deletions(-) diffs (83 lines): diff -r 850cdbcf7976 -r 493202676845 NEWS --- a/NEWS Sat Apr 06 16:54:57 2013 +0200 +++ b/NEWS Sat Apr 06 22:37:02 2013 +0200 @@ -1,3 +1,32 @@ +v0.3.4 06-04-2013 Stephan Bosch + + * Changed error handling to be less of a nuisance for administrators. Strictly + user-caused errors are only reported in user log. Some errors are logged as + info instead. + * Sieve: Changed behavior of redirect in case of a duplicate message delivery + or a mail loop. If a duplicate is detected the implicit keep is canceled, + as though the redirect was successful. This prevents getting local + deliveries. The original SMTP recipient is used when it is available to + augment the entry in the LDA duplicate database. This way, duplicates are + only detected when (initially) addressed to the same recipient. + + Sieve vnd.dovecot.duplicate extension: added new features to the duplicate + test, making it possible to manually compose the key value for duplicate + checking. This extension is in the process of being standardized + (https://tools.ietf.org/html/draft-bosch-sieve-duplicate-01). + + Sieve date extension: generate warning when invalid date part is specified. + - Sieve editheader extension: fixed crash occuring when addheader :last was + used. + - Sieve include extension: fixed missing error cleanup that caused a resource + leak. + - Sieve vacation extension: fixed determination of From: address for when + sieve_vacation_dont_check_recipient is active. + - Sieve tools: the -D option wasn't enabled and documented for all tools. + - Siev dict script storage: fixed potential segfault occuring when dict + initialization fails. + - ManageSieve: fixed bug in skipping of CRLF at end of AUTHENTICATE command. + - ManageSieve: fixed handling of unkown commands pre-login. + - Fixed compile on Mageia Linux. + v0.3.3 18-09-2012 Stephan Bosch - Fixed compile against installed Dovecot headers. This was broken by the diff -r 850cdbcf7976 -r 493202676845 TODO --- a/TODO Sat Apr 06 16:54:57 2013 +0200 +++ b/TODO Sat Apr 06 22:37:02 2013 +0200 @@ -1,21 +1,21 @@ -Current activities: +Active development is moved to Pigeonhole v0.4 for Dovecot v2.2. The v0.3.x +series for Dovecot v2.1 is maintained for bug fixes and small updates. Check +http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/TODO for the most +up-to-date TODO list. + +Parallel plugin-based efforts: + +* Implement enotify xmpp method as a plugin. +* Implement metadata and servermetadata extensions as a plugin. + - Compiles against dovecot metadata plugin, as currently developed by + Dennis Schridde. + +Open TODO issues for this revision: * Implement generic Sieve script object that abstracts from its location and add support for retrieving scripts from dict database. - Implement infrastructure for loading a sequence of global scripts from a database (for sieve_before/sieve_after). - -Parallel plugin-based efforts: - -* Implement plugin to pipe messages to external programs. Will probably be - merged with the main tree eventually. -* Implement enotify xmpp method as a plugin. -* Implement metadata and servermetadata extensions as a plugin. - - Compiles against dovecot metadata plugin, as currently developed by - Dennis Schridde. - -Next (mostly in order of descending priority/precedence): - * Make the sieve storage a base class with (possibly) various implementations, just like mail-storage. This aims to provide support for alternate types of script storage like LDAP or SQL database. diff -r 850cdbcf7976 -r 493202676845 configure.in --- a/configure.in Sat Apr 06 16:54:57 2013 +0200 +++ b/configure.in Sat Apr 06 22:37:02 2013 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Pigeonhole], [0.3.3], [dovecot at dovecot.org], [dovecot-2.1-pigeonhole]) +AC_INIT([Pigeonhole], [0.3.4], [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 Sun Apr 7 01:58:44 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 00:58:44 +0200 Subject: dovecot-2.2-pigeonhole: Updated TODO. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/c6c6af49f8ac changeset: 1745:c6c6af49f8ac user: Stephan Bosch date: Sun Apr 07 00:58:40 2013 +0200 description: Updated TODO. diffstat: TODO | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diffs (23 lines): diff -r f4b4676a2784 -r c6c6af49f8ac TODO --- a/TODO Sun Apr 07 00:41:19 2013 +0200 +++ b/TODO Sun Apr 07 00:58:40 2013 +0200 @@ -1,7 +1,6 @@ -Active development is moved to Pigeonhole v0.4 for Dovecot v2.2. The v0.3.x -series for Dovecot v2.1 is maintained for bug fixes and small updates. Check -http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/TODO for the most -up-to-date TODO list. +Current activities: + +* Finish 0.4.0 release. Parallel plugin-based efforts: @@ -10,7 +9,7 @@ - Compiles against dovecot metadata plugin, as currently developed by Dennis Schridde. -Open TODO issues for this revision: +Next (mostly in order of descending priority/precedence): * Implement generic Sieve script object that abstracts from its location and add support for retrieving scripts from dict database. From pigeonhole at rename-it.nl Sun Apr 7 03:26:01 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 02:26:01 +0200 Subject: dovecot-2.2-pigeonhole: Added sieve_extprograms plugin to the ma... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/a68530fb25d4 changeset: 1746:a68530fb25d4 user: Stephan Bosch date: Sun Apr 07 02:25:46 2013 +0200 description: Added sieve_extprograms plugin to the main Pigeonhole tree. It is still a plugin, but no longer a separate package. diffstat: INSTALL | 27 +- Makefile.am | 24 +- configure.ac | 1 + doc/Makefile.am | 1 + doc/example-config/conf.d/90-sieve-extprograms.conf | 44 + doc/example-config/conf.d/90-sieve.conf | 1 + doc/example-config/conf.d/Makefile.am | 3 +- doc/plugins/sieve_extprograms.txt | 175 +++ doc/rfc/spec-bosch-sieve-extprograms.txt | 728 +++++++++++++++ doc/rfc/xml/reference.DSN.xml | 17 + doc/rfc/xml/reference.MDN.xml | 17 + doc/rfc/xml/reference.NET-UNICODE.xml | 17 + doc/rfc/xml/reference.RFC.3894.xml | 15 + doc/rfc/xml/reference.RFC.5429.xml | 15 + doc/rfc/xml/reference.SUBADDRESS.xml | 15 + doc/rfc/xml/reference.UTF-8.xml | 16 + doc/rfc/xml/spec-bosch-sieve-extprograms.xml | 616 ++++++++++++ src/plugins/Makefile.am | 2 +- src/plugins/sieve-extprograms/Makefile.am | 38 + src/plugins/sieve-extprograms/cmd-execute.c | 452 +++++++++ src/plugins/sieve-extprograms/cmd-filter.c | 283 +++++ src/plugins/sieve-extprograms/cmd-pipe.c | 388 +++++++ src/plugins/sieve-extprograms/ext-execute.c | 80 + src/plugins/sieve-extprograms/ext-filter.c | 80 + src/plugins/sieve-extprograms/ext-pipe.c | 111 ++ src/plugins/sieve-extprograms/script-client-local.c | 300 ++++++ src/plugins/sieve-extprograms/script-client-private.h | 59 + src/plugins/sieve-extprograms/script-client-remote.c | 327 ++++++ src/plugins/sieve-extprograms/script-client.c | 327 ++++++ src/plugins/sieve-extprograms/script-client.h | 35 + src/plugins/sieve-extprograms/sieve-extprograms-common.c | 594 ++++++++++++ src/plugins/sieve-extprograms/sieve-extprograms-common.h | 98 ++ src/plugins/sieve-extprograms/sieve-extprograms-plugin.c | 65 + src/plugins/sieve-extprograms/sieve-extprograms-plugin.h | 23 + tests/plugins/extprograms/bin/addheader | 6 + tests/plugins/extprograms/bin/cat | 3 + tests/plugins/extprograms/bin/env | 3 + tests/plugins/extprograms/bin/frame | 7 + tests/plugins/extprograms/bin/modify | 8 + tests/plugins/extprograms/bin/program | 5 + tests/plugins/extprograms/bin/replace | 12 + tests/plugins/extprograms/bin/sleep2 | 3 + tests/plugins/extprograms/bin/stderr | 20 + tests/plugins/extprograms/errors.svtest | 32 + tests/plugins/extprograms/errors/arguments.sieve | 5 + tests/plugins/extprograms/errors/programname.sieve | 25 + tests/plugins/extprograms/execute/command.svtest | 27 + tests/plugins/extprograms/execute/errors.svtest | 32 + tests/plugins/extprograms/execute/errors/syntax.sieve | 38 + tests/plugins/extprograms/execute/errors/variables.sieve | 7 + tests/plugins/extprograms/execute/execute.svtest | 103 ++ tests/plugins/extprograms/filter/command.svtest | 10 + tests/plugins/extprograms/filter/errors.svtest | 18 + tests/plugins/extprograms/filter/errors/syntax.sieve | 22 + tests/plugins/extprograms/filter/execute.svtest | 180 +++ tests/plugins/extprograms/pipe/command.svtest | 10 + tests/plugins/extprograms/pipe/errors.svtest | 57 + tests/plugins/extprograms/pipe/errors/syntax.sieve | 22 + tests/plugins/extprograms/pipe/errors/timeout.sieve | 3 + tests/plugins/extprograms/pipe/execute.svtest | 56 + 60 files changed, 5701 insertions(+), 7 deletions(-) diffs (truncated from 6004 to 300 lines): diff -r c6c6af49f8ac -r a68530fb25d4 INSTALL --- a/INSTALL Sun Apr 07 00:58:40 2013 +0200 +++ b/INSTALL Sun Apr 07 02:25:46 2013 +0200 @@ -127,7 +127,8 @@ The Pigeonhole Sieve interpreter can have plugins of its own. Using this setting, the used plugins can be specified. Check the Dovecot wiki (wiki2.dovecot.org) or the pigeonhole website (http://pigeonhole.dovecot.org) - for available plugins. + for available plugins. The sieve_extprograms plugin is included in this + release. sieve_user_log = The path to the file where the user log file is written. If not configured, a @@ -367,7 +368,7 @@ configuration options. Refer to doc/extensions/include.txt for settings specific to the include extension. -- Spamtest and Virustest extensions: +- Spamtest and virustest extensions: Using the spamtest and virustest extensions (RFC 5235), the Sieve language provides a uniform and standardized command interface for evaluating spam and @@ -382,6 +383,28 @@ configuration and are not enabled for use by default. Refer to doc/extensions/spamtest-virustest.txt for configuration information. +- Vnd.dovecot.duplicate extension: + + The vnd.dovecot.duplicate extension augments the Sieve filtering + implementation with a test that allows detecting and handling duplicate + message deliveries, e.g. as caused by mailinglists when people reply both to + the mailinglist and the user directly. + + The vnd.dovecot.duplicate extension requires explicit configuration and is not + enabled for use by default. Refer to doc/extensions/vnd.dovecot.duplicate.txt + for configuration information. + +- Vnd.dovovecot.pipe, vnd.dovecot.filter, vnd.dovecot.execute extensions: + + The "sieve_extprograms" plugin provides extensions to the Sieve filtering + language adding new action commands for invoking a predefined set of external + programs. Messages can be piped to or filtered through those programs and + string data can be input to and retrieved from those programs. + + This plugin and the extensions it provides require explicit configuration and + are not enabled for use by default. Refer to doc/plugins/sieve_extprograms.txt + for more information. + Sieve Interpreter - Migration from CMUSieve (Dovecot v1.0/v1.1) --------------------------------------------------------------- diff -r c6c6af49f8ac -r a68530fb25d4 Makefile.am --- a/Makefile.am Sun Apr 07 00:58:40 2013 +0200 +++ b/Makefile.am Sun Apr 07 02:25:46 2013 +0200 @@ -20,7 +20,7 @@ hg log --style=changelog > ChangeLog endif -# Testsuite tests +# Testsuite tests (FIXME: ugly) TESTSUITE_BIN = $(top_builddir)/src/testsuite/testsuite $(TESTSUITE_OPTIONS) @@ -148,8 +148,26 @@ $(test_cases): @$(TEST_BIN) $(top_srcdir)/$@ -.PHONY: $(test_cases) +TEST_EXTPROGRAMS_BIN = $(TEST_BIN) \ + -P src/plugins/sieve-extprograms/.libs/sieve_extprograms +extprograms_test_cases = \ + tests/plugins/extprograms/errors.svtest \ + tests/plugins/extprograms/pipe/command.svtest \ + tests/plugins/extprograms/pipe/errors.svtest \ + tests/plugins/extprograms/pipe/execute.svtest \ + tests/plugins/extprograms/filter/command.svtest \ + tests/plugins/extprograms/filter/errors.svtest \ + tests/plugins/extprograms/filter/execute.svtest \ + tests/plugins/extprograms/execute/command.svtest \ + tests/plugins/extprograms/execute/errors.svtest \ + tests/plugins/extprograms/execute/execute.svtest + +$(extprograms_test_cases): + @$(TEST_EXTPROGRAMS_BIN) $(top_srcdir)/$@ + +.PHONY: $(test_cases) $(extprograms_test_cases) test: $(test_cases) +test-plugins: $(extprograms_test_cases) -check: check-am test all-am +check: check-am test test-plugins all-am diff -r c6c6af49f8ac -r a68530fb25d4 configure.ac --- a/configure.ac Sun Apr 07 00:58:40 2013 +0200 +++ b/configure.ac Sun Apr 07 02:25:46 2013 +0200 @@ -129,6 +129,7 @@ src/plugins/Makefile src/plugins/doveadm-sieve/Makefile src/plugins/lda-sieve/Makefile +src/plugins/sieve-extprograms/Makefile src/sieve-tools/Makefile src/managesieve/Makefile src/managesieve-login/Makefile diff -r c6c6af49f8ac -r a68530fb25d4 doc/Makefile.am --- a/doc/Makefile.am Sun Apr 07 00:58:40 2013 +0200 +++ b/doc/Makefile.am Sun Apr 07 02:25:46 2013 +0200 @@ -10,5 +10,6 @@ EXTRA_DIST = \ devel \ extensions \ + plugins \ $(docfiles) diff -r c6c6af49f8ac -r a68530fb25d4 doc/example-config/conf.d/90-sieve-extprograms.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/example-config/conf.d/90-sieve-extprograms.conf Sun Apr 07 02:25:46 2013 +0200 @@ -0,0 +1,44 @@ +# Sieve Extprograms plugin configuration + +# Don't forget to add the sieve_extprograms plugin to the sieve_plugins setting. +# Also enable the extensions you need (one or more of vnd.dovecot.pipe, +# vnd.dovecot.filter and vnd.dovecot.execute) by adding these to the +# sieve_extensions or sieve_global_extensions settings. Restricting these +# extensions to a global context using sieve_global_extensions is recommended. + +plugin { + + # The directory where the program sockets are located for the + # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension + # respectively. The name of each unix socket contained in that directory + # directly maps to a program-name referenced from the Sieve script. + #sieve_pipe_socket_dir = sieve-pipe + #sieve_filter_socket_dir = sieve-filter + #sieve_execute_socket_dir = sieve-execute + + # The directory where the scripts are located for direct execution by the + # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension + # respectively. The name of each script contained in that directory + # directly maps to a program-name referenced from the Sieve script. + #sieve_pipe_bin_dir = /usr/lib/dovecot/sieve-pipe + #sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter + #sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute +} + +# An example program service called 'do-something' to pipe messages to +#service do-something { + # Define the executed script as parameter to the sieve service + #executable = script /usr/lib/dovecot/sieve-pipe/do-something.sh + + # Use some unprivileged user for executing the program + #user = dovenull + + # The unix socket located in the sieve_pipe_socket_dir (as defined in the + # plugin {} section above) + #unix_listener sieve-pipe/do-something { + # LDA/LMTP must have access + # user = vmail + # mode = 0600 + #} +#} + diff -r c6c6af49f8ac -r a68530fb25d4 doc/example-config/conf.d/90-sieve.conf --- a/doc/example-config/conf.d/90-sieve.conf Sun Apr 07 00:58:40 2013 +0200 +++ b/doc/example-config/conf.d/90-sieve.conf Sun Apr 07 02:25:46 2013 +0200 @@ -68,6 +68,7 @@ # setting, the used plugins can be specified. Check the Dovecot wiki # (wiki2.dovecot.org) or the pigeonhole website # (http://pigeonhole.dovecot.org) for available plugins. + # The sieve_extprograms plugin is included in this release. #sieve_plugins = # The separator that is expected between the :user and :detail diff -r c6c6af49f8ac -r a68530fb25d4 doc/example-config/conf.d/Makefile.am --- a/doc/example-config/conf.d/Makefile.am Sun Apr 07 00:58:40 2013 +0200 +++ b/doc/example-config/conf.d/Makefile.am Sun Apr 07 02:25:46 2013 +0200 @@ -3,7 +3,8 @@ exampledir = $(dovecot_docdir)/example-config/conf.d example_DATA = \ 20-managesieve.conf \ - 90-sieve.conf + 90-sieve.conf \ + 90-sieve-extprograms.conf EXTRA_DIST = \ $(example_DATA) diff -r c6c6af49f8ac -r a68530fb25d4 doc/plugins/sieve_extprograms.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/plugins/sieve_extprograms.txt Sun Apr 07 02:25:46 2013 +0200 @@ -0,0 +1,175 @@ +Sieve Extprograms plugin for Pigeonhole + +Relevant specifications +======================= + + doc/rfc/spec-bosch-sieve-extprograms.txt + +Introduction +============ + +Sieve (RFC 5228) is a highly extensible machine language specifically tailored +for internet message filtering. For the Dovecot Secure IMAP server, Sieve +support is provided by the Pigeonhole Sieve plugin. This package includes a +plugin for Pigeonhole called "sieve_extprograms", which extends the Sieve +filtering implementation with action commands for invoking a predefined set of +external programs. Messages can be piped to or filtered through those programs +and string data can be input to and retrieved from those programs. + +The Sieve language is explicitly designed to be powerful enough to be useful yet +limited in order to allow for a safe server-side filtering system. Therefore, +the base specification of the language makes it impossible for users to do +anything more complex (and dangerous) than write simple mail filters. One of the +consequences of this security-minded design is that users cannot execute +external programs from their mail filter. Particularly for server-side filtering +setups in which mail accounts have no corresponding system account, allowing the +execution of arbitrary programs from the mail filter can be a significant +security risk. However, such functionality can also be very useful, for instance +to easily implement a custom action or external effect that Sieve normally +cannot provide. + +The "sieve_extprograms" plugin provides an extension to the Sieve filtering +language adding new action commands for invoking a predefined set of external +programs. To mitigate the security concerns, the external programs cannot be +chosen arbitrarily; the available programs are restricted through administrator +configuration. + +This extension is specific to the Pigeonhole Sieve implementation for the +Dovecot Secure IMAP server. It will therefore most likely not be supported by +web interfaces or GUI-based Sieve editors. This extension is primarily meant for +use in small setups or global scripts that are managed by the systems +administrator. + +Implementation Status +--------------------- + +The "vnd.dovecot.pipe", "vnd.dovecot.filter" and "vnd.dovecot.execute" Sieve +language extensions introduced by this plugin are vendor-specific with draft +status and their implementation for Pigeonhole is experimental, which means that +the language extensions are still subject to change and that the current +implementation is not thoroughly tested. + +Configuration +============= + +The plugin is activated by adding it to the sieve_plugins setting: + +sieve_plugins = sieve_extprograms + +This plugin registers the "vnd.dovecot.pipe", "vnd.dovecot.filter" and +"vnd.dovecot.execute" extensions with the Sieve interpreter. However, these +extensions are not enabled by default and thus need to be enabled explicitly. It +is recommended to restrict the use of these extensions to global context by +adding these to the "sieve_global_extensions" setting. If personal user scripts +also need to directly access external programs, the extensions need to be added +to the "sieve_extensions" setting. + +The commands introduced by the Sieve language extensions in this plugin can +directly pipe a message or string data to an external program (typically a shell +script) by forking a new process. Alternatively, these can connect to a unix +socket behind which a Dovecot script service is listening to start the external +program, e.g. to execute as a different user or for added security. + +The program name specified for the new Sieve "pipe", "filter" and "execute" +commands is used to find the program or socket in a configured directory. +Separate directories are specified for the sockets and the directly executed +binaries. The socket directory is searched first. Since the use of "/" in +program names is prohibited, it is not possible to build a hierarchical +structure. + +Directly forked programs are executed with a limited set of environment +variables: HOME, USER, HOST, SENDER, RECIPIENT and ORIG_RECIPIENT. Programs +executed through the script-pipe socket service currently have no environment +set at all. + +If a shell script is expected to read a message or string data, it must fully +read the provided input until the data ends with EOF, otherwise the Sieve action +invoking the program will fail. The action will also fail when the shell script +returns a nonzero exit code. Standard output is available for returning a +message (for the filter command) or string data (for the execute command) to the +Sieve interpreter. Standard error is written to the LDA log file. + +The three extensions introduced by this plugin - "vnd.dovecot.pipe", +"vnd.dovecot.filter" and "vnd.dovecot.pipe" - each have separate but similar +configuration. The settings that specify a period are specified in s(econds), +unless followed by a d(ay), h(our) or m(inute) specifier character. The +following configuration settings are used, for which "" in the +setting name is replaced by either "pipe", "filter" or "execute" depending on +which extension is being configured. + +sieve__socket_dir = + Points to a directory relative to the Dovecot base_dir where the plugin looks + for script service sockets. + +sieve__bin_dir = + Points to a directory where the plugin looks for programs (shell scripts) to + execute directly and pipe messages to. + +sieve__exec_timeout = 10s + Configures the maximum execution time after which the program is forcefully + terminated. + From pigeonhole at rename-it.nl Sun Apr 7 03:30:16 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 02:30:16 +0200 Subject: dovecot-2.2-pigeonhole: Updated TODO to include items related to... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1d2bf4a7dc9f changeset: 1747:1d2bf4a7dc9f user: Stephan Bosch date: Sun Apr 07 02:30:11 2013 +0200 description: Updated TODO to include items related to sieve_extprograms plugin. diffstat: TODO | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diffs (36 lines): diff -r a68530fb25d4 -r 1d2bf4a7dc9f TODO --- a/TODO Sun Apr 07 02:25:46 2013 +0200 +++ b/TODO Sun Apr 07 02:30:11 2013 +0200 @@ -6,8 +6,7 @@ * Implement enotify xmpp method as a plugin. * Implement metadata and servermetadata extensions as a plugin. - - Compiles against dovecot metadata plugin, as currently developed by - Dennis Schridde. + - Update to native Dovecot metadata implementation once it is created. Next (mostly in order of descending priority/precedence): @@ -47,6 +46,13 @@ - Verify outgoing mail addresses at runtime when necessary (e.g. after variables substitution) - Improve handling of invalid addresses in headers (requires Dovecot changes) +* Improve sieve_extprograms plugin: + - Redesign (forcible) local script termination. It should use SIGCHLD and + a ioloop-based timeout. + - Add facility to trigger a temporary failure condition when a program + fails rather than an implicit keep. + - Add a method to implicitly pass environment variables such as SENDER and + RECIPIENT through the script socket service. * Properly implement Sieve internationalization support (utf-8 handling), currently it is not complete: - Make this implementation fully conform section 2.7.2 of RFC5228 (Comparisons @@ -70,7 +76,7 @@ * Build a server with test mail accounts that processes lots and lots of mail (e.g. spam, mailing lists etc.) -* ## MAKE A FOURTH MAIN RELEASE (0.4.x) ## +* ## MAKE A FIFTH MAIN RELEASE (0.5.x) ## * Implement extlists extension as a plugin * Enotify extension: detect use of variable values extracted from the message From pigeonhole at rename-it.nl Sun Apr 7 06:13:04 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 05:13:04 +0200 Subject: dovecot-2.1-pigeonhole: testsuite: fixed local timezone dependen... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/bc2126771d00 changeset: 1685: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 dovecot at dovecot.org Sun Apr 7 14:46:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 14:46:51 +0300 Subject: dovecot-2.2: replicator: Have remote dsync notify the replicator... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f1ba737bc241 changeset: 16217:f1ba737bc241 user: Timo Sirainen date: Sun Apr 07 14:46:45 2013 +0300 description: replicator: Have remote dsync notify the replicator that the user was just synced. This way the replicators are roughly in sync. diffstat: src/doveadm/dsync/doveadm-dsync.c | 58 ++++++++++++++++++++++-- src/replication/replicator/doveadm-connection.c | 28 ++++++++++++ src/replication/replicator/dsync-client.c | 2 +- 3 files changed, 82 insertions(+), 6 deletions(-) diffs (170 lines): diff -r 9824f8df62a3 -r f1ba737bc241 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Sat Apr 06 21:01:41 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Sun Apr 07 14:46:45 2013 +0300 @@ -36,7 +36,7 @@ #include #include -#define DSYNC_COMMON_GETOPT_ARGS "+dEfg:l:m:n:Nr:Rs:" +#define DSYNC_COMMON_GETOPT_ARGS "+dEfg:l:m:n:Nr:Rs:U" #define DSYNC_REMOTE_CMD_EXIT_WAIT_SECS 30 enum dsync_run_type { @@ -78,6 +78,7 @@ unsigned int remote_user_prefix:1; unsigned int no_mail_sync:1; unsigned int local_location_from_arg:1; + unsigned int replicator_notify:1; }; static bool legacy_dsync = FALSE; @@ -441,6 +442,42 @@ name, temp_prefix); } +static void +dsync_replicator_notify(struct dsync_cmd_context *ctx, const char *state_str) +{ +#define REPLICATOR_HANDSHAKE "VERSION\treplicator-doveadm-client\t1\t0\n" + const char *path; + string_t *str; + int fd; + + path = t_strdup_printf("%s/replicator-doveadm", + ctx->ctx.cur_mail_user->set->base_dir); + fd = net_connect_unix(path); + if (fd == -1) { + if (errno == ECONNREFUSED || errno == ENOENT) { + /* replicator not running on this server. ignore. */ + return; + } + i_error("net_connect_unix(%s) failed: %m", path); + return; + } + str = t_str_new(128); + str_append(str, REPLICATOR_HANDSHAKE"NOTIFY\t"); + str_append_tabescaped(str, ctx->ctx.cur_mail_user->username); + str_append_c(str, '\t'); + if (ctx->sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL) + str_append_c(str, 'f'); + str_append_c(str, '\t'); + str_append_tabescaped(str, state_str); + str_append_c(str, '\n'); + if (write_full(fd, str_data(str), str_len(str)) < 0) + i_error("write(%s) failed: %m", path); + /* we only wanted to notify replicator. we don't care enough about the + answer to wait for it. */ + if (close(fd) < 0) + i_error("close(%s) failed: %m", path); +} + static int cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user) { @@ -450,6 +487,7 @@ struct mail_namespace *sync_ns = NULL; enum dsync_brain_flags brain_flags; bool remote_errors_logged = FALSE; + string_t *state_str = NULL; int status = 0, ret = 0; user->admin = TRUE; @@ -501,13 +539,15 @@ } if (ctx->state_input != NULL) { - string_t *str = t_str_new(128); - dsync_brain_get_state(brain, str); - doveadm_print(str_c(str)); + state_str = t_str_new(128); + dsync_brain_get_state(brain, state_str); + doveadm_print(str_c(state_str)); } - if (dsync_brain_deinit(&brain) < 0) + if (dsync_brain_deinit(&brain) < 0) { ctx->ctx.exit_code = EX_TEMPFAIL; + ret = -1; + } dsync_ibc_deinit(&ibc); if (ibc2 != NULL) dsync_ibc_deinit(&ibc2); @@ -540,6 +580,11 @@ i_close_fd(&ctx->fd_err); ctx->input = NULL; ctx->output = NULL; + + if (ctx->replicator_notify) { + dsync_replicator_notify(ctx, state_str == NULL ? "" : + str_c(state_str)); + } return ret; } @@ -820,6 +865,9 @@ ctx->sync_type = DSYNC_BRAIN_SYNC_TYPE_STATE; ctx->state_input = optarg; break; + case 'U': + ctx->replicator_notify = TRUE; + break; default: return FALSE; } diff -r 9824f8df62a3 -r f1ba737bc241 src/replication/replicator/doveadm-connection.c --- a/src/replication/replicator/doveadm-connection.c Sat Apr 06 21:01:41 2013 +0300 +++ b/src/replication/replicator/doveadm-connection.c Sun Apr 07 14:46:45 2013 +0300 @@ -137,6 +137,32 @@ return 0; } +static int +client_input_notify(struct doveadm_connection *client, const char *const *args) +{ + struct replicator_user *user; + + /* */ + if (str_array_length(args) < 3) { + i_error("%s: NOTIFY: Invalid parameters", client->conn.name); + return -1; + } + + user = replicator_queue_add(client->queue, args[0], + REPLICATION_PRIORITY_NONE); + if (args[1][0] == 'f') + user->last_full_sync = ioloop_time; + user->last_fast_sync = ioloop_time; + user->last_update = ioloop_time; + + if (args[2][0] != '\0') { + i_free(user->state); + user->state = i_strdup(args[2]); + } + o_stream_send_str(client->conn.output, "+\n"); + return 0; +} + static int client_input_args(struct connection *conn, const char *const *args) { struct doveadm_connection *client = (struct doveadm_connection *)conn; @@ -152,6 +178,8 @@ return client_input_status(client, args); else if (strcmp(cmd, "REPLICATE") == 0) return client_input_replicate(client, args); + else if (strcmp(cmd, "NOTIFY") == 0) + return client_input_notify(client, args); i_error("%s: Unknown command: %s", conn->name, cmd); return -1; } diff -r 9824f8df62a3 -r f1ba737bc241 src/replication/replicator/dsync-client.c --- a/src/replication/replicator/dsync-client.c Sat Apr 06 21:01:41 2013 +0300 +++ b/src/replication/replicator/dsync-client.c Sun Apr 07 14:46:45 2013 +0300 @@ -209,7 +209,7 @@ str_printfa(cmd, "\tsync\t-d\t-N\t-l\t%u", DSYNC_LOCK_TIMEOUT_SECS); if (full) str_append(cmd, "\t-f"); - str_append(cmd, "\t-s\t"); + str_append(cmd, "\t-U\t-s\t"); if (state != NULL) str_append(cmd, state); str_append_c(cmd, '\n'); From dovecot at dovecot.org Sun Apr 7 14:56:50 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 14:56:50 +0300 Subject: dovecot-2.2: lib-http: Fixed receiving 100-continue reply after ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3647c414c67d changeset: 16218:3647c414c67d user: Timo Sirainen date: Sun Apr 07 14:56:19 2013 +0300 description: lib-http: Fixed receiving 100-continue reply after we already timed out waiting for it. diffstat: src/lib-http/http-client-connection.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (15 lines): diff -r f1ba737bc241 -r 3647c414c67d src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Sun Apr 07 14:46:45 2013 +0300 +++ b/src/lib-http/http-client-connection.c Sun Apr 07 14:56:19 2013 +0300 @@ -484,6 +484,11 @@ ignored by a user agent. */ if (req->payload_sync && response->status == 100) { + if (conn->payload_continue) { + http_client_connection_debug(conn, + "Got 100-continue response after timeout"); + return; + } conn->payload_continue = TRUE; http_client_connection_debug(conn, "Got expected 100-continue response"); From dovecot at dovecot.org Sun Apr 7 15:02:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 15:02:52 +0300 Subject: dovecot-2.2: lib-http: ssl_crypto_device and ssl_allow_invalid_c... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/abe0256dd3c0 changeset: 16219:abe0256dd3c0 user: Timo Sirainen date: Sun Apr 07 15:02:46 2013 +0300 description: lib-http: ssl_crypto_device and ssl_allow_invalid_cert settings were ignored. diffstat: src/lib-http/http-client.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 3647c414c67d -r abe0256dd3c0 src/lib-http/http-client.c --- a/src/lib-http/http-client.c Sun Apr 07 14:56:19 2013 +0300 +++ b/src/lib-http/http-client.c Sun Apr 07 15:02:46 2013 +0300 @@ -83,6 +83,8 @@ client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir); client->set.ssl_ca_dir = p_strdup(pool, set->ssl_ca_dir); 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.max_idle_time_msecs = set->max_idle_time_msecs; client->set.max_parallel_connections = (set->max_parallel_connections > 0 ? set->max_parallel_connections : 1); From dovecot at dovecot.org Sun Apr 7 15:03:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 15:03:40 +0300 Subject: dovecot-2.2: test-http-client: Allow invalid SSL certs in tests. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6bddc6d3530c changeset: 16220:6bddc6d3530c user: Timo Sirainen date: Sun Apr 07 15:03:36 2013 +0300 description: test-http-client: Allow invalid SSL certs in tests. diffstat: src/lib-http/test-http-client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r abe0256dd3c0 -r 6bddc6d3530c src/lib-http/test-http-client.c --- a/src/lib-http/test-http-client.c Sun Apr 07 15:02:46 2013 +0300 +++ b/src/lib-http/test-http-client.c Sun Apr 07 15:03:36 2013 +0300 @@ -328,7 +328,7 @@ memset(&http_set, 0, sizeof(http_set)); http_set.dns_client_socket_path = "/var/run/dovecot/dns-client"; - http_set.debug = TRUE; + http_set.ssl_allow_invalid_cert = TRUE; http_set.ssl_ca_dir = "/etc/ssl/certs"; http_set.max_idle_time_msecs = 5*1000; http_set.max_parallel_connections = 4; From dovecot at dovecot.org Sun Apr 7 15:10:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 15:10:51 +0300 Subject: dovecot-2.2: connection_disconnect(): Explicitly close input/out... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cb2e3676547d changeset: 16221:cb2e3676547d user: Timo Sirainen date: Sun Apr 07 15:10:36 2013 +0300 description: connection_disconnect(): Explicitly close input/output stream. This makes sure that if the ostream has some data pending and is still referenced, the io_remove() won't be called after fd is already closed. diffstat: src/lib/connection.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 6bddc6d3530c -r cb2e3676547d src/lib/connection.c --- a/src/lib/connection.c Sun Apr 07 15:03:36 2013 +0300 +++ b/src/lib/connection.c Sun Apr 07 15:10:36 2013 +0300 @@ -243,10 +243,14 @@ timeout_remove(&conn->to); if (conn->io != NULL) io_remove(&conn->io); - if (conn->input != NULL) + if (conn->input != NULL) { + i_stream_close(conn->input); i_stream_destroy(&conn->input); - if (conn->output != NULL) + } + if (conn->output != NULL) { + o_stream_close(conn->output); o_stream_destroy(&conn->output); + } if (conn->fd_in != -1) { if (close(conn->fd_in) < 0) i_error("close(%s) failed: %m", conn->name); From dovecot at dovecot.org Sun Apr 7 15:37:12 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 15:37:12 +0300 Subject: dovecot-2.2: dsync: Fixed talking to earlier dsync without mailb... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d79cf48f1072 changeset: 16222:d79cf48f1072 user: Timo Sirainen date: Sun Apr 07 15:36:35 2013 +0300 description: dsync: Fixed talking to earlier dsync without mailbox attribute support. Most importantly it can now be used as an example how to add more features to dsync. diffstat: src/doveadm/dsync/dsync-brain-mailbox-tree.c | 2 +- src/doveadm/dsync/dsync-brain-mailbox.c | 2 +- src/doveadm/dsync/dsync-brain-mails.c | 8 ++++---- src/doveadm/dsync/dsync-brain.c | 2 +- src/doveadm/dsync/dsync-ibc-pipe.c | 3 ++- src/doveadm/dsync/dsync-ibc-private.h | 3 ++- src/doveadm/dsync/dsync-ibc-stream.c | 21 +++++++++++++++++---- src/doveadm/dsync/dsync-ibc.c | 4 ++-- src/doveadm/dsync/dsync-ibc.h | 12 +++++++++++- 9 files changed, 41 insertions(+), 16 deletions(-) diffs (210 lines): diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-brain-mailbox-tree.c --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Sun Apr 07 15:36:35 2013 +0300 @@ -124,7 +124,7 @@ return; } dsync_mailbox_tree_iter_deinit(&brain->local_tree_iter); - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAILBOX_TREE); brain->state = DSYNC_STATE_SEND_MAILBOX_TREE_DELETES; } diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-brain-mailbox.c --- a/src/doveadm/dsync/dsync-brain-mailbox.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox.c Sun Apr 07 15:36:35 2013 +0300 @@ -412,7 +412,7 @@ if (!dsync_brain_next_mailbox(brain, &box, &dsync_box)) { brain->state = DSYNC_STATE_DONE; - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAILBOX); return; } diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-brain-mails.c --- a/src/doveadm/dsync/dsync-brain-mails.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain-mails.c Sun Apr 07 15:36:35 2013 +0300 @@ -87,7 +87,7 @@ if (dsync_ibc_send_mailbox_attribute(brain->ibc, attr) == 0) return; } - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAILBOX_ATTRIBUTE); brain->box_send_state = DSYNC_BOX_STATE_CHANGES; } @@ -119,7 +119,7 @@ if (dsync_ibc_send_change(brain->ibc, change) == 0) return; } - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAIL_CHANGES); if (brain->mail_requests && brain->box_importer != NULL) brain->box_send_state = DSYNC_BOX_STATE_MAIL_REQUESTS; else @@ -159,7 +159,7 @@ if (brain->box_recv_state < DSYNC_BOX_STATE_MAIL_REQUESTS) return FALSE; - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAIL_REQUESTS); if (brain->box_exporter != NULL) brain->box_send_state = DSYNC_BOX_STATE_MAILS; else { @@ -257,7 +257,7 @@ } brain->box_send_state = DSYNC_BOX_STATE_DONE; - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAILS); dsync_brain_sync_half_finished(brain); return TRUE; diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Sun Apr 07 15:36:35 2013 +0300 @@ -344,7 +344,7 @@ } hash_table_iterate_deinit(&brain->mailbox_states_iter); - dsync_ibc_send_end_of_list(brain->ibc); + dsync_ibc_send_end_of_list(brain->ibc, DSYNC_IBC_EOL_MAILBOX_STATE); brain->state = DSYNC_STATE_SEND_MAILBOX_TREE; } diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-ibc-pipe.c --- a/src/doveadm/dsync/dsync-ibc-pipe.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-pipe.c Sun Apr 07 15:36:35 2013 +0300 @@ -195,7 +195,8 @@ } static void -dsync_ibc_pipe_send_end_of_list(struct dsync_ibc *ibc) +dsync_ibc_pipe_send_end_of_list(struct dsync_ibc *ibc, + enum dsync_ibc_eol_type type ATTR_UNUSED) { struct dsync_ibc_pipe *pipe = (struct dsync_ibc_pipe *)ibc; diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-ibc-private.h --- a/src/doveadm/dsync/dsync-ibc-private.h Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-private.h Sun Apr 07 15:36:35 2013 +0300 @@ -12,7 +12,8 @@ (*recv_handshake)(struct dsync_ibc *ibc, const struct dsync_ibc_settings **set_r); - void (*send_end_of_list)(struct dsync_ibc *ibc); + void (*send_end_of_list)(struct dsync_ibc *ibc, + enum dsync_ibc_eol_type type); void (*send_mailbox_state)(struct dsync_ibc *ibc, const struct dsync_mailbox_state *state); diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-ibc-stream.c --- a/src/doveadm/dsync/dsync-ibc-stream.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Sun Apr 07 15:36:35 2013 +0300 @@ -61,8 +61,9 @@ char chr; const char *required_keys; const char *optional_keys; + unsigned int min_minor_version; } items[ITEM_END_OF_LIST+1] = { - { NULL, '\0', NULL, NULL }, + { NULL, '\0', NULL, NULL, 0 }, { .name = "done", .chr = 'X', .optional_keys = "" @@ -100,7 +101,8 @@ { .name = "mailbox_attribute", .chr = 'A', .required_keys = "type key", - .optional_keys = "value stream deleted last_change modseq" + .optional_keys = "value stream deleted last_change modseq", + .min_minor_version = DSYNC_PROTOCOL_MINOR_HAVE_ATTRIBUTES }, { .name = "mail_change", .chr = 'C', @@ -123,7 +125,7 @@ .optional_keys = "last_used" }, - { "end_of_list", '\0', NULL, NULL } + { "end_of_list", '\0', NULL, NULL, 0 } }; struct dsync_ibc_stream { @@ -453,6 +455,7 @@ for (i = ITEM_DONE + 1; i < ITEM_END_OF_LIST; i++) { if (ibc->deserializers[i] == NULL && + ibc->minor_version >= items[i].min_minor_version && (items[i].required_keys != NULL || items[i].optional_keys != NULL)) { dsync_ibc_input_error(ibc, NULL, @@ -707,12 +710,22 @@ } static void -dsync_ibc_stream_send_end_of_list(struct dsync_ibc *_ibc) +dsync_ibc_stream_send_end_of_list(struct dsync_ibc *_ibc, + enum dsync_ibc_eol_type type) { struct dsync_ibc_stream *ibc = (struct dsync_ibc_stream *)_ibc; i_assert(ibc->value_output == NULL); + switch (type) { + case DSYNC_IBC_EOL_MAILBOX_ATTRIBUTE: + if (ibc->minor_version < DSYNC_PROTOCOL_MINOR_HAVE_ATTRIBUTES) + return; + break; + default: + break; + } + o_stream_nsend_str(ibc->output, END_OF_LIST_LINE"\n"); } diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-ibc.c --- a/src/doveadm/dsync/dsync-ibc.c Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc.c Sun Apr 07 15:36:35 2013 +0300 @@ -41,9 +41,9 @@ } enum dsync_ibc_send_ret -dsync_ibc_send_end_of_list(struct dsync_ibc *ibc) +dsync_ibc_send_end_of_list(struct dsync_ibc *ibc, enum dsync_ibc_eol_type type) { - ibc->v.send_end_of_list(ibc); + ibc->v.send_end_of_list(ibc, type); return dsync_ibc_send_ret(ibc); } diff -r cb2e3676547d -r d79cf48f1072 src/doveadm/dsync/dsync-ibc.h --- a/src/doveadm/dsync/dsync-ibc.h Sun Apr 07 15:10:36 2013 +0300 +++ b/src/doveadm/dsync/dsync-ibc.h Sun Apr 07 15:36:35 2013 +0300 @@ -29,6 +29,16 @@ DSYNC_IBC_RECV_RET_OK = 1 }; +enum dsync_ibc_eol_type { + DSYNC_IBC_EOL_MAILBOX_STATE, + DSYNC_IBC_EOL_MAILBOX_TREE, + DSYNC_IBC_EOL_MAILBOX_ATTRIBUTE, + DSYNC_IBC_EOL_MAILBOX, + DSYNC_IBC_EOL_MAIL_CHANGES, + DSYNC_IBC_EOL_MAIL_REQUESTS, + DSYNC_IBC_EOL_MAILS +}; + struct dsync_ibc_settings { /* Server hostname. Used for determining which server does the locking. */ @@ -64,7 +74,7 @@ const struct dsync_ibc_settings **set_r); enum dsync_ibc_send_ret ATTR_NOWARN_UNUSED_RESULT -dsync_ibc_send_end_of_list(struct dsync_ibc *ibc); +dsync_ibc_send_end_of_list(struct dsync_ibc *ibc, enum dsync_ibc_eol_type type); enum dsync_ibc_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_ibc_send_mailbox_state(struct dsync_ibc *ibc, From dovecot at dovecot.org Sun Apr 7 16:36:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 16:36:11 +0300 Subject: dovecot-2.2: lib-storage: If transaction commit fails, don't try... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3c4712bcf473 changeset: 16223:3c4712bcf473 user: Timo Sirainen date: Sun Apr 07 16:36:00 2013 +0300 description: lib-storage: If transaction commit fails, don't try to access garbage memory. diffstat: src/lib-storage/mail-storage.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r d79cf48f1072 -r 3c4712bcf473 src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Sun Apr 07 15:36:35 2013 +0300 +++ b/src/lib-storage/mail-storage.c Sun Apr 07 16:36:00 2013 +0300 @@ -1825,7 +1825,8 @@ /* either all the saved messages get UIDs or none, because a) we failed, b) MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS not set, c) backend doesn't support it (e.g. virtual plugin) */ - i_assert(seq_range_count(&changes_r->saved_uids) == save_count || + i_assert(ret < 0 || + seq_range_count(&changes_r->saved_uids) == save_count || array_count(&changes_r->saved_uids) == 0); if (ret < 0 && changes_r->pool != NULL) pool_unref(&changes_r->pool); From dovecot at dovecot.org Sun Apr 7 17:47:31 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 17:47:31 +0300 Subject: dovecot-2.2: dsync: Fixed -U to send the notification on the rem... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8b13ef2e9569 changeset: 16224:8b13ef2e9569 user: Timo Sirainen date: Sun Apr 07 17:47:16 2013 +0300 description: dsync: Fixed -U to send the notification on the remote server, not local. diffstat: src/doveadm/doveadm-settings.c | 2 +- src/doveadm/dsync/doveadm-dsync.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diffs (84 lines): diff -r 3c4712bcf473 -r 8b13ef2e9569 src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Sun Apr 07 16:36:00 2013 +0300 +++ b/src/doveadm/doveadm-settings.c Sun Apr 07 17:47:16 2013 +0300 @@ -81,7 +81,7 @@ .doveadm_password = "", .doveadm_allowed_commands = "", .dsync_alt_char = "_", - .dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u", + .dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u -U", .plugin_envs = ARRAY_INIT }; diff -r 3c4712bcf473 -r 8b13ef2e9569 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Sun Apr 07 16:36:00 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Sun Apr 07 17:47:16 2013 +0300 @@ -487,7 +487,6 @@ struct mail_namespace *sync_ns = NULL; enum dsync_brain_flags brain_flags; bool remote_errors_logged = FALSE; - string_t *state_str = NULL; int status = 0, ret = 0; user->admin = TRUE; @@ -539,7 +538,7 @@ } if (ctx->state_input != NULL) { - state_str = t_str_new(128); + string_t *state_str = t_str_new(128); dsync_brain_get_state(brain, state_str); doveadm_print(str_c(state_str)); } @@ -581,10 +580,6 @@ ctx->input = NULL; ctx->output = NULL; - if (ctx->replicator_notify) { - dsync_replicator_notify(ctx, state_str == NULL ? "" : - str_c(state_str)); - } return ret; } @@ -669,6 +664,8 @@ str_append_tabescaped(cmd, ctx->ctx.cur_username); str_append(cmd, "\tdsync-server\t-u"); str_append_tabescaped(cmd, ctx->ctx.cur_username); + if (ctx->replicator_notify) + str_append(cmd, "\t-U"); str_append_c(cmd, '\n'); ctx->tcp_conn = conn; @@ -945,6 +942,12 @@ o_stream_close(_ctx->conn->output); } + if (ctx->replicator_notify) { + string_t *state_str = t_str_new(128); + dsync_brain_get_state(brain, state_str); + dsync_replicator_notify(ctx, str_c(state_str)); + } + return _ctx->exit_code == 0 ? 0 : -1; } @@ -961,6 +964,9 @@ case 'r': ctx->rawlog_path = optarg; break; + case 'U': + ctx->replicator_notify = TRUE; + break; default: return FALSE; } @@ -972,7 +978,7 @@ struct dsync_cmd_context *ctx; ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context); - ctx->ctx.getopt_args = "Er:"; + ctx->ctx.getopt_args = "Er:U"; ctx->ctx.v.parse_arg = cmd_mailbox_dsync_server_parse_arg; ctx->ctx.v.run = cmd_dsync_server_run; ctx->sync_type = DSYNC_BRAIN_SYNC_TYPE_CHANGED; From dovecot at dovecot.org Sun Apr 7 18:02:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 18:02:06 +0300 Subject: dovecot-2.2: Added "doveadm replicator remove" command to remove... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/872b06768835 changeset: 16225:872b06768835 user: Timo Sirainen date: Sun Apr 07 18:01:52 2013 +0300 description: Added "doveadm replicator remove" command to remove users from replicator queue. diffstat: src/doveadm/doveadm-replicator.c | 30 +++++++++++++++++++++++++ src/replication/replicator/doveadm-connection.c | 22 ++++++++++++++++++ src/replication/replicator/replicator-queue.c | 8 +++++- src/replication/replicator/replicator-queue.h | 3 ++ 4 files changed, 62 insertions(+), 1 deletions(-) diffs (121 lines): diff -r 8b13ef2e9569 -r 872b06768835 src/doveadm/doveadm-replicator.c --- a/src/doveadm/doveadm-replicator.c Sun Apr 07 17:47:16 2013 +0300 +++ b/src/doveadm/doveadm-replicator.c Sun Apr 07 18:01:52 2013 +0300 @@ -215,11 +215,41 @@ replicator_disconnect(ctx); } +static void cmd_replicator_remove(int argc, char *argv[]) +{ + struct replicator_context *ctx; + string_t *str; + const char *line; + + if (argv[1] == NULL) + replicator_cmd_help(cmd_replicator_remove); + + ctx = cmd_replicator_init(argc, argv, "a:", cmd_replicator_remove); + + str = t_str_new(128); + str_append(str, "REMOVE\t"); + str_append_tabescaped(str, argv[1]); + str_append_c(str, '\n'); + replicator_send(ctx, str_c(str)); + + line = i_stream_read_next_line(ctx->input); + if (line == NULL) { + i_error("Replicator disconnected unexpectedly"); + doveadm_exit_code = EX_TEMPFAIL; + } else if (line[0] != '+') { + i_error("Replicator failed: %s", line+1); + doveadm_exit_code = EX_USAGE; + } + replicator_disconnect(ctx); +} + struct doveadm_cmd doveadm_cmd_replicator[] = { { cmd_replicator_status, "replicator status", "[-a ] []" }, { cmd_replicator_replicate, "replicator replicate", "[-a ] [-p ] " }, + { cmd_replicator_remove, "replicator remove", + "[-a ] " }, }; static void replicator_cmd_help(doveadm_command_t *cmd) diff -r 8b13ef2e9569 -r 872b06768835 src/replication/replicator/doveadm-connection.c --- a/src/replication/replicator/doveadm-connection.c Sun Apr 07 17:47:16 2013 +0300 +++ b/src/replication/replicator/doveadm-connection.c Sun Apr 07 18:01:52 2013 +0300 @@ -138,6 +138,26 @@ } static int +client_input_remove(struct doveadm_connection *client, const char *const *args) +{ + struct replicator_user *user; + + /* */ + if (str_array_length(args) != 1) { + i_error("%s: REMOVE: Invalid parameters", client->conn.name); + return -1; + } + user = replicator_queue_lookup(client->queue, args[0]); + if (user == NULL) + o_stream_send_str(client->conn.output, "-User not found\n"); + else { + replicator_queue_remove(client->queue, &user); + o_stream_send_str(client->conn.output, "+\n"); + } + return 0; +} + +static int client_input_notify(struct doveadm_connection *client, const char *const *args) { struct replicator_user *user; @@ -178,6 +198,8 @@ return client_input_status(client, args); else if (strcmp(cmd, "REPLICATE") == 0) return client_input_replicate(client, args); + else if (strcmp(cmd, "REMOVE") == 0) + return client_input_remove(client, args); else if (strcmp(cmd, "NOTIFY") == 0) return client_input_notify(client, args); i_error("%s: Unknown command: %s", conn->name, cmd); diff -r 8b13ef2e9569 -r 872b06768835 src/replication/replicator/replicator-queue.c --- a/src/replication/replicator/replicator-queue.c Sun Apr 07 17:47:16 2013 +0300 +++ b/src/replication/replicator/replicator-queue.c Sun Apr 07 18:01:52 2013 +0300 @@ -120,13 +120,19 @@ queue->change_context = context; } +struct replicator_user * +replicator_queue_lookup(struct replicator_queue *queue, const char *username) +{ + return hash_table_lookup(queue->user_hash, username); +} + static struct replicator_user * replicator_queue_add_int(struct replicator_queue *queue, const char *username, enum replication_priority priority) { struct replicator_user *user; - user = hash_table_lookup(queue->user_hash, username); + user = replicator_queue_lookup(queue, username); if (user == NULL) { user = i_new(struct replicator_user, 1); user->username = i_strdup(username); diff -r 8b13ef2e9569 -r 872b06768835 src/replication/replicator/replicator-queue.h --- a/src/replication/replicator/replicator-queue.h Sun Apr 07 17:47:16 2013 +0300 +++ b/src/replication/replicator/replicator-queue.h Sun Apr 07 18:01:52 2013 +0300 @@ -35,6 +35,9 @@ void (*callback)(void *context), void *context); +/* Lookup an existing user */ +struct replicator_user * +replicator_queue_lookup(struct replicator_queue *queue, const char *username); /* Add a user to queue and return it. If the user already exists, it's updated only if the new priority is higher. */ struct replicator_user * From dovecot at dovecot.org Sun Apr 7 18:33:26 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 18:33:26 +0300 Subject: dovecot-2.2: example-config: Added mailbox_list_index. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b945403c491f changeset: 16226:b945403c491f user: Timo Sirainen date: Sun Apr 07 18:33:21 2013 +0300 description: example-config: Added mailbox_list_index. diffstat: doc/example-config/conf.d/10-mail.conf | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diffs (14 lines): diff -r 872b06768835 -r b945403c491f doc/example-config/conf.d/10-mail.conf --- a/doc/example-config/conf.d/10-mail.conf Sun Apr 07 18:01:52 2013 +0300 +++ b/doc/example-config/conf.d/10-mail.conf Sun Apr 07 18:33:21 2013 +0300 @@ -211,6 +211,10 @@ ## Mailbox handling optimizations ## +# Mailbox list indexes can be used to optimize IMAP STATUS commands. They are +# also required for IMAP NOTIFY extension to be enabled. +#mailbox_list_index = no + # The minimum number of mails in a mailbox before updates are done to cache # file. This allows optimizing Dovecot's behavior to do less disk writes at # the cost of more disk reads. From dovecot at dovecot.org Sun Apr 7 18:50:41 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 18:50:41 +0300 Subject: dovecot-2.2: lib-storage: dovecot.mailbox.log should have used f... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6e8d5d78ce0d changeset: 16227:6e8d5d78ce0d user: Timo Sirainen date: Sun Apr 07 18:49:32 2013 +0300 description: lib-storage: dovecot.mailbox.log should have used file permissions, not dir Although this didn't actually make any difference since 0666 mask was used. diffstat: src/lib-storage/mailbox-list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r b945403c491f -r 6e8d5d78ce0d src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Sun Apr 07 18:33:21 2013 +0300 +++ b/src/lib-storage/mailbox-list.c Sun Apr 07 18:49:32 2013 +0300 @@ -1433,7 +1433,7 @@ list->changelog = mailbox_log_alloc(path); mailbox_list_get_root_permissions(list, &perm); - mailbox_log_set_permissions(list->changelog, perm.dir_create_mode, + mailbox_log_set_permissions(list->changelog, perm.file_create_mode, perm.file_create_gid, perm.file_create_gid_origin); return TRUE; From dovecot at dovecot.org Sun Apr 7 18:50:41 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 18:50:41 +0300 Subject: dovecot-2.2: lib-storage: mailbox list index didn't get its perm... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0b7cb5fdc7b5 changeset: 16228:0b7cb5fdc7b5 user: Timo Sirainen date: Sun Apr 07 18:50:31 2013 +0300 description: lib-storage: mailbox list index didn't get its permissions from the root dir. diffstat: src/lib-storage/list/mailbox-list-index.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (23 lines): diff -r 6e8d5d78ce0d -r 0b7cb5fdc7b5 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Sun Apr 07 18:49:32 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Sun Apr 07 18:50:31 2013 +0300 @@ -40,6 +40,7 @@ { struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list); const struct mail_storage_settings *set = list->mail_set; + struct mailbox_permissions perm; enum mail_index_open_flags index_flags; unsigned int lock_timeout; @@ -55,6 +56,11 @@ lock_timeout = set->mail_max_lock_timeout == 0 ? UINT_MAX : set->mail_max_lock_timeout; + mailbox_list_get_root_permissions(list, &perm); + mail_index_set_permissions(ilist->index, perm.file_create_mode, + perm.file_create_gid, + perm.file_create_gid_origin); + mail_index_set_lock_method(ilist->index, set->parsed_lock_method, lock_timeout); if (mail_index_open_or_create(ilist->index, index_flags) < 0) { From dovecot at dovecot.org Sun Apr 7 19:50:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 19:50:43 +0300 Subject: dovecot-2.2: Moved lib-fs/fs-test to "doveadm fs" command. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d09aa718221f changeset: 16229:d09aa718221f user: Timo Sirainen date: Sun Apr 07 19:50:29 2013 +0300 description: Moved lib-fs/fs-test to "doveadm fs" command. diffstat: .hgignore | 1 - src/doveadm/Makefile.am | 1 + src/doveadm/doveadm-fs.c | 232 +++++++++++++++++++++++++++++++++++++++++ src/doveadm/doveadm-settings.c | 2 + src/doveadm/doveadm-settings.h | 1 + src/doveadm/doveadm.c | 1 + src/doveadm/doveadm.h | 1 + src/lib-fs/Makefile.am | 12 -- src/lib-fs/fs-test.c | 164 ---------------------------- 9 files changed, 238 insertions(+), 177 deletions(-) diffs (truncated from 504 to 300 lines): diff -r 0b7cb5fdc7b5 -r d09aa718221f .hgignore --- a/.hgignore Sun Apr 07 18:50:31 2013 +0300 +++ b/.hgignore Sun Apr 07 19:50:29 2013 +0300 @@ -77,7 +77,6 @@ src/ipc/ipc src/lib/unicodemap.c src/lib/UnicodeData.txt -src/lib-fs/fs-test src/lib-dict/dict-drivers-register.c src/lib-sql/sql-drivers-register.c src/lib-storage/register/mail-storage-register.c diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Sun Apr 07 18:50:31 2013 +0300 +++ b/src/doveadm/Makefile.am Sun Apr 07 19:50:29 2013 +0300 @@ -89,6 +89,7 @@ doveadm-dump-log.c \ doveadm-dump-mailboxlog.c \ doveadm-dump-thread.c \ + doveadm-fs.c \ doveadm-instance.c \ doveadm-kick.c \ doveadm-log.c \ diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/doveadm-fs.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/doveadm/doveadm-fs.c Sun Apr 07 19:50:29 2013 +0300 @@ -0,0 +1,232 @@ +/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "istream.h" +#include "ostream.h" +#include "iostream-ssl.h" +#include "fs-api.h" +#include "doveadm.h" + +#include + +static void fs_cmd_help(doveadm_command_t *cmd); + +static struct fs * +cmd_fs_init(int *argc, char **argv[], int own_arg_count, doveadm_command_t *cmd) +{ + struct ssl_iostream_settings ssl_set; + struct fs_settings fs_set; + struct fs *fs; + const char *error; + + if (*argc != 3 + own_arg_count) + fs_cmd_help(cmd); + + memset(&ssl_set, 0, sizeof(ssl_set)); + ssl_set.ca_dir = doveadm_settings->ssl_client_ca_dir; + + memset(&fs_set, 0, sizeof(fs_set)); + fs_set.ssl_client_set = &ssl_set; + fs_set.temp_dir = "/tmp"; + + if (fs_init((*argv)[1], (*argv)[2], &fs_set, &fs, &error) < 0) + i_fatal("fs_init() failed: %s", error); + + *argc += 3; + *argv += 3; + return fs; +} + +static void cmd_fs_get(int argc, char *argv[]) +{ + struct fs *fs; + struct fs_file *file; + struct istream *input; + const unsigned char *data; + size_t size; + ssize_t ret; + + fs = cmd_fs_init(&argc, &argv, 1, cmd_fs_get); + + file = fs_file_init(fs, argv[0], FS_OPEN_MODE_READONLY); + input = fs_read_stream(file, IO_BLOCK_SIZE); + while ((ret = i_stream_read_data(input, &data, &size, 0)) > 0) { + fwrite(data, 1, size, stdout); + i_stream_skip(input, size); + } + i_assert(ret == -1); + if (input->stream_errno == ENOENT) { + i_error("%s doesn't exist", fs_file_path(file)); + doveadm_exit_code = DOVEADM_EX_NOTFOUND; + } else if (input->stream_errno != 0) { + i_error("read(%s) failed: %m", fs_file_path(file)); + doveadm_exit_code = EX_TEMPFAIL; + } + i_stream_unref(&input); + fs_file_deinit(&file); + fs_deinit(&fs); +} + +static void cmd_fs_put(int argc, char *argv[]) +{ + struct fs *fs; + const char *src_path, *dest_path; + struct fs_file *file; + struct istream *input; + struct ostream *output; + off_t ret; + + fs = cmd_fs_init(&argc, &argv, 2, cmd_fs_put); + src_path = argv[0]; + dest_path = argv[1]; + + file = fs_file_init(fs, dest_path, FS_OPEN_MODE_REPLACE); + output = fs_write_stream(file); + input = i_stream_create_file(src_path, IO_BLOCK_SIZE); + if ((ret = o_stream_send_istream(output, input)) < 0) { + if (output->stream_errno != 0) + i_error("write(%s) failed: %m", dest_path); + else + i_error("read(%s) failed: %m", src_path); + doveadm_exit_code = EX_TEMPFAIL; + } + i_stream_destroy(&input); + if (fs_write_stream_finish(file, &output) < 0) { + i_error("fs_write_stream_finish() failed: %s", + fs_file_last_error(file)); + doveadm_exit_code = EX_TEMPFAIL; + } + fs_file_deinit(&file); + fs_deinit(&fs); +} + +static void cmd_fs_copy(int argc, char *argv[]) +{ + struct fs *fs; + struct fs_file *src_file, *dest_file; + const char *src_path, *dest_path; + + fs = cmd_fs_init(&argc, &argv, 2, cmd_fs_copy); + src_path = argv[0]; + dest_path = argv[1]; + + src_file = fs_file_init(fs, src_path, FS_OPEN_MODE_READONLY); + dest_file = fs_file_init(fs, dest_path, FS_OPEN_MODE_REPLACE); + if (fs_copy(src_file, dest_file) == 0) ; + else if (errno == ENOENT) { + i_error("%s doesn't exist", src_path); + doveadm_exit_code = DOVEADM_EX_NOTFOUND; + } else { + i_error("fs_copy(%s, %s) failed: %s", + src_path, dest_path, fs_last_error(fs)); + doveadm_exit_code = EX_TEMPFAIL; + } + fs_file_deinit(&src_file); + fs_file_deinit(&dest_file); + fs_deinit(&fs); +} + +static void cmd_fs_stat(int argc, char *argv[]) +{ + struct fs *fs; + struct fs_file *file; + struct stat st; + + fs = cmd_fs_init(&argc, &argv, 1, cmd_fs_stat); + + file = fs_file_init(fs, argv[0], FS_OPEN_MODE_READONLY); + if (fs_stat(file, &st) == 0) { + printf("%s size=%lld\n", fs_file_path(file), + (long long)st.st_size); + } else if (errno == ENOENT) { + i_error("%s doesn't exist", fs_file_path(file)); + doveadm_exit_code = DOVEADM_EX_NOTFOUND; + } else { + i_error("fs_stat(%s) failed: %s", + fs_file_path(file), fs_file_last_error(file)); + doveadm_exit_code = EX_TEMPFAIL; + } + fs_file_deinit(&file); + fs_deinit(&fs); +} + +static void cmd_fs_delete(int argc, char *argv[]) +{ + struct fs *fs; + struct fs_file *file; + + fs = cmd_fs_init(&argc, &argv, 1, cmd_fs_delete); + + file = fs_file_init(fs, argv[0], FS_OPEN_MODE_READONLY); + if (fs_delete(file) == 0) + ; + else if (errno == ENOENT) { + i_error("%s doesn't exist", fs_file_path(file)); + doveadm_exit_code = DOVEADM_EX_NOTFOUND; + } else { + i_error("fs_delete(%s) failed: %s", + fs_file_path(file), fs_file_last_error(file)); + doveadm_exit_code = EX_TEMPFAIL; + } + fs_file_deinit(&file); + fs_deinit(&fs); +} + +static void cmd_fs_iter_full(int argc, char *argv[], enum fs_iter_flags flags, + doveadm_command_t *cmd) +{ + struct fs *fs; + struct fs_iter *iter; + const char *fname; + + fs = cmd_fs_init(&argc, &argv, 1, cmd); + + iter = fs_iter_init(fs, argv[0], flags); + while ((fname = fs_iter_next(iter)) != NULL) + printf("%s\n", fname); + if (fs_iter_deinit(&iter) < 0) { + i_error("fs_iter_deinit(%s) failed: %s", + argv[0], fs_last_error(fs)); + doveadm_exit_code = EX_TEMPFAIL; + } + fs_deinit(&fs); +} + +static void cmd_fs_iter(int argc, char *argv[]) +{ + cmd_fs_iter_full(argc, argv, 0, cmd_fs_iter); +} + +static void cmd_fs_iter_dirs(int argc, char *argv[]) +{ + cmd_fs_iter_full(argc, argv, FS_ITER_FLAG_DIRS, cmd_fs_iter_dirs); +} + +struct doveadm_cmd doveadm_cmd_fs[] = { + { cmd_fs_get, "fs get", " " }, + { cmd_fs_put, "fs put", " " }, + { cmd_fs_copy, "fs copy", " " }, + { cmd_fs_stat, "fs stat", " " }, + { cmd_fs_delete, "fs delete", " " }, + { cmd_fs_iter, "fs iter", " " }, + { cmd_fs_iter_dirs, "fs iter-dirs", " " }, +}; + +static void fs_cmd_help(doveadm_command_t *cmd) +{ + unsigned int i; + + for (i = 0; i < N_ELEMENTS(doveadm_cmd_fs); i++) { + if (doveadm_cmd_fs[i].cmd == cmd) + help(&doveadm_cmd_fs[i]); + } + i_unreached(); +} + +void doveadm_register_fs_commands(void) +{ + unsigned int i; + + for (i = 0; i < N_ELEMENTS(doveadm_cmd_fs); i++) + doveadm_register_cmd(&doveadm_cmd_fs[i]); +} diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Sun Apr 07 18:50:31 2013 +0300 +++ b/src/doveadm/doveadm-settings.c Sun Apr 07 19:50:29 2013 +0300 @@ -64,6 +64,7 @@ DEF(SET_STR, doveadm_allowed_commands), DEF(SET_STR, dsync_alt_char), DEF(SET_STR, dsync_remote_cmd), + DEF(SET_STR, ssl_client_ca_dir), { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL }, @@ -82,6 +83,7 @@ .doveadm_allowed_commands = "", .dsync_alt_char = "_", .dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u -U", + .ssl_client_ca_dir = "", .plugin_envs = ARRAY_INIT }; diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/doveadm-settings.h --- a/src/doveadm/doveadm-settings.h Sun Apr 07 18:50:31 2013 +0300 +++ b/src/doveadm/doveadm-settings.h Sun Apr 07 19:50:29 2013 +0300 @@ -13,6 +13,7 @@ const char *doveadm_allowed_commands; const char *dsync_alt_char; const char *dsync_remote_cmd; + const char *ssl_client_ca_dir; ARRAY(const char *) plugin_envs; }; diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/doveadm.c --- a/src/doveadm/doveadm.c Sun Apr 07 18:50:31 2013 +0300 +++ b/src/doveadm/doveadm.c Sun Apr 07 19:50:29 2013 +0300 @@ -368,6 +368,7 @@ doveadm_register_proxy_commands(); doveadm_register_log_commands(); doveadm_register_replicator_commands(); + doveadm_register_fs_commands(); doveadm_dump_init(); doveadm_mail_init(); doveadm_load_modules(); diff -r 0b7cb5fdc7b5 -r d09aa718221f src/doveadm/doveadm.h From dovecot at dovecot.org Sun Apr 7 20:06:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 20:06:58 +0300 Subject: dovecot-2.2: lib-fs: Added debug setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/821a2b489039 changeset: 16230:821a2b489039 user: Timo Sirainen date: Sun Apr 07 20:06:28 2013 +0300 description: lib-fs: Added debug setting. diffstat: src/lib-fs/fs-api.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r d09aa718221f -r 821a2b489039 src/lib-fs/fs-api.h --- a/src/lib-fs/fs-api.h Sun Apr 07 19:50:29 2013 +0300 +++ b/src/lib-fs/fs-api.h Sun Apr 07 20:06:28 2013 +0300 @@ -74,6 +74,9 @@ /* When creating temporary files, use this prefix (to avoid conflicts with existing files). */ const char *temp_file_prefix; + + /* Enable debugging */ + bool debug; }; struct fs_metadata { From dovecot at dovecot.org Sun Apr 7 20:06:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 20:06:58 +0300 Subject: dovecot-2.2: doveadm fs: Enable fs debug if doveadm -D parameter... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/de165567386d changeset: 16231:de165567386d user: Timo Sirainen date: Sun Apr 07 20:06:42 2013 +0300 description: doveadm fs: Enable fs debug if doveadm -D parameter is given. diffstat: src/doveadm/doveadm-fs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (16 lines): diff -r 821a2b489039 -r de165567386d src/doveadm/doveadm-fs.c --- a/src/doveadm/doveadm-fs.c Sun Apr 07 20:06:28 2013 +0300 +++ b/src/doveadm/doveadm-fs.c Sun Apr 07 20:06:42 2013 +0300 @@ -24,10 +24,12 @@ memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = doveadm_settings->ssl_client_ca_dir; + ssl_set.verbose = doveadm_debug; memset(&fs_set, 0, sizeof(fs_set)); fs_set.ssl_client_set = &ssl_set; fs_set.temp_dir = "/tmp"; + fs_set.debug = doveadm_debug; if (fs_init((*argv)[1], (*argv)[2], &fs_set, &fs, &error) < 0) i_fatal("fs_init() failed: %s", error); From dovecot at dovecot.org Sun Apr 7 20:28:53 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 20:28:53 +0300 Subject: dovecot-2.2: Added ssl_client_ca_file to specify the CA certs as... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f0c997709b4d changeset: 16232:f0c997709b4d user: Timo Sirainen date: Sun Apr 07 20:28:31 2013 +0300 description: Added ssl_client_ca_file to specify the CA certs as a file instead of as a dir. This is required for Redhat-based systems where there isn't a CA directory like in Debian/Ubuntu. diffstat: src/doveadm/doveadm-fs.c | 1 + src/doveadm/doveadm-settings.c | 2 + src/doveadm/doveadm-settings.h | 1 + src/doveadm/dsync/doveadm-dsync.c | 1 + src/lib-http/http-client.c | 2 + src/lib-http/http-client.h | 2 +- src/lib-http/test-http-client.c | 3 +- src/lib-imap-client/imapc-client.c | 2 + src/lib-imap-client/imapc-client.h | 2 +- src/lib-ssl-iostream/iostream-openssl-context.c | 66 ++++++++++++++++-------- src/lib-ssl-iostream/iostream-ssl.h | 2 +- src/lib-storage/index/imapc/imapc-storage.c | 1 + src/lib-storage/index/pop3c/pop3c-client.c | 2 + src/lib-storage/index/pop3c/pop3c-client.h | 2 +- src/lib-storage/index/pop3c/pop3c-storage.c | 1 + src/lib-storage/mail-storage-settings.c | 2 + src/lib-storage/mail-storage-settings.h | 1 + 17 files changed, 65 insertions(+), 28 deletions(-) diffs (truncated from 304 to 300 lines): diff -r de165567386d -r f0c997709b4d src/doveadm/doveadm-fs.c --- a/src/doveadm/doveadm-fs.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/doveadm/doveadm-fs.c Sun Apr 07 20:28:31 2013 +0300 @@ -24,6 +24,7 @@ memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = doveadm_settings->ssl_client_ca_dir; + ssl_set.ca_file = doveadm_settings->ssl_client_ca_file; ssl_set.verbose = doveadm_debug; memset(&fs_set, 0, sizeof(fs_set)); diff -r de165567386d -r f0c997709b4d src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/doveadm/doveadm-settings.c Sun Apr 07 20:28:31 2013 +0300 @@ -65,6 +65,7 @@ DEF(SET_STR, dsync_alt_char), DEF(SET_STR, dsync_remote_cmd), DEF(SET_STR, ssl_client_ca_dir), + DEF(SET_STR, ssl_client_ca_file), { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL }, @@ -84,6 +85,7 @@ .dsync_alt_char = "_", .dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u -U", .ssl_client_ca_dir = "", + .ssl_client_ca_file = "", .plugin_envs = ARRAY_INIT }; diff -r de165567386d -r f0c997709b4d src/doveadm/doveadm-settings.h --- a/src/doveadm/doveadm-settings.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/doveadm/doveadm-settings.h Sun Apr 07 20:28:31 2013 +0300 @@ -14,6 +14,7 @@ const char *dsync_alt_char; const char *dsync_remote_cmd; const char *ssl_client_ca_dir; + const char *ssl_client_ca_file; ARRAY(const char *) plugin_envs; }; diff -r de165567386d -r f0c997709b4d src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Sun Apr 07 20:28:31 2013 +0300 @@ -619,6 +619,7 @@ memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = mail_set->ssl_client_ca_dir; + ssl_set.ca_file = mail_set->ssl_client_ca_file; ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = mail_set->ssl_crypto_device; diff -r de165567386d -r f0c997709b4d src/lib-http/http-client.c --- a/src/lib-http/http-client.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-http/http-client.c Sun Apr 07 20:28:31 2013 +0300 @@ -82,6 +82,7 @@ if (set->rawlog_dir != NULL && *set->rawlog_dir != '\0') client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir); client->set.ssl_ca_dir = p_strdup(pool, set->ssl_ca_dir); + client->set.ssl_ca_file = p_strdup(pool, set->ssl_ca_file); 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; @@ -192,6 +193,7 @@ memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = client->set.ssl_ca_dir; + ssl_set.ca_file = client->set.ssl_ca_file; ssl_set.ca = client->set.ssl_ca; ssl_set.verify_remote_cert = TRUE; ssl_set.crypto_device = client->set.ssl_crypto_device; diff -r de165567386d -r f0c997709b4d src/lib-http/http-client.h --- a/src/lib-http/http-client.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-http/http-client.h Sun Apr 07 20:28:31 2013 +0300 @@ -33,7 +33,7 @@ struct http_client_settings { const char *dns_client_socket_path; - const char *ssl_ca_dir, *ssl_ca; + const char *ssl_ca_dir, *ssl_ca_file, *ssl_ca; const char *ssl_crypto_device; bool ssl_allow_invalid_cert; diff -r de165567386d -r f0c997709b4d src/lib-http/test-http-client.c --- a/src/lib-http/test-http-client.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-http/test-http-client.c Sun Apr 07 20:28:31 2013 +0300 @@ -329,7 +329,8 @@ memset(&http_set, 0, sizeof(http_set)); http_set.dns_client_socket_path = "/var/run/dovecot/dns-client"; http_set.ssl_allow_invalid_cert = TRUE; - http_set.ssl_ca_dir = "/etc/ssl/certs"; + http_set.ssl_ca_dir = "/etc/ssl/certs"; /* debian */ + http_set.ssl_ca_file = "/etc/pki/tls/cert.pem"; /* redhat */ http_set.max_idle_time_msecs = 5*1000; http_set.max_parallel_connections = 4; http_set.max_pipelined_requests = 4; diff -r de165567386d -r f0c997709b4d src/lib-imap-client/imapc-client.c --- a/src/lib-imap-client/imapc-client.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-imap-client/imapc-client.c Sun Apr 07 20:28:31 2013 +0300 @@ -63,10 +63,12 @@ if (set->ssl_mode != IMAPC_CLIENT_SSL_MODE_NONE) { client->set.ssl_mode = set->ssl_mode; client->set.ssl_ca_dir = p_strdup(pool, set->ssl_ca_dir); + client->set.ssl_ca_file = p_strdup(pool, set->ssl_ca_file); client->set.ssl_verify = set->ssl_verify; memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = set->ssl_ca_dir; + ssl_set.ca_file = set->ssl_ca_file; ssl_set.verify_remote_cert = set->ssl_verify; ssl_set.crypto_device = set->ssl_crypto_device; diff -r de165567386d -r f0c997709b4d src/lib-imap-client/imapc-client.h --- a/src/lib-imap-client/imapc-client.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-imap-client/imapc-client.h Sun Apr 07 20:28:31 2013 +0300 @@ -62,7 +62,7 @@ const char *temp_path_prefix; enum imapc_client_ssl_mode ssl_mode; - const char *ssl_ca_dir; + const char *ssl_ca_dir, *ssl_ca_file; bool ssl_verify; const char *rawlog_dir; diff -r de165567386d -r f0c997709b4d src/lib-ssl-iostream/iostream-openssl-context.c --- a/src/lib-ssl-iostream/iostream-openssl-context.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl-context.c Sun Apr 07 20:28:31 2013 +0300 @@ -311,13 +311,51 @@ #endif static int +ssl_iostream_context_load_ca(struct ssl_iostream_context *ctx, + const struct ssl_iostream_settings *set, + const char **error_r) +{ + X509_STORE *store; + STACK_OF(X509_NAME) *xnames = NULL; + const char *ca_file, *ca_dir; + bool have_ca = FALSE; + + if (set->ca != NULL) { + store = SSL_CTX_get_cert_store(ctx->ssl_ctx); + if (load_ca(store, set->ca, &xnames) < 0) { + *error_r = t_strdup_printf("Couldn't parse ssl_ca: %s", + openssl_iostream_error()); + return -1; + } + ssl_iostream_ctx_verify_remote_cert(ctx, xnames); + have_ca = TRUE; + } + ca_file = set->ca_file == NULL || *set->ca_file == '\0' ? + NULL : set->ca_file; + ca_dir = set->ca_dir == NULL || *set->ca_dir == '\0' ? + NULL : set->ca_dir; + if (ca_file != NULL || ca_dir != NULL) { + if (!SSL_CTX_load_verify_locations(ctx->ssl_ctx, ca_file, ca_dir)) { + *error_r = t_strdup_printf( + "Can't load CA certs from directory %s: %s", + set->ca_dir, openssl_iostream_error()); + return -1; + } + have_ca = TRUE; + } + + if (!have_ca) { + *error_r = "Can't verify remote certs without CA"; + return -1; + } + return 0; +} + +static int ssl_iostream_context_set(struct ssl_iostream_context *ctx, const struct ssl_iostream_settings *set, const char **error_r) { - X509_STORE *store; - STACK_OF(X509_NAME) *xnames = NULL; - ctx->set = ssl_iostream_settings_dup(ctx->pool, set); if (set->cipher_list != NULL && !SSL_CTX_set_cipher_list(ctx->ssl_ctx, set->cipher_list)) { @@ -342,27 +380,9 @@ } /* set trusted CA certs */ - if (!set->verify_remote_cert) { - /* no CA */ - } else if (set->ca != NULL) { - store = SSL_CTX_get_cert_store(ctx->ssl_ctx); - if (load_ca(store, set->ca, &xnames) < 0) { - *error_r = t_strdup_printf("Couldn't parse ssl_ca: %s", - openssl_iostream_error()); + if (set->verify_remote_cert) { + if (ssl_iostream_context_load_ca(ctx, set, error_r) < 0) return -1; - } - ssl_iostream_ctx_verify_remote_cert(ctx, xnames); - } else if (set->ca_dir != NULL) { - if (!SSL_CTX_load_verify_locations(ctx->ssl_ctx, NULL, - set->ca_dir)) { - *error_r = t_strdup_printf( - "Can't load CA certs from directory %s: %s", - set->ca_dir, openssl_iostream_error()); - return -1; - } - } else { - *error_r = "Can't verify remote certs without CA"; - return -1; } if (set->cert_username_field != NULL) { diff -r de165567386d -r f0c997709b4d src/lib-ssl-iostream/iostream-ssl.h --- a/src/lib-ssl-iostream/iostream-ssl.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.h Sun Apr 07 20:28:31 2013 +0300 @@ -7,7 +7,7 @@ struct ssl_iostream_settings { const char *protocols; const char *cipher_list; - const char *ca, *ca_dir; /* context-only */ + const char *ca, *ca_file, *ca_dir; /* context-only */ const char *cert; const char *key; const char *key_password; diff -r de165567386d -r f0c997709b4d src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Sun Apr 07 20:28:31 2013 +0300 @@ -251,6 +251,7 @@ set.temp_path_prefix = str_c(str); set.ssl_ca_dir = _storage->set->ssl_client_ca_dir; + set.ssl_ca_file = _storage->set->ssl_client_ca_file; set.ssl_verify = storage->set->imapc_ssl_verify; if (strcmp(storage->set->imapc_ssl, "imaps") == 0) set.ssl_mode = IMAPC_CLIENT_SSL_MODE_IMMEDIATE; diff -r de165567386d -r f0c997709b4d src/lib-storage/index/pop3c/pop3c-client.c --- a/src/lib-storage/index/pop3c/pop3c-client.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Sun Apr 07 20:28:31 2013 +0300 @@ -95,10 +95,12 @@ if (set->ssl_mode != POP3C_CLIENT_SSL_MODE_NONE) { client->set.ssl_mode = set->ssl_mode; client->set.ssl_ca_dir = p_strdup(pool, set->ssl_ca_dir); + client->set.ssl_ca_file = p_strdup(pool, set->ssl_ca_file); client->set.ssl_verify = set->ssl_verify; memset(&ssl_set, 0, sizeof(ssl_set)); ssl_set.ca_dir = set->ssl_ca_dir; + ssl_set.ca_file = set->ssl_ca_file; ssl_set.verify_remote_cert = set->ssl_verify; ssl_set.crypto_device = set->ssl_crypto_device; diff -r de165567386d -r f0c997709b4d src/lib-storage/index/pop3c/pop3c-client.h --- a/src/lib-storage/index/pop3c/pop3c-client.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-client.h Sun Apr 07 20:28:31 2013 +0300 @@ -31,7 +31,7 @@ const char *temp_path_prefix; enum pop3c_client_ssl_mode ssl_mode; - const char *ssl_ca_dir; + const char *ssl_ca_dir, *ssl_ca_file; bool ssl_verify; const char *rawlog_dir; diff -r de165567386d -r f0c997709b4d src/lib-storage/index/pop3c/pop3c-storage.c --- a/src/lib-storage/index/pop3c/pop3c-storage.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-storage.c Sun Apr 07 20:28:31 2013 +0300 @@ -74,6 +74,7 @@ mail_user_home_expand(storage->user, set->pop3c_rawlog_dir); client_set.ssl_ca_dir = storage->set->ssl_client_ca_dir; + client_set.ssl_ca_file = storage->set->ssl_client_ca_file; client_set.ssl_verify = set->pop3c_ssl_verify; if (strcmp(set->pop3c_ssl, "pop3s") == 0) client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_IMMEDIATE; diff -r de165567386d -r f0c997709b4d src/lib-storage/mail-storage-settings.c --- a/src/lib-storage/mail-storage-settings.c Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/mail-storage-settings.c Sun Apr 07 20:28:31 2013 +0300 @@ -54,6 +54,7 @@ DEF(SET_STR, pop3_uidl_format), DEF(SET_STR, ssl_client_ca_dir), + DEF(SET_STR, ssl_client_ca_file), DEF(SET_STR, ssl_crypto_device), SETTING_DEFINE_LIST_END @@ -89,6 +90,7 @@ .pop3_uidl_format = "%08Xu%08Xv", .ssl_client_ca_dir = "", + .ssl_client_ca_file = "", .ssl_crypto_device = "" }; diff -r de165567386d -r f0c997709b4d src/lib-storage/mail-storage-settings.h --- a/src/lib-storage/mail-storage-settings.h Sun Apr 07 20:06:42 2013 +0300 +++ b/src/lib-storage/mail-storage-settings.h Sun Apr 07 20:28:31 2013 +0300 @@ -39,6 +39,7 @@ const char *pop3_uidl_format; const char *ssl_client_ca_dir; From dovecot at dovecot.org Sun Apr 7 20:32:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 20:32:43 +0300 Subject: dovecot-2.2: example-config: Added ssl_client_ca_file Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/32289a1d44fb changeset: 16233:32289a1d44fb user: Timo Sirainen date: Sun Apr 07 20:32:37 2013 +0300 description: example-config: Added ssl_client_ca_file diffstat: doc/example-config/conf.d/10-ssl.conf | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (20 lines): diff -r f0c997709b4d -r 32289a1d44fb doc/example-config/conf.d/10-ssl.conf --- a/doc/example-config/conf.d/10-ssl.conf Sun Apr 07 20:28:31 2013 +0300 +++ b/doc/example-config/conf.d/10-ssl.conf Sun Apr 07 20:32:37 2013 +0300 @@ -26,11 +26,12 @@ # Require that CRL check succeeds for client certificates. #ssl_require_crl = yes -# Directory for trusted SSL CA certificates. These are used only when Dovecot -# needs to act as an SSL client (e.g. imapc backend). The directory is usually -# /etc/ssl/certs in Debian-based systems and /etc/pki/tls/certs in RedHat-based -# systems. +# Directory and/or file for trusted SSL CA certificates. These are used only +# when Dovecot needs to act as an SSL client (e.g. imapc backend). The +# directory is usually /etc/ssl/certs in Debian-based systems and the file is +# /etc/pki/tls/cert.pem in RedHat-based systems. #ssl_client_ca_dir = +#ssl_client_ca_file = # Request client to send a certificate. If you also want to require it, set # auth_ssl_require_client_cert=yes in auth section. From dovecot at dovecot.org Sun Apr 7 22:54:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 22:54:54 +0300 Subject: dovecot-2.2: ostream-metawrap: Copy parent ostream's errors. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/daf6803df4ac changeset: 16234:daf6803df4ac user: Timo Sirainen date: Sun Apr 07 22:54:48 2013 +0300 description: ostream-metawrap: Copy parent ostream's errors. diffstat: src/lib-fs/ostream-metawrap.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diffs (31 lines): diff -r 32289a1d44fb -r daf6803df4ac src/lib-fs/ostream-metawrap.c --- a/src/lib-fs/ostream-metawrap.c Sun Apr 07 20:32:37 2013 +0300 +++ b/src/lib-fs/ostream-metawrap.c Sun Apr 07 22:54:48 2013 +0300 @@ -25,9 +25,12 @@ const struct const_iovec *iov, unsigned int iov_count) { struct metawrap_ostream *mstream = (struct metawrap_ostream *)stream; + ssize_t ret; o_stream_metawrap_call_callback(mstream); - return o_stream_sendv(stream->parent, iov, iov_count); + if ((ret = o_stream_sendv(stream->parent, iov, iov_count)) < 0) + o_stream_copy_error_from_parent(stream); + return ret; } static off_t @@ -36,9 +39,12 @@ { struct metawrap_ostream *outstream = (struct metawrap_ostream *)_outstream; + off_t ret; o_stream_metawrap_call_callback(outstream); - return o_stream_send_istream(_outstream->parent, instream); + if ((ret = o_stream_send_istream(_outstream->parent, instream)) < 0) + o_stream_copy_error_from_parent(stream); + return ret; } struct ostream * From dovecot at dovecot.org Sun Apr 7 22:55:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 22:55:47 +0300 Subject: dovecot-2.2: ostream-metawrap: ..and compile fix to previous com... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f00cc6d783cf changeset: 16235:f00cc6d783cf user: Timo Sirainen date: Sun Apr 07 22:55:42 2013 +0300 description: ostream-metawrap: ..and compile fix to previous commit. diffstat: src/lib-fs/ostream-metawrap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r daf6803df4ac -r f00cc6d783cf src/lib-fs/ostream-metawrap.c --- a/src/lib-fs/ostream-metawrap.c Sun Apr 07 22:54:48 2013 +0300 +++ b/src/lib-fs/ostream-metawrap.c Sun Apr 07 22:55:42 2013 +0300 @@ -43,7 +43,7 @@ o_stream_metawrap_call_callback(outstream); if ((ret = o_stream_send_istream(_outstream->parent, instream)) < 0) - o_stream_copy_error_from_parent(stream); + o_stream_copy_error_from_parent(_outstream); return ret; } From dovecot at dovecot.org Sun Apr 7 23:26:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 23:26:58 +0300 Subject: dovecot-2.2: istream API change: Added support for multiple dest... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/81d87e43e167 changeset: 16236:81d87e43e167 user: Timo Sirainen date: Sun Apr 07 23:17:37 2013 +0300 description: istream API change: Added support for multiple destroy callbacks. diffstat: src/lib-http/http-client-connection.c | 5 ++- src/lib-imap-urlauth/imap-urlauth-connection.c | 2 +- src/lib-storage/index/index-mail.c | 7 +++-- src/lib/iostream-private.h | 8 +++++- src/lib/iostream-temp.c | 2 +- src/lib/iostream.c | 10 +++++++- src/lib/istream.c | 28 +++++++++++++++++++------ src/lib/istream.h | 9 ++++--- src/lib/json-parser.c | 2 +- 9 files changed, 50 insertions(+), 23 deletions(-) diffs (221 lines): diff -r f00cc6d783cf -r 81d87e43e167 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib-http/http-client-connection.c Sun Apr 07 23:17:37 2013 +0300 @@ -370,7 +370,7 @@ actual payload stream. */ conn->incoming_payload = response->payload = i_stream_create_limit(response->payload, (uoff_t)-1); - i_stream_set_destroy_callback(response->payload, + i_stream_add_destroy_callback(response->payload, http_client_payload_destroyed, req); /* the callback may add its own I/O, so we need to remove @@ -391,7 +391,8 @@ if (retrying) { /* retrying, don't destroy the request */ if (response->payload != NULL) { - i_stream_unset_destroy_callback(conn->incoming_payload); + i_stream_remove_destroy_callback(conn->incoming_payload, + http_client_payload_destroyed); i_stream_unref(&conn->incoming_payload); conn->conn.io = io_add(conn->conn.fd_in, IO_READ, http_client_connection_input, diff -r f00cc6d783cf -r 81d87e43e167 src/lib-imap-urlauth/imap-urlauth-connection.c --- a/src/lib-imap-urlauth/imap-urlauth-connection.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Sun Apr 07 23:17:37 2013 +0300 @@ -604,7 +604,7 @@ data = buffer_get_data(conn->literal_buf, &size); i_assert(size == conn->literal_size); reply->input = i_stream_create_from_data(data, size); - i_stream_set_destroy_callback(reply->input, + i_stream_add_destroy_callback(reply->input, literal_stream_destroy, conn->literal_buf); } diff -r f00cc6d783cf -r 81d87e43e167 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib-storage/index/index-mail.c Sun Apr 07 23:17:37 2013 +0300 @@ -948,7 +948,7 @@ /* do this only once in case a plugin changes the stream. otherwise the check would break. */ data->destroy_callback_set = TRUE; - i_stream_set_destroy_callback(data->stream, + i_stream_add_destroy_callback(data->stream, index_mail_stream_destroy_callback, mail); } @@ -1260,11 +1260,12 @@ i_stream_unref(&data->filter_stream); if (data->stream != NULL) { data->destroying_stream = TRUE; - if (!closing) { + if (!closing && data->destroy_callback_set) { /* we're replacing the stream with a new one. it's allowed to have references until the mail is closed (but we can't really check that) */ - i_stream_unset_destroy_callback(data->stream); + i_stream_remove_destroy_callback(data->stream, + index_mail_stream_destroy_callback); } i_stream_unref(&data->stream); if (closing) { diff -r f00cc6d783cf -r 81d87e43e167 src/lib/iostream-private.h --- a/src/lib/iostream-private.h Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/iostream-private.h Sun Apr 07 23:17:37 2013 +0300 @@ -3,6 +3,11 @@ /* This file is private to input stream and output stream implementations */ +struct iostream_destroy_callback { + void (*callback)(void *context); + void *context; +}; + struct iostream_private { int refcount; char *name; @@ -12,8 +17,7 @@ void (*set_max_buffer_size)(struct iostream_private *stream, size_t max_size); - void (*destroy_callback)(void *context); - void *destroy_context; + ARRAY(struct iostream_destroy_callback) destroy_callbacks; }; void io_stream_init(struct iostream_private *stream); diff -r f00cc6d783cf -r 81d87e43e167 src/lib/iostream-temp.c --- a/src/lib/iostream-temp.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/iostream-temp.c Sun Apr 07 23:17:37 2013 +0300 @@ -253,7 +253,7 @@ tstream->buf->used); i_stream_set_name(input, t_strdup_printf( "(Temp file in %s)", tstream->temp_path_prefix)); - i_stream_set_destroy_callback(input, iostream_temp_buf_destroyed, + i_stream_add_destroy_callback(input, iostream_temp_buf_destroyed, tstream->buf); tstream->buf = NULL; } diff -r f00cc6d783cf -r 81d87e43e167 src/lib/iostream.c --- a/src/lib/iostream.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/iostream.c Sun Apr 07 23:17:37 2013 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2002-2013 Dovecot authors, see the included COPYING file */ #include "lib.h" +#include "array.h" #include "iostream-private.h" static void @@ -31,14 +32,19 @@ void io_stream_unref(struct iostream_private *stream) { + const struct iostream_destroy_callback *dc; + i_assert(stream->refcount > 0); if (--stream->refcount != 0) return; stream->close(stream, FALSE); stream->destroy(stream); - if (stream->destroy_callback != NULL) - stream->destroy_callback(stream->destroy_context); + if (array_is_created(&stream->destroy_callbacks)) { + array_foreach(&stream->destroy_callbacks, dc) + dc->callback(dc->context); + array_free(&stream->destroy_callbacks); + } i_free(stream->name); i_free(stream); diff -r f00cc6d783cf -r 81d87e43e167 src/lib/istream.c --- a/src/lib/istream.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/istream.c Sun Apr 07 23:17:37 2013 +0300 @@ -2,6 +2,7 @@ #include "lib.h" #include "ioloop.h" +#include "array.h" #include "str.h" #include "istream-private.h" @@ -53,22 +54,35 @@ *stream = NULL; } -#undef i_stream_set_destroy_callback -void i_stream_set_destroy_callback(struct istream *stream, +#undef i_stream_add_destroy_callback +void i_stream_add_destroy_callback(struct istream *stream, istream_callback_t *callback, void *context) { struct iostream_private *iostream = &stream->real_stream->iostream; + struct iostream_destroy_callback *dc; - iostream->destroy_callback = callback; - iostream->destroy_context = context; + if (!array_is_created(&iostream->destroy_callbacks)) + i_array_init(&iostream->destroy_callbacks, 2); + dc = array_append_space(&iostream->destroy_callbacks); + dc->callback = callback; + dc->context = context; } -void i_stream_unset_destroy_callback(struct istream *stream) +void i_stream_remove_destroy_callback(struct istream *stream, + void (*callback)()) { struct iostream_private *iostream = &stream->real_stream->iostream; + const struct iostream_destroy_callback *dcs; + unsigned int i, count; - iostream->destroy_callback = NULL; - iostream->destroy_context = NULL; + dcs = array_get(&iostream->destroy_callbacks, &count); + for (i = 0; i < count; i++) { + if (dcs[i].callback == callback) { + array_delete(&iostream->destroy_callbacks, i, 1); + return; + } + } + i_unreached(); } int i_stream_get_fd(struct istream *stream) diff -r f00cc6d783cf -r 81d87e43e167 src/lib/istream.h --- a/src/lib/istream.h Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/istream.h Sun Apr 07 23:17:37 2013 +0300 @@ -52,15 +52,16 @@ /* Unreferences the stream and sets stream pointer to NULL. */ void i_stream_unref(struct istream **stream); /* Call the given callback function when stream is destroyed. */ -void i_stream_set_destroy_callback(struct istream *stream, +void i_stream_add_destroy_callback(struct istream *stream, istream_callback_t *callback, void *context) ATTR_NULL(3); -#define i_stream_set_destroy_callback(stream, callback, context) \ - i_stream_set_destroy_callback(stream + \ +#define i_stream_add_destroy_callback(stream, callback, context) \ + i_stream_add_destroy_callback(stream + \ CALLBACK_TYPECHECK(callback, void (*)(typeof(context))), \ (istream_callback_t *)callback, context) /* Remove the destroy callback. */ -void i_stream_unset_destroy_callback(struct istream *stream); +void i_stream_remove_destroy_callback(struct istream *stream, + void (*callback)()); /* Return file descriptor for stream, or -1 if none is available. */ int i_stream_get_fd(struct istream *stream); diff -r f00cc6d783cf -r 81d87e43e167 src/lib/json-parser.c --- a/src/lib/json-parser.c Sun Apr 07 22:55:42 2013 +0300 +++ b/src/lib/json-parser.c Sun Apr 07 23:17:37 2013 +0300 @@ -596,7 +596,7 @@ parser->state = parser->state == JSON_STATE_OBJECT_VALUE ? JSON_STATE_OBJECT_SKIP_STRING : JSON_STATE_ARRAY_SKIP_STRING; parser->strinput = i_stream_create_jsonstr(parser->input); - i_stream_set_destroy_callback(parser->strinput, + i_stream_add_destroy_callback(parser->strinput, json_strinput_destroyed, parser); *input_r = parser->strinput; From dovecot at dovecot.org Sun Apr 7 23:26:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 23:26:58 +0300 Subject: dovecot-2.2: lib-fs: posix fs backend now closes the fd after re... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/73bef641620d changeset: 16237:73bef641620d user: Timo Sirainen date: Sun Apr 07 23:26:52 2013 +0300 description: lib-fs: posix fs backend now closes the fd after reads are finished. This allows keeping more fs_file structs open than there are available fds. diffstat: src/lib-fs/fs-posix.c | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diffs (64 lines): diff -r 81d87e43e167 -r 73bef641620d src/lib-fs/fs-posix.c --- a/src/lib-fs/fs-posix.c Sun Apr 07 23:17:37 2013 +0300 +++ b/src/lib-fs/fs-posix.c Sun Apr 07 23:26:52 2013 +0300 @@ -252,6 +252,16 @@ return &file->file; } +static void fs_posix_file_close(struct posix_fs_file *file) +{ + if (file->fd != -1 && file->file.output == NULL) { + if (close(file->fd) < 0) { + fs_set_critical(file->file.fs, "close(%s) failed: %m", + file->file.path); + } + } +} + static void fs_posix_file_deinit(struct fs_file *_file) { struct posix_fs_file *file = (struct posix_fs_file *)_file; @@ -275,12 +285,7 @@ break; } - if (file->fd != -1) { - if (close(file->fd) < 0) { - fs_set_critical(_file->fs, "close(%s) failed: %m", - _file->path); - } - } + fs_posix_file_close(file); i_free(file->temp_path); i_free(file->file.path); i_free(file); @@ -327,6 +332,7 @@ ret = read(file->fd, buf, size); if (ret < 0) fs_set_error(_file->fs, "read(%s) failed: %m", _file->path); + fs_posix_file_close(file); return ret; } @@ -336,14 +342,14 @@ struct posix_fs_file *file = (struct posix_fs_file *)_file; struct istream *input; - if (file->fd == -1) { - if (fs_posix_open(file) < 0) { - input = i_stream_create_error(errno); - i_stream_set_name(input, _file->path); - return input; - } + if (file->fd == -1 && fs_posix_open(file) < 0) { + input = i_stream_create_error(errno); + i_stream_set_name(input, _file->path); + } else { + input = i_stream_create_fd(file->fd, max_buffer_size, FALSE); } - return i_stream_create_fd(file->fd, max_buffer_size, FALSE); + i_stream_add_destroy_callback(input, fs_posix_file_close, file); + return input; } static int fs_posix_write_finish(struct posix_fs_file *file) From dovecot at dovecot.org Sun Apr 7 23:56:11 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 07 Apr 2013 23:56:11 +0300 Subject: dovecot-2.2: istream-qp-decoder: Fixed assert-crashes caused by ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bb25fa35d887 changeset: 16238:bb25fa35d887 user: Timo Sirainen date: Sun Apr 07 23:56:01 2013 +0300 description: istream-qp-decoder: Fixed assert-crashes caused by recent forced-CRLF q-p change. diffstat: src/lib-mail/istream-qp-decoder.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (24 lines): diff -r 73bef641620d -r bb25fa35d887 src/lib-mail/istream-qp-decoder.c --- a/src/lib-mail/istream-qp-decoder.c Sun Apr 07 23:26:52 2013 +0300 +++ b/src/lib-mail/istream-qp-decoder.c Sun Apr 07 23:56:01 2013 +0300 @@ -45,15 +45,16 @@ if (size == 0) return 0; - /* the decoded quoted-printable content can never be larger than the - encoded content. at worst they are equal. */ + /* normally the decoded quoted-printable content can't be larger than + the encoded content, but because we always use CRLFs, it may use + twice as much space by only converting LFs to CRLFs. */ i_stream_try_alloc(stream, size, &avail); buffer_avail = stream->buffer_size - stream->pos; - if (size > buffer_avail) { + if (size > buffer_avail/2) { /* can't fit everything to destination buffer. write as much as we can. */ - size = buffer_avail; + size = buffer_avail/2; if (size == 0) return -2; } From dovecot at dovecot.org Mon Apr 8 00:19:04 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 00:19:04 +0300 Subject: dovecot-2.2: fs-posix: Set file's fd to -1 after closing it Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/57960f02d1bb changeset: 16239:57960f02d1bb user: Timo Sirainen date: Mon Apr 08 00:18:56 2013 +0300 description: fs-posix: Set file's fd to -1 after closing it diffstat: src/lib-fs/fs-posix.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r bb25fa35d887 -r 57960f02d1bb src/lib-fs/fs-posix.c --- a/src/lib-fs/fs-posix.c Sun Apr 07 23:56:01 2013 +0300 +++ b/src/lib-fs/fs-posix.c Mon Apr 08 00:18:56 2013 +0300 @@ -259,6 +259,7 @@ fs_set_critical(file->file.fs, "close(%s) failed: %m", file->file.path); } + file->fd = -1; } } From pigeonhole at rename-it.nl Mon Apr 8 00:42:23 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 07 Apr 2013 23:42:23 +0200 Subject: dovecot-2.2-pigeonhole: Compile warning fixes. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/aafcff20c8a7 changeset: 1748:aafcff20c8a7 user: Stephan Bosch date: Sun Apr 07 23:42:04 2013 +0200 description: Compile warning fixes. diffstat: src/plugins/sieve-extprograms/script-client-remote.c | 8 -------- src/plugins/sieve-extprograms/sieve-extprograms-common.h | 2 +- 2 files changed, 1 insertions(+), 9 deletions(-) diffs (30 lines): diff -r 1d2bf4a7dc9f -r aafcff20c8a7 src/plugins/sieve-extprograms/script-client-remote.c --- a/src/plugins/sieve-extprograms/script-client-remote.c Sun Apr 07 02:30:11 2013 +0200 +++ b/src/plugins/sieve-extprograms/script-client-remote.c Sun Apr 07 23:42:04 2013 +0200 @@ -114,14 +114,6 @@ return ret; } -static void ATTR_NORETURN script_client_istream_seek -(struct istream_private *stream ATTR_UNUSED, uoff_t v_offset ATTR_UNUSED, - bool mark ATTR_UNUSED) -{ - // FIXME: implement forward seeking - i_panic("script_client_istream seek() not implemented"); -} - static void ATTR_NORETURN script_client_istream_sync (struct istream_private *stream ATTR_UNUSED) { diff -r 1d2bf4a7dc9f -r aafcff20c8a7 src/plugins/sieve-extprograms/sieve-extprograms-common.h --- a/src/plugins/sieve-extprograms/sieve-extprograms-common.h Sun Apr 07 02:30:11 2013 +0200 +++ b/src/plugins/sieve-extprograms/sieve-extprograms-common.h Sun Apr 07 23:42:04 2013 +0200 @@ -77,7 +77,7 @@ void sieve_extprogram_exec_error (struct sieve_error_handler *ehandler, const char *location, - const char *fmt, ...); + const char *fmt, ...) ATTR_FORMAT(3, 4); struct sieve_extprogram *sieve_extprogram_create (const struct sieve_extension *ext, const struct sieve_script_env *senv, From dovecot at dovecot.org Mon Apr 8 01:56:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 01:56:37 +0300 Subject: dovecot-2.2: dsync: Fixed crashes with dsync-server -U parameter Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f55fbfc909d1 changeset: 16240:f55fbfc909d1 user: Timo Sirainen date: Mon Apr 08 01:56:25 2013 +0300 description: dsync: Fixed crashes with dsync-server -U parameter diffstat: src/doveadm/dsync/doveadm-dsync.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diffs (38 lines): diff -r 57960f02d1bb -r f55fbfc909d1 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Mon Apr 08 00:18:56 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Mon Apr 08 01:56:25 2013 +0300 @@ -909,7 +909,7 @@ struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx; struct dsync_ibc *ibc; struct dsync_brain *brain; - string_t *temp_prefix; + string_t *temp_prefix, *state_str = NULL; if (_ctx->conn != NULL) { /* doveadm-server connection. start with a success reply. @@ -933,6 +933,11 @@ io_loop_run(current_ioloop); + if (ctx->replicator_notify) { + state_str = t_str_new(128); + dsync_brain_get_state(brain, state_str); + } + if (dsync_brain_deinit(&brain) < 0) _ctx->exit_code = EX_TEMPFAIL; dsync_ibc_deinit(&ibc); @@ -943,12 +948,8 @@ o_stream_close(_ctx->conn->output); } - if (ctx->replicator_notify) { - string_t *state_str = t_str_new(128); - dsync_brain_get_state(brain, state_str); + if (ctx->replicator_notify) dsync_replicator_notify(ctx, str_c(state_str)); - } - return _ctx->exit_code == 0 ? 0 : -1; } From dovecot at dovecot.org Mon Apr 8 02:13:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 02:13:30 +0300 Subject: dovecot-2.2: Released v2.2.rc6. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ae4341d0e83b changeset: 16241:ae4341d0e83b user: Timo Sirainen date: Mon Apr 08 02:06:25 2013 +0300 description: Released v2.2.rc6. diffstat: NEWS | 14 ++++++++++++++ configure.ac | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-) diffs (33 lines): diff -r f55fbfc909d1 -r ae4341d0e83b NEWS --- a/NEWS Mon Apr 08 01:56:25 2013 +0300 +++ b/NEWS Mon Apr 08 02:06:25 2013 +0300 @@ -1,3 +1,17 @@ +v2.2.rc6 2013-04-08 Timo Sirainen + + * replicator: Don't create replicator-doveadm socket by default. + This way doveadm replicator commands don't accidentally start an + unconfigured replicator server. + + replicator: Have remote dsync notify the remote replicator that + a user was just synced. This way the replicators are kept roughly + in sync. + + Added ssl_client_ca_file to specify the CA certs as a file. This is + needed (instead of ssl_client_ca_dir) in RedHat-based systems. + + Added "doveadm fs" commands, mainly to debug lib-fs backends. + - Mailbox list indexes weren't using proper file permissions based + on the root directory. + v2.2.rc5 2013-04-05 Timo Sirainen - A few small random fixes diff -r f55fbfc909d1 -r ae4341d0e83b configure.ac --- a/configure.ac Mon Apr 08 01:56:25 2013 +0300 +++ b/configure.ac Mon Apr 08 02:06:25 2013 +0300 @@ -2,7 +2,7 @@ # 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.rc5],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.2.rc6],[dovecot at dovecot.org]) AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Mon Apr 8 02:13:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 02:13:30 +0300 Subject: dovecot-2.2: Added signature for changeset ae4341d0e83b Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/be767af05259 changeset: 16243:be767af05259 user: Timo Sirainen date: Mon Apr 08 02:06:29 2013 +0300 description: Added signature for changeset ae4341d0e83b diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r bc279284fe91 -r be767af05259 .hgsigs --- a/.hgsigs Mon Apr 08 02:06:25 2013 +0300 +++ b/.hgsigs Mon Apr 08 02:06:29 2013 +0300 @@ -64,3 +64,4 @@ 11bd79bf4866b0d728b25717134a6ba972505746 0 iEYEABECAAYFAlFKFqsACgkQyUhSUUBVismbSwCdHgMYWjcwcTM7fD4v6wTd/8/8ZEsAn2THId1zYspMTEMtDg0rlrvjlht4 92c88eca562d45a55b65e45eb9bb937292b20595 0 iEYEABECAAYFAlFd75QACgkQyUhSUUBVismY8ACeI2egJAQjbspR/2ioZ85G+NbekuwAoIy2pl+wrSDOhwt9Qd4D72Q9I4ag 9446df6da5a89ae94653362ef4d4ea154272cd3e 0 iEYEABECAAYFAlFfEeQACgkQyUhSUUBViskn8QCfW8C5xr/OuOSQNuLchv9HJduncaEAnici8NhTmN7G9qwReXnLqcdrC1Tc +ae4341d0e83bd63397b418666bc80076700432fd 0 iEYEABECAAYFAlFh+/EACgkQyUhSUUBViskLaACfaQUhj/uJIZ5oDL5Wo5hTUgJC+cQAnR4GFR/GhGqJmvFWe8jZPD3CwtW/ From dovecot at dovecot.org Mon Apr 8 02:13:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 02:13:30 +0300 Subject: dovecot-2.2: Added tag 2.2.rc6 for changeset ae4341d0e83b Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bc279284fe91 changeset: 16242:bc279284fe91 user: Timo Sirainen date: Mon Apr 08 02:06:25 2013 +0300 description: Added tag 2.2.rc6 for changeset ae4341d0e83b diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r ae4341d0e83b -r bc279284fe91 .hgtags --- a/.hgtags Mon Apr 08 02:06:25 2013 +0300 +++ b/.hgtags Mon Apr 08 02:06:25 2013 +0300 @@ -101,3 +101,4 @@ 11bd79bf4866b0d728b25717134a6ba972505746 2.2.rc3 92c88eca562d45a55b65e45eb9bb937292b20595 2.2.rc4 9446df6da5a89ae94653362ef4d4ea154272cd3e 2.2.rc5 +ae4341d0e83bd63397b418666bc80076700432fd 2.2.rc6 From dovecot at dovecot.org Mon Apr 8 13:03:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 13:03:27 +0300 Subject: dovecot-2.2: lib-ssl-iostream: Added ssl_iostream_has_handshake_... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c7555e6d13fd changeset: 16244:c7555e6d13fd user: Timo Sirainen date: Mon Apr 08 13:02:27 2013 +0300 description: lib-ssl-iostream: Added ssl_iostream_has_handshake_failed() diffstat: src/lib-ssl-iostream/iostream-openssl.c | 12 +++++++++++- src/lib-ssl-iostream/iostream-openssl.h | 1 + src/lib-ssl-iostream/iostream-ssl-private.h | 1 + src/lib-ssl-iostream/iostream-ssl.c | 5 +++++ src/lib-ssl-iostream/iostream-ssl.h | 3 +++ 5 files changed, 21 insertions(+), 1 deletions(-) diffs (94 lines): diff -r be767af05259 -r c7555e6d13fd src/lib-ssl-iostream/iostream-openssl.c --- a/src/lib-ssl-iostream/iostream-openssl.c Mon Apr 08 02:06:29 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.c Mon Apr 08 13:02:27 2013 +0300 @@ -117,8 +117,10 @@ } if (!preverify_ok) { ssl_io->cert_broken = TRUE; - if (ssl_io->require_valid_cert) + if (ssl_io->require_valid_cert) { + ssl_io->handshake_failed = TRUE; return 0; + } } return 1; } @@ -550,6 +552,7 @@ i_stream_close(ssl_io->plain_input); o_stream_close(ssl_io->plain_output); openssl_iostream_set_error(ssl_io, error); + ssl_io->handshake_failed = TRUE; errno = EINVAL; return -1; } @@ -584,6 +587,12 @@ } static bool +openssl_iostream_has_handshake_failed(const struct ssl_iostream *ssl_io) +{ + return ssl_io->handshake_failed; +} + +static bool openssl_iostream_has_valid_client_cert(const struct ssl_iostream *ssl_io) { return ssl_io->cert_received && !ssl_io->cert_broken; @@ -685,6 +694,7 @@ openssl_iostream_set_log_prefix, openssl_iostream_is_handshaked, + openssl_iostream_has_handshake_failed, openssl_iostream_has_valid_client_cert, openssl_iostream_has_broken_client_cert, openssl_iostream_cert_match_name, diff -r be767af05259 -r c7555e6d13fd src/lib-ssl-iostream/iostream-openssl.h --- a/src/lib-ssl-iostream/iostream-openssl.h Mon Apr 08 02:06:29 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-openssl.h Mon Apr 08 13:02:27 2013 +0300 @@ -41,6 +41,7 @@ void *handshake_context; unsigned int handshaked:1; + unsigned int handshake_failed:1; unsigned int cert_received:1; unsigned int cert_broken:1; unsigned int want_read:1; diff -r be767af05259 -r c7555e6d13fd src/lib-ssl-iostream/iostream-ssl-private.h --- a/src/lib-ssl-iostream/iostream-ssl-private.h Mon Apr 08 02:06:29 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl-private.h Mon Apr 08 13:02:27 2013 +0300 @@ -30,6 +30,7 @@ void (*set_log_prefix)(struct ssl_iostream *ssl_io, const char *prefix); bool (*is_handshaked)(const struct ssl_iostream *ssl_io); + bool (*has_handshake_failed)(const struct ssl_iostream *ssl_io); bool (*has_valid_client_cert)(const struct ssl_iostream *ssl_io); bool (*has_broken_client_cert)(struct ssl_iostream *ssl_io); int (*cert_match_name)(struct ssl_iostream *ssl_io, const char *name); diff -r be767af05259 -r c7555e6d13fd src/lib-ssl-iostream/iostream-ssl.c --- a/src/lib-ssl-iostream/iostream-ssl.c Mon Apr 08 02:06:29 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.c Mon Apr 08 13:02:27 2013 +0300 @@ -151,6 +151,11 @@ return ssl_vfuncs->is_handshaked(ssl_io); } +bool ssl_iostream_has_handshake_failed(const struct ssl_iostream *ssl_io) +{ + return ssl_vfuncs->has_handshake_failed(ssl_io); +} + bool ssl_iostream_has_valid_client_cert(const struct ssl_iostream *ssl_io) { return ssl_vfuncs->has_valid_client_cert(ssl_io); diff -r be767af05259 -r c7555e6d13fd src/lib-ssl-iostream/iostream-ssl.h --- a/src/lib-ssl-iostream/iostream-ssl.h Mon Apr 08 02:06:29 2013 +0300 +++ b/src/lib-ssl-iostream/iostream-ssl.h Mon Apr 08 13:02:27 2013 +0300 @@ -49,6 +49,9 @@ void *context); bool ssl_iostream_is_handshaked(const struct ssl_iostream *ssl_io); +/* Returns TRUE if the remote cert is invalid, or handshake callback returned + failure. */ +bool ssl_iostream_has_handshake_failed(const struct ssl_iostream *ssl_io); bool ssl_iostream_has_valid_client_cert(const struct ssl_iostream *ssl_io); bool ssl_iostream_has_broken_client_cert(struct ssl_iostream *ssl_io); int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io, From dovecot at dovecot.org Mon Apr 8 13:03:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 13:03:27 +0300 Subject: dovecot-2.2: lib-http: If remote SSL cert is invalid, treat it a... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ac0e59dfe081 changeset: 16245:ac0e59dfe081 user: Timo Sirainen date: Mon Apr 08 13:03:12 2013 +0300 description: lib-http: If remote SSL cert is invalid, treat it as non-retryable error. diffstat: src/lib-http/http-client-connection.c | 54 ++++++++++++++++++++-------------- 1 files changed, 31 insertions(+), 23 deletions(-) diffs (71 lines): diff -r c7555e6d13fd -r ac0e59dfe081 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Mon Apr 08 13:02:27 2013 +0300 +++ b/src/lib-http/http-client-connection.c Mon Apr 08 13:03:12 2013 +0300 @@ -97,29 +97,6 @@ } static void -http_client_connection_abort_temp_error(struct http_client_connection **_conn, - unsigned int status, const char *error) -{ - struct http_client_connection *conn = *_conn; - const char *sslerr; - - if (status == HTTP_CLIENT_REQUEST_ERROR_CONNECTION_LOST && - conn->ssl_iostream != NULL) { - sslerr = ssl_iostream_get_last_error(conn->ssl_iostream); - if (sslerr != NULL) { - error = t_strdup_printf("%s (last SSL error: %s)", - error, sslerr); - } - } - - conn->connected = FALSE; - conn->closing = TRUE; - - http_client_connection_retry_requests(conn, status, error); - http_client_connection_unref(_conn); -} - -static void http_client_connection_abort_error(struct http_client_connection **_conn, unsigned int status, const char *error) { @@ -138,6 +115,37 @@ } static void +http_client_connection_abort_temp_error(struct http_client_connection **_conn, + unsigned int status, const char *error) +{ + struct http_client_connection *conn = *_conn; + const char *sslerr; + + if (status == HTTP_CLIENT_REQUEST_ERROR_CONNECTION_LOST && + conn->ssl_iostream != NULL) { + sslerr = ssl_iostream_get_last_error(conn->ssl_iostream); + if (sslerr != NULL) { + error = t_strdup_printf("%s (last SSL error: %s)", + error, sslerr); + } + if (ssl_iostream_has_handshake_failed(conn->ssl_iostream)) { + /* this isn't really a "connection lost", but that we + don't trust the remote's SSL certificate. don't + retry. */ + http_client_connection_abort_error(_conn, + HTTP_CLIENT_REQUEST_ERROR_BAD_RESPONSE, error); + return; + } + } + + conn->connected = FALSE; + conn->closing = TRUE; + + http_client_connection_retry_requests(conn, status, error); + http_client_connection_unref(_conn); +} + +static void http_client_connection_idle_timeout(struct http_client_connection *conn) { http_client_connection_debug(conn, "Idle connection timed out"); From dovecot at dovecot.org Mon Apr 8 13:10:04 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 13:10:04 +0300 Subject: dovecot-2.2: restrict_process_count(): Don't die if process coun... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/dd0d5981ad42 changeset: 16246:dd0d5981ad42 user: Timo Sirainen date: Mon Apr 08 13:09:52 2013 +0300 description: restrict_process_count(): Don't die if process count can't be changed. SELinux has hard limits and doesn't allow root to increase them. The admin should fix the error one way or another, but it's not a total failure just leaving it. diffstat: src/lib/restrict-process-size.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r ac0e59dfe081 -r dd0d5981ad42 src/lib/restrict-process-size.c --- a/src/lib/restrict-process-size.c Mon Apr 08 13:03:12 2013 +0300 +++ b/src/lib/restrict-process-size.c Mon Apr 08 13:09:52 2013 +0300 @@ -30,7 +30,7 @@ rlim.rlim_max = rlim.rlim_cur = count; if (setrlimit(RLIMIT_NPROC, &rlim) < 0) { - i_fatal("setrlimit(RLIMIT_NPROC, %llu): %m", + i_error("setrlimit(RLIMIT_NPROC, %llu): %m", (unsigned long long)count); } #endif From dovecot at dovecot.org Mon Apr 8 13:25:33 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 13:25:33 +0300 Subject: dovecot-2.2: checkpasword: Don't set AUTH_PASSWORD environment. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9feb2986945c changeset: 16247:9feb2986945c user: Timo Sirainen date: Mon Apr 08 13:25:18 2013 +0300 description: checkpasword: Don't set AUTH_PASSWORD environment. diffstat: src/auth/db-checkpassword.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diffs (23 lines): diff -r dd0d5981ad42 -r 9feb2986945c src/auth/db-checkpassword.c --- a/src/auth/db-checkpassword.c Mon Apr 08 13:09:52 2013 +0300 +++ b/src/auth/db-checkpassword.c Mon Apr 08 13:25:18 2013 +0300 @@ -226,7 +226,18 @@ tab = auth_request_get_var_expand_table(request, NULL); for (i = 0; tab[i].key != '\0' || tab[i].long_key != NULL; i++) { - if (tab[i].long_key != NULL && tab[i].value != NULL) { + /* avoid keeping passwords in environment .. just in case + an attacker might find it from there. environment is no + longer world-readable in modern OSes, but maybe the attacker + could be running with the same UID. of course then the + attacker could usually ptrace() the process, except that is + disabled on some secured systems. so, although I find it + highly unlikely anyone could actually attack Dovecot this + way in a real system, be safe just in case. besides, lets + try to keep at least minimally compatible with the + checkpassword API. */ + if (tab[i].long_key != NULL && tab[i].value != NULL && + strcasecmp(tab[i].long_key, "password") != 0) { env_put(t_strdup_printf("AUTH_%s=%s", t_str_ucase(tab[i].long_key), tab[i].value)); From dovecot at dovecot.org Mon Apr 8 14:38:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 14:38:52 +0300 Subject: dovecot-2.2: replicator: doveadm commands and user list export m... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cff14ef4cce5 changeset: 16248:cff14ef4cce5 user: Timo Sirainen date: Mon Apr 08 14:38:30 2013 +0300 description: replicator: doveadm commands and user list export may have skipped some users. The users were exported from the queue, but they are temporarily removed from there while the user is being replicated. The users always exist in the hash table though. diffstat: src/replication/replicator/doveadm-connection.c | 56 +++++++++++++----------- src/replication/replicator/replicator-queue.c | 54 +++++++++++++++++------ src/replication/replicator/replicator-queue.h | 10 ++- 3 files changed, 75 insertions(+), 45 deletions(-) diffs (237 lines): diff -r 9feb2986945c -r cff14ef4cce5 src/replication/replicator/doveadm-connection.c --- a/src/replication/replicator/doveadm-connection.c Mon Apr 08 13:25:18 2013 +0300 +++ b/src/replication/replicator/doveadm-connection.c Mon Apr 08 14:38:30 2013 +0300 @@ -23,10 +23,11 @@ static int client_input_status_overview(struct doveadm_connection *client) { - struct replicator_user *const *users; + struct replicator_queue_iter *iter; + struct replicator_user *user; enum replication_priority priority; unsigned int pending_counts[REPLICATION_PRIORITY_SYNC+1]; - unsigned int i, count, next_secs, pending_failed_count; + unsigned int user_count, next_secs, pending_failed_count; unsigned int pending_full_resync_count, waiting_failed_count; string_t *str = t_str_new(256); @@ -34,21 +35,24 @@ pending_failed_count = 0; waiting_failed_count = 0; pending_full_resync_count = 0; - users = replicator_queue_get_users(client->queue, &count); - for (i = 0; i < count; i++) { - if (users[i]->priority != REPLICATION_PRIORITY_NONE) - pending_counts[users[i]->priority]++; + user_count = 0; + iter = replicator_queue_iter_init(client->queue); + while ((user = replicator_queue_iter_next(iter)) != NULL) { + if (user->priority != REPLICATION_PRIORITY_NONE) + pending_counts[user->priority]++; else if (replicator_queue_want_sync_now(client->queue, - users[i], &next_secs)) { - if (users[i]->last_sync_failed) + user, &next_secs)) { + if (user->last_sync_failed) pending_failed_count++; else pending_full_resync_count++; } else { - if (users[i]->last_sync_failed) + if (user->last_sync_failed) waiting_failed_count++; } + user_count++; } + replicator_queue_iter_deinit(&iter); for (priority = REPLICATION_PRIORITY_SYNC; priority > 0; priority--) { str_printfa(str, "Queued '%s' requests\t%u\n", @@ -61,7 +65,7 @@ pending_full_resync_count); str_printfa(str, "Waiting 'failed' requests\t%u\n", waiting_failed_count); - str_printfa(str, "Total number of known users\t%u\n", count); + str_printfa(str, "Total number of known users\t%u\n", user_count); str_append_c(str, '\n'); o_stream_send(client->conn.output, str_data(str), str_len(str)); return 0; @@ -70,17 +74,16 @@ static int client_input_status(struct doveadm_connection *client, const char *const *args) { - struct replicator_user *const *users, *user; - unsigned int i, count; + struct replicator_queue_iter *iter; + struct replicator_user *user; const char *mask = args[0]; string_t *str = t_str_new(128); if (mask == NULL) return client_input_status_overview(client); - users = replicator_queue_get_users(client->queue, &count); - for (i = 0; i < count; i++) { - user = users[i]; + iter = replicator_queue_iter_init(client->queue); + while ((user = replicator_queue_iter_next(iter)) != NULL) { if (!wildcard_match(user->username, mask)) continue; @@ -94,6 +97,7 @@ user->last_sync_failed); o_stream_send(client->conn.output, str_data(str), str_len(str)); } + replicator_queue_iter_deinit(&iter); o_stream_send(client->conn.output, "\n", 1); return 0; } @@ -101,10 +105,11 @@ static int client_input_replicate(struct doveadm_connection *client, const char *const *args) { - struct replicator_user *const *queue_users, **users_dup; - unsigned int i, count, match_count; + struct replicator_queue_iter *iter; + struct replicator_user *user; const char *usermask; enum replication_priority priority; + unsigned int match_count; /* | */ if (str_array_length(args) != 2) { @@ -122,16 +127,15 @@ return 0; } - queue_users = replicator_queue_get_users(client->queue, &count); - users_dup = i_new(struct replicator_user *, count+1); - for (i = match_count = 0; i < count; i++) { - if (wildcard_match(queue_users[i]->username, usermask)) - users_dup[match_count++] = queue_users[i]; + match_count = 0; + iter = replicator_queue_iter_init(client->queue); + while ((user = replicator_queue_iter_next(iter)) != NULL) { + if (!wildcard_match(user->username, usermask)) + continue; + replicator_queue_add(client->queue, user->username, priority); + match_count++; } - for (i = 0; i < match_count; i++) { - replicator_queue_add(client->queue, users_dup[i]->username, - priority); - } + replicator_queue_iter_deinit(&iter); o_stream_send_str(client->conn.output, t_strdup_printf("+%u\n", match_count)); return 0; diff -r 9feb2986945c -r cff14ef4cce5 src/replication/replicator/replicator-queue.c --- a/src/replication/replicator/replicator-queue.c Mon Apr 08 13:25:18 2013 +0300 +++ b/src/replication/replicator/replicator-queue.c Mon Apr 08 14:38:30 2013 +0300 @@ -36,6 +36,11 @@ void *change_context; }; +struct replicator_queue_iter { + struct replicator_queue *queue; + struct hash_iterate_context *iter; +}; + static int user_priority_cmp(const void *p1, const void *p2) { const struct replicator_user *user1 = p1, *user2 = p2; @@ -387,9 +392,9 @@ int replicator_queue_export(struct replicator_queue *queue, const char *path) { + struct replicator_queue_iter *iter; + struct replicator_user *user; struct ostream *output; - struct priorityq_item *const *items; - unsigned int i, count; string_t *str; int fd, ret = 0; @@ -402,17 +407,14 @@ o_stream_cork(output); str = t_str_new(128); - items = priorityq_items(queue->user_queue); - count = priorityq_count(queue->user_queue); - for (i = 0; i < count; i++) { - struct replicator_user *user = - (struct replicator_user *)items[i]; - + iter = replicator_queue_iter_init(queue); + while ((user = replicator_queue_iter_next(iter)) != NULL) { str_truncate(str, 0); replicator_queue_export_user(user, str); if (o_stream_send(output, str_data(str), str_len(str)) < 0) break; } + replicator_queue_iter_deinit(&iter); if (o_stream_nfinish(output) < 0) { i_error("write(%s) failed: %m", path); ret = -1; @@ -421,13 +423,35 @@ return ret; } -struct replicator_user *const * -replicator_queue_get_users(struct replicator_queue *queue, - unsigned int *count_r) +struct replicator_queue_iter * +replicator_queue_iter_init(struct replicator_queue *queue) { - struct priorityq_item *const *items = - priorityq_items(queue->user_queue); + struct replicator_queue_iter *iter; - *count_r = priorityq_count(queue->user_queue); - return (void *)items; + iter = i_new(struct replicator_queue_iter, 1); + iter->queue = queue; + iter->iter = hash_table_iterate_init(queue->user_hash); + return iter; } + +struct replicator_user * +replicator_queue_iter_next(struct replicator_queue_iter *iter) +{ + struct replicator_user *user; + char *username; + + if (!hash_table_iterate(iter->iter, iter->queue->user_hash, + &username, &user)) + return NULL; + return user; +} + +void replicator_queue_iter_deinit(struct replicator_queue_iter **_iter) +{ + struct replicator_queue_iter *iter = *_iter; + + *_iter = NULL; + + hash_table_iterate_deinit(&iter->iter); + i_free(iter); +} diff -r 9feb2986945c -r cff14ef4cce5 src/replication/replicator/replicator-queue.h --- a/src/replication/replicator/replicator-queue.h Mon Apr 08 13:25:18 2013 +0300 +++ b/src/replication/replicator/replicator-queue.h Mon Apr 08 14:38:30 2013 +0300 @@ -69,9 +69,11 @@ bool replicator_queue_want_sync_now(struct replicator_queue *queue, struct replicator_user *user, unsigned int *next_secs_r); -/* Returns an (unsorted) array of all users in the queue. */ -struct replicator_user *const * -replicator_queue_get_users(struct replicator_queue *queue, - unsigned int *count_r); +/* Iterate through all users in the queue. */ +struct replicator_queue_iter * +replicator_queue_iter_init(struct replicator_queue *queue); +struct replicator_user * +replicator_queue_iter_next(struct replicator_queue_iter *iter); +void replicator_queue_iter_deinit(struct replicator_queue_iter **iter); #endif From dovecot at dovecot.org Mon Apr 8 14:43:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 14:43:28 +0300 Subject: dovecot-2.2: doveadm replicator: Fixed showing over 1h old times... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/db5ce75d70b9 changeset: 16249:db5ce75d70b9 user: Timo Sirainen date: Mon Apr 08 14:43:09 2013 +0300 description: doveadm replicator: Fixed showing over 1h old timestamps. diffstat: src/doveadm/doveadm-replicator.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r cff14ef4cce5 -r db5ce75d70b9 src/doveadm/doveadm-replicator.c --- a/src/doveadm/doveadm-replicator.c Mon Apr 08 14:38:30 2013 +0300 +++ b/src/doveadm/doveadm-replicator.c Mon Apr 08 14:43:09 2013 +0300 @@ -102,7 +102,8 @@ if (t == 0) return "-"; - return t_strdup_printf("%02d:%02d:%02d", diff/3600, diff/60, diff%60); + return t_strdup_printf("%02d:%02d:%02d", diff/3600, + (diff/60)%60, diff%60); } static void cmd_replicator_status_overview(struct replicator_context *ctx) From dovecot at dovecot.org Mon Apr 8 14:49:26 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 14:49:26 +0300 Subject: dovecot-2.2: lib-master: Ignore mountpoints with type cgroup. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b9758a044222 changeset: 16250:b9758a044222 user: Timo Sirainen date: Mon Apr 08 14:49:07 2013 +0300 description: lib-master: Ignore mountpoints with type cgroup. diffstat: src/lib-master/mountpoint-list.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r db5ce75d70b9 -r b9758a044222 src/lib-master/mountpoint-list.c --- a/src/lib-master/mountpoint-list.c Mon Apr 08 14:43:09 2013 +0300 +++ b/src/lib-master/mountpoint-list.c Mon Apr 08 14:49:07 2013 +0300 @@ -39,6 +39,7 @@ "rpc_pipefs", /* Linux */ "fusectl", /* Linux */ "nfsd", /* Linux */ + "cgroup", /* Linux */ "binfmt_misc", /* Linux */ "devfs", /* Solaris, OSX, BSD */ "ctfs", /* Solaris */ From dovecot at dovecot.org Mon Apr 8 14:54:04 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 14:54:04 +0300 Subject: dovecot-2.2: dsync: If dsync fails due to lock timeout, give a b... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e41a13ae504d changeset: 16251:e41a13ae504d user: Timo Sirainen date: Mon Apr 08 14:53:31 2013 +0300 description: dsync: If dsync fails due to lock timeout, give a better error message. diffstat: src/doveadm/dsync/dsync-brain.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diffs (17 lines): diff -r b9758a044222 -r e41a13ae504d src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Mon Apr 08 14:49:07 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Mon Apr 08 14:53:31 2013 +0300 @@ -238,7 +238,12 @@ if (file_wait_lock(brain->lock_fd, brain->lock_path, F_WRLCK, FILE_LOCK_METHOD_FCNTL, brain->lock_timeout, &brain->lock) <= 0) { - i_error("Couldn't lock %s: %m", brain->lock_path); + if (errno == EAGAIN) { + i_error("Couldn't lock %s: Timed out after %u seconds", + brain->lock_path, brain->lock_timeout); + } else { + i_error("Couldn't lock %s: %m", brain->lock_path); + } break; } if (fstat(brain->lock_fd, &st1) < 0) { From dovecot at dovecot.org Mon Apr 8 15:14:01 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 15:14:01 +0300 Subject: dovecot-2.2: quota: dsync shouldn't trigger quota warnings Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/54cdc5b6727c changeset: 16252:54cdc5b6727c user: Timo Sirainen date: Mon Apr 08 15:13:39 2013 +0300 description: quota: dsync shouldn't trigger quota warnings They would probably just be duplicates that were already triggered by the other replica. diffstat: src/plugins/quota/quota-private.h | 1 + src/plugins/quota/quota-storage.c | 16 +++++++++++++++- src/plugins/quota/quota.c | 7 +++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diffs (87 lines): diff -r e41a13ae504d -r 54cdc5b6727c src/plugins/quota/quota-private.h --- a/src/plugins/quota/quota-private.h Mon Apr 08 14:53:31 2013 +0300 +++ b/src/plugins/quota/quota-private.h Mon Apr 08 15:13:39 2013 +0300 @@ -156,6 +156,7 @@ unsigned int limits_set:1; unsigned int failed:1; unsigned int recalculate:1; + unsigned int sync_transaction:1; }; /* Register storage to all user's quota roots. */ diff -r e41a13ae504d -r 54cdc5b6727c src/plugins/quota/quota-storage.c --- a/src/plugins/quota/quota-storage.c Mon Apr 08 14:53:31 2013 +0300 +++ b/src/plugins/quota/quota-storage.c Mon Apr 08 15:13:39 2013 +0300 @@ -32,6 +32,7 @@ ARRAY(uoff_t) expunge_sizes; unsigned int recalculate:1; + unsigned int sync_transaction_expunge:1; }; struct quota_user_module quota_user_module = @@ -61,6 +62,14 @@ } array_append(&qbox->expunge_uids, &_mail->uid, 1); array_append(&qbox->expunge_sizes, &size, 1); + if ((_mail->transaction->flags & MAILBOX_TRANSACTION_FLAG_SYNC) != 0) { + /* we're running dsync. if this brings the quota below + a negative quota warning, don't execute it, because + it probably was already executed by the replica. */ + qbox->sync_transaction_expunge = TRUE; + } else { + qbox->sync_transaction_expunge = FALSE; + } } qmail->super.expunge(_mail); @@ -106,6 +115,7 @@ t = qbox->module_ctx.super.transaction_begin(box, flags); qt = quota_transaction_begin(box); + qt->sync_transaction = (flags & MAILBOX_TRANSACTION_FLAG_SYNC) != 0; MODULE_CONTEXT_SET(t, quota_storage_module, qt); return t; @@ -285,6 +295,7 @@ mail_free(&qbox->expunge_qt->tmp_mail); mailbox_transaction_rollback(&qbox->expunge_trans); } + qbox->sync_transaction_expunge = FALSE; } static void quota_mailbox_sync_commit(struct quota_mailbox *qbox) @@ -330,8 +341,11 @@ } } - if (qbox->expunge_qt == NULL) + if (qbox->expunge_qt == NULL) { qbox->expunge_qt = quota_transaction_begin(box); + qbox->expunge_qt->sync_transaction = + qbox->sync_transaction_expunge; + } if (i != count) { /* we already know the size */ diff -r e41a13ae504d -r 54cdc5b6727c src/plugins/quota/quota.c --- a/src/plugins/quota/quota.c Mon Apr 08 14:53:31 2013 +0300 +++ b/src/plugins/quota/quota.c Mon Apr 08 15:13:39 2013 +0300 @@ -1210,12 +1210,15 @@ if (roots[i]->backend.v.update(roots[i], ctx) < 0) ret = -1; - else + else if (!ctx->sync_transaction) array_append(&warn_roots, &roots[i], 1); } /* execute quota warnings after all updates. this makes it work correctly regardless of whether backend.get_resource() - returns updated values before backend.update() or not */ + returns updated values before backend.update() or not. + warnings aren't executed when dsync bring the user over, + because the user probably already got the warning on the + other replica. */ array_foreach(&warn_roots, roots) quota_warnings_execute(ctx, *roots); } T_END; From dovecot at dovecot.org Mon Apr 8 15:33:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 15:33:47 +0300 Subject: dovecot-2.2: dsync: -U parameter never updated replicator's full... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1a58d4bcb49c changeset: 16253:1a58d4bcb49c user: Timo Sirainen date: Mon Apr 08 15:33:23 2013 +0300 description: dsync: -U parameter never updated replicator's full_sync state. diffstat: src/doveadm/dsync/doveadm-dsync.c | 10 +++++++--- src/doveadm/dsync/dsync-brain.c | 5 +++++ src/doveadm/dsync/dsync-brain.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diffs (74 lines): diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Mon Apr 08 15:13:39 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Mon Apr 08 15:33:23 2013 +0300 @@ -443,7 +443,9 @@ } static void -dsync_replicator_notify(struct dsync_cmd_context *ctx, const char *state_str) +dsync_replicator_notify(struct dsync_cmd_context *ctx, + enum dsync_brain_sync_type sync_type, + const char *state_str) { #define REPLICATOR_HANDSHAKE "VERSION\treplicator-doveadm-client\t1\t0\n" const char *path; @@ -465,7 +467,7 @@ str_append(str, REPLICATOR_HANDSHAKE"NOTIFY\t"); str_append_tabescaped(str, ctx->ctx.cur_mail_user->username); str_append_c(str, '\t'); - if (ctx->sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL) + if (sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL) str_append_c(str, 'f'); str_append_c(str, '\t'); str_append_tabescaped(str, state_str); @@ -910,6 +912,7 @@ struct dsync_ibc *ibc; struct dsync_brain *brain; string_t *temp_prefix, *state_str = NULL; + enum dsync_brain_sync_type sync_type; if (_ctx->conn != NULL) { /* doveadm-server connection. start with a success reply. @@ -937,6 +940,7 @@ state_str = t_str_new(128); dsync_brain_get_state(brain, state_str); } + sync_type = dsync_brain_get_sync_type(brain); if (dsync_brain_deinit(&brain) < 0) _ctx->exit_code = EX_TEMPFAIL; @@ -949,7 +953,7 @@ } if (ctx->replicator_notify) - dsync_replicator_notify(ctx, str_c(state_str)); + dsync_replicator_notify(ctx, sync_type, str_c(state_str)); return _ctx->exit_code == 0 ? 0 : -1; } diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Mon Apr 08 15:13:39 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Mon Apr 08 15:33:23 2013 +0300 @@ -498,6 +498,11 @@ dsync_mailbox_states_export(brain->mailbox_states, output); } +enum dsync_brain_sync_type dsync_brain_get_sync_type(struct dsync_brain *brain) +{ + return brain->sync_type; +} + bool dsync_brain_has_failed(struct dsync_brain *brain) { return brain->failed; diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/dsync-brain.h --- a/src/doveadm/dsync/dsync-brain.h Mon Apr 08 15:13:39 2013 +0300 +++ b/src/doveadm/dsync/dsync-brain.h Mon Apr 08 15:33:23 2013 +0300 @@ -50,5 +50,7 @@ /* Returns the current sync state string, which can be given as parameter to dsync_brain_master_init() to quickly sync only the new changes. */ void dsync_brain_get_state(struct dsync_brain *brain, string_t *output); +/* Returns the sync type that was used. Mainly useful with slave brain. */ +enum dsync_brain_sync_type dsync_brain_get_sync_type(struct dsync_brain *brain); #endif From dovecot at dovecot.org Mon Apr 8 17:10:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 17:10:23 +0300 Subject: dovecot-2.2: dsync: If saving mails fail, stop trying to save mo... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e0acf38f6199 changeset: 16254:e0acf38f6199 user: Timo Sirainen date: Mon Apr 08 17:10:14 2013 +0300 description: dsync: If saving mails fail, stop trying to save more of them and flooding logs. diffstat: src/doveadm/dsync/dsync-mailbox-import.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 1a58d4bcb49c -r e0acf38f6199 src/doveadm/dsync/dsync-mailbox-import.c --- a/src/doveadm/dsync/dsync-mailbox-import.c Mon Apr 08 15:33:23 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Mon Apr 08 17:10:14 2013 +0300 @@ -1949,6 +1949,9 @@ i_assert(mail->input == NULL || mail->input->seekable); i_assert(importer->new_uids_assigned); + if (importer->failed) + return; + all_newmails = *mail->guid != '\0' ? hash_table_lookup(importer->import_guids, mail->guid) : hash_table_lookup(importer->import_uids, POINTER_CAST(mail->uid)); From dovecot at dovecot.org Mon Apr 8 18:14:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 08 Apr 2013 18:14:45 +0300 Subject: dovecot-2.2: dsync: Commit large transactions every 100 new mess... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/548e59794f2e changeset: 16255:548e59794f2e user: Timo Sirainen date: Mon Apr 08 18:14:32 2013 +0300 description: dsync: Commit large transactions every 100 new messages. This way if the dsync crashes or transaction fails in the middle, the next run can finish faster. Also the rollbacking finishes faster. diffstat: src/doveadm/dsync/dsync-mailbox-import.c | 187 ++++++++++++++++++++---------- 1 files changed, 122 insertions(+), 65 deletions(-) diffs (truncated from 339 to 300 lines): diff -r e0acf38f6199 -r 548e59794f2e src/doveadm/dsync/dsync-mailbox-import.c --- a/src/doveadm/dsync/dsync-mailbox-import.c Mon Apr 08 17:10:14 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Mon Apr 08 18:14:32 2013 +0300 @@ -13,6 +13,8 @@ #include "dsync-mailbox.h" #include "dsync-mailbox-import.h" +#define DSYNC_COMMIT_MSGS_INTERVAL 100 + struct importer_mail { const char *guid; uint32_t uid; @@ -79,6 +81,7 @@ ARRAY(struct importer_new_mail *) newmails; ARRAY_TYPE(uint32_t) wanted_uids; + ARRAY_TYPE(uint32_t) saved_uids; uint32_t highest_wanted_uid; ARRAY(struct dsync_mail_request) mail_requests; @@ -104,6 +107,8 @@ static void dsync_mailbox_save_newmails(struct dsync_mailbox_importer *importer, const struct dsync_mail *mail, struct importer_new_mail *all_newmails); +static int dsync_mailbox_import_commit(struct dsync_mailbox_importer *importer, + bool final); static void dsync_mailbox_import_search_init(struct dsync_mailbox_importer *importer) @@ -128,6 +133,22 @@ importer->cur_mail_skip = TRUE; } +static void +dsync_mailbox_import_transaction_begin(struct dsync_mailbox_importer *importer) +{ + const enum mailbox_transaction_flags ext_trans_flags = + MAILBOX_TRANSACTION_FLAG_SYNC | + MAILBOX_TRANSACTION_FLAG_EXTERNAL | + MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS; + + importer->trans = mailbox_transaction_begin(importer->box, + MAILBOX_TRANSACTION_FLAG_SYNC); + importer->ext_trans = mailbox_transaction_begin(importer->box, + ext_trans_flags); + importer->mail = mail_alloc(importer->trans, 0, NULL); + importer->ext_mail = mail_alloc(importer->ext_trans, 0, NULL); +} + struct dsync_mailbox_importer * dsync_mailbox_import_init(struct mailbox *box, struct dsync_transaction_log_scan *log_scan, @@ -140,10 +161,6 @@ uint64_t remote_highest_pvt_modseq, enum dsync_mailbox_import_flags flags) { - const enum mailbox_transaction_flags ext_trans_flags = - MAILBOX_TRANSACTION_FLAG_SYNC | - MAILBOX_TRANSACTION_FLAG_EXTERNAL | - MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS; struct dsync_mailbox_importer *importer; struct mailbox_status status; pool_t pool; @@ -170,12 +187,9 @@ i_array_init(&importer->maybe_saves, 128); i_array_init(&importer->newmails, 128); i_array_init(&importer->wanted_uids, 128); + i_array_init(&importer->saved_uids, 128); - importer->trans = mailbox_transaction_begin(importer->box, - MAILBOX_TRANSACTION_FLAG_SYNC); - importer->ext_trans = mailbox_transaction_begin(box, ext_trans_flags); - importer->mail = mail_alloc(importer->trans, 0, NULL); - importer->ext_mail = mail_alloc(importer->ext_trans, 0, NULL); + dsync_mailbox_import_transaction_begin(importer); if ((flags & DSYNC_MAILBOX_IMPORT_FLAG_WANT_MAIL_REQUESTS) != 0) { i_array_init(&importer->mail_requests, 128); @@ -1498,12 +1512,21 @@ } static void -dsync_mailbox_import_want_uid(struct dsync_mailbox_importer *importer, - uint32_t uid) +dsync_mailbox_import_saved_uid(struct dsync_mailbox_importer *importer, + uint32_t uid) { + i_assert(importer->search_ctx == NULL); + if (importer->highest_wanted_uid < uid) importer->highest_wanted_uid = uid; array_append(&importer->wanted_uids, &uid, 1); + + /* commit the transaction once in a while, so if we fail we don't + rollback everything. */ + if (array_count(&importer->wanted_uids) % DSYNC_COMMIT_MSGS_INTERVAL == 0) { + if (dsync_mailbox_import_commit(importer, FALSE) < 0) + importer->failed = TRUE; + } } static bool @@ -1522,7 +1545,7 @@ mailbox_save_set_uid(save_ctx, new_uid); if (mailbox_move(&save_ctx, importer->mail) < 0) return FALSE; - dsync_mailbox_import_want_uid(importer, new_uid); + dsync_mailbox_import_saved_uid(importer, new_uid); return TRUE; } @@ -1737,6 +1760,15 @@ /* save mails from local sources where possible, request the rest from remote */ dsync_mailbox_import_handle_local_mails(importer); + + if (importer->search_ctx != NULL) { + if (mailbox_search_deinit(&importer->search_ctx) < 0) { + i_error("Mailbox %s: Search failed: %s", + mailbox_get_vname(importer->box), + mailbox_get_last_error(importer->box, NULL)); + importer->failed = TRUE; + } + } } const struct dsync_mail_request * @@ -1872,7 +1904,7 @@ } if (ret > 0) { i_assert(save_ctx == NULL); - dsync_mailbox_import_want_uid(importer, newmail->final_uid); + dsync_mailbox_import_saved_uid(importer, newmail->final_uid); return; } /* fallback to saving from remote stream */ @@ -1920,8 +1952,8 @@ mailbox_get_last_error(importer->box, NULL)); importer->failed = TRUE; } else { - dsync_mailbox_import_want_uid(importer, - newmail->final_uid); + dsync_mailbox_import_saved_uid(importer, + newmail->final_uid); } } } @@ -2031,24 +2063,22 @@ static int reassign_unwanted_uids(struct dsync_mailbox_importer *importer, - const struct mail_transaction_commit_changes *changes, bool *changes_during_sync_r) { ARRAY_TYPE(seq_range) unwanted_uids; - struct seq_range_iter iter; - const uint32_t *wanted_uids; - uint32_t saved_uid, highest_seen_uid; - unsigned int i, n, wanted_count; + const uint32_t *wanted_uids, *saved_uids; + uint32_t highest_seen_uid; + unsigned int i, wanted_count, saved_count; int ret = 0; wanted_uids = array_get(&importer->wanted_uids, &wanted_count); - if (wanted_count == 0) { - i_assert(array_count(&changes->saved_uids) == 0); + saved_uids = array_get(&importer->saved_uids, &saved_count); + i_assert(wanted_count == saved_count); + if (wanted_count == 0) return 0; - } /* wanted_uids contains the UIDs we tried to save mails with. if nothing changed during dsync, we should have the expected UIDs - (changes->saved_uids) and all is well. + (saved_uids) and all is well. if any new messages got inserted during dsync, we'll need to fix up the UIDs and let the next dsync fix up the other side. for example: @@ -2069,14 +2099,11 @@ i_assert(importer->local_uid_next <= highest_seen_uid); seq_range_array_add_range(&unwanted_uids, importer->local_uid_next, highest_seen_uid); - seq_range_array_iter_init(&iter, &changes->saved_uids); i = n = 0; - while (seq_range_array_iter_nth(&iter, n++, &saved_uid)) { + for (i = 0; i < wanted_count; i++) { i_assert(i < wanted_count); - if (saved_uid == wanted_uids[i]) - seq_range_array_remove(&unwanted_uids, saved_uid); - i++; + if (saved_uids[i] == wanted_uids[i]) + seq_range_array_remove(&unwanted_uids, saved_uids[i]); } - i_assert(i == wanted_count); ret = reassign_uids_in_seq_range(importer->box, &unwanted_uids); if (ret == 0) { @@ -2088,12 +2115,17 @@ return ret < 0 ? -1 : 0; } -static int dsync_mailbox_import_commit(struct dsync_mailbox_importer *importer, - bool *changes_during_sync_r) +static int +dsync_mailbox_import_commit(struct dsync_mailbox_importer *importer, bool final) { struct mail_transaction_commit_changes changes; - struct mailbox_update update; - int ret = 0; + struct seq_range_iter iter; + uint32_t uid; + unsigned int n; + int ret = importer->failed ? -1 : 0; + + mail_free(&importer->mail); + mail_free(&importer->ext_mail); /* commit saves */ if (mailbox_transaction_commit_get_changes(&importer->ext_trans, @@ -2101,33 +2133,59 @@ i_error("Mailbox %s: Save commit failed: %s", mailbox_get_vname(importer->box), mailbox_get_last_error(importer->box, NULL)); + /* removed wanted_uids that weren't actually saved */ + array_delete(&importer->wanted_uids, + array_count(&importer->saved_uids), + array_count(&importer->wanted_uids) - + array_count(&importer->saved_uids)); mailbox_transaction_rollback(&importer->trans); - return -1; + ret = -1; + } else { + /* remember the UIDs that were successfully saved */ + seq_range_array_iter_init(&iter, &changes.saved_uids); n = 0; + while (seq_range_array_iter_nth(&iter, n++, &uid)) + array_append(&importer->saved_uids, &uid, 1); + pool_unref(&changes.pool); + + /* commit flag changes and expunges */ + if (mailbox_transaction_commit(&importer->trans) < 0) { + i_error("Mailbox %s: Commit failed: %s", + mailbox_get_vname(importer->box), + mailbox_get_last_error(importer->box, NULL)); + ret = -1; + } } - /* commit flag changes and expunges */ - if (mailbox_transaction_commit(&importer->trans) < 0) { - i_error("Mailbox %s: Commit failed: %s", - mailbox_get_vname(importer->box), - mailbox_get_last_error(importer->box, NULL)); - pool_unref(&changes.pool); - return -1; - } + if (!final) + dsync_mailbox_import_transaction_begin(importer); + return ret; +} - /* update mailbox metadata. */ - memset(&update, 0, sizeof(update)); - update.min_next_uid = importer->remote_uid_next; - update.min_first_recent_uid = - I_MIN(importer->last_common_uid+1, - importer->remote_first_recent_uid); - update.min_highest_modseq = importer->remote_highest_modseq; - update.min_highest_pvt_modseq = importer->remote_highest_pvt_modseq; +static int dsync_mailbox_import_finish(struct dsync_mailbox_importer *importer, + bool *changes_during_sync_r) +{ + struct mailbox_update update; + int ret; - if (mailbox_update(importer->box, &update) < 0) { - i_error("Mailbox %s: Update failed: %s", - mailbox_get_vname(importer->box), - mailbox_get_last_error(importer->box, NULL)); - ret = -1; + ret = dsync_mailbox_import_commit(importer, TRUE); + + if (ret == 0) { + /* update mailbox metadata if we successfully saved + everything. */ + memset(&update, 0, sizeof(update)); + update.min_next_uid = importer->remote_uid_next; + update.min_first_recent_uid = + I_MIN(importer->last_common_uid+1, + importer->remote_first_recent_uid); + update.min_highest_modseq = importer->remote_highest_modseq; + update.min_highest_pvt_modseq = importer->remote_highest_pvt_modseq; + + if (mailbox_update(importer->box, &update) < 0) { + i_error("Mailbox %s: Update failed: %s", + mailbox_get_vname(importer->box), + mailbox_get_last_error(importer->box, NULL)); + ret = -1; + } } From dovecot at dovecot.org Tue Apr 9 14:18:03 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 09 Apr 2013 14:18:03 +0300 Subject: dovecot-2.2: dsync: Fixed assert-crash caused by previous change Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/194df093a05f changeset: 16256:194df093a05f user: Timo Sirainen date: Tue Apr 09 14:17:56 2013 +0300 description: dsync: Fixed assert-crash caused by previous change diffstat: src/doveadm/dsync/dsync-mailbox-import.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (27 lines): diff -r 548e59794f2e -r 194df093a05f src/doveadm/dsync/dsync-mailbox-import.c --- a/src/doveadm/dsync/dsync-mailbox-import.c Mon Apr 08 18:14:32 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Tue Apr 09 14:17:56 2013 +0300 @@ -1756,11 +1756,6 @@ while (importer->cur_mail != NULL) (void)dsync_mailbox_try_save(importer, NULL); - dsync_mailbox_import_assign_new_uids(importer); - /* save mails from local sources where possible, - request the rest from remote */ - dsync_mailbox_import_handle_local_mails(importer); - if (importer->search_ctx != NULL) { if (mailbox_search_deinit(&importer->search_ctx) < 0) { i_error("Mailbox %s: Search failed: %s", @@ -1769,6 +1764,11 @@ importer->failed = TRUE; } } + + dsync_mailbox_import_assign_new_uids(importer); + /* save mails from local sources where possible, + request the rest from remote */ + dsync_mailbox_import_handle_local_mails(importer); } const struct dsync_mail_request * From dovecot at dovecot.org Tue Apr 9 23:54:58 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 09 Apr 2013 23:54:58 +0300 Subject: dovecot-2.2: istream-seekable: Fixed handling "buffer full" i_st... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fbef40826602 changeset: 16257:fbef40826602 user: Timo Sirainen date: Tue Apr 09 23:54:52 2013 +0300 description: istream-seekable: Fixed handling "buffer full" i_stream_read() result from underlying streams. diffstat: src/lib/istream-seekable.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 194df093a05f -r fbef40826602 src/lib/istream-seekable.c --- a/src/lib/istream-seekable.c Tue Apr 09 14:17:56 2013 +0300 +++ b/src/lib/istream-seekable.c Tue Apr 09 23:54:52 2013 +0300 @@ -254,7 +254,7 @@ if (stream->istream.v_offset + stream->pos == sstream->write_peak) { /* need to read more */ ret = read_more(sstream); - if (ret <= 0) + if (ret == -1 || ret == 0) return ret; /* save to our file */ From dovecot at dovecot.org Wed Apr 10 00:14:19 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 00:14:19 +0300 Subject: dovecot-2.2: lib-storage: Fixed crash with mailbox_list_index=ye... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f39664bd4b29 changeset: 16258:f39664bd4b29 user: Timo Sirainen date: Wed Apr 10 00:14:09 2013 +0300 description: lib-storage: Fixed crash with mailbox_list_index=yes and out-of-date index. diffstat: src/lib-storage/list/mailbox-list-index-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r fbef40826602 -r f39664bd4b29 src/lib-storage/list/mailbox-list-index-status.c --- a/src/lib-storage/list/mailbox-list-index-status.c Tue Apr 09 23:54:52 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index-status.c Wed Apr 10 00:14:09 2013 +0300 @@ -498,7 +498,7 @@ view = mail_index_view_open(ilist->index); if (!mail_index_lookup_seq(view, uid, &seq)) { /* our in-memory tree is out of sync */ - ret = 0; + ret = 1; } else T_BEGIN { ret = box->v.list_index_has_changed == NULL ? 0 : box->v.list_index_has_changed(box, view, seq); From dovecot at dovecot.org Wed Apr 10 13:41:28 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 13:41:28 +0300 Subject: dovecot-2.2: dsync: Don't fail the sync if attribute couldn't be... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8da591260f7c changeset: 16259:8da591260f7c user: Timo Sirainen date: Wed Apr 10 13:40:57 2013 +0300 description: dsync: Don't fail the sync if attribute couldn't be set. It's probably a system configuration mismatch where some/all attributes don't work in one system but do on another. This might or might not be a problem, so it deserves an error message, but probably doesn't deserve failing entirely. diffstat: src/doveadm/dsync/dsync-mailbox-import.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diffs (35 lines): diff -r f39664bd4b29 -r 8da591260f7c src/doveadm/dsync/dsync-mailbox-import.c --- a/src/doveadm/dsync/dsync-mailbox-import.c Wed Apr 10 00:14:09 2013 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Wed Apr 10 13:40:57 2013 +0300 @@ -350,7 +350,7 @@ { struct dsync_mailbox_attribute *local_attr; struct mail_attribute_value value; - int ret, cmp; + int cmp; bool ignore = FALSE; i_assert(DSYNC_ATTR_HAS_VALUE(attr) || attr->deleted); @@ -416,17 +416,17 @@ value.value = attr->value; value.value_stream = attr->value_stream; value.last_change = attr->last_change; - ret = mailbox_attribute_set(importer->trans, attr->type, - attr->key, &value); - if (ret < 0) { + if (mailbox_attribute_set(importer->trans, attr->type, + attr->key, &value) < 0) { i_error("Mailbox %s: Failed to set attribute %s: %s", mailbox_get_vname(importer->box), attr->key, mailbox_get_last_error(importer->box, NULL)); - importer->failed = TRUE; + /* the attributes aren't vital, don't fail everything just + because of them. */ } if (local_attr != NULL && local_attr->value_stream != NULL) i_stream_unref(&local_attr->value_stream); - return ret; + return 0; } static void dsync_mail_error(struct dsync_mailbox_importer *importer, From dovecot at dovecot.org Wed Apr 10 14:01:00 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:01:00 +0300 Subject: dovecot-2.2: lib-storage: Make sure index root dir is created wh... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/52233547b371 changeset: 16260:52233547b371 user: Timo Sirainen date: Wed Apr 10 14:00:47 2013 +0300 description: lib-storage: Make sure index root dir is created when mailbox list index is created. diffstat: src/lib-storage/list/mailbox-list-index.c | 3 ++ src/lib-storage/mailbox-list.c | 46 ++++++++++++++++++++---------- src/lib-storage/mailbox-list.h | 4 ++ 3 files changed, 38 insertions(+), 15 deletions(-) diffs (101 lines): diff -r 8da591260f7c -r 52233547b371 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Wed Apr 10 13:40:57 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Wed Apr 10 14:00:47 2013 +0300 @@ -47,6 +47,9 @@ if (ilist->opened) return 0; + if (mailbox_list_mkdir_missing_index_root(list) < 0) + return -1; + index_flags = mail_storage_settings_to_index_flags(set); if (strcmp(list->name, MAILBOX_LIST_NAME_INDEX) == 0) { /* LAYOUT=index. this is the only location for the mailbox diff -r 8da591260f7c -r 52233547b371 src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Wed Apr 10 13:40:57 2013 +0300 +++ b/src/lib-storage/mailbox-list.c Wed Apr 10 14:00:47 2013 +0300 @@ -1107,6 +1107,8 @@ mailbox_list_set_critical(list, "%s", error); return -1; } + if (type == MAILBOX_LIST_PATH_TYPE_INDEX) + list->index_root_dir_created = TRUE; return 0; } @@ -1439,32 +1441,46 @@ return TRUE; } +int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list) +{ + const char *root_dir, *index_dir; + int ret; + + if (list->index_root_dir_created) + return 1; + + /* if index root dir hasn't been created yet, do it now */ + ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, + &index_dir); + if (ret <= 0) + return ret; + ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX, + &root_dir); + if (ret <= 0) + return ret; + + if (strcmp(root_dir, index_dir) != 0) { + if (mailbox_list_mkdir_root(list, index_dir, + MAILBOX_LIST_PATH_TYPE_INDEX) < 0) + return -1; + } + list->index_root_dir_created = TRUE; + return 1; +} + void mailbox_list_add_change(struct mailbox_list *list, enum mailbox_log_record_type type, const guid_128_t mailbox_guid) { struct mailbox_log_record rec; - const char *root_dir, *index_dir; time_t stamp; if (!mailbox_list_init_changelog(list) || guid_128_is_empty(mailbox_guid)) return; - if (!list->index_root_dir_created) { - /* if index root dir hasn't been created yet, do it now */ - if (mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, - &index_dir) <= 0) - return; - if (mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX, - &root_dir) <= 0 || - strcmp(root_dir, index_dir) != 0) { - if (mailbox_list_mkdir_root(list, index_dir, - MAILBOX_LIST_PATH_TYPE_INDEX) < 0) - return; - } - list->index_root_dir_created = TRUE; - } + if (mailbox_list_mkdir_missing_index_root(list) <= 0) + return; stamp = list->changelog_timestamp != (time_t)-1 ? list->changelog_timestamp : ioloop_time; diff -r 8da591260f7c -r 52233547b371 src/lib-storage/mailbox-list.h --- a/src/lib-storage/mailbox-list.h Wed Apr 10 13:40:57 2013 +0300 +++ b/src/lib-storage/mailbox-list.h Wed Apr 10 14:00:47 2013 +0300 @@ -181,6 +181,10 @@ int mailbox_list_try_mkdir_root(struct mailbox_list *list, const char *path, enum mailbox_list_path_type type, const char **error_r); +/* Call mailbox_list_mkdir_root() for index, unless the index root is the + same as mailbox root. Returns 1 if ok, 0 if there are no indexes, -1 if + error. Calling this multiple times does the check only once. */ +int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list); /* Returns TRUE if name is ok, FALSE if it can't be safely passed to mailbox_list_*() functions */ From dovecot at dovecot.org Wed Apr 10 14:17:49 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:17:49 +0300 Subject: dovecot-2.2: lib-storage: Fixed mailbox list index crashes with ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/61ee2da538e1 changeset: 16262:61ee2da538e1 user: Timo Sirainen date: Wed Apr 10 14:17:41 2013 +0300 description: lib-storage: Fixed mailbox list index crashes with shared mailboxes. diffstat: src/lib-storage/list/mailbox-list-index.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 3d8c08c19190 -r 61ee2da538e1 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Wed Apr 10 14:13:51 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Wed Apr 10 14:17:41 2013 +0300 @@ -615,7 +615,7 @@ } static void -mailbox_list_index_namespaces_created(struct mail_namespace *namespaces) +mailbox_list_index_namespaces_added(struct mail_namespace *namespaces) { struct mail_namespace *ns; @@ -645,7 +645,7 @@ static struct mail_storage_hooks mailbox_list_index_hooks = { .mailbox_list_created = mailbox_list_index_created, - .mail_namespaces_created = mailbox_list_index_namespaces_created, + .mail_namespaces_added = mailbox_list_index_namespaces_added, .mailbox_allocated = mailbox_list_index_mailbox_allocated }; From dovecot at dovecot.org Wed Apr 10 14:17:49 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:17:49 +0300 Subject: dovecot-2.2: lib-storage: Added mail_namespaces_added hook. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3d8c08c19190 changeset: 16261:3d8c08c19190 user: Timo Sirainen date: Wed Apr 10 14:13:51 2013 +0300 description: lib-storage: Added mail_namespaces_added hook. diffstat: src/lib-storage/mail-storage-hooks.c | 10 ++++++++++ src/lib-storage/mail-storage-hooks.h | 7 +++++++ src/lib-storage/mail-user.c | 4 ++++ 3 files changed, 21 insertions(+), 0 deletions(-) diffs (59 lines): diff -r 52233547b371 -r 3d8c08c19190 src/lib-storage/mail-storage-hooks.c --- a/src/lib-storage/mail-storage-hooks.c Wed Apr 10 14:00:47 2013 +0300 +++ b/src/lib-storage/mail-storage-hooks.c Wed Apr 10 14:13:51 2013 +0300 @@ -281,6 +281,16 @@ } } +void hook_mail_namespaces_added(struct mail_namespace *namespaces) +{ + const struct mail_storage_hooks *const *hooks; + + array_foreach(&namespaces->user->hooks, hooks) { + if ((*hooks)->mail_namespaces_added != NULL) + (*hooks)->mail_namespaces_added(namespaces); + } +} + void hook_mail_storage_created(struct mail_storage *storage) { const struct mail_storage_hooks *const *hooks; diff -r 52233547b371 -r 3d8c08c19190 src/lib-storage/mail-storage-hooks.h --- a/src/lib-storage/mail-storage-hooks.h Wed Apr 10 14:00:47 2013 +0300 +++ b/src/lib-storage/mail-storage-hooks.h Wed Apr 10 14:13:51 2013 +0300 @@ -12,7 +12,13 @@ struct mail_storage_hooks { void (*mail_user_created)(struct mail_user *user); void (*mail_namespace_storage_added)(struct mail_namespace *ns); + /* called the first time user's initial namespaces were added */ void (*mail_namespaces_created)(struct mail_namespace *namespaces); + /* called every time namespaces are added. most importantly called + when shared mailbox accesses trigger creating new namespaces. + this is called before mail_namespaces_created() at startup. + The namespaces parameter contains all of the current namespaces. */ + void (*mail_namespaces_added)(struct mail_namespace *namespaces); void (*mail_storage_created)(struct mail_storage *storage); void (*mailbox_list_created)(struct mailbox_list *list); void (*mailbox_allocated)(struct mailbox *box); @@ -37,6 +43,7 @@ void hook_mail_user_created(struct mail_user *user); void hook_mail_namespace_storage_added(struct mail_namespace *ns); void hook_mail_namespaces_created(struct mail_namespace *namespaces); +void hook_mail_namespaces_added(struct mail_namespace *namespaces); void hook_mail_storage_created(struct mail_storage *storage); void hook_mailbox_list_created(struct mailbox_list *list); void hook_mailbox_allocated(struct mailbox *box); diff -r 52233547b371 -r 3d8c08c19190 src/lib-storage/mail-user.c --- a/src/lib-storage/mail-user.c Wed Apr 10 14:00:47 2013 +0300 +++ b/src/lib-storage/mail-user.c Wed Apr 10 14:13:51 2013 +0300 @@ -258,6 +258,10 @@ *tmp = ns; } *namespaces = user->namespaces; + + T_BEGIN { + hook_mail_namespaces_added(user->namespaces); + } T_END; } void mail_user_drop_useless_namespaces(struct mail_user *user) From dovecot at dovecot.org Wed Apr 10 14:18:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:18:44 +0300 Subject: dovecot-2.1: doveadm batch: Fixed handling subcommand parameters... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/850b5d8bbcc9 changeset: 14953:850b5d8bbcc9 user: Timo Sirainen date: Fri Apr 05 14:05:54 2013 +0300 description: doveadm batch: Fixed handling subcommand parameters and errors. diffstat: src/doveadm/doveadm-mail-batch.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (26 lines): diff -r c6b4a639cae1 -r 850b5d8bbcc9 src/doveadm/doveadm-mail-batch.c --- a/src/doveadm/doveadm-mail-batch.c Fri Apr 05 13:21:40 2013 +0300 +++ b/src/doveadm/doveadm-mail-batch.c Fri Apr 05 14:05:54 2013 +0300 @@ -37,10 +37,14 @@ int ret = 0; array_foreach(&ctx->commands, cmdp) { + (*cmdp)->cur_mail_user = user; if ((*cmdp)->v.run(*cmdp, user) < 0) { + i_assert((*cmdp)->exit_code != 0); + _ctx->exit_code = (*cmdp)->exit_code; ret = -1; break; } + (*cmdp)->cur_mail_user = NULL; } return ret; } @@ -149,6 +153,7 @@ struct batch_cmd_context *ctx; ctx = doveadm_mail_cmd_alloc(struct batch_cmd_context); + ctx->ctx.getopt_args = "+"; /* disable processing -args in the middle */ ctx->ctx.v.preinit = cmd_batch_preinit; ctx->ctx.v.init = cmd_batch_init; ctx->ctx.v.prerun = cmd_batch_prerun; From dovecot at dovecot.org Wed Apr 10 14:18:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:18:44 +0300 Subject: dovecot-2.1: quota-status: Fixed compiling with old Solaris. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8e9f1c744516 changeset: 14954:8e9f1c744516 user: Timo Sirainen date: Wed Apr 10 14:18:38 2013 +0300 description: quota-status: Fixed compiling with old Solaris. diffstat: src/plugins/quota/quota-status.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 850b5d8bbcc9 -r 8e9f1c744516 src/plugins/quota/quota-status.c --- a/src/plugins/quota/quota-status.c Fri Apr 05 14:05:54 2013 +0300 +++ b/src/plugins/quota/quota-status.c Wed Apr 10 14:18:38 2013 +0300 @@ -14,6 +14,9 @@ #include "quota-private.h" #include "quota-plugin.h" +#include +#include + enum quota_protocol { QUOTA_PROTOCOL_UNKNOWN = 0, QUOTA_PROTOCOL_POSTFIX From dovecot at dovecot.org Wed Apr 10 14:52:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:52:30 +0300 Subject: dovecot-2.2: lib-fs: Add data stack frames to most API calls, so... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/08602cf498ea changeset: 16264:08602cf498ea user: Timo Sirainen date: Wed Apr 10 14:52:17 2013 +0300 description: lib-fs: Add data stack frames to most API calls, so the backends/callers don't need to. diffstat: src/lib-fs/fs-api.c | 138 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 113 insertions(+), 25 deletions(-) diffs (271 lines): diff -r e8f366822a59 -r 08602cf498ea src/lib-fs/fs-api.c --- a/src/lib-fs/fs-api.c Wed Apr 10 14:51:37 2013 +0300 +++ b/src/lib-fs/fs-api.c Wed Apr 10 14:52:17 2013 +0300 @@ -175,7 +175,9 @@ } file->fs->files_open_count--; - file->fs->v.file_deinit(file); + T_BEGIN { + file->fs->v.file_deinit(file); + } T_END; if (metadata_pool != NULL) pool_unref(&metadata_pool); @@ -207,8 +209,9 @@ void fs_set_metadata(struct fs_file *file, const char *key, const char *value) { - if (file->fs->v.set_metadata != NULL) + if (file->fs->v.set_metadata != NULL) T_BEGIN { file->fs->v.set_metadata(file, key, value); + } T_END; } int fs_get_metadata(struct fs_file *file, @@ -257,7 +260,12 @@ bool fs_prefetch(struct fs_file *file, uoff_t length) { - return file->fs->v.prefetch(file, length); + bool ret; + + T_BEGIN { + ret = file->fs->v.prefetch(file, length); + } T_END; + return ret; } ssize_t fs_read_via_stream(struct fs_file *file, void *buf, size_t size) @@ -289,8 +297,14 @@ ssize_t fs_read(struct fs_file *file, void *buf, size_t size) { - if (file->fs->v.read != NULL) - return file->fs->v.read(file, buf, size); + int ret; + + if (file->fs->v.read != NULL) { + T_BEGIN { + ret = file->fs->v.read(file, buf, size); + } T_END; + return ret; + } /* backend didn't bother to implement read(), but we can do it with streams. */ @@ -310,7 +324,9 @@ i_stream_ref(file->seekable_input); return file->seekable_input; } - input = file->fs->v.read_stream(file, max_buffer_size); + T_BEGIN { + input = file->fs->v.read_stream(file, max_buffer_size); + } T_END; if (input->stream_errno != 0) { /* read failed already */ return input; @@ -382,8 +398,14 @@ int fs_write(struct fs_file *file, const void *data, size_t size) { - if (file->fs->v.write != NULL) - return file->fs->v.write(file, data, size); + int ret; + + if (file->fs->v.write != NULL) { + T_BEGIN { + ret = file->fs->v.write(file, data, size); + } T_END; + return ret; + } /* backend didn't bother to implement write(), but we can do it with streams. */ @@ -392,22 +414,34 @@ struct ostream *fs_write_stream(struct fs_file *file) { - file->fs->v.write_stream(file); + T_BEGIN { + file->fs->v.write_stream(file); + } T_END; i_assert(file->output != NULL); return file->output; } int fs_write_stream_finish(struct fs_file *file, struct ostream **output) { + int ret; + i_assert(*output == file->output || *output == NULL); *output = NULL; - return file->fs->v.write_stream_finish(file, TRUE); + T_BEGIN { + ret = file->fs->v.write_stream_finish(file, TRUE); + } T_END; + return ret; } int fs_write_stream_finish_async(struct fs_file *file) { - return file->fs->v.write_stream_finish(file, TRUE); + int ret; + + T_BEGIN { + ret = file->fs->v.write_stream_finish(file, TRUE); + } T_END; + return ret; } void fs_write_stream_abort(struct fs_file *file, struct ostream **output) @@ -415,7 +449,9 @@ i_assert(*output == file->output); *output = NULL; - (void)file->fs->v.write_stream_finish(file, FALSE); + T_BEGIN { + (void)file->fs->v.write_stream_finish(file, FALSE); + } T_END; } void fs_file_set_async_callback(struct fs_file *file, @@ -430,15 +466,24 @@ int fs_wait_async(struct fs *fs) { + int ret; + if (fs->v.wait_async == NULL) - return 0; - else - return fs->v.wait_async(fs); + ret = 0; + else T_BEGIN { + ret = fs->v.wait_async(fs); + } T_END; + return ret; } int fs_lock(struct fs_file *file, unsigned int secs, struct fs_lock **lock_r) { - return file->fs->v.lock(file, secs, lock_r); + int ret; + + T_BEGIN { + ret = file->fs->v.lock(file, secs, lock_r); + } T_END; + return ret; } void fs_unlock(struct fs_lock **_lock) @@ -446,17 +491,29 @@ struct fs_lock *lock = *_lock; *_lock = NULL; - lock->file->fs->v.unlock(lock); + T_BEGIN { + lock->file->fs->v.unlock(lock); + } T_END; } int fs_exists(struct fs_file *file) { - return file->fs->v.exists(file); + int ret; + + T_BEGIN { + ret = file->fs->v.exists(file); + } T_END; + return ret; } int fs_stat(struct fs_file *file, struct stat *st_r) { - return file->fs->v.stat(file, st_r); + int ret; + + T_BEGIN { + ret = file->fs->v.stat(file, st_r); + } T_END; + return ret; } int fs_default_copy(struct fs_file *src, struct fs_file *dest) @@ -501,38 +558,69 @@ int fs_copy(struct fs_file *src, struct fs_file *dest) { + int ret; + i_assert(src->fs == dest->fs); - return src->fs->v.copy(src, dest); + + T_BEGIN { + ret = src->fs->v.copy(src, dest); + } T_END; + return ret; } int fs_copy_finish_async(struct fs_file *dest) { - return dest->fs->v.copy(NULL, dest); + int ret; + + T_BEGIN { + ret = dest->fs->v.copy(NULL, dest); + } T_END; + return ret; } int fs_rename(struct fs_file *src, struct fs_file *dest) { + int ret; + i_assert(src->fs == dest->fs); - return src->fs->v.rename(src, dest); + + T_BEGIN { + ret = src->fs->v.rename(src, dest); + } T_END; + return ret; } int fs_delete(struct fs_file *file) { - return file->fs->v.delete_file(file); + int ret; + + T_BEGIN { + ret = file->fs->v.delete_file(file); + } T_END; + return ret; } struct fs_iter * fs_iter_init(struct fs *fs, const char *path, enum fs_iter_flags flags) { - return fs->v.iter_init(fs, path, flags); + struct fs_iter *iter; + + T_BEGIN { + iter = fs->v.iter_init(fs, path, flags); + } T_END; + return iter; } int fs_iter_deinit(struct fs_iter **_iter) { struct fs_iter *iter = *_iter; + int ret; *_iter = NULL; - return iter->fs->v.iter_deinit(iter); + T_BEGIN { + ret = iter->fs->v.iter_deinit(iter); + } T_END; + return ret; } const char *fs_iter_next(struct fs_iter *iter) From dovecot at dovecot.org Wed Apr 10 14:52:29 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 14:52:29 +0300 Subject: dovecot-2.2: lib-http: Added data stack frame to avoid unnecessa... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e8f366822a59 changeset: 16263:e8f366822a59 user: Timo Sirainen date: Wed Apr 10 14:51:37 2013 +0300 description: lib-http: Added data stack frame to avoid unnecessary data stack wasting. diffstat: src/lib-http/http-client-request.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diffs (32 lines): diff -r 61ee2da538e1 -r e8f366822a59 src/lib-http/http-client-request.c --- a/src/lib-http/http-client-request.c Wed Apr 10 14:17:41 2013 +0300 +++ b/src/lib-http/http-client-request.c Wed Apr 10 14:51:37 2013 +0300 @@ -365,8 +365,8 @@ return ret < 0 ? -1 : 0; } -int http_client_request_send(struct http_client_request *req, - const char **error_r) +static int http_client_request_send_real(struct http_client_request *req, + const char **error_r) { struct http_client_connection *conn = req->conn; struct ostream *output = conn->conn.output; @@ -435,6 +435,17 @@ return ret; } +int http_client_request_send(struct http_client_request *req, + const char **error_r) +{ + int ret; + + T_BEGIN { + ret = http_client_request_send_real(req, error_r); + } T_END; + return ret; +} + bool http_client_request_callback(struct http_client_request *req, struct http_response *response) { From dovecot at dovecot.org Wed Apr 10 16:51:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 16:51:23 +0300 Subject: dovecot-2.2: lib-index: Assert-crashfix on some rare situations. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/286fa7f9538c changeset: 16265:286fa7f9538c user: Timo Sirainen date: Wed Apr 10 16:50:34 2013 +0300 description: lib-index: Assert-crashfix on some rare situations. mail_index_modseq_get_next_log_offset() might have returned e.g. (seq=4, offset=40) to point to the beginning of a next file. The view itself could still have been pointing to seq=3 end of file. Now calling mail_transaction_log_view_set() with these two positions (that are basically the same) should result in an empty view instead of assert crash. diffstat: src/lib-index/mail-transaction-log-view.c | 34 +++++++++++++++++++----------- 1 files changed, 21 insertions(+), 13 deletions(-) diffs (88 lines): diff -r 08602cf498ea -r 286fa7f9538c src/lib-index/mail-transaction-log-view.c --- a/src/lib-index/mail-transaction-log-view.c Wed Apr 10 14:52:17 2013 +0300 +++ b/src/lib-index/mail-transaction-log-view.c Wed Apr 10 16:50:34 2013 +0300 @@ -63,14 +63,12 @@ uint32_t max_file_seq, uoff_t max_file_offset, bool *reset_r) { - struct mail_transaction_log_file *file, *const *files, *tail; + struct mail_transaction_log_file *file, *const *files; uoff_t start_offset, end_offset; unsigned int i; uint32_t seq; int ret; - i_assert(min_file_seq <= max_file_seq); - *reset_r = FALSE; if (view->log == NULL) { @@ -79,28 +77,35 @@ return -1; } - tail = view->log->files; if (min_file_seq == 0) { /* index file doesn't exist yet. this transaction log should start from the beginning */ - if (tail->hdr.prev_file_seq != 0) { + if (view->log->files->hdr.prev_file_seq != 0) { /* but it doesn't */ return 0; } - min_file_seq = tail->hdr.file_seq; + min_file_seq = view->log->files->hdr.file_seq; min_file_offset = 0; if (max_file_seq == 0) { max_file_seq = min_file_seq; max_file_offset = min_file_offset; } - } + } - if (min_file_seq == tail->hdr.prev_file_seq && - min_file_offset == tail->hdr.prev_file_offset) { - /* we can skip this */ - min_file_seq = tail->hdr.file_seq; + 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 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) { @@ -108,6 +113,8 @@ max_file_seq = min_file_seq; max_file_offset = min_file_offset; } + } else { + i_assert(min_file_seq <= max_file_seq); } if (min_file_seq == max_file_seq && min_file_offset > max_file_offset) { @@ -119,12 +126,13 @@ return -1; } - if (min_file_offset > 0 && min_file_offset < tail->hdr.hdr_size) { + 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, tail->hdr.hdr_size); + min_file_seq, min_file_offset, file->hdr.hdr_size); return -1; } From dovecot at dovecot.org Wed Apr 10 17:53:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 17:53:43 +0300 Subject: dovecot-2.2: lib-http: http_client_deinit() calls any pending de... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6466af800ed4 changeset: 16266:6466af800ed4 user: Timo Sirainen date: Wed Apr 10 17:53:24 2013 +0300 description: lib-http: http_client_deinit() calls any pending delayed failure callbacks. diffstat: src/lib-http/http-client-host.c | 9 +++++++- src/lib-http/http-client-request.c | 40 +++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 20 deletions(-) diffs (93 lines): diff -r 286fa7f9538c -r 6466af800ed4 src/lib-http/http-client-host.c --- a/src/lib-http/http-client-host.c Wed Apr 10 16:50:34 2013 +0300 +++ b/src/lib-http/http-client-host.c Wed Apr 10 17:53:24 2013 +0300 @@ -379,6 +379,7 @@ { struct http_client_host *host = *_host; struct http_client_host_port *hport; + struct http_client_request *req, *const *reqp; const char *hostname = host->name; http_client_host_debug(host, "Host destroy"); @@ -395,7 +396,13 @@ } array_free(&host->ports); - i_assert(array_count(&host->delayed_failing_requests) == 0); + while (array_count(&host->delayed_failing_requests) > 0) { + reqp = array_idx(&host->delayed_failing_requests, 0); + req = *reqp; + + i_assert(req->refcount == 1); + http_client_request_unref(&req); + } array_free(&host->delayed_failing_requests); i_free(host->ips); diff -r 286fa7f9538c -r 6466af800ed4 src/lib-http/http-client-request.c --- a/src/lib-http/http-client-request.c Wed Apr 10 16:50:34 2013 +0300 +++ b/src/lib-http/http-client-request.c Wed Apr 10 17:53:24 2013 +0300 @@ -49,6 +49,7 @@ /* * Request */ +static void http_client_request_remove_delayed(struct http_client_request *req); #undef http_client_request struct http_client_request * @@ -81,23 +82,6 @@ req->refcount++; } -static void http_client_request_remove_delayed(struct http_client_request *req) -{ - struct http_client_request *const *reqs; - unsigned int i, count; - - timeout_remove(&req->to_delayed_error); - - reqs = array_get(&req->host->delayed_failing_requests, &count); - for (i = 0; i < count; i++) { - if (reqs[i] == req) { - array_delete(&req->host->delayed_failing_requests, i, 1); - return; - } - } - i_unreached(); -} - void http_client_request_unref(struct http_client_request **_req) { struct http_client_request *req = *_req; @@ -487,11 +471,29 @@ } } +static void http_client_request_remove_delayed(struct http_client_request *req) +{ + struct http_client_request *const *reqs; + unsigned int i, count; + + http_client_request_send_error(req, req->delayed_error_status, + req->delayed_error); + + timeout_remove(&req->to_delayed_error); + + reqs = array_get(&req->host->delayed_failing_requests, &count); + for (i = 0; i < count; i++) { + if (reqs[i] == req) { + array_delete(&req->host->delayed_failing_requests, i, 1); + return; + } + } + i_unreached(); +} + static void http_client_request_error_delayed(struct http_client_request *req) { http_client_request_remove_delayed(req); - http_client_request_send_error(req, req->delayed_error_status, - req->delayed_error); http_client_request_unref(&req); } From dovecot at dovecot.org Wed Apr 10 18:00:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 18:00:25 +0300 Subject: dovecot-2.2: lib-http: Don't double-free request memory when abo... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/79a74a23b742 changeset: 16267:79a74a23b742 user: Timo Sirainen date: Wed Apr 10 18:00:12 2013 +0300 description: lib-http: Don't double-free request memory when aborting them. diffstat: src/lib-http/http-client-connection.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (26 lines): diff -r 6466af800ed4 -r 79a74a23b742 src/lib-http/http-client-connection.c --- a/src/lib-http/http-client-connection.c Wed Apr 10 17:53:24 2013 +0300 +++ b/src/lib-http/http-client-connection.c Wed Apr 10 18:00:12 2013 +0300 @@ -107,9 +107,9 @@ conn->closing = TRUE; array_foreach_modifiable(&conn->request_wait_list, req) { + i_assert((*req)->submitted); http_client_request_error(*req, status, error); - http_client_request_unref(req); - } + } array_clear(&conn->request_wait_list); http_client_connection_unref(_conn); } @@ -819,9 +819,9 @@ /* abort all pending requests */ array_foreach_modifiable(&conn->request_wait_list, req) { + i_assert((*req)->submitted); http_client_request_error(*req, HTTP_CLIENT_REQUEST_ERROR_ABORTED, "Aborting"); - http_client_request_unref(req); } array_free(&conn->request_wait_list); From dovecot at dovecot.org Wed Apr 10 18:48:59 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 18:48:59 +0300 Subject: dovecot-2.2: lib-index: Fixed failing unit test Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a3bd79aec23a changeset: 16268:a3bd79aec23a user: Timo Sirainen date: Wed Apr 10 18:48:54 2013 +0300 description: lib-index: Fixed failing unit test diffstat: src/lib-index/test-mail-transaction-log-view.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 79a74a23b742 -r a3bd79aec23a src/lib-index/test-mail-transaction-log-view.c --- a/src/lib-index/test-mail-transaction-log-view.c Wed Apr 10 18:00:12 2013 +0300 +++ b/src/lib-index/test-mail-transaction-log-view.c Wed Apr 10 18:48:54 2013 +0300 @@ -63,6 +63,7 @@ file->hdr.file_seq = file_seq; file->hdr.hdr_size = file->sync_offset = sizeof(file->hdr); file->hdr.prev_file_seq = file_seq - 1; + file->hdr.prev_file_offset = (uint32_t)-1; file->log = log; file->fd = -1; file->buffer = buffer_create_dynamic(default_pool, 256); From dovecot at dovecot.org Wed Apr 10 21:18:21 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 21:18:21 +0300 Subject: dovecot-2.2: lib-fs: Added fs_file_close() to explicitly close a... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/5ce775d70c7d changeset: 16269:5ce775d70c7d user: Timo Sirainen date: Wed Apr 10 21:18:07 2013 +0300 description: lib-fs: Added fs_file_close() to explicitly close all streams that the file has open. diffstat: src/lib-fs/fs-api-private.h | 1 + src/lib-fs/fs-api.c | 22 +++++++++++++++------- src/lib-fs/fs-api.h | 3 +++ src/lib-fs/fs-metawrap.c | 17 ++++++++++++++--- src/lib-fs/fs-posix.c | 10 ++++++---- src/lib-fs/fs-sis-queue.c | 9 +++++++++ src/lib-fs/fs-sis.c | 13 +++++++++++-- 7 files changed, 59 insertions(+), 16 deletions(-) diffs (216 lines): diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-api-private.h --- a/src/lib-fs/fs-api-private.h Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-api-private.h Wed Apr 10 21:18:07 2013 +0300 @@ -15,6 +15,7 @@ enum fs_open_mode mode, enum fs_open_flags flags); void (*file_deinit)(struct fs_file *file); + void (*file_close)(struct fs_file *file); const char *(*get_path)(struct fs_file *file); void (*set_async_callback)(struct fs_file *file, diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-api.c --- a/src/lib-fs/fs-api.c Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-api.c Wed Apr 10 21:18:07 2013 +0300 @@ -164,6 +164,19 @@ *_file = NULL; + fs_file_close(file); + + file->fs->files_open_count--; + T_BEGIN { + file->fs->v.file_deinit(file); + } T_END; + + if (metadata_pool != NULL) + pool_unref(&metadata_pool); +} + +void fs_file_close(struct fs_file *file) +{ if (file->pending_read_input != NULL) i_stream_unref(&file->pending_read_input); if (file->seekable_input != NULL) @@ -173,14 +186,9 @@ i_stream_unref(&file->copy_input); (void)fs_write_stream_abort(file, &file->copy_output); } - - file->fs->files_open_count--; - T_BEGIN { - file->fs->v.file_deinit(file); + if (file->fs->v.file_close != NULL) T_BEGIN { + file->fs->v.file_close(file); } T_END; - - if (metadata_pool != NULL) - pool_unref(&metadata_pool); } enum fs_properties fs_get_properties(struct fs *fs) diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-api.h --- a/src/lib-fs/fs-api.h Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-api.h Wed Apr 10 21:18:07 2013 +0300 @@ -95,6 +95,9 @@ struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags); void fs_file_deinit(struct fs_file **file); +/* If the file has an input streams open, close them. */ +void fs_file_close(struct fs_file *file); + /* Return properties supported by backend. */ enum fs_properties fs_get_properties(struct fs *fs); diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-metawrap.c --- a/src/lib-fs/fs-metawrap.c Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-metawrap.c Wed Apr 10 21:18:07 2013 +0300 @@ -123,15 +123,25 @@ { struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file; - if (file->input != NULL) - i_stream_unref(&file->input); - if (file->super_read != file->super) + if (file->super_read != file->super && file->super_read != NULL) fs_file_deinit(&file->super_read); fs_file_deinit(&file->super); i_free(file->file.path); i_free(file); } +static void fs_metawrap_file_close(struct fs_file *_file) +{ + struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file; + + if (file->input != NULL) + i_stream_unref(&file->input); + if (file->super_read != NULL) + fs_file_close(file->super_read); + if (file->super != NULL) + fs_file_close(file->super); +} + static const char *fs_metawrap_file_get_path(struct fs_file *_file) { struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file; @@ -408,6 +418,7 @@ fs_metawrap_get_properties, fs_metawrap_file_init, fs_metawrap_file_deinit, + fs_metawrap_file_close, fs_metawrap_file_get_path, fs_metawrap_set_async_callback, fs_metawrap_wait_async, diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-posix.c --- a/src/lib-fs/fs-posix.c Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-posix.c Wed Apr 10 21:18:07 2013 +0300 @@ -252,8 +252,10 @@ return &file->file; } -static void fs_posix_file_close(struct posix_fs_file *file) +static void fs_posix_file_close(struct fs_file *_file) { + struct posix_fs_file *file = (struct posix_fs_file *)_file; + if (file->fd != -1 && file->file.output == NULL) { if (close(file->fd) < 0) { fs_set_critical(file->file.fs, "close(%s) failed: %m", @@ -286,7 +288,6 @@ break; } - fs_posix_file_close(file); i_free(file->temp_path); i_free(file->file.path); i_free(file); @@ -333,7 +334,7 @@ ret = read(file->fd, buf, size); if (ret < 0) fs_set_error(_file->fs, "read(%s) failed: %m", _file->path); - fs_posix_file_close(file); + fs_posix_file_close(_file); return ret; } @@ -349,7 +350,7 @@ } else { input = i_stream_create_fd(file->fd, max_buffer_size, FALSE); } - i_stream_add_destroy_callback(input, fs_posix_file_close, file); + i_stream_add_destroy_callback(input, fs_posix_file_close, _file); return input; } @@ -754,6 +755,7 @@ fs_posix_get_properties, fs_posix_file_init, fs_posix_file_deinit, + fs_posix_file_close, NULL, NULL, NULL, NULL, NULL, diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-sis-queue.c --- a/src/lib-fs/fs-sis-queue.c Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-sis-queue.c Wed Apr 10 21:18:07 2013 +0300 @@ -117,6 +117,14 @@ i_free(file); } +static void fs_sis_queue_file_close(struct fs_file *_file) +{ + struct sis_queue_fs_file *file = (struct sis_queue_fs_file *)_file; + + if (file->super != NULL) + fs_file_close(file->super); +} + static const char *fs_sis_queue_file_get_path(struct fs_file *_file) { struct sis_queue_fs_file *file = (struct sis_queue_fs_file *)_file; @@ -352,6 +360,7 @@ fs_sis_queue_get_properties, fs_sis_queue_file_init, fs_sis_queue_file_deinit, + fs_sis_queue_file_close, fs_sis_queue_file_get_path, fs_sis_queue_set_async_callback, fs_sis_queue_wait_async, diff -r a3bd79aec23a -r 5ce775d70c7d src/lib-fs/fs-sis.c --- a/src/lib-fs/fs-sis.c Wed Apr 10 18:48:54 2013 +0300 +++ b/src/lib-fs/fs-sis.c Wed Apr 10 21:18:07 2013 +0300 @@ -145,8 +145,6 @@ { struct sis_fs_file *file = (struct sis_fs_file *)_file; - if (file->hash_input != NULL) - i_stream_unref(&file->hash_input); fs_file_deinit(&file->hash_file); fs_file_deinit(&file->super); i_free(file->hash); @@ -155,6 +153,16 @@ i_free(file); } +static void fs_sis_file_close(struct fs_file *_file) +{ + struct sis_fs_file *file = (struct sis_fs_file *)_file; + + if (file->hash_input != NULL) + i_stream_unref(&file->hash_input); + fs_file_close(file->hash_file); + fs_file_close(file->super); +} + static const char *fs_sis_file_get_path(struct fs_file *_file) { struct sis_fs_file *file = (struct sis_fs_file *)_file; @@ -486,6 +494,7 @@ fs_sis_get_properties, fs_sis_file_init, fs_sis_file_deinit, + fs_sis_file_close, fs_sis_file_get_path, fs_sis_set_async_callback, fs_sis_wait_async, From dovecot at dovecot.org Wed Apr 10 22:05:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 22:05:47 +0300 Subject: dovecot-2.2: iostream-ssl: Don't hang if ostream's max buffer si... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0ff3c63eb183 changeset: 16270:0ff3c63eb183 user: Timo Sirainen date: Wed Apr 10 22:05:36 2013 +0300 description: iostream-ssl: Don't hang if ostream's max buffer size is set to 0. diffstat: src/lib-ssl-iostream/ostream-openssl.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 5ce775d70c7d -r 0ff3c63eb183 src/lib-ssl-iostream/ostream-openssl.c --- a/src/lib-ssl-iostream/ostream-openssl.c Wed Apr 10 21:18:07 2013 +0300 +++ b/src/lib-ssl-iostream/ostream-openssl.c Wed Apr 10 22:05:36 2013 +0300 @@ -47,8 +47,14 @@ skip_left -= iov[i].iov_len; } - avail = sstream->ostream.max_buffer_size > sstream->buffer->used ? - sstream->ostream.max_buffer_size - sstream->buffer->used : 0; + if (sstream->ostream.max_buffer_size == 0) { + /* we're requeted to use whatever space is available in + the buffer */ + avail = buffer_get_size(sstream->buffer) - sstream->buffer->used; + } else { + avail = sstream->ostream.max_buffer_size > sstream->buffer->used ? + sstream->ostream.max_buffer_size - sstream->buffer->used : 0; + } if (i < iov_count && skip_left > 0) { size = I_MIN(iov[i].iov_len - skip_left, avail); buffer_append(sstream->buffer, From dovecot at dovecot.org Wed Apr 10 22:11:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 22:11:45 +0300 Subject: dovecot-2.2: imapc: If APPEND to selected mailbox doesn't send E... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1bdb2765499c changeset: 16271:1bdb2765499c user: Timo Sirainen date: Wed Apr 10 22:11:33 2013 +0300 description: imapc: If APPEND to selected mailbox doesn't send EXISTS, try if NOOP sends it. This makes Dovecot behave better with Courier. diffstat: src/lib-storage/index/imapc/imapc-mailbox.c | 1 + src/lib-storage/index/imapc/imapc-save.c | 27 +++++++++++++++++++++++++++ src/lib-storage/index/imapc/imapc-storage.c | 1 + src/lib-storage/index/imapc/imapc-storage.h | 2 ++ 4 files changed, 31 insertions(+), 0 deletions(-) diffs (85 lines): diff -r 0ff3c63eb183 -r 1bdb2765499c src/lib-storage/index/imapc/imapc-mailbox.c --- a/src/lib-storage/index/imapc/imapc-mailbox.c Wed Apr 10 22:05:36 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-mailbox.c Wed Apr 10 22:11:33 2013 +0300 @@ -145,6 +145,7 @@ mbox->sync_fetch_first_uid = hdr->next_uid; } mbox->exists_count = exists_count; + mbox->exists_received = TRUE; imapc_mailbox_idle_notify(mbox); } diff -r 0ff3c63eb183 -r 1bdb2765499c src/lib-storage/index/imapc/imapc-save.c --- a/src/lib-storage/index/imapc/imapc-save.c Wed Apr 10 22:05:36 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-save.c Wed Apr 10 22:11:33 2013 +0300 @@ -184,6 +184,17 @@ } static void +imapc_save_noop_callback(const struct imapc_command_reply *reply ATTR_UNUSED, + void *context) +{ + struct imapc_save_cmd_context *ctx = context; + + /* we don't really care about the reply */ + ctx->ret = 0; + imapc_client_stop(ctx->ctx->mbox->storage->client); +} + +static void imapc_append_keywords(string_t *str, struct mail_keywords *kw) { const ARRAY_TYPE(keywords) *kw_arr; @@ -223,6 +234,8 @@ imap_to_datetime(mdata->received_date)); } + ctx->mbox->exists_received = FALSE; + input = i_stream_create_fd(ctx->fd, IO_BLOCK_SIZE, FALSE); sctx.ctx = ctx; sctx.ret = -2; @@ -233,6 +246,20 @@ i_stream_unref(&input); while (sctx.ret == -2) imapc_storage_run(ctx->mbox->storage); + + if (sctx.ret == 0 && ctx->mbox->selected && + !ctx->mbox->exists_received) { + /* e.g. Courier doesn't send EXISTS reply before the tagged + APPEND reply. That isn't exactly required by the IMAP RFC, + but it makes the behavior better. See if NOOP finds + the mail. */ + sctx.ret = -2; + cmd = imapc_client_cmd(ctx->mbox->storage->client, + imapc_save_noop_callback, &sctx); + imapc_command_send(cmd, "NOOP"); + while (sctx.ret == -2) + imapc_storage_run(ctx->mbox->storage); + } return sctx.ret; } diff -r 0ff3c63eb183 -r 1bdb2765499c src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Wed Apr 10 22:05:36 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Wed Apr 10 22:11:33 2013 +0300 @@ -424,6 +424,7 @@ struct imapc_open_context *ctx = context; ctx->mbox->selecting = FALSE; + ctx->mbox->selected = TRUE; if (reply->state == IMAPC_COMMAND_STATE_OK) ctx->ret = 0; else if (reply->state == IMAPC_COMMAND_STATE_NO) { diff -r 0ff3c63eb183 -r 1bdb2765499c src/lib-storage/index/imapc/imapc-storage.h --- a/src/lib-storage/index/imapc/imapc-storage.h Wed Apr 10 22:05:36 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.h Wed Apr 10 22:11:33 2013 +0300 @@ -103,6 +103,8 @@ unsigned int selecting:1; unsigned int syncing:1; unsigned int initial_sync_done:1; + unsigned int selected:1; + unsigned int exists_received:1; }; struct imapc_simple_context { From dovecot at dovecot.org Wed Apr 10 22:12:32 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 22:12:32 +0300 Subject: dovecot-2.1: imapc: If APPEND to selected mailbox doesn't send E... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b63f87ed9311 changeset: 14955:b63f87ed9311 user: Timo Sirainen date: Wed Apr 10 22:11:33 2013 +0300 description: imapc: If APPEND to selected mailbox doesn't send EXISTS, try if NOOP sends it. This makes Dovecot behave better with Courier. diffstat: src/lib-storage/index/imapc/imapc-mailbox.c | 1 + src/lib-storage/index/imapc/imapc-save.c | 27 +++++++++++++++++++++++++++ src/lib-storage/index/imapc/imapc-storage.c | 1 + src/lib-storage/index/imapc/imapc-storage.h | 2 ++ 4 files changed, 31 insertions(+), 0 deletions(-) diffs (85 lines): diff -r 8e9f1c744516 -r b63f87ed9311 src/lib-storage/index/imapc/imapc-mailbox.c --- a/src/lib-storage/index/imapc/imapc-mailbox.c Wed Apr 10 14:18:38 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-mailbox.c Wed Apr 10 22:11:33 2013 +0300 @@ -145,6 +145,7 @@ mbox->sync_fetch_first_uid = hdr->next_uid; } mbox->exists_count = exists_count; + mbox->exists_received = TRUE; imapc_mailbox_idle_notify(mbox); } diff -r 8e9f1c744516 -r b63f87ed9311 src/lib-storage/index/imapc/imapc-save.c --- a/src/lib-storage/index/imapc/imapc-save.c Wed Apr 10 14:18:38 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-save.c Wed Apr 10 22:11:33 2013 +0300 @@ -183,6 +183,17 @@ } static void +imapc_save_noop_callback(const struct imapc_command_reply *reply ATTR_UNUSED, + void *context) +{ + struct imapc_save_cmd_context *ctx = context; + + /* we don't really care about the reply */ + ctx->ret = 0; + imapc_client_stop(ctx->ctx->mbox->storage->client); +} + +static void imapc_append_keywords(string_t *str, struct mail_keywords *kw) { const ARRAY_TYPE(keywords) *kw_arr; @@ -221,6 +232,8 @@ imap_to_datetime(_ctx->received_date)); } + ctx->mbox->exists_received = FALSE; + input = i_stream_create_fd(ctx->fd, IO_BLOCK_SIZE, FALSE); sctx.ctx = ctx; sctx.ret = -2; @@ -231,6 +244,20 @@ i_stream_unref(&input); while (sctx.ret == -2) imapc_storage_run(ctx->mbox->storage); + + if (sctx.ret == 0 && ctx->mbox->selected && + !ctx->mbox->exists_received) { + /* e.g. Courier doesn't send EXISTS reply before the tagged + APPEND reply. That isn't exactly required by the IMAP RFC, + but it makes the behavior better. See if NOOP finds + the mail. */ + sctx.ret = -2; + cmd = imapc_client_cmd(ctx->mbox->storage->client, + imapc_save_noop_callback, &sctx); + imapc_command_send(cmd, "NOOP"); + while (sctx.ret == -2) + imapc_storage_run(ctx->mbox->storage); + } return sctx.ret; } diff -r 8e9f1c744516 -r b63f87ed9311 src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Wed Apr 10 14:18:38 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Wed Apr 10 22:11:33 2013 +0300 @@ -411,6 +411,7 @@ struct imapc_open_context *ctx = context; ctx->mbox->selecting = FALSE; + ctx->mbox->selected = TRUE; if (reply->state == IMAPC_COMMAND_STATE_OK) ctx->ret = 0; else if (reply->state == IMAPC_COMMAND_STATE_NO) { diff -r 8e9f1c744516 -r b63f87ed9311 src/lib-storage/index/imapc/imapc-storage.h --- a/src/lib-storage/index/imapc/imapc-storage.h Wed Apr 10 14:18:38 2013 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.h Wed Apr 10 22:11:33 2013 +0300 @@ -94,6 +94,8 @@ unsigned int selecting:1; unsigned int syncing:1; unsigned int initial_sync_done:1; + unsigned int selected:1; + unsigned int exists_received:1; }; struct imapc_simple_context { From dovecot at dovecot.org Wed Apr 10 23:47:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 23:47:25 +0300 Subject: dovecot-2.2: Released v2.2.rc7. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d7f29af73468 changeset: 16272:d7f29af73468 user: Timo Sirainen date: Wed Apr 10 22:31:41 2013 +0300 description: Released v2.2.rc7. diffstat: NEWS | 12 ++++++++++++ TODO | 2 ++ configure.ac | 2 +- 3 files changed, 15 insertions(+), 1 deletions(-) diffs (43 lines): diff -r 1bdb2765499c -r d7f29af73468 NEWS --- a/NEWS Wed Apr 10 22:11:33 2013 +0300 +++ b/NEWS Wed Apr 10 22:31:41 2013 +0300 @@ -1,3 +1,15 @@ +v2.2.rc7 2013-04-10 Timo Sirainen + + * checkpasword: AUTH_PASSWORD environment is no longer set. + * Running dsync no longer triggers quota warnings. + + + dsync: Commit large transactions every 100 new messages, so if a + large sync crashes it doesn't have to be restarted from the + beginning. + - replicator: doveadm commands and user list export may have skipped + some users. + - Various fixes to mailbox_list_index=yes + v2.2.rc6 2013-04-08 Timo Sirainen * replicator: Don't create replicator-doveadm socket by default. diff -r 1bdb2765499c -r d7f29af73468 TODO --- a/TODO Wed Apr 10 22:11:33 2013 +0300 +++ b/TODO Wed Apr 10 22:31:41 2013 +0300 @@ -24,6 +24,8 @@ - quota recalc + dict-file [+acl?] assert-crashes in !indexing->syncing - imaptest: add condstore, qresync tests + - SASL client library, initially supporting only PLAIN and plugins. Use it + everywhere we currently use hardcoded PLAIN (proxy, doveadm, ..) - zlib plugin should do caching similar to binary fetches. otherwise partial fetches from large compressed mails are hopelessly slow. - Track highestmodseq always, just don't keep per-message modseqs unless diff -r 1bdb2765499c -r d7f29af73468 configure.ac --- a/configure.ac Wed Apr 10 22:11:33 2013 +0300 +++ b/configure.ac Wed Apr 10 22:31:41 2013 +0300 @@ -2,7 +2,7 @@ # 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.rc6],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.2.rc7],[dovecot at dovecot.org]) AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Wed Apr 10 23:47:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 23:47:25 +0300 Subject: dovecot-2.2: Added tag 2.2.rc7 for changeset d7f29af73468 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b0c696c48051 changeset: 16273:b0c696c48051 user: Timo Sirainen date: Wed Apr 10 22:31:41 2013 +0300 description: Added tag 2.2.rc7 for changeset d7f29af73468 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r d7f29af73468 -r b0c696c48051 .hgtags --- a/.hgtags Wed Apr 10 22:31:41 2013 +0300 +++ b/.hgtags Wed Apr 10 22:31:41 2013 +0300 @@ -102,3 +102,4 @@ 92c88eca562d45a55b65e45eb9bb937292b20595 2.2.rc4 9446df6da5a89ae94653362ef4d4ea154272cd3e 2.2.rc5 ae4341d0e83bd63397b418666bc80076700432fd 2.2.rc6 +d7f29af734683149badfc45a4e2015254ca78672 2.2.rc7 From dovecot at dovecot.org Wed Apr 10 23:47:25 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 10 Apr 2013 23:47:25 +0300 Subject: dovecot-2.2: Added signature for changeset d7f29af73468 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d44c04dc68b9 changeset: 16274:d44c04dc68b9 user: Timo Sirainen date: Wed Apr 10 22:31:53 2013 +0300 description: Added signature for changeset d7f29af73468 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r b0c696c48051 -r d44c04dc68b9 .hgsigs --- a/.hgsigs Wed Apr 10 22:31:41 2013 +0300 +++ b/.hgsigs Wed Apr 10 22:31:53 2013 +0300 @@ -65,3 +65,4 @@ 92c88eca562d45a55b65e45eb9bb937292b20595 0 iEYEABECAAYFAlFd75QACgkQyUhSUUBVismY8ACeI2egJAQjbspR/2ioZ85G+NbekuwAoIy2pl+wrSDOhwt9Qd4D72Q9I4ag 9446df6da5a89ae94653362ef4d4ea154272cd3e 0 iEYEABECAAYFAlFfEeQACgkQyUhSUUBViskn8QCfW8C5xr/OuOSQNuLchv9HJduncaEAnici8NhTmN7G9qwReXnLqcdrC1Tc ae4341d0e83bd63397b418666bc80076700432fd 0 iEYEABECAAYFAlFh+/EACgkQyUhSUUBViskLaACfaQUhj/uJIZ5oDL5Wo5hTUgJC+cQAnR4GFR/GhGqJmvFWe8jZPD3CwtW/ +d7f29af734683149badfc45a4e2015254ca78672 0 iEYEABECAAYFAlFlvh0ACgkQyUhSUUBVislyrgCfSTX5MQWcV+eAWNlZ1jpawq9rNPMAnRNU9RBWmrUNU9PqDrsqS3WDCGyu From dovecot at dovecot.org Thu Apr 11 13:13:23 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 13:13:23 +0300 Subject: dovecot-2.2: Fixed getmntinfo() usage with NetBSD. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e33ec9eb166e changeset: 16275:e33ec9eb166e user: Timo Sirainen date: Thu Apr 11 13:13:14 2013 +0300 description: Fixed getmntinfo() usage with NetBSD. Patch by Emmanuel Dreyfus diffstat: src/lib/mountpoint.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diffs (27 lines): diff -r d44c04dc68b9 -r e33ec9eb166e src/lib/mountpoint.c --- a/src/lib/mountpoint.c Wed Apr 10 22:31:53 2013 +0300 +++ b/src/lib/mountpoint.c Thu Apr 11 13:13:14 2013 +0300 @@ -137,7 +137,11 @@ #elif defined(MOUNTPOINT_SOLARIS) || defined(MOUNTPOINT_LINUX) FILE *f; #elif defined(HAVE_GETMNTINFO) /* BSDs */ +#ifndef __NetBSD__ struct statfs *fs; +#else + struct statvfs *fs; +#endif int count; #endif struct mountpoint mnt; @@ -287,7 +291,11 @@ return NULL; #elif defined(HAVE_GETMNTINFO) /* BSDs */ while (iter->count > 0) { +#ifndef __NetBSD__ struct statfs *fs = iter->fs; +#else + struct statvfs *fs = iter->fs; +#endif iter->fs++; iter->count--; From dovecot at dovecot.org Thu Apr 11 13:15:46 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 13:15:46 +0300 Subject: dovecot-2.2: net_getunixcred() support for NetBSD details: http://hg.dovecot.org/dovecot-2.2/rev/d594ce839da3 changeset: 16276:d594ce839da3 user: Timo Sirainen date: Thu Apr 11 13:15:39 2013 +0300 description: net_getunixcred() support for NetBSD sc_uid = sc->sc_euid = sc->sc_gid = sc->sc_egid = -1; + memset(&cdata.ch, 0, sizeof cdata.ch); + + memset(&msg, 0, sizeof msg); + + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = &cdata; + msg.msg_controllen = sizeof(cdata.ch) + sizeof(cdata.buf); + + for (i = 0; i < 10; i++) { + n = recvmsg(fd, &msg, MSG_WAITALL | MSG_PEEK); + if (n >= 0 || errno != EAGAIN) + break; + usleep(100); + } + if (n < 0) { + i_error("recvmsg() failed: %m"); + return -1; + } + cred_r->uid = sc->sc_euid; + cred_r->gid = sc->sc_egid; + return 0; #else errno = EINVAL; return -1; From dovecot at dovecot.org Thu Apr 11 13:38:30 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 13:38:30 +0300 Subject: dovecot-2.2: net_getunixcred(): Fix to previous NetBSD<5 support... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c802c0b960e2 changeset: 16277:c802c0b960e2 user: Timo Sirainen date: Thu Apr 11 13:38:16 2013 +0300 description: net_getunixcred(): Fix to previous NetBSD<5 support: return pid as -1. diffstat: src/lib/net.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r d594ce839da3 -r c802c0b960e2 src/lib/net.c --- a/src/lib/net.c Thu Apr 11 13:15:39 2013 +0300 +++ b/src/lib/net.c Thu Apr 11 13:38:16 2013 +0300 @@ -837,6 +837,7 @@ } cred_r->uid = sc->sc_euid; cred_r->gid = sc->sc_egid; + cred_r->pid = (pid_t)-1; return 0; #else errno = EINVAL; From dovecot at dovecot.org Thu Apr 11 16:19:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 16:19:43 +0300 Subject: dovecot-2.2: lib-storage: mail_update_pvt_modseq() shouldn't cra... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/17b037da123b changeset: 16278:17b037da123b user: Timo Sirainen date: Thu Apr 11 16:19:35 2013 +0300 description: lib-storage: mail_update_pvt_modseq() shouldn't crash if there is no private index. diffstat: src/lib-storage/index/index-mail.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r c802c0b960e2 -r 17b037da123b src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Thu Apr 11 13:38:16 2013 +0300 +++ b/src/lib-storage/index/index-mail.c Thu Apr 11 16:19:35 2013 +0300 @@ -1809,6 +1809,8 @@ void index_mail_update_pvt_modseq(struct mail *mail, uint64_t min_pvt_modseq) { + if (mail->box->view_pvt == NULL) + return; index_transaction_init_pvt(mail->transaction); mail_index_update_modseq(mail->transaction->itrans_pvt, mail->seq, min_pvt_modseq); From dovecot at dovecot.org Thu Apr 11 16:55:03 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 16:55:03 +0300 Subject: dovecot-2.2: lib-storage: mailbox_list_index=yes wasn't working ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/309abf35676e changeset: 16279:309abf35676e user: Timo Sirainen date: Thu Apr 11 16:54:53 2013 +0300 description: lib-storage: mailbox_list_index=yes wasn't working with ACLs. diffstat: src/lib-storage/list/mailbox-list-index.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diffs (37 lines): diff -r 17b037da123b -r 309abf35676e src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Thu Apr 11 16:19:35 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Thu Apr 11 16:54:53 2013 +0300 @@ -536,7 +536,7 @@ return 0; } -static void mailbox_list_index_created(struct mailbox_list *list) +static void mailbox_list_index_created_last(struct mailbox_list *list) { struct mailbox_list_index *ilist; bool has_backing_store; @@ -643,6 +643,24 @@ mailbox_list_index_backend_init_mailbox(box); } +static struct mail_storage_hooks mailbox_list_index_hooks_last = { + .mailbox_list_created = mailbox_list_index_created_last +}; +static bool mailbox_list_index_hooks_last_added = FALSE; + +static void mailbox_list_index_created(struct mailbox_list *list ATTR_UNUSED) +{ + /* We want our mailbox list index hooks to be called just before the + backend methods are called. Most importantly the ACL plugin's hooks + must be called before us, otherwise we'll end up skipping them and + showing all the mailboxes. So we do this dual-registration where + this second one gets us into the correct position. */ + if (!mailbox_list_index_hooks_last_added) { + mailbox_list_index_hooks_last_added = TRUE; + mail_storage_hooks_add_internal(&mailbox_list_index_hooks_last); + } +} + static struct mail_storage_hooks mailbox_list_index_hooks = { .mailbox_list_created = mailbox_list_index_created, .mail_namespaces_added = mailbox_list_index_namespaces_added, From dovecot at dovecot.org Thu Apr 11 17:35:43 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 17:35:43 +0300 Subject: dovecot-2.2: doveadm: Don't use MAILBOX_LIST_ITER_RAW_LIST when ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/81a111f1c420 changeset: 16280:81a111f1c420 user: Timo Sirainen date: Thu Apr 11 17:35:31 2013 +0300 description: doveadm: Don't use MAILBOX_LIST_ITER_RAW_LIST when listing mailboxes. That skips ACLs and mailbox list. There's really no good reason to use that by default. diffstat: src/doveadm/doveadm-mail-altmove.c | 1 - src/doveadm/doveadm-mail-copymove.c | 1 - src/doveadm/doveadm-mail-expunge.c | 1 - src/doveadm/doveadm-mail-import.c | 1 - src/doveadm/doveadm-mail-index.c | 1 - src/doveadm/doveadm-mail-mailbox-status.c | 1 - src/doveadm/doveadm-mail-mailbox.c | 1 - src/doveadm/doveadm-mail-search.c | 1 - src/doveadm/doveadm-mail.c | 1 - 9 files changed, 0 insertions(+), 9 deletions(-) diffs (99 lines): diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-altmove.c --- a/src/doveadm/doveadm-mail-altmove.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-altmove.c Thu Apr 11 17:35:31 2013 +0300 @@ -57,7 +57,6 @@ { struct altmove_cmd_context *ctx = (struct altmove_cmd_context *)_ctx; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-copymove.c --- a/src/doveadm/doveadm-mail-copymove.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-copymove.c Thu Apr 11 17:35:31 2013 +0300 @@ -92,7 +92,6 @@ { struct copy_cmd_context *ctx = (struct copy_cmd_context *)_ctx; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-expunge.c --- a/src/doveadm/doveadm-mail-expunge.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-expunge.c Thu Apr 11 17:35:31 2013 +0300 @@ -197,7 +197,6 @@ cmd_expunge_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-import.c --- a/src/doveadm/doveadm-mail-import.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-import.c Thu Apr 11 17:35:31 2013 +0300 @@ -135,7 +135,6 @@ { struct import_cmd_context *ctx = (struct import_cmd_context *)_ctx; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-index.c --- a/src/doveadm/doveadm-mail-index.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-index.c Thu Apr 11 17:35:31 2013 +0300 @@ -162,7 +162,6 @@ { struct index_cmd_context *ctx = (struct index_cmd_context *)_ctx; const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS | MAILBOX_LIST_ITER_STAR_WITHIN_NS; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-mailbox-status.c --- a/src/doveadm/doveadm-mail-mailbox-status.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-mailbox-status.c Thu Apr 11 17:35:31 2013 +0300 @@ -146,7 +146,6 @@ { struct status_cmd_context *ctx = (struct status_cmd_context *)_ctx; enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-mailbox.c --- a/src/doveadm/doveadm-mail-mailbox.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-mailbox.c Thu Apr 11 17:35:31 2013 +0300 @@ -108,7 +108,6 @@ { struct list_cmd_context *ctx = (struct list_cmd_context *)_ctx; enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; const struct mailbox_info *info; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail-search.c --- a/src/doveadm/doveadm-mail-search.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail-search.c Thu Apr 11 17:35:31 2013 +0300 @@ -47,7 +47,6 @@ cmd_search_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_NO_AUTO_BOXES | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; struct doveadm_mailbox_list_iter *iter; diff -r 309abf35676e -r 81a111f1c420 src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Thu Apr 11 16:54:53 2013 +0300 +++ b/src/doveadm/doveadm-mail.c Thu Apr 11 17:35:31 2013 +0300 @@ -222,7 +222,6 @@ struct mail_user *user) { const enum mailbox_list_iter_flags iter_flags = - MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_RETURN_NO_FLAGS | MAILBOX_LIST_ITER_STAR_WITHIN_NS; const enum mail_namespace_type ns_mask = MAIL_NAMESPACE_TYPE_MASK_ALL; From dovecot at dovecot.org Thu Apr 11 18:50:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 18:50:38 +0300 Subject: dovecot-2.2: Removed ambiguous mail_user.admin flag. dsync shoul... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7a7fa88aafe7 changeset: 16281:7a7fa88aafe7 user: Timo Sirainen date: Thu Apr 11 18:50:25 2013 +0300 description: Removed ambiguous mail_user.admin flag. dsync shouldn't sync mailboxes without +r ACL. diffstat: src/doveadm/dsync/doveadm-dsync.c | 5 +---- src/lib-storage/mail-user.h | 3 --- src/plugins/acl/acl-api.c | 22 +++++++++++++++------- src/plugins/acl/acl-attributes.c | 8 ++++---- src/plugins/imap-quota/imap-quota-plugin.c | 9 +++++---- src/plugins/quota/quota.c | 4 ++-- 6 files changed, 27 insertions(+), 24 deletions(-) diffs (174 lines): diff -r 81a111f1c420 -r 7a7fa88aafe7 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Thu Apr 11 17:35:31 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Thu Apr 11 18:50:25 2013 +0300 @@ -320,7 +320,7 @@ ctx->ctx.exit_code = ret == -1 ? EX_TEMPFAIL : EX_CONFIG; return -1; } - user2->admin = TRUE; + user2->dsyncing = TRUE; if (mail_namespaces_get_root_sep(user->namespaces) != mail_namespaces_get_root_sep(user2->namespaces)) { @@ -491,7 +491,6 @@ bool remote_errors_logged = FALSE; int status = 0, ret = 0; - user->admin = TRUE; user->dsyncing = TRUE; if (ctx->namespace_prefix != NULL) { @@ -922,8 +921,6 @@ ctx->output = _ctx->conn->output; o_stream_nsend(ctx->output, "\n+\n", 3); } - - user->admin = TRUE; user->dsyncing = TRUE; i_set_failure_prefix("dsync-remote(%s): ", user->username); diff -r 81a111f1c420 -r 7a7fa88aafe7 src/lib-storage/mail-user.h --- a/src/lib-storage/mail-user.h Thu Apr 11 17:35:31 2013 +0300 +++ b/src/lib-storage/mail-user.h Thu Apr 11 18:50:25 2013 +0300 @@ -51,9 +51,6 @@ unsigned int nonexistent:1; /* Either home is set or there is no home for the user. */ unsigned int home_looked_up:1; - /* User is an administrator. Allow operations not normally allowed - for other people. */ - unsigned int admin:1; /* User is anonymous */ unsigned int anonymous:1; /* This is an autocreated user (e.g. for shared namespace or diff -r 81a111f1c420 -r 7a7fa88aafe7 src/plugins/acl/acl-api.c --- a/src/plugins/acl/acl-api.c Thu Apr 11 17:35:31 2013 +0300 +++ b/src/plugins/acl/acl-api.c Thu Apr 11 18:50:25 2013 +0300 @@ -33,12 +33,7 @@ { struct acl_backend *backend = aclobj->backend; const struct acl_mask *have_mask; - - if (mailbox_list_get_user(aclobj->backend->list)->admin) { - /* admin user (especially dsync) can do anything regardless - of ACLs */ - return 1; - } + unsigned int read_idx; if (backend->v.object_refresh_cache(aclobj) < 0) return -1; @@ -49,7 +44,20 @@ return -1; } - return acl_cache_mask_isset(have_mask, right_idx); + if (acl_cache_mask_isset(have_mask, right_idx)) + return 1; + + if (mailbox_list_get_user(aclobj->backend->list)->dsyncing) { + /* when dsync is running on a shared mailbox, it must be able + to do everything inside it. however, dsync shouldn't touch + mailboxes where user doesn't have any read access, because + that could make them readable on the replica. */ + read_idx = acl_backend_lookup_right(aclobj->backend, + MAIL_ACL_READ); + if (acl_cache_mask_isset(have_mask, read_idx)) + return 1; + } + return 0; } const char *const * diff -r 81a111f1c420 -r 7a7fa88aafe7 src/plugins/acl/acl-attributes.c --- a/src/plugins/acl/acl-attributes.c Thu Apr 11 17:35:31 2013 +0300 +++ b/src/plugins/acl/acl-attributes.c Thu Apr 11 18:50:25 2013 +0300 @@ -24,12 +24,12 @@ const char *value_str, *id, *const *rights, *error; struct acl_rights_update update; - /* for now allow only admin (=dsync) to update ACLs this way. + /* for now allow only dsync to update ACLs this way. if this check is removed, it should be replaced by a setting, since some admins may still have configured Dovecot using dovecot-acl files directly that they don't want users to update. and in any case ACL_STORAGE_RIGHT_ADMIN must be checked then. */ - if (!t->box->storage->user->admin) { + if (!t->box->storage->user->dsyncing) { mail_storage_set_error(t->box->storage, MAIL_ERROR_PERM, MAIL_ERRSTR_NO_PERMISSION); return -1; @@ -64,7 +64,7 @@ memset(value_r, 0, sizeof(*value_r)); - if (!box->storage->user->admin) { + if (!box->storage->user->dsyncing) { mail_storage_set_error(box->storage, MAIL_ERROR_PERM, MAIL_ERRSTR_NO_PERMISSION); return -1; @@ -172,7 +172,7 @@ else { aiter->super = abox->module_ctx.super. attribute_iter_init(box, type, prefix); - if (box->storage->user->admin && + if (box->storage->user->dsyncing && type == MAIL_ATTRIBUTE_TYPE_SHARED && strncmp(prefix, MAILBOX_ATTRIBUTE_PREFIX_ACL, strlen(prefix)) == 0) { diff -r 81a111f1c420 -r 7a7fa88aafe7 src/plugins/imap-quota/imap-quota-plugin.c --- a/src/plugins/imap-quota/imap-quota-plugin.c Thu Apr 11 17:35:31 2013 +0300 +++ b/src/plugins/imap-quota/imap-quota-plugin.c Thu Apr 11 18:50:25 2013 +0300 @@ -90,8 +90,7 @@ client_send_tagline(cmd, "OK No quota."); return TRUE; } - if (ns->owner != NULL && ns->owner != client->user && - !client->user->admin) { + if (ns->owner != NULL && ns->owner != client->user) { client_send_tagline(cmd, "NO Not showing other users' quota."); return TRUE; } @@ -131,7 +130,7 @@ { struct mail_user *owner = cmd->client->user; struct quota_root *root; - const char *root_name, *p; + const char *root_name; string_t *quota_reply; /* */ @@ -139,10 +138,11 @@ return FALSE; root = quota_root_lookup(cmd->client->user, root_name); +#if 0 if (root == NULL && cmd->client->user->admin) { /* we're an admin. see if there's a quota root for another user. */ - p = strchr(root_name, QUOTA_USER_SEPARATOR); + const char *p = strchr(root_name, QUOTA_USER_SEPARATOR); if (p != NULL) { owner = mail_user_find(cmd->client->user, t_strdup_until(root_name, p)); @@ -150,6 +150,7 @@ quota_root_lookup(owner, p + 1); } } +#endif if (root == NULL) { client_send_tagline(cmd, "NO Quota root doesn't exist."); return TRUE; diff -r 81a111f1c420 -r 7a7fa88aafe7 src/plugins/quota/quota.c --- a/src/plugins/quota/quota.c Thu Apr 11 17:35:31 2013 +0300 +++ b/src/plugins/quota/quota.c Thu Apr 11 18:50:25 2013 +0300 @@ -997,8 +997,8 @@ ctx->bytes_ceil2 = (uint64_t)-1; ctx->count_ceil = (uint64_t)-1; - if (box->storage->user->admin) { - /* ignore quota for admins */ + if (box->storage->user->dsyncing) { + /* ignore quota for dsync */ ctx->limits_set = TRUE; } return ctx; From dovecot at dovecot.org Thu Apr 11 19:06:39 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 11 Apr 2013 19:06:39 +0300 Subject: dovecot-2.2: lib-storage: mailbox_list_index=yes was broken by p... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cf898dbcbffb changeset: 16282:cf898dbcbffb user: Timo Sirainen date: Thu Apr 11 19:06:25 2013 +0300 description: lib-storage: mailbox_list_index=yes was broken by previous change. Reverted the previous change and fixed it the right way. diffstat: src/lib-storage/list/mailbox-list-index.c | 48 ++++++++++-------------------- 1 files changed, 16 insertions(+), 32 deletions(-) diffs (78 lines): diff -r 7a7fa88aafe7 -r cf898dbcbffb src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Thu Apr 11 18:50:25 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Thu Apr 11 19:06:25 2013 +0300 @@ -536,8 +536,9 @@ return 0; } -static void mailbox_list_index_created_last(struct mailbox_list *list) +static void mailbox_list_index_created(struct mailbox_list *list) { + struct mailbox_list_vfuncs *v = list->vlast; struct mailbox_list_index *ilist; bool has_backing_store; @@ -555,24 +556,25 @@ } ilist = p_new(list->pool, struct mailbox_list_index, 1); - ilist->module_ctx.super = list->v; + ilist->module_ctx.super = *v; + list->vlast = &ilist->module_ctx.super; ilist->has_backing_store = has_backing_store; ilist->pending_init = TRUE; - list->v.deinit = mailbox_list_index_deinit; - list->v.iter_init = mailbox_list_index_iter_init; - list->v.iter_deinit = mailbox_list_index_iter_deinit; - list->v.iter_next = mailbox_list_index_iter_next; + v->deinit = mailbox_list_index_deinit; + v->iter_init = mailbox_list_index_iter_init; + v->iter_deinit = mailbox_list_index_iter_deinit; + v->iter_next = mailbox_list_index_iter_next; - list->v.delete_mailbox = mailbox_list_index_delete_mailbox; - list->v.delete_dir = mailbox_list_index_delete_dir; - list->v.rename_mailbox = mailbox_list_index_rename_mailbox; - list->v.set_subscribed = mailbox_list_index_set_subscribed; + v->delete_mailbox = mailbox_list_index_delete_mailbox; + v->delete_dir = mailbox_list_index_delete_dir; + v->rename_mailbox = mailbox_list_index_rename_mailbox; + v->set_subscribed = mailbox_list_index_set_subscribed; - list->v.notify_init = mailbox_list_index_notify_init; - list->v.notify_next = mailbox_list_index_notify_next; - list->v.notify_deinit = mailbox_list_index_notify_deinit; - list->v.notify_wait = mailbox_list_index_notify_wait; + v->notify_init = mailbox_list_index_notify_init; + v->notify_next = mailbox_list_index_notify_next; + v->notify_deinit = mailbox_list_index_notify_deinit; + v->notify_wait = mailbox_list_index_notify_wait; MODULE_CONTEXT_SET(list, mailbox_list_index_module, ilist); } @@ -643,24 +645,6 @@ mailbox_list_index_backend_init_mailbox(box); } -static struct mail_storage_hooks mailbox_list_index_hooks_last = { - .mailbox_list_created = mailbox_list_index_created_last -}; -static bool mailbox_list_index_hooks_last_added = FALSE; - -static void mailbox_list_index_created(struct mailbox_list *list ATTR_UNUSED) -{ - /* We want our mailbox list index hooks to be called just before the - backend methods are called. Most importantly the ACL plugin's hooks - must be called before us, otherwise we'll end up skipping them and - showing all the mailboxes. So we do this dual-registration where - this second one gets us into the correct position. */ - if (!mailbox_list_index_hooks_last_added) { - mailbox_list_index_hooks_last_added = TRUE; - mail_storage_hooks_add_internal(&mailbox_list_index_hooks_last); - } -} - static struct mail_storage_hooks mailbox_list_index_hooks = { .mailbox_list_created = mailbox_list_index_created, .mail_namespaces_added = mailbox_list_index_namespaces_added, From pigeonhole at rename-it.nl Thu Apr 11 21:42:47 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 11 Apr 2013 20:42:47 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Updated to dsync changes ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1a3a4545fa10 changeset: 1749:1a3a4545fa10 user: Stephan Bosch date: Thu Apr 11 20:42:41 2013 +0200 description: doveadm-sieve: Updated to dsync changes in Dovecot mail storage API. Patch by Timo Sirainen. diffstat: src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diffs (31 lines): diff -r aafcff20c8a7 -r 1a3a4545fa10 src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Sun Apr 07 23:42:04 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Thu Apr 11 20:42:41 2013 +0200 @@ -323,7 +323,7 @@ union mailbox_module_context *sbox = SIEVE_MAIL_CONTEXT(t->box); time_t ts = value->last_change != 0 ? value->last_change : ioloop_time; - if (t->box->storage->user->admin && + if (t->box->storage->user->dsyncing && type == MAIL_ATTRIBUTE_TYPE_PRIVATE && strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_SIEVE, strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE)) == 0) { @@ -460,7 +460,7 @@ { union mailbox_module_context *sbox = SIEVE_MAIL_CONTEXT(t->box); - if (t->box->storage->user->admin && + if (t->box->storage->user->dsyncing && type == MAIL_ATTRIBUTE_TYPE_PRIVATE && strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_SIEVE, strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE)) == 0) @@ -503,7 +503,8 @@ siter->iter.box = box; siter->super = sbox->super.attribute_iter_init(box, type, prefix); - if (box->storage->user->admin && type == MAIL_ATTRIBUTE_TYPE_PRIVATE && + if (box->storage->user->dsyncing && + type == MAIL_ATTRIBUTE_TYPE_PRIVATE && strncmp(prefix, MAILBOX_ATTRIBUTE_PREFIX_SIEVE, strlen(prefix)) == 0) { if (sieve_attribute_iter_script_init(siter) < 0) From pigeonhole at rename-it.nl Thu Apr 11 23:40:13 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 11 Apr 2013 22:40:13 +0200 Subject: dovecot-2.2-pigeonhole: lib-sieve: environment extension: Finall... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/9d38ca755000 changeset: 1750:9d38ca755000 user: Stephan Bosch date: Thu Apr 11 22:40:07 2013 +0200 description: lib-sieve: environment extension: Finally finished this extension a much as possible. Some environment items in the base specification are not (yet) applicable to Dovecot and are therefore not supported. diffstat: README | 2 +- src/lib-sieve-tool/sieve-tool.c | 4 +- src/lib-sieve/plugins/environment/ext-environment-common.c | 86 +++++++++---- src/lib-sieve/sieve-common.h | 3 + src/lib-sieve/sieve-types.h | 27 ++++- src/lib-sieve/sieve.c | 27 ++++- src/plugins/lda-sieve/lda-sieve-plugin.c | 2 + tests/extensions/environment/basic.svtest | 8 +- tests/extensions/environment/rfc.svtest | 2 +- 9 files changed, 128 insertions(+), 33 deletions(-) diffs (truncated from 328 to 300 lines): diff -r 1a3a4545fa10 -r 9d38ca755000 README --- a/README Thu Apr 11 20:42:41 2013 +0200 +++ b/README Thu Apr 11 22:40:07 2013 +0200 @@ -102,7 +102,7 @@ body (RFC 5173): almost fully supported, but the text body-transform implementation is simple and some issues make it still not completely RFC compliant. - environment (RFC 5183): basic support is provided (v0.1.5+). + environment (RFC 5183): fully supported (v0.1.5+). variables (RFC 5229): fully supported. vacation (RFC 5230): fully supported. + vacation-seconds (RFC 6131): fully supported (v0.2.3+). diff -r 1a3a4545fa10 -r 9d38ca755000 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Thu Apr 11 20:42:41 2013 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Thu Apr 11 22:40:07 2013 +0200 @@ -271,8 +271,10 @@ memset((void *)&svenv, 0, sizeof(svenv)); svenv.username = username; (void)mail_user_get_home(tool->mail_user_dovecot, &svenv.home_dir); - svenv.hostname = "host.example.com"; + svenv.hostname = my_hostdomain(); svenv.base_dir = tool->mail_user_dovecot->set->base_dir; + svenv.location = SIEVE_ENV_LOCATION_MS; + svenv.delivery_phase = SIEVE_DELIVERY_PHASE_POST; /* Initialize Sieve Engine */ if ( (tool->svinst=sieve_init diff -r 1a3a4545fa10 -r 9d38ca755000 src/lib-sieve/plugins/environment/ext-environment-common.c --- a/src/lib-sieve/plugins/environment/ext-environment-common.c Thu Apr 11 20:42:41 2013 +0200 +++ b/src/lib-sieve/plugins/environment/ext-environment-common.c Thu Apr 11 22:40:07 2013 +0200 @@ -102,11 +102,8 @@ if ( item->value != NULL ) return item->value; - if ( item->get_value != NULL ) { - const char *value = item->get_value(ext->svinst, senv); - - return ( value == NULL ? "" : value ); - } + if ( item->get_value != NULL ) + return item->get_value(ext->svinst, senv); return NULL; } @@ -120,10 +117,17 @@ * The primary DNS domain associated with the Sieve execution context, usually * but not always a proper suffix of the host name. */ + +static const char *envit_domain_get_value +(struct sieve_instance *svinst, + const struct sieve_script_env *senv ATTR_UNUSED) +{ + return svinst->domainname; +} + const struct sieve_environment_item domain_env_item = { - "domain", - NULL, - NULL, + .name = "domain", + .get_value = envit_domain_get_value, }; /* "host": @@ -133,15 +137,15 @@ */ static const char *envit_host_get_value -(struct sieve_instance *svinst, const struct sieve_script_env *senv ATTR_UNUSED) +(struct sieve_instance *svinst, + const struct sieve_script_env *senv ATTR_UNUSED) { return svinst->hostname; } const struct sieve_environment_item host_env_item = { - "host", - NULL, - envit_host_get_value, + .name = "host", + .get_value = envit_host_get_value, }; /* "location": @@ -151,13 +155,30 @@ * service that is evaluating the script. Possible values are: * "MTA" - the Sieve script is being evaluated by a Message Transfer Agent * "MDA" - evaluation is being performed by a Mail Delivery Agent - * "MUA" - evaluation is being performed by a Mail User Agent + * "MUA" - evaluation is being performed by a Mail User Agent (right...) * "MS" - evaluation is being performed by a Message Store */ + +static const char *envit_location_get_value +(struct sieve_instance *svinst, + const struct sieve_script_env *senv ATTR_UNUSED) +{ + switch ( svinst->env_location ) { + case SIEVE_ENV_LOCATION_MDA: + return "MDA"; + case SIEVE_ENV_LOCATION_MTA: + return "MTA"; + case SIEVE_ENV_LOCATION_MS: + return "MS"; + default: + break; + } + return NULL; +} + const struct sieve_environment_item location_env_item = { - "location", - NULL, - NULL, + .name = "location", + .get_value = envit_location_get_value }; /* "phase": @@ -168,20 +189,36 @@ * taken place. */ +static const char *envit_phase_get_value +(struct sieve_instance *svinst, + const struct sieve_script_env *senv ATTR_UNUSED) +{ + switch ( svinst->delivery_phase ) { + case SIEVE_DELIVERY_PHASE_PRE: + return "pre"; + case SIEVE_DELIVERY_PHASE_DURING: + return "during"; + case SIEVE_DELIVERY_PHASE_POST: + return "post"; + default: + break; + } + return NULL; +} + const struct sieve_environment_item phase_env_item = { - "phase", - NULL, - NULL, + .name = "phase", + .get_value = envit_phase_get_value }; /* "name": * * The product name associated with the Sieve interpreter. */ + const struct sieve_environment_item name_env_item = { - "name", - PIGEONHOLE_NAME" Sieve", - NULL, + .name = "name", + .value = PIGEONHOLE_NAME" Sieve" }; /* "version": @@ -192,9 +229,8 @@ */ const struct sieve_environment_item version_env_item = { - "version", - PIGEONHOLE_VERSION, - NULL, + .name = "version", + .value = PIGEONHOLE_VERSION, }; diff -r 1a3a4545fa10 -r 9d38ca755000 src/lib-sieve/sieve-common.h --- a/src/lib-sieve/sieve-common.h Thu Apr 11 20:42:41 2013 +0200 +++ b/src/lib-sieve/sieve-common.h Thu Apr 11 22:40:07 2013 +0200 @@ -157,6 +157,7 @@ /* System environment */ const char *hostname; + const char *domainname; const char *base_dir; /* User environment */ @@ -181,6 +182,8 @@ /* Plugin modules */ struct sieve_plugin *plugins; + enum sieve_env_location env_location; + enum sieve_delivery_phase delivery_phase; /* Limits */ size_t max_script_size; diff -r 1a3a4545fa10 -r 9d38ca755000 src/lib-sieve/sieve-types.h --- a/src/lib-sieve/sieve-types.h Thu Apr 11 20:42:41 2013 +0200 +++ b/src/lib-sieve/sieve-types.h Thu Apr 11 22:40:07 2013 +0200 @@ -31,14 +31,39 @@ SIEVE_FLAG_HOME_RELATIVE = (1 << 0), }; +/* Sieve evaluation can be performed at various different points as messages + are processed. */ +enum sieve_env_location { + /* Unknown */ + SIEVE_ENV_LOCATION_UNKNOWN = 0, + /* "MDA" - evaluation is being performed by a Mail Delivery Agent */ + SIEVE_ENV_LOCATION_MDA, + /* "MTA" - the Sieve script is being evaluated by a Message Transfer Agent */ + SIEVE_ENV_LOCATION_MTA, + /* "MS" - evaluation is being performed by a Message Store */ + SIEVE_ENV_LOCATION_MS +}; + +/* The point relative to final delivery where the Sieve script is being + evaluated. */ +enum sieve_delivery_phase { + SIEVE_DELIVERY_PHASE_UNKNOWN = 0, + SIEVE_DELIVERY_PHASE_PRE, + SIEVE_DELIVERY_PHASE_DURING, + SIEVE_DELIVERY_PHASE_POST, +}; + struct sieve_environment { const char *hostname; + const char *domainname; + const char *base_dir; - const char *username; const char *home_dir; enum sieve_flag flags; + enum sieve_env_location location; + enum sieve_delivery_phase delivery_phase; }; /* diff -r 1a3a4545fa10 -r 9d38ca755000 src/lib-sieve/sieve.c --- a/src/lib-sieve/sieve.c Thu Apr 11 20:42:41 2013 +0200 +++ b/src/lib-sieve/sieve.c Thu Apr 11 22:40:07 2013 +0200 @@ -49,6 +49,7 @@ struct sieve_instance *svinst; unsigned long long int uint_setting; size_t size_setting; + const char *domain; pool_t pool; /* Create Sieve engine instance */ @@ -58,11 +59,35 @@ svinst->callbacks = callbacks; svinst->context = context; svinst->debug = debug; - svinst->hostname = p_strdup_empty(pool, env->hostname); svinst->base_dir = p_strdup_empty(pool, env->base_dir); svinst->username = p_strdup_empty(pool, env->username); svinst->home_dir = p_strdup_empty(pool, env->home_dir); svinst->flags = env->flags; + svinst->env_location = env->location; + svinst->delivery_phase = env->delivery_phase; + + /* Determine domain */ + if ( env->domainname != NULL && *(env->domainname) != '\0' ) { + domain = env->domainname; + } else { + /* Fall back to parsing username localpart at domain */ + domain = strchr(svinst->username, '@'); + if ( domain == NULL || *(domain+1) == '\0' ) { + /* Fall back to parsing hostname host.domain */ + domain = ( env->hostname != NULL ? strchr(env->hostname, '.') : NULL ); + if ( domain == NULL || *(domain+1) == '\0' + || strchr(domain+1, '.') == NULL ) { + /* Fall back to bare hostname */ + domain = env->hostname; + } else { + domain++; + } + } else { + domain++; + } + } + svinst->hostname = p_strdup_empty(pool, env->hostname); + svinst->domainname = p_strdup(pool, domain); sieve_errors_init(svinst); diff -r 1a3a4545fa10 -r 9d38ca755000 src/plugins/lda-sieve/lda-sieve-plugin.c --- a/src/plugins/lda-sieve/lda-sieve-plugin.c Thu Apr 11 20:42:41 2013 +0200 +++ b/src/plugins/lda-sieve/lda-sieve-plugin.c Thu Apr 11 22:40:07 2013 +0200 @@ -622,6 +622,8 @@ svenv.hostname = mdctx->set->hostname; svenv.base_dir = mdctx->dest_user->set->base_dir; svenv.flags = SIEVE_FLAG_HOME_RELATIVE; + svenv.location = SIEVE_ENV_LOCATION_MDA; + svenv.delivery_phase = SIEVE_DELIVERY_PHASE_DURING; svinst = sieve_init(&svenv, &lda_sieve_callbacks, mdctx, debug); diff -r 1a3a4545fa10 -r 9d38ca755000 tests/extensions/environment/basic.svtest From dovecot at dovecot.org Fri Apr 12 20:34:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 12 Apr 2013 20:34:54 +0300 Subject: dovecot-2.2: Released v2.1.0. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7ea8f20e5195 changeset: 16283:7ea8f20e5195 user: Timo Sirainen date: Thu Apr 11 22:38:54 2013 +0300 description: Released v2.1.0. diffstat: NEWS | 106 +++++++++++----------- configure.ac | 2 +- doc/example-config/conf.d/11-object-storage.conf | 4 + 3 files changed, 60 insertions(+), 52 deletions(-) diffs (140 lines): diff -r cf898dbcbffb -r 7ea8f20e5195 NEWS --- a/NEWS Thu Apr 11 19:06:25 2013 +0300 +++ b/NEWS Thu Apr 11 22:38:54 2013 +0300 @@ -1,54 +1,4 @@ -v2.2.rc7 2013-04-10 Timo Sirainen - - * checkpasword: AUTH_PASSWORD environment is no longer set. - * Running dsync no longer triggers quota warnings. - - + dsync: Commit large transactions every 100 new messages, so if a - large sync crashes it doesn't have to be restarted from the - beginning. - - replicator: doveadm commands and user list export may have skipped - some users. - - Various fixes to mailbox_list_index=yes - -v2.2.rc6 2013-04-08 Timo Sirainen - - * replicator: Don't create replicator-doveadm socket by default. - This way doveadm replicator commands don't accidentally start an - unconfigured replicator server. - + replicator: Have remote dsync notify the remote replicator that - a user was just synced. This way the replicators are kept roughly - in sync. - + Added ssl_client_ca_file to specify the CA certs as a file. This is - needed (instead of ssl_client_ca_dir) in RedHat-based systems. - + Added "doveadm fs" commands, mainly to debug lib-fs backends. - - Mailbox list indexes weren't using proper file permissions based - on the root directory. - -v2.2.rc5 2013-04-05 Timo Sirainen - - - A few small random fixes - -v2.2.rc4 2013-04-05 Timo Sirainen - - + Added "doveadm replicator" commands - - Larger changes to lib-http and lib-ssl-iostream error handling. - The API caller can now get the exact error message as a string. - - Various bugfixes to LDAP changes in rc3 - -v2.2.rc3 2013-03-20 Timo Sirainen - - + dsync: Support syncing ACLs (and Sieve scripts with Pigeonhole) - + ldap: Support subqueries and value pointers, see - http://wiki2.dovecot.org/AuthDatabase/LDAP/Userdb - + postmaster_address setting: Expand %d to recipient's domain - - Fixed a crash when decoding quoted-printable content. - - dsync: Various bugfixes - -v2.2.rc2 2013-02-15 Timo Sirainen - - - rc1 wasn't actually usable in most configurations. - -v2.2.rc1 2013-02-15 Timo Sirainen +v2.2.0 2013-04-11 Timo Sirainen * When creating home directories, the permissions are copied from the parent directory if it has setgid-bit set. For full details, see @@ -89,6 +39,60 @@ + LMTP proxy: Implemented XCLIENT extension for passing remote IP address through proxy. +v2.2.rc7 2013-04-10 Timo Sirainen + + * checkpasword: AUTH_PASSWORD environment is no longer set. + * Running dsync no longer triggers quota warnings. + + + dsync: Commit large transactions every 100 new messages, so if a + large sync crashes it doesn't have to be restarted from the + beginning. + - replicator: doveadm commands and user list export may have skipped + some users. + - Various fixes to mailbox_list_index=yes + +v2.2.rc6 2013-04-08 Timo Sirainen + + * replicator: Don't create replicator-doveadm socket by default. + This way doveadm replicator commands don't accidentally start an + unconfigured replicator server. + + replicator: Have remote dsync notify the remote replicator that + a user was just synced. This way the replicators are kept roughly + in sync. + + Added ssl_client_ca_file to specify the CA certs as a file. This is + needed (instead of ssl_client_ca_dir) in RedHat-based systems. + + Added "doveadm fs" commands, mainly to debug lib-fs backends. + - Mailbox list indexes weren't using proper file permissions based + on the root directory. + +v2.2.rc5 2013-04-05 Timo Sirainen + + - A few small random fixes + +v2.2.rc4 2013-04-05 Timo Sirainen + + + Added "doveadm replicator" commands + - Larger changes to lib-http and lib-ssl-iostream error handling. + The API caller can now get the exact error message as a string. + - Various bugfixes to LDAP changes in rc3 + +v2.2.rc3 2013-03-20 Timo Sirainen + + + dsync: Support syncing ACLs (and Sieve scripts with Pigeonhole) + + ldap: Support subqueries and value pointers, see + http://wiki2.dovecot.org/AuthDatabase/LDAP/Userdb + + postmaster_address setting: Expand %d to recipient's domain + - Fixed a crash when decoding quoted-printable content. + - dsync: Various bugfixes + +v2.2.rc2 2013-02-15 Timo Sirainen + + - rc1 wasn't actually usable in most configurations. + +v2.2.rc1 2013-02-15 Timo Sirainen + + * See v2.2.0 notes + v2.1.13 2013-01-06 Timo Sirainen - Some fixes to cache file changes in v2.1.11. diff -r cf898dbcbffb -r 7ea8f20e5195 configure.ac --- a/configure.ac Thu Apr 11 19:06:25 2013 +0300 +++ b/configure.ac Thu Apr 11 22:38:54 2013 +0300 @@ -2,7 +2,7 @@ # 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.rc7],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.2.0],[dovecot at dovecot.org]) AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version]) AC_CONFIG_SRCDIR([src]) diff -r cf898dbcbffb -r 7ea8f20e5195 doc/example-config/conf.d/11-object-storage.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/example-config/conf.d/11-object-storage.conf Thu Apr 11 22:38:54 2013 +0300 @@ -0,0 +1,4 @@ +# Dovecot supports storing emails into various Object Storage Systems, +# such as Amazon S3, Windows Azure, Dropbox and others. +# See installation instructions and example configuration at +# http://dl.dovecot.fi/obox/obox-example-config.txt From dovecot at dovecot.org Fri Apr 12 20:34:54 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 12 Apr 2013 20:34:54 +0300 Subject: dovecot-2.2: Added signature for changeset e2cd03cc9c69 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/1c8e7a295d4b changeset: 16284:1c8e7a295d4b user: Timo Sirainen date: Thu Apr 11 22:38:59 2013 +0300 description: Added signature for changeset e2cd03cc9c69 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 7ea8f20e5195 -r 1c8e7a295d4b .hgsigs --- a/.hgsigs Thu Apr 11 22:38:54 2013 +0300 +++ b/.hgsigs Thu Apr 11 22:38:59 2013 +0300 @@ -66,3 +66,4 @@ 9446df6da5a89ae94653362ef4d4ea154272cd3e 0 iEYEABECAAYFAlFfEeQACgkQyUhSUUBViskn8QCfW8C5xr/OuOSQNuLchv9HJduncaEAnici8NhTmN7G9qwReXnLqcdrC1Tc ae4341d0e83bd63397b418666bc80076700432fd 0 iEYEABECAAYFAlFh+/EACgkQyUhSUUBViskLaACfaQUhj/uJIZ5oDL5Wo5hTUgJC+cQAnR4GFR/GhGqJmvFWe8jZPD3CwtW/ d7f29af734683149badfc45a4e2015254ca78672 0 iEYEABECAAYFAlFlvh0ACgkQyUhSUUBVislyrgCfSTX5MQWcV+eAWNlZ1jpawq9rNPMAnRNU9RBWmrUNU9PqDrsqS3WDCGyu +e2cd03cc9c690c4989fb53a1871b7109c547388a 0 iEYEABECAAYFAlFnEVAACgkQyUhSUUBVismWBgCgit90C+1stGSchsVzJGghBs9278UAnj0vB6BETfOU9tNjViyCR18aEdUH From dovecot at dovecot.org Fri Apr 12 21:19:56 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 12 Apr 2013 21:19:56 +0300 Subject: dovecot-2.2: Added tag 2.2.0 for changeset 1c8e7a295d4b Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/4af6b464ef9b changeset: 16285:4af6b464ef9b user: Timo Sirainen date: Fri Apr 12 21:19:38 2013 +0300 description: Added tag 2.2.0 for changeset 1c8e7a295d4b diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 1c8e7a295d4b -r 4af6b464ef9b .hgtags --- a/.hgtags Thu Apr 11 22:38:59 2013 +0300 +++ b/.hgtags Fri Apr 12 21:19:38 2013 +0300 @@ -103,3 +103,4 @@ 9446df6da5a89ae94653362ef4d4ea154272cd3e 2.2.rc5 ae4341d0e83bd63397b418666bc80076700432fd 2.2.rc6 d7f29af734683149badfc45a4e2015254ca78672 2.2.rc7 +1c8e7a295d4bd167a2b0a7243a3ec4d1e161360d 2.2.0 From pigeonhole at rename-it.nl Fri Apr 12 21:32:31 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 12 Apr 2013 20:32:31 +0200 Subject: dovecot-2.2-pigeonhole: Fixed doveconf crash caused by previous ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/70f0b7140939 changeset: 1751:70f0b7140939 user: Stephan Bosch date: Fri Apr 12 20:25:02 2013 +0200 description: Fixed doveconf crash caused by previous change. Patch by Timo Sirainen. diffstat: src/lib-sieve/sieve.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 9d38ca755000 -r 70f0b7140939 src/lib-sieve/sieve.c --- a/src/lib-sieve/sieve.c Thu Apr 11 22:40:07 2013 +0200 +++ b/src/lib-sieve/sieve.c Fri Apr 12 20:25:02 2013 +0200 @@ -71,7 +71,8 @@ domain = env->domainname; } else { /* Fall back to parsing username localpart at domain */ - domain = strchr(svinst->username, '@'); + domain = svinst->username == NULL ? NULL : + strchr(svinst->username, '@'); if ( domain == NULL || *(domain+1) == '\0' ) { /* Fall back to parsing hostname host.domain */ domain = ( env->hostname != NULL ? strchr(env->hostname, '.') : NULL ); From dovecot at dovecot.org Sun Apr 14 20:40:59 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 14 Apr 2013 20:40:59 +0300 Subject: dovecot-2.2: Linking error fix. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a7d0bb66639f changeset: 16286:a7d0bb66639f user: Timo Sirainen date: Sun Apr 14 20:40:47 2013 +0300 description: Linking error fix. diffstat: src/doveadm/doveadm-mail.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (11 lines): diff -r 4af6b464ef9b -r a7d0bb66639f src/doveadm/doveadm-mail.h --- a/src/doveadm/doveadm-mail.h Fri Apr 12 21:19:38 2013 +0300 +++ b/src/doveadm/doveadm-mail.h Sun Apr 14 20:40:47 2013 +0300 @@ -150,6 +150,6 @@ extern struct doveadm_mail_cmd cmd_mailbox_subscribe; extern struct doveadm_mail_cmd cmd_mailbox_unsubscribe; extern struct doveadm_mail_cmd cmd_mailbox_status; -struct doveadm_mail_cmd cmd_batch; +extern struct doveadm_mail_cmd cmd_batch; #endif From dovecot at dovecot.org Sun Apr 14 21:27:46 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 14 Apr 2013 21:27:46 +0300 Subject: dovecot-2.2: lib-storage: mailbox_list_index=yes was still broken. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fc9ef7d2251a changeset: 16287:fc9ef7d2251a user: Timo Sirainen date: Sun Apr 14 21:27:29 2013 +0300 description: lib-storage: mailbox_list_index=yes was still broken. diffstat: src/lib-storage/mail-namespace.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r a7d0bb66639f -r fc9ef7d2251a src/lib-storage/mail-namespace.c --- a/src/lib-storage/mail-namespace.c Sun Apr 14 20:40:47 2013 +0300 +++ b/src/lib-storage/mail-namespace.c Sun Apr 14 21:27:29 2013 +0300 @@ -467,6 +467,7 @@ user->namespaces = ns; T_BEGIN { + hook_mail_namespaces_added(ns); hook_mail_namespaces_created(ns); } T_END; return 0; From dovecot at dovecot.org Mon Apr 15 17:22:15 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 15 Apr 2013 17:22:15 +0300 Subject: dovecot-2.2: lib-mail: Don't assert-crash when multipart doesn't... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b38d5ebacf25 changeset: 16288:b38d5ebacf25 user: Timo Sirainen date: Mon Apr 15 17:22:06 2013 +0300 description: lib-mail: Don't assert-crash when multipart doesn't actually have any parts. diffstat: src/lib-mail/message-parser.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r fc9ef7d2251a -r b38d5ebacf25 src/lib-mail/message-parser.c --- a/src/lib-mail/message-parser.c Sun Apr 14 21:27:29 2013 +0300 +++ b/src/lib-mail/message-parser.c Mon Apr 15 17:22:06 2013 +0300 @@ -839,7 +839,10 @@ } i_stream_skip(ctx->input, offset - ctx->input->v_offset); - if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0) + /* multipart messages may begin with --boundary--, which makes them + not have any children. */ + if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 || + ctx->part->children == NULL) ctx->parse_next_block = preparsed_parse_body_more; else ctx->parse_next_block = preparsed_parse_prologue_more; From dovecot at dovecot.org Mon Apr 15 21:40:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 15 Apr 2013 21:40:47 +0300 Subject: dovecot-2.2: zlib: Don't crash when trying to use zlib_save for ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9a5b132b6832 changeset: 16289:9a5b132b6832 user: Timo Sirainen date: Mon Apr 15 21:40:35 2013 +0300 description: zlib: Don't crash when trying to use zlib_save for handler that isn't compiled in. diffstat: src/plugins/zlib/zlib-plugin.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diffs (14 lines): diff -r b38d5ebacf25 -r 9a5b132b6832 src/plugins/zlib/zlib-plugin.c --- a/src/plugins/zlib/zlib-plugin.c Mon Apr 15 17:22:06 2013 +0300 +++ b/src/plugins/zlib/zlib-plugin.c Mon Apr 15 21:40:35 2013 +0300 @@ -295,6 +295,10 @@ zuser->save_handler = compression_lookup_handler(name); if (zuser->save_handler == NULL) i_error("zlib_save: Unknown handler: %s", name); + else if (zuser->save_handler->create_ostream == NULL) { + i_error("zlib_save: Support not compiled in for handler: %s", name); + zuser->save_handler = NULL; + } } name = mail_user_plugin_getenv(user, "zlib_save_level"); if (name != NULL) { From dovecot at dovecot.org Tue Apr 16 15:54:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 16 Apr 2013 15:54:17 +0300 Subject: dovecot-2.2: maildir: Fixed crash in some rare situations. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f33bacb03cc2 changeset: 16290:f33bacb03cc2 user: Timo Sirainen date: Tue Apr 16 15:54:05 2013 +0300 description: maildir: Fixed crash in some rare situations. diffstat: src/lib-storage/index/maildir/maildir-util.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 9a5b132b6832 -r f33bacb03cc2 src/lib-storage/index/maildir/maildir-util.c --- a/src/lib-storage/index/maildir/maildir-util.c Mon Apr 15 21:40:35 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-util.c Tue Apr 16 15:54:05 2013 +0300 @@ -87,6 +87,9 @@ fname = maildir_filename_guess(mbox, uid, fname, &flags, &have_flags); } + /* make a copy, just in case callback refreshes uidlist and + the pointer becomes invalid. */ + fname = t_strdup(fname); ret = 0; if ((flags & MAILDIR_UIDLIST_REC_FLAG_NEW_DIR) != 0) { From dovecot at dovecot.org Tue Apr 16 16:20:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 16 Apr 2013 16:20:40 +0300 Subject: dovecot-2.2: auth: Fixed multiple master passdbs. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/854469baa57c changeset: 16291:854469baa57c user: Timo Sirainen date: Tue Apr 16 16:20:30 2013 +0300 description: auth: Fixed multiple master passdbs. diffstat: src/auth/auth-request.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r f33bacb03cc2 -r 854469baa57c src/auth/auth-request.c --- a/src/auth/auth-request.c Tue Apr 16 15:54:05 2013 +0300 +++ b/src/auth/auth-request.c Tue Apr 16 16:20:30 2013 +0300 @@ -583,7 +583,8 @@ request->skip_password_check = TRUE; } - if (request->requested_login_user != NULL) { + if (request->requested_login_user != NULL && + *result == PASSDB_RESULT_OK) { auth_request_master_lookup_finish(request); /* if the passdb lookup continues, it continues with non-master passdbs for the requested_login_user. */ From dovecot at dovecot.org Tue Apr 16 20:08:24 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 16 Apr 2013 20:08:24 +0300 Subject: dovecot-2.2: mbox: Handle broken Status: and X-Status: headers w... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c473f8d2540e changeset: 16292:c473f8d2540e user: Timo Sirainen date: Tue Apr 16 20:08:18 2013 +0300 description: mbox: Handle broken Status: and X-Status: headers without sync errors. diffstat: src/lib-storage/index/mbox/mbox-sync-parse.c | 18 +++++++++++++----- src/lib-storage/index/mbox/mbox-sync-private.h | 2 ++ src/lib-storage/index/mbox/mbox-sync-update.c | 6 ++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diffs (84 lines): diff -r 854469baa57c -r c473f8d2540e src/lib-storage/index/mbox/mbox-sync-parse.c --- a/src/lib-storage/index/mbox/mbox-sync-parse.c Tue Apr 16 16:20:30 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-parse.c Tue Apr 16 20:08:18 2013 +0300 @@ -79,24 +79,31 @@ return 0; } -static void parse_status_flags(struct mbox_sync_mail_context *ctx, +static bool parse_status_flags(struct mbox_sync_mail_context *ctx, struct message_header_line *hdr, struct mbox_flag_type *flags_list) { + enum mail_flags flag; size_t i; + bool duplicates = FALSE; ctx->mail.flags ^= MBOX_NONRECENT_KLUDGE; for (i = 0; i < hdr->full_value_len; i++) { - ctx->mail.flags |= - mbox_flag_find(flags_list, hdr->full_value[i]); + flag = mbox_flag_find(flags_list, hdr->full_value[i]); + if ((ctx->mail.flags & flag) != 0) + duplicates = TRUE; + else + ctx->mail.flags |= flag; } ctx->mail.flags ^= MBOX_NONRECENT_KLUDGE; + return duplicates; } static bool parse_status(struct mbox_sync_mail_context *ctx, struct message_header_line *hdr) { - parse_status_flags(ctx, hdr, mbox_status_flags); + if (parse_status_flags(ctx, hdr, mbox_status_flags)) + ctx->mail.status_broken = TRUE; ctx->hdr_pos[MBOX_HDR_STATUS] = str_len(ctx->header); return TRUE; } @@ -104,7 +111,8 @@ static bool parse_x_status(struct mbox_sync_mail_context *ctx, struct message_header_line *hdr) { - parse_status_flags(ctx, hdr, mbox_xstatus_flags); + if (parse_status_flags(ctx, hdr, mbox_xstatus_flags)) + ctx->mail.xstatus_broken = TRUE; ctx->hdr_pos[MBOX_HDR_X_STATUS] = str_len(ctx->header); return TRUE; } diff -r 854469baa57c -r c473f8d2540e src/lib-storage/index/mbox/mbox-sync-private.h --- a/src/lib-storage/index/mbox/mbox-sync-private.h Tue Apr 16 16:20:30 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-private.h Tue Apr 16 20:08:18 2013 +0300 @@ -52,6 +52,8 @@ unsigned int uid_broken:1; unsigned int expunged:1; unsigned int pseudo:1; + unsigned int status_broken:1; + unsigned int xstatus_broken:1; uoff_t from_offset; uoff_t body_size; diff -r 854469baa57c -r c473f8d2540e src/lib-storage/index/mbox/mbox-sync-update.c --- a/src/lib-storage/index/mbox/mbox-sync-update.c Tue Apr 16 16:20:30 2013 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-update.c Tue Apr 16 20:08:18 2013 +0300 @@ -409,7 +409,8 @@ mbox_sync_update_header_from_real(struct mbox_sync_mail_context *ctx, const struct mbox_sync_mail *mail) { - if ((ctx->mail.flags & STATUS_FLAGS_MASK) != + if (mail->status_broken || + (ctx->mail.flags & STATUS_FLAGS_MASK) != (mail->flags & STATUS_FLAGS_MASK) || (ctx->mail.flags & MAIL_RECENT) != 0) { ctx->mail.flags = (ctx->mail.flags & ~STATUS_FLAGS_MASK) | @@ -418,7 +419,8 @@ ctx->mail.flags &= ~MAIL_RECENT; mbox_sync_update_status(ctx); } - if ((ctx->mail.flags & XSTATUS_FLAGS_MASK) != + if (mail->xstatus_broken || + (ctx->mail.flags & XSTATUS_FLAGS_MASK) != (mail->flags & XSTATUS_FLAGS_MASK)) { ctx->mail.flags = (ctx->mail.flags & ~XSTATUS_FLAGS_MASK) | (mail->flags & XSTATUS_FLAGS_MASK); From dovecot at dovecot.org Wed Apr 17 16:20:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Apr 2013 16:20:36 +0300 Subject: dovecot-2.2: doveadm fs: Set base_dir. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7f00331058ef changeset: 16293:7f00331058ef user: Timo Sirainen date: Wed Apr 17 16:08:26 2013 +0300 description: doveadm fs: Set base_dir. diffstat: src/doveadm/doveadm-fs.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r c473f8d2540e -r 7f00331058ef src/doveadm/doveadm-fs.c --- a/src/doveadm/doveadm-fs.c Tue Apr 16 20:08:18 2013 +0300 +++ b/src/doveadm/doveadm-fs.c Wed Apr 17 16:08:26 2013 +0300 @@ -30,6 +30,7 @@ memset(&fs_set, 0, sizeof(fs_set)); fs_set.ssl_client_set = &ssl_set; fs_set.temp_dir = "/tmp"; + fs_set.base_dir = doveadm_settings->base_dir; fs_set.debug = doveadm_debug; if (fs_init((*argv)[1], (*argv)[2], &fs_set, &fs, &error) < 0) From dovecot at dovecot.org Wed Apr 17 16:20:36 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Apr 2013 16:20:36 +0300 Subject: dovecot-2.2: lib-storage: mailbox_save_finish() internally does ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/8a07a5f6fd54 changeset: 16294:8a07a5f6fd54 user: Timo Sirainen date: Wed Apr 17 16:19:42 2013 +0300 description: lib-storage: mailbox_save_finish() internally does one final mailbox_save_continue() diffstat: src/imap/cmd-append.c | 3 --- src/lib-storage/mail-storage.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diffs (34 lines): diff -r 7f00331058ef -r 8a07a5f6fd54 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Wed Apr 17 16:08:26 2013 +0300 +++ b/src/imap/cmd-append.c Wed Apr 17 16:19:42 2013 +0300 @@ -342,9 +342,6 @@ if (ctx->save_ctx != NULL) mailbox_save_cancel(&ctx->save_ctx); } else { - /* do mailbox_save_continue() once more after appending EOF, - to finish any pending reads */ - (void)mailbox_save_continue(ctx->save_ctx); if (mailbox_save_finish(&ctx->save_ctx) < 0) { client_send_storage_error(cmd, ctx->storage); ctx->failed = TRUE; diff -r 7f00331058ef -r 8a07a5f6fd54 src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Wed Apr 17 16:08:26 2013 +0300 +++ b/src/lib-storage/mail-storage.c Wed Apr 17 16:19:42 2013 +0300 @@ -2018,7 +2018,17 @@ bool copying_via_save = ctx->copying_via_save; int ret; + /* Do one final continue. The caller may not have done it if the + input stream's offset already matched the number of bytes that + were wanted to be saved. But due to nested istreams some of the + underlying ones may not have seen the EOF yet, and haven't flushed + out the pending data. */ + if (mailbox_save_continue(ctx) < 0) { + mailbox_save_cancel(_ctx); + return -1; + } *_ctx = NULL; + ret = t->box->v.save_finish(ctx); if (ret == 0 && !copying_via_save) { if (pvt_flags != 0) From dovecot at dovecot.org Wed Apr 17 18:45:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Apr 2013 18:45:17 +0300 Subject: dovecot-2.2: lib-imap-urlauth: Fixed connection error handling t... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cc0dd0d79952 changeset: 16295:cc0dd0d79952 user: Stephan Bosch date: Wed Apr 17 18:44:52 2013 +0300 description: lib-imap-urlauth: Fixed connection error handling to abort all pending requests. diffstat: src/lib-imap-urlauth/imap-urlauth-connection.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 8a07a5f6fd54 -r cc0dd0d79952 src/lib-imap-urlauth/imap-urlauth-connection.c --- a/src/lib-imap-urlauth/imap-urlauth-connection.c Wed Apr 17 16:19:42 2013 +0300 +++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Wed Apr 17 18:44:52 2013 +0300 @@ -873,6 +873,7 @@ if (conn->user->auth_token == NULL) { i_error("imap-urlauth: cannot authenticate because no auth token " "is available for this session (standalone IMAP?)."); + imap_urlauth_connection_abort(conn, NULL); return -1; } @@ -884,6 +885,7 @@ if (fd == -1) { i_error("imap-urlauth: net_connect_unix(%s) failed: %m", conn->path); + imap_urlauth_connection_abort(conn, NULL); return -1; } From dovecot at dovecot.org Wed Apr 17 18:48:00 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Apr 2013 18:48:00 +0300 Subject: dovecot-2.2: liblib: Added DLLIST2_INSERT_AFTER_FULL() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/bafcb428167b changeset: 16296:bafcb428167b user: Stephan Bosch date: Wed Apr 17 18:47:36 2013 +0300 description: liblib: Added DLLIST2_INSERT_AFTER_FULL() For inserting a new element in a doubly-linked list after an existing element. diffstat: src/lib/llist.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diffs (22 lines): diff -r cc0dd0d79952 -r bafcb428167b src/lib/llist.h --- a/src/lib/llist.h Wed Apr 17 18:44:52 2013 +0300 +++ b/src/lib/llist.h Wed Apr 17 18:47:36 2013 +0300 @@ -48,6 +48,18 @@ #define DLLIST2_APPEND(head, tail, item) \ DLLIST2_APPEND_FULL(head, tail, item, prev, next) +#define DLLIST2_INSERT_AFTER_FULL(head, tail, after, item, prev, next) \ + STMT_START { \ + (item)->prev = (after); \ + (item)->next = (after)->next; \ + (after)->next = (item); \ + if (*(tail) == (after)) \ + *(tail) = (item); \ + } STMT_END + +#define DLLIST2_INSERT_AFTER(head, tail, after, item) \ + DLLIST2_INSERT_AFTER_FULL(head, tail, after, item, prev, next) + #define DLLIST2_REMOVE_FULL(head, tail, item, prev, next) STMT_START { \ if ((item)->prev == NULL) \ *(head) = (item)->next; \ From dovecot at dovecot.org Thu Apr 18 17:48:52 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 18 Apr 2013 17:48:52 +0300 Subject: dovecot-2.2: lib-storage: mailbox_copy() didn't always copy all ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/61e567c7fdd7 changeset: 16297:61e567c7fdd7 user: Timo Sirainen date: Thu Apr 18 17:48:38 2013 +0300 description: lib-storage: mailbox_copy() didn't always copy all the cached fields to destination. If the destination mailbox's cache file wasn't already opened, the default cache decisions were used. diffstat: src/lib-storage/index/index-storage.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (26 lines): diff -r bafcb428167b -r 61e567c7fdd7 src/lib-storage/index/index-storage.c --- a/src/lib-storage/index/index-storage.c Wed Apr 17 18:47:36 2013 +0300 +++ b/src/lib-storage/index/index-storage.c Thu Apr 18 17:48:38 2013 +0300 @@ -806,7 +806,7 @@ struct mail *src_mail, uint32_t dest_seq) { T_BEGIN { - struct mailbox_metadata src_metadata; + struct mailbox_metadata src_metadata, dest_metadata; const struct mailbox_cache_field *field; buffer_t *buf; @@ -814,6 +814,13 @@ MAILBOX_METADATA_CACHE_FIELDS, &src_metadata) < 0) i_unreached(); + /* the only reason we're doing the destination lookup is to + make sure that the cache file is opened and the cache + decisinos are up to date */ + if (mailbox_get_metadata(ctx->transaction->box, + MAILBOX_METADATA_CACHE_FIELDS, + &dest_metadata) < 0) + i_unreached(); buf = buffer_create_dynamic(pool_datastack_create(), 1024); array_foreach(src_metadata.cache_fields, field) { From dovecot at dovecot.org Thu Apr 18 17:54:41 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 18 Apr 2013 17:54:41 +0300 Subject: dovecot-2.2: lib-storage: Set virtual/physical size in dest_mail... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/f0b232b956a6 changeset: 16298:f0b232b956a6 user: Timo Sirainen date: Thu Apr 18 17:54:29 2013 +0300 description: lib-storage: Set virtual/physical size in dest_mail when copying, if possible. Ideally lib-index would be fixed so this wouldn't be necessary. The lib-index way of fixing it would also be useful for more than just quota plugin. diffstat: src/lib-storage/index/index-storage.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diffs (27 lines): diff -r 61e567c7fdd7 -r f0b232b956a6 src/lib-storage/index/index-storage.c --- a/src/lib-storage/index/index-storage.c Thu Apr 18 17:48:38 2013 +0300 +++ b/src/lib-storage/index/index-storage.c Thu Apr 18 17:54:29 2013 +0300 @@ -795,6 +795,23 @@ if (mail_cache_lookup_field(src_mail->transaction->cache_view, buf, src_mail->seq, src_field_idx) <= 0) buffer_set_used_size(buf, 0); + else if (ctx->dest_mail != NULL && + (strcmp(name, "size.physical") == 0 || + strcmp(name, "size.virtual") == 0)) { + /* FIXME: until mail_cache_lookup() can read unwritten + cached data from buffer, we'll do this optimization + to make quota plugin's work faster */ + struct index_mail *imail = + (struct index_mail *)ctx->dest_mail; + uoff_t size; + + i_assert(buf->used == sizeof(size)); + memcpy(&size, buf->data, sizeof(size)); + if (strcmp(name, "size.physical") == 0) + imail->data.physical_size = size; + else + imail->data.virtual_size = size; + } } if (buf->used > 0) { mail_cache_add(dest_trans->cache_trans, dest_seq, From dovecot at dovecot.org Thu Apr 18 18:50:14 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 18 Apr 2013 18:50:14 +0300 Subject: dovecot-2.2: layout=index: Fixed listing subscriptions. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2da229987a81 changeset: 16299:2da229987a81 user: Timo Sirainen date: Thu Apr 18 18:49:55 2013 +0300 description: layout=index: Fixed listing subscriptions. diffstat: src/lib-storage/list/mailbox-list-index-backend.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diffs (41 lines): diff -r f0b232b956a6 -r 2da229987a81 src/lib-storage/list/mailbox-list-index-backend.c --- a/src/lib-storage/list/mailbox-list-index-backend.c Thu Apr 18 17:54:29 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index-backend.c Thu Apr 18 18:49:55 2013 +0300 @@ -613,12 +613,17 @@ static struct mailbox_list_iterate_context * index_list_iter_init(struct mailbox_list *list, - const char *const *patterns ATTR_UNUSED, + const char *const *patterns, enum mailbox_list_iter_flags flags) { struct mailbox_list_iterate_context *ctx; pool_t pool; + if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) { + return mailbox_list_subscriptions_iter_init(list, patterns, + flags); + } + pool = pool_alloconly_create("mailbox list index backend iter", 1024); ctx = p_new(pool, struct mailbox_list_iterate_context, 1); ctx->pool = pool; @@ -629,13 +634,17 @@ } static const struct mailbox_info * -index_list_iter_next(struct mailbox_list_iterate_context *ctx ATTR_UNUSED) +index_list_iter_next(struct mailbox_list_iterate_context *ctx) { + if ((ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) + return mailbox_list_subscriptions_iter_next(ctx); return NULL; } static int index_list_iter_deinit(struct mailbox_list_iterate_context *ctx) { + if ((ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) + return mailbox_list_subscriptions_iter_deinit(ctx); pool_unref(&ctx->pool); return 0; } From dovecot at dovecot.org Fri Apr 19 00:43:46 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 19 Apr 2013 00:43:46 +0300 Subject: dovecot-2.2: Released v2.2.1. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6fcf060b50f1 changeset: 16300:6fcf060b50f1 user: Timo Sirainen date: Fri Apr 19 00:38:00 2013 +0300 description: Released v2.2.1. diffstat: NEWS | 8 ++++++++ TODO | 1 + configure.ac | 2 +- 3 files changed, 10 insertions(+), 1 deletions(-) diffs (38 lines): diff -r 2da229987a81 -r 6fcf060b50f1 NEWS --- a/NEWS Thu Apr 18 18:49:55 2013 +0300 +++ b/NEWS Fri Apr 19 00:38:00 2013 +0300 @@ -1,3 +1,11 @@ +v2.2.1 2013-04-19 Timo Sirainen + + - mailbox_list_index=yes was broken. + - LAYOUT=index didn't list subscriptions. + - auth: Multiple master passdbs didn't work. + - Message parsing (e.g. during search) crashed when multipart message + didn't actually contain any parts. + v2.2.0 2013-04-11 Timo Sirainen * When creating home directories, the permissions are copied from the diff -r 2da229987a81 -r 6fcf060b50f1 TODO --- a/TODO Thu Apr 18 18:49:55 2013 +0300 +++ b/TODO Fri Apr 19 00:38:00 2013 +0300 @@ -8,6 +8,7 @@ and can be matched -> rename mailbox. - GUID-less sync could optionally use just rfc822.size [and internaldate] to match messages. + - why does it use separate FETCH INTERNALDATE + FETCH BODY[HEADER] - lib-ssl-iostream: ssl_get_last_error() should return also syscall errors instead of being NULL. most importantly handle handshake code. diff -r 2da229987a81 -r 6fcf060b50f1 configure.ac --- a/configure.ac Thu Apr 18 18:49:55 2013 +0300 +++ b/configure.ac Fri Apr 19 00:38:00 2013 +0300 @@ -2,7 +2,7 @@ # 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.0],[dovecot at dovecot.org]) +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_CONFIG_SRCDIR([src]) From dovecot at dovecot.org Fri Apr 19 00:43:46 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 19 Apr 2013 00:43:46 +0300 Subject: dovecot-2.2: Added tag 2.2.1 for changeset 6fcf060b50f1 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ff45bebb36bd changeset: 16301:ff45bebb36bd user: Timo Sirainen date: Fri Apr 19 00:38:00 2013 +0300 description: Added tag 2.2.1 for changeset 6fcf060b50f1 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 6fcf060b50f1 -r ff45bebb36bd .hgtags --- a/.hgtags Fri Apr 19 00:38:00 2013 +0300 +++ b/.hgtags Fri Apr 19 00:38:00 2013 +0300 @@ -104,3 +104,4 @@ ae4341d0e83bd63397b418666bc80076700432fd 2.2.rc6 d7f29af734683149badfc45a4e2015254ca78672 2.2.rc7 1c8e7a295d4bd167a2b0a7243a3ec4d1e161360d 2.2.0 +6fcf060b50f183549909f0fee17307e646edcbc6 2.2.1 From dovecot at dovecot.org Fri Apr 19 00:43:46 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 19 Apr 2013 00:43:46 +0300 Subject: dovecot-2.2: Added signature for changeset 6fcf060b50f1 Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/999564a5b2a5 changeset: 16302:999564a5b2a5 user: Timo Sirainen date: Fri Apr 19 00:38:05 2013 +0300 description: Added signature for changeset 6fcf060b50f1 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r ff45bebb36bd -r 999564a5b2a5 .hgsigs --- a/.hgsigs Fri Apr 19 00:38:00 2013 +0300 +++ b/.hgsigs Fri Apr 19 00:38:05 2013 +0300 @@ -67,3 +67,4 @@ ae4341d0e83bd63397b418666bc80076700432fd 0 iEYEABECAAYFAlFh+/EACgkQyUhSUUBViskLaACfaQUhj/uJIZ5oDL5Wo5hTUgJC+cQAnR4GFR/GhGqJmvFWe8jZPD3CwtW/ d7f29af734683149badfc45a4e2015254ca78672 0 iEYEABECAAYFAlFlvh0ACgkQyUhSUUBVislyrgCfSTX5MQWcV+eAWNlZ1jpawq9rNPMAnRNU9RBWmrUNU9PqDrsqS3WDCGyu e2cd03cc9c690c4989fb53a1871b7109c547388a 0 iEYEABECAAYFAlFnEVAACgkQyUhSUUBVismWBgCgit90C+1stGSchsVzJGghBs9278UAnj0vB6BETfOU9tNjViyCR18aEdUH +6fcf060b50f183549909f0fee17307e646edcbc6 0 iEYEABECAAYFAlFwZ7oACgkQyUhSUUBVismG6wCeI05eVDC++LqgfF9sOkoT3qRp9xYAn3pRDGYKPx7DhcTp+0RX/I9TXUmB From pigeonhole at rename-it.nl Fri Apr 19 10:15:18 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 19 Apr 2013 09:15:18 +0200 Subject: dovecot-2.2-pigeonhole: Fixed test suite for vnd.dovecot.execute... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/2688c750b426 changeset: 1752:2688c750b426 user: Stephan Bosch date: Fri Apr 19 09:15:01 2013 +0200 description: Fixed test suite for vnd.dovecot.execute extension. Testsuite hostname is now true local hostname. diffstat: tests/plugins/extprograms/execute/execute.svtest | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (22 lines): diff -r 70f0b7140939 -r 2688c750b426 tests/plugins/extprograms/execute/execute.svtest --- a/tests/plugins/extprograms/execute/execute.svtest Fri Apr 12 20:25:02 2013 +0200 +++ b/tests/plugins/extprograms/execute/execute.svtest Fri Apr 19 09:15:01 2013 +0200 @@ -3,6 +3,7 @@ require "vnd.dovecot.debug"; require "variables"; require "relational"; +require "environment"; test_set "message" text: From: stephan at example.com @@ -70,8 +71,8 @@ } execute :output "out" "env" "HOST"; - if not string :is "${out}" "host.example.com" { - test_fail "wrong ORIG_RECIPIENT env returned: '${out}'"; + if not environment :is "host" "${out}" { + test_fail "wrong HOST env returned: '${out}'"; } execute :output "out" "env" "HOME"; From pigeonhole at rename-it.nl Fri Apr 19 10:47:00 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 19 Apr 2013 09:47:00 +0200 Subject: dovecot-2.2-pigeonhole: Made preparations for first v0.4 release. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/5fa5e2dfbb57 changeset: 1754:5fa5e2dfbb57 user: Stephan Bosch date: Fri Apr 19 09:46:49 2013 +0200 description: Made preparations for first v0.4 release. diffstat: INSTALL | 6 +++- NEWS | 22 ++++++++++++++++++- README | 44 ++++++++++++++++++++++++++++---------- TODO | 24 +++++++++----------- doc/plugins/sieve_extprograms.txt | 6 ++-- 5 files changed, 71 insertions(+), 31 deletions(-) diffs (200 lines): diff -r ee5a40db9e73 -r 5fa5e2dfbb57 INSTALL --- a/INSTALL Fri Apr 19 09:45:15 2013 +0200 +++ b/INSTALL Fri Apr 19 09:46:49 2013 +0200 @@ -394,7 +394,8 @@ enabled for use by default. Refer to doc/extensions/vnd.dovecot.duplicate.txt for configuration information. -- Vnd.dovovecot.pipe, vnd.dovecot.filter, vnd.dovecot.execute extensions: +- Extprograms plugin; + vnd.dovovecot.pipe, vnd.dovecot.filter, vnd.dovecot.execute extensions: The "sieve_extprograms" plugin provides extensions to the Sieve filtering language adding new action commands for invoking a predefined set of external @@ -644,7 +645,8 @@ available when this package is compiled against the Dovecot headers only. The 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 test suite using `make test`. +the basic test suite using `make test`, which does not include the plugins. You +can execute the full test suite using `make check`. A failing test case is always a bug and a report is greatly appreciated. diff -r ee5a40db9e73 -r 5fa5e2dfbb57 NEWS --- a/NEWS Fri Apr 19 09:45:15 2013 +0200 +++ b/NEWS Fri Apr 19 09:46:49 2013 +0200 @@ -1,3 +1,23 @@ +v0.4.0 UNRELEASED Stephan Bosch + + + Added doveadm-sieve plugin that provides the possibility to synch Sieve + scripts using doveadm sync along with the user's mailboxes. + + Added the Sieve extprograms plugin to the main Pigeonhole package. It is + still a plugin, but it is now included so that a separate compile is no + longer necessary and distributors are likely to include it. The extprograms + plugin provides Sieve language extensions that allows executing + (administrator-controlled) external programs for message delivery, + message filtering and string manipulation. Refer to + doc/plugins/sieve_extprograms.txt for more information. + + Added debug message showing Pigeonhole version at initialization. Makes it + very clear that the plugin is properly loaded. + + Finished implementation of the Sieve include extension. It should now + fully conform to RFC 6609. The main addition is the new :optional tag which + makes the include command ignore missing included scripts without an error. + + Finished implementation of the Sieve environment extension as much as + possible. Environment items "location", "phase" and "domain" now also + return a usable value. + v0.3.4 06-04-2013 Stephan Bosch * Changed error handling to be less of a nuisance for administrators. Strictly @@ -22,7 +42,7 @@ sieve_vacation_dont_check_recipient is active. - Sieve tools: the -D option wasn't enabled and documented for all tools. - Siev dict script storage: fixed potential segfault occuring when dict - initialization fails. + initialization fails. - ManageSieve: fixed bug in skipping of CRLF at end of AUTHENTICATE command. - ManageSieve: fixed handling of unkown commands pre-login. - Fixed compile on Mageia Linux. diff -r ee5a40db9e73 -r 5fa5e2dfbb57 README --- a/README Fri Apr 19 09:45:15 2013 +0200 +++ b/README Fri Apr 19 09:46:49 2013 +0200 @@ -102,7 +102,7 @@ body (RFC 5173): almost fully supported, but the text body-transform implementation is simple and some issues make it still not completely RFC compliant. - environment (RFC 5183): fully supported (v0.1.5+). + environment (RFC 5183): fully supported (v0.4.0+). variables (RFC 5229): fully supported. vacation (RFC 5230): fully supported. + vacation-seconds (RFC 6131): fully supported (v0.2.3+). @@ -132,6 +132,22 @@ The availability of these deprecated extensions is disabled by default. + The following Dovecot-specific Sieve extensions are available: + + vnd.dovecot.debug (v0.3.0+): + Allows logging debug messages + vnd.dovecot.duplicate (v0.3.1+): + Allows detecting duplicate message deliveries based on message ID and + other criteria. + vnd.dovecot.pipe (v0.4.0+; sieve_extprograms plugin): + Implements piping messages to a pre-defined set of external programs + vnd.dovecot.filter (v0.4.0+; sieve_extprograms plugin): + Implements filtering messages through a pre-defined set of external + programs + vnd.dovecot.execute (v0.4.0+; sieve_extprograms plugin): + Implements executing a pre-defined set of external programs with the + option to process string data through the external program + The following extensions are under development: ereject (RFC 5429; page 4): implemented, but currently equal to reject @@ -159,19 +175,23 @@ these are available at your $prefix/bin directory. The following commands are installed: -sievec - Compiles sieve scripts into a binary representation for later - execution. Refer to the next section on manually compiling Sieve - scripts. +sievec - Compiles sieve scripts into a binary representation for later + execution. Refer to the next section on manually compiling Sieve + scripts. -sieve-test - This is a universal Sieve test tool for testing the effect of a - Sieve script on a particular message. It allows compiling, running - and testing Sieve scripts. It can either be used to display the - actions that would be performed on the provided test message or it - can be used to test the actual delivery of the message and show the - messages that would normally be sent through SMTP. +sieve-test - This is a universal Sieve test tool for testing the effect of a + Sieve script on a particular message. It allows compiling, + running and testing Sieve scripts. It can either be used to + display the actions that would be performed on the provided test + message or it can be used to test the actual delivery of the + message and show the messages that would normally be sent through + SMTP. -sieve-dump - Dumps the content of a Sieve binary file for (development) - debugging purposes. +sieve-dump - Dumps the content of a Sieve binary file for (development) + debugging purposes. + +sieve-filter - Allow running Sieve filters on messages already stored in a + mailbox. When installed, man pages are also available for these commands. In this package the man pages are present in doc/man and can be viewed before install using diff -r ee5a40db9e73 -r 5fa5e2dfbb57 TODO --- a/TODO Fri Apr 19 09:45:15 2013 +0200 +++ b/TODO Fri Apr 19 09:46:49 2013 +0200 @@ -1,8 +1,14 @@ Current activities: -* Finish 0.4.0 release. +* Make the sieve storage a base class with (possibly) various implementations, + just like mail-storage. This aims to provide support for alternate types + of script storage like LDAP or SQL database. + - Implement read/write script storages for using ManageSieve with dict + database + - Implement infrastructure for loading a sequence of global scripts from + a database (for sieve_before/sieve_after). -Parallel plugin-based efforts: +Parallel plugin-based efforts (on hold at the moment): * Implement enotify xmpp method as a plugin. * Implement metadata and servermetadata extensions as a plugin. @@ -10,15 +16,6 @@ Next (mostly in order of descending priority/precedence): -* Implement generic Sieve script object that abstracts from its location and - add support for retrieving scripts from dict database. - - Implement infrastructure for loading a sequence of global scripts from - a database (for sieve_before/sieve_after). -* Make the sieve storage a base class with (possibly) various implementations, - just like mail-storage. This aims to provide support for alternate types - of script storage like LDAP or SQL database. - - Implement read/write script storages for using ManageSieve with dict - database * Implement index extension * Add normalize() method to comparators to normalize the string before matching (for efficiency). @@ -65,7 +62,8 @@ - Review the specification documents and check whether the given requirements are tested at least once. * Fix ManageSieve proxy to recognize response codes from the backend and forward - them to the user if appropriate/safe. + them to the user if appropriate/safe. Probably means implementing a proper + ManageSieve client library. * Test ManageSieve behavior thoroughly: - Test pipelined behavior - Test proxy authentication @@ -76,7 +74,7 @@ * Build a server with test mail accounts that processes lots and lots of mail (e.g. spam, mailing lists etc.) -* ## MAKE A FIFTH MAIN RELEASE (0.5.x) ## +Low priority items: * Implement extlists extension as a plugin * Enotify extension: detect use of variable values extracted from the message diff -r ee5a40db9e73 -r 5fa5e2dfbb57 doc/plugins/sieve_extprograms.txt --- a/doc/plugins/sieve_extprograms.txt Fri Apr 19 09:45:15 2013 +0200 +++ b/doc/plugins/sieve_extprograms.txt Fri Apr 19 09:46:49 2013 +0200 @@ -91,9 +91,9 @@ The three extensions introduced by this plugin - "vnd.dovecot.pipe", "vnd.dovecot.filter" and "vnd.dovecot.pipe" - each have separate but similar -configuration. The settings that specify a period are specified in s(econds), -unless followed by a d(ay), h(our) or m(inute) specifier character. The -following configuration settings are used, for which "" in the +configuration. The settings that specify a time period are specified in +s(econds), unless followed by a d(ay), h(our) or m(inute) specifier character. +The following configuration settings are used, for which "" in the setting name is replaced by either "pipe", "filter" or "execute" depending on which extension is being configured. From pigeonhole at rename-it.nl Fri Apr 19 10:47:00 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 19 Apr 2013 09:47:00 +0200 Subject: dovecot-2.2-pigeonhole: Fixed distcheck failure on sieve_extprog... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/ee5a40db9e73 changeset: 1753:ee5a40db9e73 user: Stephan Bosch date: Fri Apr 19 09:45:15 2013 +0200 description: Fixed distcheck failure on sieve_extprograms plugin testsuite. diffstat: src/testsuite/testsuite-variables.c | 2 +- tests/plugins/extprograms/bin/sleep10 | 3 +++ tests/plugins/extprograms/execute/command.svtest | 2 +- tests/plugins/extprograms/execute/errors.svtest | 3 +++ tests/plugins/extprograms/execute/execute.svtest | 2 +- tests/plugins/extprograms/filter/command.svtest | 2 +- tests/plugins/extprograms/filter/errors.svtest | 3 +++ tests/plugins/extprograms/filter/execute.svtest | 2 +- tests/plugins/extprograms/pipe/command.svtest | 2 +- tests/plugins/extprograms/pipe/errors.svtest | 3 ++- tests/plugins/extprograms/pipe/errors/timeout.sieve | 2 +- tests/plugins/extprograms/pipe/execute.svtest | 6 +++--- 12 files changed, 21 insertions(+), 11 deletions(-) diffs (161 lines): diff -r 2688c750b426 -r ee5a40db9e73 src/testsuite/testsuite-variables.c --- a/src/testsuite/testsuite-variables.c Fri Apr 19 09:15:01 2013 +0200 +++ b/src/testsuite/testsuite-variables.c Fri Apr 19 09:45:15 2013 +0200 @@ -77,7 +77,7 @@ name_element = array_idx(var_name, 1); if ( name_element->num_variable >= 0 ) { sieve_argument_validate_error(valdtr, arg, - "testsuite: invalid variable name within testsuite namespace 'testsuite.%d': " + "testsuite: invalid variable name within testsuite namespace 'tst.%d': " "encountered numeric variable name", name_element->num_variable); return FALSE; } diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/bin/sleep10 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/plugins/extprograms/bin/sleep10 Fri Apr 19 09:45:15 2013 +0200 @@ -0,0 +1,3 @@ +#!/bin/sh + +sleep 10 diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/execute/command.svtest --- a/tests/plugins/extprograms/execute/command.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/execute/command.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -2,7 +2,7 @@ require "vnd.dovecot.execute"; require "variables"; -test_config_set "sieve_execute_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_execute_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.execute"; test "Basic" { diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/execute/errors.svtest --- a/tests/plugins/extprograms/execute/errors.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/execute/errors.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -3,6 +3,9 @@ require "relational"; require "comparator-i;ascii-numeric"; +test_config_set "sieve_execute_bin_dir" "${tst.path}/../bin"; +test_config_reload :extension "vnd.dovecot.execute"; + /* * Command syntax */ diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/execute/execute.svtest --- a/tests/plugins/extprograms/execute/execute.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/execute/execute.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -14,7 +14,7 @@ . ; -test_config_set "sieve_execute_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_execute_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.execute"; test_result_reset; diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/filter/command.svtest --- a/tests/plugins/extprograms/filter/command.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/filter/command.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -2,7 +2,7 @@ require "vnd.dovecot.filter"; require "variables"; -test_config_set "sieve_filter_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_filter_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.filter"; test "Basic" { diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/filter/errors.svtest --- a/tests/plugins/extprograms/filter/errors.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/filter/errors.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -7,6 +7,9 @@ * Command syntax */ +test_config_set "sieve_filter_bin_dir" "${tst.path}/../bin"; +test_config_reload :extension "vnd.dovecot.filter"; + test "Command syntax" { if test_script_compile "errors/syntax.sieve" { test_fail "compile should have failed"; diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/filter/execute.svtest --- a/tests/plugins/extprograms/filter/execute.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/filter/execute.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -16,7 +16,7 @@ . ; -test_config_set "sieve_filter_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_filter_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.filter"; test_result_reset; diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/pipe/command.svtest --- a/tests/plugins/extprograms/pipe/command.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/pipe/command.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -1,7 +1,7 @@ require "vnd.dovecot.testsuite"; require "vnd.dovecot.pipe"; -test_config_set "sieve_pipe_dir" "./"; +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.pipe"; test "Basic" { diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/pipe/errors.svtest --- a/tests/plugins/extprograms/pipe/errors.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/pipe/errors.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -1,4 +1,5 @@ require "vnd.dovecot.testsuite"; +require "variables"; require "relational"; require "comparator-i;ascii-numeric"; @@ -28,7 +29,7 @@ . ; -test_config_set "sieve_pipe_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; test_config_set "sieve_pipe_exec_timeout" "1s"; test_config_reload :extension "vnd.dovecot.pipe"; test_result_reset; diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/pipe/errors/timeout.sieve --- a/tests/plugins/extprograms/pipe/errors/timeout.sieve Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/pipe/errors/timeout.sieve Fri Apr 19 09:45:15 2013 +0200 @@ -1,3 +1,3 @@ require "vnd.dovecot.pipe"; -pipe "sleep2"; +pipe "sleep10"; diff -r 2688c750b426 -r ee5a40db9e73 tests/plugins/extprograms/pipe/execute.svtest --- a/tests/plugins/extprograms/pipe/execute.svtest Fri Apr 19 09:15:01 2013 +0200 +++ b/tests/plugins/extprograms/pipe/execute.svtest Fri Apr 19 09:45:15 2013 +0200 @@ -14,7 +14,7 @@ /* Basic pipe */ -test_config_set "sieve_pipe_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; test_config_reload :extension "vnd.dovecot.pipe"; test_result_reset; @@ -28,7 +28,7 @@ /* Timeout */ -test_config_set "sieve_pipe_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; test_config_set "sieve_pipe_exec_timeout" "3s"; test_config_reload :extension "vnd.dovecot.pipe"; test_result_reset; @@ -42,7 +42,7 @@ } test_result_reset; -test_config_set "sieve_pipe_bin_dir" "./tests/plugins/extprograms/bin"; +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; test_config_set "sieve_pipe_exec_timeout" "0"; test_config_reload :extension "vnd.dovecot.pipe"; test_result_reset; From dovecot at dovecot.org Fri Apr 19 14:29:40 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 19 Apr 2013 14:29:40 +0300 Subject: dovecot-2.2: Compiling fix for Sun compilers. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/46dc61f6acae changeset: 16303:46dc61f6acae user: Timo Sirainen date: Fri Apr 19 14:29:23 2013 +0300 description: Compiling fix for Sun compilers. I wish gcc/clang warned about these as well, as sometimes they indicate bugs. diffstat: src/imap-urlauth/imap-urlauth-worker.c | 2 +- src/lib/ioloop.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diffs (24 lines): diff -r 999564a5b2a5 -r 46dc61f6acae src/imap-urlauth/imap-urlauth-worker.c --- a/src/imap-urlauth/imap-urlauth-worker.c Fri Apr 19 00:38:05 2013 +0300 +++ b/src/imap-urlauth/imap-urlauth-worker.c Fri Apr 19 14:29:23 2013 +0300 @@ -941,7 +941,7 @@ { bool debug; - debug = getenv("DEBUG"); + debug = getenv("DEBUG") != NULL; access_user = access_user != NULL ? access_user : getenv("USER"); if (access_user == NULL && IS_STANDALONE()) access_user = getlogin(); diff -r 999564a5b2a5 -r 46dc61f6acae src/lib/ioloop.c --- a/src/lib/ioloop.c Fri Apr 19 00:38:05 2013 +0300 +++ b/src/lib/ioloop.c Fri Apr 19 14:29:23 2013 +0300 @@ -663,7 +663,7 @@ bool io_loop_have_ios(struct ioloop *ioloop) { - return ioloop->io_files; + return ioloop->io_files != NULL; } bool io_loop_have_immediate_timeouts(struct ioloop *ioloop) From pigeonhole at rename-it.nl Fri Apr 19 23:26:39 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 19 Apr 2013 22:26:39 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Prevented Sieve storage f... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/9f14740cc1c0 changeset: 1755:9f14740cc1c0 user: Stephan Bosch date: Fri Apr 19 22:26:32 2013 +0200 description: doveadm-sieve: Prevented Sieve storage from logging useless while synchronizing. Added flag to prevent warnings about non-link active scripts and disable critical error logging. A rather fundamental synchronization problem remains to be solved. diffstat: src/lib-sievestorage/sieve-storage-private.h | 9 --- src/lib-sievestorage/sieve-storage-script.c | 15 +++-- src/lib-sievestorage/sieve-storage.c | 56 +++++++++++++---------- src/lib-sievestorage/sieve-storage.h | 12 +++- src/managesieve/managesieve-client.c | 6 ++- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 54 +++++++++++++++++----- 6 files changed, 95 insertions(+), 57 deletions(-) diffs (truncated from 358 to 300 lines): diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/lib-sievestorage/sieve-storage-private.h --- a/src/lib-sievestorage/sieve-storage-private.h Fri Apr 19 09:46:49 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-private.h Fri Apr 19 22:26:32 2013 +0200 @@ -9,14 +9,6 @@ #include "sieve-storage.h" - -enum sieve_storage_flags { - /* Print debugging information while initializing the storage */ - SIEVE_STORAGE_FLAG_DEBUG = 0x01, - /* Use CRLF linefeeds when saving mails. */ - SIEVE_STORAGE_FLAG_SAVE_CRLF = 0x02, -}; - #define SIEVE_READ_BLOCK_SIZE (1024*8) /* How often to scan tmp/ directory for old files (based on dir's atime) */ @@ -38,7 +30,6 @@ char *name; char *dir; - bool debug; /* Private */ char *active_path; diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Fri Apr 19 09:46:49 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.c Fri Apr 19 22:26:32 2013 +0200 @@ -126,18 +126,20 @@ ret = readlink(storage->active_path, linkbuf, sizeof(linkbuf)); if ( ret < 0 ) { - if (errno == EINVAL) { + if ( errno == EINVAL ) { /* Our symlink is no symlink. Report 'no active script'. * Activating a script will automatically resolve this, so * there is no need to panic on this one. */ - i_warning - ("sieve-storage: Active sieve script symlink %s is no symlink.", - storage->active_path); + if ( (storage->flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) == 0 ) { + i_warning + ("sieve-storage: Active sieve script symlink %s is no symlink.", + storage->active_path); + } return 0; } - if (errno == ENOENT ) { + if ( errno == ENOENT ) { /* Symlink not found */ return 0; } @@ -395,6 +397,7 @@ static bool sieve_storage_rescue_regular_file(struct sieve_storage *storage) { + bool debug = ( (storage->flags & SIEVE_STORAGE_FLAG_DEBUG) != 0 ); struct stat st; /* Stat the file */ @@ -409,7 +412,7 @@ } if ( S_ISLNK( st.st_mode ) ) { - if ( storage->debug ) + if ( debug ) i_debug( "sieve-storage: nothing to rescue %s.", storage->active_path); return TRUE; /* Nothing to rescue */ } diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Fri Apr 19 09:46:49 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Fri Apr 19 22:26:32 2013 +0200 @@ -203,10 +203,12 @@ } static struct sieve_storage *_sieve_storage_create -(struct sieve_instance *svinst, const char *user, const char *home, bool debug) +(struct sieve_instance *svinst, const char *user, const char *home, + enum sieve_storage_flags flags) { pool_t pool; struct sieve_storage *storage; + 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; mode_t dir_create_mode, file_create_mode; @@ -408,7 +410,7 @@ pool = pool_alloconly_create("sieve-storage", 512+256); storage = p_new(pool, struct sieve_storage, 1); storage->svinst = svinst; - storage->debug = debug; + storage->flags = flags; storage->pool = pool; storage->dir = p_strdup(pool, storage_dir); storage->user = p_strdup(pool, user); @@ -461,12 +463,13 @@ } struct sieve_storage *sieve_storage_create -(struct sieve_instance *svinst, const char *user, const char *home, bool debug) +(struct sieve_instance *svinst, const char *user, const char *home, + enum sieve_storage_flags flags) { struct sieve_storage *storage; T_BEGIN { - storage = _sieve_storage_create(svinst, user, home, debug); + storage = _sieve_storage_create(svinst, user, home, flags); } T_END; return storage; @@ -574,20 +577,6 @@ storage->error_code = error; } -void sieve_storage_set_internal_error(struct sieve_storage *storage) -{ - struct tm *tm; - char str[256]; - - tm = localtime(&ioloop_time); - - i_free(storage->error); - storage->error_code = SIEVE_ERROR_TEMP_FAIL; - storage->error = - strftime(str, sizeof(str), CRITICAL_MSG_STAMP, tm) > 0 ? - i_strdup(str) : i_strdup(CRITICAL_MSG); -} - void sieve_storage_set_critical (struct sieve_storage *storage, const char *fmt, ...) { @@ -595,14 +584,31 @@ sieve_storage_clear_error(storage); if (fmt != NULL) { - va_start(va, fmt); - i_error("sieve-storage: %s", t_strdup_vprintf(fmt, va)); - va_end(va); + i_free(storage->error); + storage->error_code = SIEVE_ERROR_TEMP_FAIL; - /* critical errors may contain sensitive data, so let user - see only "Internal error" with a timestamp to make it - easier to look from log files the actual error message. */ - sieve_storage_set_internal_error(storage); + if ( (storage->flags & SIEVE_STORAGE_FLAG_SYNCHRONIZING) == 0 ) { + struct tm *tm; + char str[256]; + + va_start(va, fmt); + i_error("sieve-storage: %s", t_strdup_vprintf(fmt, va)); + va_end(va); + + /* critical errors may contain sensitive data, so let user + see only "Internal error" with a timestamp to make it + easier to look from log files the actual error message. */ + tm = localtime(&ioloop_time); + storage->error = + strftime(str, sizeof(str), CRITICAL_MSG_STAMP, tm) > 0 ? + i_strdup(str) : i_strdup(CRITICAL_MSG); + } else { + /* no user is involved while synchronizing, so do it the + normal way */ + va_start(va, fmt); + storage->error = i_strdup_vprintf(fmt, va); + va_end(va); + } } } diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/lib-sievestorage/sieve-storage.h --- a/src/lib-sievestorage/sieve-storage.h Fri Apr 19 09:46:49 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.h Fri Apr 19 22:26:32 2013 +0200 @@ -9,8 +9,16 @@ #include "sieve.h" +enum sieve_storage_flags { + /* Print debugging information */ + SIEVE_STORAGE_FLAG_DEBUG = 0x01, + /* This storage is used for synchronization (and not normal ManageSieve) */ + SIEVE_STORAGE_FLAG_SYNCHRONIZING = 0x02 +}; + struct sieve_storage *sieve_storage_create - (struct sieve_instance *svinst, const char *user, const char *home, bool debug); + (struct sieve_instance *svinst, const char *user, const char *home, + enum sieve_storage_flags flags); void sieve_storage_free(struct sieve_storage *storage); struct sieve_error_handler *sieve_storage_get_error_handler @@ -27,8 +35,6 @@ void sieve_storage_set_critical(struct sieve_storage *storage, const char *fmt, ...) ATTR_FORMAT(2, 3); -void sieve_storage_set_internal_error(struct sieve_storage *storage); - const char *sieve_storage_get_last_error (struct sieve_storage *storage, enum sieve_error *error_r); diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/managesieve/managesieve-client.c --- a/src/managesieve/managesieve-client.c Fri Apr 19 09:46:49 2013 +0200 +++ b/src/managesieve/managesieve-client.c Fri Apr 19 22:26:32 2013 +0200 @@ -62,13 +62,17 @@ const struct managesieve_settings *set) { struct sieve_storage *storage; + enum sieve_storage_flags flags = 0; const char *home; if ( mail_user_get_home(user, &home) <= 0 ) home = NULL; + if ( set->mail_debug ) + flags |= SIEVE_STORAGE_FLAG_DEBUG; + storage = sieve_storage_create - (svinst, user->username, home, set->mail_debug); + (svinst, user->username, home, flags); if (storage == NULL) { struct tm *tm; diff -r 5fa5e2dfbb57 -r 9f14740cc1c0 src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Fri Apr 19 09:46:49 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Fri Apr 19 22:26:32 2013 +0200 @@ -26,10 +26,6 @@ #define MAILBOX_ATTRIBUTE_SIEVE_SCRIPT \ MAILBOX_ATTRIBUTE_PREFIX_SIEVE"script" -// FIXME: Sieve has its own 'critical' error handling functionality -// Passing the last sieve storage error in such situations to the -// mail storage error handler is a bit futile. - struct sieve_mail_user { union mail_user_module_context module_ctx; @@ -86,12 +82,13 @@ (struct mail_user *user, struct sieve_storage **svstorage_r) { struct sieve_mail_user *suser = SIEVE_USER_CONTEXT(user); + enum sieve_storage_flags storage_flags = SIEVE_STORAGE_FLAG_SYNCHRONIZING; struct mail_user_vfuncs *v = user->vlast; struct sieve_environment svenv; if (suser != NULL) { *svstorage_r = suser->sieve_storage; - return 0; + return 0; } /* Delayed initialization of sieve storage until it's actually needed */ @@ -106,10 +103,13 @@ user->vlast = &suser->module_ctx.super; v->deinit = mail_sieve_user_deinit; + if (user->mail_debug) + storage_flags |= SIEVE_STORAGE_FLAG_DEBUG; + suser->svinst = sieve_init(&svenv, &mail_sieve_callbacks, user, user->mail_debug); suser->sieve_storage = sieve_storage_create(suser->svinst, user->username, - svenv.home_dir, user->mail_debug); + svenv.home_dir, storage_flags); MODULE_CONTEXT_SET(user, sieve_user_module, suser); *svstorage_r = suser->sieve_storage; @@ -320,6 +320,7 @@ enum mail_attribute_type type, const char *key, const struct mail_attribute_value *value) { + struct mail_user *user = t->box->storage->user; union mailbox_module_context *sbox = SIEVE_MAIL_CONTEXT(t->box); time_t ts = value->last_change != 0 ? value->last_change : ioloop_time; @@ -329,6 +330,8 @@ strlen(MAILBOX_ATTRIBUTE_PREFIX_SIEVE)) == 0) { if (sieve_attribute_set_sieve(t->box->storage, key, value) < 0) return -1; + if (user->mail_debug) + i_debug("doveadm-sieve: Assigned value for key `%s'", key); /* FIXME: set value len to sieve script size / active name length */ if (value->value != NULL || value->value_stream != NULL) @@ -348,9 +351,9 @@ int ret; ret = sieve_storage_active_script_get_name(svstorage, &value_r->value); - if (ret >= 0) { - ret = sieve_storage_active_script_get_last_change - (svstorage, &value_r->last_change); + 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); From pigeonhole at rename-it.nl Sat Apr 20 00:21:43 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 19 Apr 2013 23:21:43 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Made active script last_c... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/2de5c020cc03 changeset: 1756:2de5c020cc03 user: Stephan Bosch date: Fri Apr 19 23:21:35 2013 +0200 description: doveadm-sieve: Made active script last_change time always dependent on sieve_dir mtime. Change is preliminary. Still doing some experiments, 'ping-pong' problem is not solved. diffstat: src/lib-sievestorage/sieve-storage-save.c | 2 ++ src/lib-sievestorage/sieve-storage-script.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diffs (31 lines): diff -r 9f14740cc1c0 -r 2de5c020cc03 src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Fri Apr 19 22:26:32 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.c Fri Apr 19 23:21:35 2013 +0200 @@ -416,6 +416,8 @@ sieve_storage_set_critical(storage, "rename(%s, %s) failed: %m", str_c(temp_path), storage->active_path); } + } else { + sieve_storage_mark_modified(storage); } (void)unlink(str_c(temp_path)); diff -r 9f14740cc1c0 -r 2de5c020cc03 src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Fri Apr 19 22:26:32 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.c Fri Apr 19 23:21:35 2013 +0200 @@ -302,6 +302,7 @@ { struct stat st; +#if 0 /* Try direct lstat first */ if (lstat(storage->active_path, &st) == 0) { *last_change_r = st.st_mtime; @@ -313,6 +314,7 @@ sieve_storage_set_critical(storage, "lstat(%s) failed: %m", storage->active_path); } +#endif /* Fall back to statting storage directory */ return sieve_storage_get_last_change(storage, last_change_r); From dovecot at dovecot.org Sat Apr 20 20:58:37 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 20 Apr 2013 20:58:37 +0300 Subject: dovecot-2.1: stats plugin: Fixed memory leak. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/143bd7f3d4a2 changeset: 14956:143bd7f3d4a2 user: Timo Sirainen date: Sat Apr 20 20:58:06 2013 +0300 description: stats plugin: Fixed memory leak. diffstat: src/plugins/stats/stats-plugin.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r b63f87ed9311 -r 143bd7f3d4a2 src/plugins/stats/stats-plugin.c --- a/src/plugins/stats/stats-plugin.c Wed Apr 10 22:11:33 2013 +0300 +++ b/src/plugins/stats/stats-plugin.c Sat Apr 20 20:58:06 2013 +0300 @@ -388,6 +388,7 @@ trans_stats_add(&suser->session_stats.trans_stats, &strans->trans->stats); + i_free(strans); } static int From dovecot at dovecot.org Sat Apr 20 20:58:45 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 20 Apr 2013 20:58:45 +0300 Subject: dovecot-2.2: stats plugin: Fixed memory leak. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/cac2978505b8 changeset: 16304:cac2978505b8 user: Timo Sirainen date: Sat Apr 20 20:58:06 2013 +0300 description: stats plugin: Fixed memory leak. diffstat: src/plugins/stats/stats-plugin.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 46dc61f6acae -r cac2978505b8 src/plugins/stats/stats-plugin.c --- a/src/plugins/stats/stats-plugin.c Fri Apr 19 14:29:23 2013 +0300 +++ b/src/plugins/stats/stats-plugin.c Sat Apr 20 20:58:06 2013 +0300 @@ -388,6 +388,7 @@ trans_stats_add(&suser->session_stats.trans_stats, &strans->trans->stats); + i_free(strans); } static int From dovecot at dovecot.org Sat Apr 20 21:02:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 20 Apr 2013 21:02:38 +0300 Subject: dovecot-2.2: Fixed a memory leak. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/994488139eca changeset: 16305:994488139eca user: Timo Sirainen date: Sat Apr 20 21:02:30 2013 +0300 description: Fixed a memory leak. diffstat: src/lib-mail/istream-attachment-connector.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diffs (42 lines): diff -r cac2978505b8 -r 994488139eca src/lib-mail/istream-attachment-connector.c --- a/src/lib-mail/istream-attachment-connector.c Sat Apr 20 20:58:06 2013 +0300 +++ b/src/lib-mail/istream-attachment-connector.c Sat Apr 20 21:02:30 2013 +0300 @@ -88,6 +88,20 @@ return 0; } +static void +istream_attachment_connector_free(struct istream_attachment_connector *conn) +{ + struct istream *const *streamp, *stream; + + array_foreach(&conn->streams, streamp) { + stream = *streamp; + if (stream != NULL) + i_stream_unref(&stream); + } + i_stream_unref(&conn->base_input); + pool_unref(&conn->pool); +} + struct istream * istream_attachment_connector_finish(struct istream_attachment_connector **_conn) { @@ -111,8 +125,7 @@ inputs = array_idx_modifiable(&conn->streams, 0); input = i_stream_create_concat(inputs); - i_stream_unref(&conn->base_input); - pool_unref(&conn->pool); + istream_attachment_connector_free(conn); return input; } @@ -122,6 +135,5 @@ *_conn = NULL; - i_stream_unref(&conn->base_input); - pool_unref(&conn->pool); + istream_attachment_connector_free(conn); } From dovecot at dovecot.org Sat Apr 20 21:58:08 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 20 Apr 2013 21:58:08 +0300 Subject: dovecot-2.2: lib-storage: Avoid wasting data stack during searches. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/e819374de157 changeset: 16306:e819374de157 user: Timo Sirainen date: Sat Apr 20 21:57:47 2013 +0300 description: lib-storage: Avoid wasting data stack during searches. diffstat: src/lib-storage/index/index-search.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diffs (38 lines): diff -r 994488139eca -r e819374de157 src/lib-storage/index/index-search.c --- a/src/lib-storage/index/index-search.c Sat Apr 20 21:02:30 2013 +0300 +++ b/src/lib-storage/index/index-search.c Sat Apr 20 21:57:47 2013 +0300 @@ -1377,7 +1377,9 @@ } for (i = 0; i < n && ret < 0; i++) { ctx->cur_mail->lookup_abort = cache_lookups[i]; - ret = search_match_once(ctx); + T_BEGIN { + ret = search_match_once(ctx); + } T_END; } ctx->cur_mail->lookup_abort = MAIL_LOOKUP_ABORT_NEVER; search_match_finish(ctx, ret); @@ -1556,7 +1558,9 @@ int ret = 0; while ((mail = index_search_get_mail(ctx)) != NULL) { - ret = search_more_with_mail(ctx, mail); + T_BEGIN { + ret = search_more_with_mail(ctx, mail); + } T_END; if (ret <= 0) break; @@ -1612,8 +1616,10 @@ mail_search_args_result_deserialize(ctx->mail_ctx.args, imail->data.search_results->data, imail->data.search_results->used); - ret = search_match_once(ctx); - search_match_finish(ctx, ret); + T_BEGIN { + ret = search_match_once(ctx); + search_match_finish(ctx, ret); + } T_END; ctx->cur_mail = NULL; return ret > 0; } From pigeonhole at rename-it.nl Sat Apr 20 22:27:28 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 20 Apr 2013 21:27:28 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Set mtime of modified scr... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/94cd5a1c85cf changeset: 1757:94cd5a1c85cf user: Stephan Bosch date: Sat Apr 20 21:27:15 2013 +0200 description: doveadm-sieve: Set mtime of modified scripts and sieve dir to timestamp from dsync. Still does not fix the ping-pong issue. diffstat: src/lib-sievestorage/sieve-storage-save.c | 33 ++++++++++++++- src/lib-sievestorage/sieve-storage-save.h | 5 +- src/lib-sievestorage/sieve-storage.c | 53 +++++++++++++++++------ src/lib-sievestorage/sieve-storage.h | 2 + src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 7 ++- 5 files changed, 81 insertions(+), 19 deletions(-) diffs (226 lines): diff -r 2de5c020cc03 -r 94cd5a1c85cf src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Fri Apr 19 23:21:35 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.c Sat Apr 20 21:27:15 2013 +0200 @@ -37,6 +37,8 @@ int fd; const char *tmp_path; + time_t mtime; + unsigned int failed:1; unsigned int moving:1; unsigned int finished:1; @@ -205,6 +207,7 @@ ctx->storage = storage; ctx->scriptname = p_strdup(pool, scriptname); ctx->scriptobject = NULL; + ctx->mtime = (time_t)-1; T_BEGIN { ctx->fd = sieve_storage_create_tmp(storage, scriptname, &path); @@ -279,6 +282,12 @@ return ( ctx->failed ? -1 : 0 ); } +void sieve_storage_save_set_mtime +(struct sieve_save_context *ctx, time_t mtime) +{ + ctx->mtime = mtime; +} + static void sieve_storage_save_destroy(struct sieve_save_context **ctx) { if ((*ctx)->scriptobject != NULL) @@ -335,6 +344,23 @@ return result; } +static void sieve_storage_update_mtime(const char *path, time_t mtime) +{ + struct utimbuf times = { .actime = mtime, .modtime = mtime }; + + if ( utime(path, ×) < 0 ) { + switch ( errno ) { + case ENOENT: + break; + case EACCES: + i_error("sieve-storage: %s", eacces_error_get("utime", path)); + break; + default: + i_error("sieve-storage: utime(%s) failed: %m", path); + } + } +} + int sieve_storage_save_commit(struct sieve_save_context **ctx) { const char *dest_path; @@ -351,6 +377,9 @@ failed = !sieve_storage_script_move((*ctx), dest_path); } T_END; + if ( (*ctx)->mtime != (time_t)-1 ) + sieve_storage_update_mtime(dest_path, (*ctx)->mtime); + sieve_storage_save_destroy(ctx); return ( failed ? -1 : 0 ); @@ -371,7 +400,7 @@ } int sieve_storage_save_as_active_script(struct sieve_storage *storage, - struct istream *input) + struct istream *input, time_t mtime) { int fd; string_t *temp_path; @@ -417,7 +446,7 @@ "rename(%s, %s) failed: %m", str_c(temp_path), storage->active_path); } } else { - sieve_storage_mark_modified(storage); + sieve_storage_update_mtime(storage->active_path, mtime); } (void)unlink(str_c(temp_path)); diff -r 2de5c020cc03 -r 94cd5a1c85cf src/lib-sievestorage/sieve-storage-save.h --- a/src/lib-sievestorage/sieve-storage-save.h Fri Apr 19 23:21:35 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.h Sat Apr 20 21:27:15 2013 +0200 @@ -22,6 +22,9 @@ bool sieve_storage_save_will_activate (struct sieve_save_context *ctx); +void sieve_storage_save_set_mtime + (struct sieve_save_context *ctx, time_t mtime); + void sieve_storage_save_cancel(struct sieve_save_context **ctx); int sieve_storage_save_commit(struct sieve_save_context **ctx); @@ -30,7 +33,7 @@ * This is needed for the doveadm-sieve plugin. */ int sieve_storage_save_as_active_script(struct sieve_storage *storage, - struct istream *input); + struct istream *input, time_t mtime); #endif diff -r 2de5c020cc03 -r 94cd5a1c85cf src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Fri Apr 19 23:21:35 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Sat Apr 20 21:27:15 2013 +0200 @@ -483,21 +483,6 @@ pool_unref(&storage->pool); } -void sieve_storage_mark_modified(struct sieve_storage *storage) -{ - if ( utime(storage->dir, NULL) < 0 ) { - switch ( errno ) { - case ENOENT: - break; - case EACCES: - i_error("sieve-storage: %s", eacces_error_get("utime", storage->dir)); - break; - default: - i_error("sieve-storage: utime(%s) failed: %m", storage->dir); - } - } -} - int sieve_storage_get_last_change (struct sieve_storage *storage, time_t *last_change_r) { @@ -516,6 +501,44 @@ return 0; } +void sieve_storage_set_modified +(struct sieve_storage *storage, time_t mtime) +{ + struct utimbuf times = { .actime = mtime, .modtime = mtime }; + time_t cur_mtime; + + if ( sieve_storage_get_last_change(storage, &cur_mtime) >= 0 && + cur_mtime > mtime ) + return; + + if ( utime(storage->dir, ×) < 0 ) { + switch ( errno ) { + case ENOENT: + break; + case EACCES: + i_error("sieve-storage: %s", eacces_error_get("utime", storage->dir)); + break; + default: + i_error("sieve-storage: utime(%s) failed: %m", storage->dir); + } + } +} + +void sieve_storage_mark_modified(struct sieve_storage *storage) +{ + if ( utime(storage->dir, NULL) < 0 ) { + switch ( errno ) { + case ENOENT: + break; + case EACCES: + i_error("sieve-storage: %s", eacces_error_get("utime", storage->dir)); + break; + default: + i_error("sieve-storage: utime(%s) failed: %m", storage->dir); + } + } +} + /* Error handling */ struct sieve_error_handler *sieve_storage_get_error_handler diff -r 2de5c020cc03 -r 94cd5a1c85cf src/lib-sievestorage/sieve-storage.h --- a/src/lib-sievestorage/sieve-storage.h Fri Apr 19 23:21:35 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.h Sat Apr 20 21:27:15 2013 +0200 @@ -40,5 +40,7 @@ int sieve_storage_get_last_change (struct sieve_storage *storage, time_t *last_change_r); +void sieve_storage_set_modified + (struct sieve_storage *storage, time_t mtime); #endif diff -r 2de5c020cc03 -r 94cd5a1c85cf src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Fri Apr 19 23:21:35 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Sat Apr 20 21:27:15 2013 +0200 @@ -184,6 +184,7 @@ } if (script != NULL) sieve_script_unref(&script); + sieve_storage_set_modified(svstorage, value->last_change); return ret; } @@ -224,7 +225,8 @@ return sieve_attribute_unset_active_script(storage, svstorage); } - if (sieve_storage_save_as_active_script(svstorage, input) < 0) { + if (sieve_storage_save_as_active_script + (svstorage, input, value->last_change) < 0) { mail_storage_set_critical(storage, "Failed to save active sieve script: %s", sieve_storage_get_last_error(svstorage, NULL)); @@ -232,6 +234,7 @@ return -1; } + sieve_storage_set_modified(svstorage, value->last_change); i_stream_unref(&input); return 0; } @@ -274,6 +277,8 @@ return sieve_attribute_unset_script(storage, svstorage, scriptname); } + sieve_storage_save_set_mtime(save_ctx, value->last_change); + if (save_ctx == NULL) { /* save initialization failed */ mail_storage_set_critical(storage, From dovecot at dovecot.org Mon Apr 22 18:45:17 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 22 Apr 2013 18:45:17 +0300 Subject: dovecot-2.2: zlib: Keep the last read mail cached uncompressed i... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/fe56ba75d6ef changeset: 16307:fe56ba75d6ef user: Timo Sirainen date: Mon Apr 22 18:45:04 2013 +0300 description: zlib: Keep the last read mail cached uncompressed in a temp file. This fixes performance problems with partial IMAP FETCH commands. diffstat: src/plugins/zlib/zlib-plugin.c | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 0 deletions(-) diffs (175 lines): diff -r e819374de157 -r fe56ba75d6ef src/plugins/zlib/zlib-plugin.c --- a/src/plugins/zlib/zlib-plugin.c Sat Apr 20 21:57:47 2013 +0300 +++ b/src/plugins/zlib/zlib-plugin.c Mon Apr 22 18:45:04 2013 +0300 @@ -3,7 +3,9 @@ #include "lib.h" #include "array.h" #include "istream.h" +#include "istream-seekable.h" #include "ostream.h" +#include "str.h" #include "mail-user.h" #include "dbox-single/sdbox-storage.h" #include "dbox-multi/mdbox-storage.h" @@ -26,6 +28,7 @@ MODULE_CONTEXT(obj, zlib_user_module) #define MAX_INBUF_SIZE (1024*1024) +#define ZLIB_MAIL_CACHE_EXPIRE_MSECS (60*1000) struct zlib_transaction_context { union mailbox_transaction_module_context module_ctx; @@ -33,9 +36,19 @@ struct mail *tmp_mail; }; +struct zlib_mail_cache { + struct timeout *to; + struct mailbox *box; + uint32_t uid; + + struct istream *input; +}; + struct zlib_user { union mail_user_module_context module_ctx; + struct zlib_mail_cache cache; + const struct compression_handler *save_handler; unsigned int save_level; }; @@ -48,9 +61,58 @@ &mail_storage_module_register); static MODULE_CONTEXT_DEFINE_INIT(zlib_mail_module, &mail_module_register); +static void zlib_mail_cache_close(struct zlib_user *zuser) +{ + struct zlib_mail_cache *cache = &zuser->cache; + + if (cache->to != NULL) + timeout_remove(&cache->to); + if (cache->input != NULL) + i_stream_unref(&cache->input); + memset(cache, 0, sizeof(*cache)); +} + +static struct istream * +zlib_mail_cache_open(struct zlib_user *zuser, struct mail *mail, + struct istream *input) +{ + struct zlib_mail_cache *cache = &zuser->cache; + struct istream *inputs[2]; + string_t *temp_prefix = t_str_new(128); + + zlib_mail_cache_close(zuser); + + /* zlib istream is seekable, but very slow. create a seekable istream + which we can use to quickly seek around in the stream that's been + read so far. usually the partial IMAP FETCHes continue from where + the previous left off, so this isn't strictly necessary, but with + the way lib-imap-storage's CRLF-cache works it has to seek backwards + somewhat, which causes a zlib stream reset. And the CRLF-cache isn't + easy to fix.. */ + input->seekable = FALSE; + inputs[0] = input; + inputs[1] = NULL; + mail_user_set_get_temp_prefix(temp_prefix, mail->box->storage->user->set); + input = i_stream_create_seekable_path(inputs, + i_stream_get_max_buffer_size(inputs[0]), + str_c(temp_prefix)); + i_stream_unref(&inputs[0]); + + cache->to = timeout_add(ZLIB_MAIL_CACHE_EXPIRE_MSECS, + zlib_mail_cache_close, zuser); + cache->box = mail->box; + cache->uid = mail->uid; + cache->input = input; + + /* index-mail wants the stream to be destroyed at close, so create + a new stream instead of just increasing reference. */ + return i_stream_create_limit(cache->input, (uoff_t)-1); +} + static int zlib_istream_opened(struct mail *_mail, struct istream **stream) { struct zlib_user *zuser = ZLIB_USER_CONTEXT(_mail->box->storage->user); + struct zlib_mail_cache *cache = &zuser->cache; struct mail_private *mail = (struct mail_private *)_mail; union mail_module_context *zmail = ZLIB_MAIL_CONTEXT(mail); struct istream *input; @@ -63,6 +125,15 @@ if (_mail->saving && zuser->save_handler == NULL) return zmail->super.istream_opened(_mail, stream); + if (cache->uid == _mail->uid && cache->box == _mail->box) { + /* use the cached stream. when doing partial reads it should + already be seeked into the wanted offset. */ + i_stream_unref(stream); + i_stream_seek(cache->input, 0); + *stream = i_stream_create_limit(cache->input, (uoff_t)-1); + return zmail->super.istream_opened(_mail, stream); + } + handler = compression_detect_handler(*stream); if (handler != NULL) { if (handler->create_istream == NULL) { @@ -75,6 +146,8 @@ input = *stream; *stream = handler->create_istream(input, TRUE); i_stream_unref(&input); + + *stream = zlib_mail_cache_open(zuser, _mail, *stream); } return zmail->super.istream_opened(_mail, stream); } @@ -265,6 +338,16 @@ return zbox->super.open(box); } +static void zlib_mailbox_close(struct mailbox *box) +{ + union mailbox_module_context *zbox = ZLIB_CONTEXT(box); + struct zlib_user *zuser = ZLIB_USER_CONTEXT(box->storage->user); + + if (zuser->cache.box == box) + zlib_mail_cache_close(zuser); + zbox->super.close(box); +} + static void zlib_mailbox_allocated(struct mailbox *box) { struct mailbox_vfuncs *v = box->vlast; @@ -274,6 +357,7 @@ zbox->super = *v; box->vlast = &zbox->super; v->open = zlib_mailbox_open; + v->close = zlib_mailbox_close; MODULE_CONTEXT_SET_SELF(box, zlib_storage_module, zbox); @@ -283,12 +367,24 @@ zlib_permail_alloc_init(box, v); } +static void zlib_mail_user_deinit(struct mail_user *user) +{ + struct zlib_user *zuser = ZLIB_USER_CONTEXT(user); + + zlib_mail_cache_close(zuser); + zuser->module_ctx.super.deinit(user); +} + static void zlib_mail_user_created(struct mail_user *user) { + struct mail_user_vfuncs *v = user->vlast; struct zlib_user *zuser; const char *name; zuser = p_new(user->pool, struct zlib_user, 1); + zuser->module_ctx.super = *v; + user->vlast = &zuser->module_ctx.super; + v->deinit = zlib_mail_user_deinit; name = mail_user_plugin_getenv(user, "zlib_save"); if (name != NULL && *name != '\0') { From dovecot at dovecot.org Mon Apr 22 19:04:04 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 22 Apr 2013 19:04:04 +0300 Subject: dovecot-2.1: zlib: Keep the last read mail cached uncompressed i... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/9c23d1fb8969 changeset: 14957:9c23d1fb8969 user: Timo Sirainen date: Mon Apr 22 19:03:53 2013 +0300 description: zlib: Keep the last read mail cached uncompressed in a temp file. This fixes performance problems with partial IMAP FETCH commands. diffstat: src/plugins/zlib/zlib-plugin.c | 124 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 124 insertions(+), 0 deletions(-) diffs (203 lines): diff -r 143bd7f3d4a2 -r 9c23d1fb8969 src/plugins/zlib/zlib-plugin.c --- a/src/plugins/zlib/zlib-plugin.c Sat Apr 20 20:58:06 2013 +0300 +++ b/src/plugins/zlib/zlib-plugin.c Mon Apr 22 19:03:53 2013 +0300 @@ -3,7 +3,11 @@ #include "lib.h" #include "array.h" #include "istream.h" +#include "istream-seekable.h" #include "ostream.h" +#include "close-keep-errno.h" +#include "safe-mkstemp.h" +#include "str.h" #include "mail-user.h" #include "dbox-single/sdbox-storage.h" #include "dbox-multi/mdbox-storage.h" @@ -36,6 +40,7 @@ #endif #define MAX_INBUF_SIZE (1024*1024) +#define ZLIB_MAIL_CACHE_EXPIRE_MSECS (60*1000) struct zlib_transaction_context { union mailbox_transaction_module_context module_ctx; @@ -43,9 +48,19 @@ struct mail *tmp_mail; }; +struct zlib_mail_cache { + struct timeout *to; + struct mailbox *box; + uint32_t uid; + + struct istream *input; +}; + struct zlib_user { union mail_user_module_context module_ctx; + struct zlib_mail_cache cache; + const struct zlib_handler *save_handler; unsigned int save_level; }; @@ -129,9 +144,84 @@ return NULL; } +static void zlib_mail_cache_close(struct zlib_user *zuser) +{ + struct zlib_mail_cache *cache = &zuser->cache; + + if (cache->to != NULL) + timeout_remove(&cache->to); + if (cache->input != NULL) + i_stream_unref(&cache->input); + memset(cache, 0, sizeof(*cache)); +} + +static int seekable_fd_callback(const char **path_r, void *context) +{ + struct mail_user *user = context; + string_t *path; + int fd; + + path = t_str_new(128); + mail_user_set_get_temp_prefix(path, user->set); + fd = safe_mkstemp(path, 0600, (uid_t)-1, (gid_t)-1); + if (fd == -1) { + i_error("safe_mkstemp(%s) failed: %m", str_c(path)); + return -1; + } + + /* we just want the fd, unlink it */ + if (unlink(str_c(path)) < 0) { + /* shouldn't happen.. */ + i_error("unlink(%s) failed: %m", str_c(path)); + close_keep_errno(fd); + return -1; + } + + *path_r = str_c(path); + return fd; +} + +static struct istream * +zlib_mail_cache_open(struct zlib_user *zuser, struct mail *mail, + struct istream *input) +{ + struct zlib_mail_cache *cache = &zuser->cache; + struct istream *inputs[2]; + string_t *temp_prefix = t_str_new(128); + + zlib_mail_cache_close(zuser); + + /* zlib istream is seekable, but very slow. create a seekable istream + which we can use to quickly seek around in the stream that's been + read so far. usually the partial IMAP FETCHes continue from where + the previous left off, so this isn't strictly necessary, but with + the way lib-imap-storage's CRLF-cache works it has to seek backwards + somewhat, which causes a zlib stream reset. And the CRLF-cache isn't + easy to fix.. */ + input->seekable = FALSE; + inputs[0] = input; + inputs[1] = NULL; + mail_user_set_get_temp_prefix(temp_prefix, mail->box->storage->user->set); + input = i_stream_create_seekable(inputs, + i_stream_get_max_buffer_size(inputs[0]), + seekable_fd_callback, mail->box->storage->user); + i_stream_unref(&inputs[0]); + + cache->to = timeout_add(ZLIB_MAIL_CACHE_EXPIRE_MSECS, + zlib_mail_cache_close, zuser); + cache->box = mail->box; + cache->uid = mail->uid; + cache->input = input; + + /* index-mail wants the stream to be destroyed at close, so create + a new stream instead of just increasing reference. */ + return i_stream_create_limit(cache->input, (uoff_t)-1); +} + static int zlib_istream_opened(struct mail *_mail, struct istream **stream) { struct zlib_user *zuser = ZLIB_USER_CONTEXT(_mail->box->storage->user); + struct zlib_mail_cache *cache = &zuser->cache; struct mail_private *mail = (struct mail_private *)_mail; union mail_module_context *zmail = ZLIB_MAIL_CONTEXT(mail); struct istream *input; @@ -144,6 +234,15 @@ if (_mail->saving && zuser->save_handler == NULL) return zmail->super.istream_opened(_mail, stream); + if (cache->uid == _mail->uid && cache->box == _mail->box) { + /* use the cached stream. when doing partial reads it should + already be seeked into the wanted offset. */ + i_stream_unref(stream); + i_stream_seek(cache->input, 0); + *stream = i_stream_create_limit(cache->input, (uoff_t)-1); + return zmail->super.istream_opened(_mail, stream); + } + handler = zlib_get_zlib_handler(*stream); if (handler != NULL) { if (handler->create_istream == NULL) { @@ -156,6 +255,8 @@ input = *stream; *stream = handler->create_istream(input, TRUE); i_stream_unref(&input); + + *stream = zlib_mail_cache_open(zuser, _mail, *stream); } return zmail->super.istream_opened(_mail, stream); } @@ -346,6 +447,16 @@ return zbox->super.open(box); } +static void zlib_mailbox_close(struct mailbox *box) +{ + union mailbox_module_context *zbox = ZLIB_CONTEXT(box); + struct zlib_user *zuser = ZLIB_USER_CONTEXT(box->storage->user); + + if (zuser->cache.box == box) + zlib_mail_cache_close(zuser); + zbox->super.close(box); +} + static void zlib_mailbox_allocated(struct mailbox *box) { struct mailbox_vfuncs *v = box->vlast; @@ -355,6 +466,7 @@ zbox->super = *v; box->vlast = &zbox->super; v->open = zlib_mailbox_open; + v->close = zlib_mailbox_close; MODULE_CONTEXT_SET_SELF(box, zlib_storage_module, zbox); @@ -364,12 +476,24 @@ zlib_permail_alloc_init(box, v); } +static void zlib_mail_user_deinit(struct mail_user *user) +{ + struct zlib_user *zuser = ZLIB_USER_CONTEXT(user); + + zlib_mail_cache_close(zuser); + zuser->module_ctx.super.deinit(user); +} + static void zlib_mail_user_created(struct mail_user *user) { + struct mail_user_vfuncs *v = user->vlast; struct zlib_user *zuser; const char *name; zuser = p_new(user->pool, struct zlib_user, 1); + zuser->module_ctx.super = *v; + user->vlast = &zuser->module_ctx.super; + v->deinit = zlib_mail_user_deinit; name = mail_user_plugin_getenv(user, "zlib_save"); if (name != NULL && *name != '\0') { From dovecot at dovecot.org Mon Apr 22 21:51:06 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 22 Apr 2013 21:51:06 +0300 Subject: dovecot-2.2: stats plugin: Use nonblocking open() for stats fifo. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/c95cea6e1389 changeset: 16308:c95cea6e1389 user: Timo Sirainen date: Mon Apr 22 21:51:01 2013 +0300 description: stats plugin: Use nonblocking open() for stats fifo. This fixes hangs in it. Alternative would be to use alarm(). diffstat: src/plugins/stats/stats-connection.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r fe56ba75d6ef -r c95cea6e1389 src/plugins/stats/stats-connection.c --- a/src/plugins/stats/stats-connection.c Mon Apr 22 18:45:04 2013 +0300 +++ b/src/plugins/stats/stats-connection.c Mon Apr 22 21:51:01 2013 +0300 @@ -23,7 +23,7 @@ if (conn->open_failed) return FALSE; - conn->fd = open(conn->path, O_WRONLY); + conn->fd = open(conn->path, O_WRONLY | O_NONBLOCK); if (conn->fd == -1) { i_error("stats: open(%s) failed: %m", conn->path); conn->open_failed = TRUE; From dovecot at dovecot.org Tue Apr 23 13:28:41 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 13:28:41 +0300 Subject: dovecot-2.2: OpenBSD compile fix: include sys/socket.h when chec... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/da8120a3a98d changeset: 16309:da8120a3a98d user: Timo Sirainen date: Tue Apr 23 13:28:17 2013 +0300 description: OpenBSD compile fix: include sys/socket.h when checking for struct sockpeercred. diffstat: configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c95cea6e1389 -r da8120a3a98d configure.ac --- a/configure.ac Mon Apr 22 21:51:01 2013 +0300 +++ b/configure.ac Tue Apr 23 13:28:17 2013 +0300 @@ -433,7 +433,7 @@ walkcontext dirfd clearenv malloc_usable_size glob fallocate \ posix_fadvise getpeereid getpeerucred) -AC_CHECK_TYPES([struct sockpeercred]) +AC_CHECK_TYPES([struct sockpeercred],,,[#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 Apr 23 13:33:27 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 13:33:27 +0300 Subject: dovecot-2.1: master: Fixed warning log message. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d044963bf65c changeset: 14958:d044963bf65c user: Timo Sirainen date: Tue Apr 23 13:33:12 2013 +0300 description: master: Fixed warning log message. diffstat: src/master/master-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 9c23d1fb8969 -r d044963bf65c src/master/master-settings.c --- a/src/master/master-settings.c Mon Apr 22 19:03:53 2013 +0300 +++ b/src/master/master-settings.c Tue Apr 23 13:33:12 2013 +0300 @@ -415,7 +415,7 @@ const struct service_settings *default_service; #else rlim_t fd_limit; - const char *max_client_limit_source = "default_client_count"; + const char *max_client_limit_source = "default_client_limit"; unsigned int max_client_limit = set->default_client_limit; #endif From dovecot at dovecot.org Tue Apr 23 13:34:16 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 13:34:16 +0300 Subject: dovecot-2.2: master: Fixed warning log message. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2bf265dc0e68 changeset: 16310:2bf265dc0e68 user: Timo Sirainen date: Tue Apr 23 13:33:12 2013 +0300 description: master: Fixed warning log message. diffstat: src/master/master-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r da8120a3a98d -r 2bf265dc0e68 src/master/master-settings.c --- a/src/master/master-settings.c Tue Apr 23 13:28:17 2013 +0300 +++ b/src/master/master-settings.c Tue Apr 23 13:33:12 2013 +0300 @@ -417,7 +417,7 @@ const struct service_settings *default_service; #else rlim_t fd_limit; - const char *max_client_limit_source = "default_client_count"; + const char *max_client_limit_source = "default_client_limit"; unsigned int max_client_limit = set->default_client_limit; #endif From dovecot at dovecot.org Tue Apr 23 13:46:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 13:46:38 +0300 Subject: dovecot-2.1: fts-solr: Don't crash if fts_solr setting is invalid. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c3e487d82df7 changeset: 14959:c3e487d82df7 user: Timo Sirainen date: Tue Apr 23 13:46:29 2013 +0300 description: fts-solr: Don't crash if fts_solr setting is invalid. diffstat: src/plugins/fts-solr/fts-backend-solr-old.c | 15 ++++++++++----- src/plugins/fts-solr/fts-backend-solr.c | 14 +++++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diffs (57 lines): diff -r d044963bf65c -r c3e487d82df7 src/plugins/fts-solr/fts-backend-solr-old.c --- a/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:33:12 2013 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:46:29 2013 +0300 @@ -226,16 +226,21 @@ } static int -fts_backend_solr_init(struct fts_backend *_backend, - const char **error_r ATTR_UNUSED) +fts_backend_solr_init(struct fts_backend *_backend, const char **error_r) { struct solr_fts_backend *backend = (struct solr_fts_backend *)_backend; struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user); - const struct fts_solr_settings *set = &fuser->set; const char *str; - if (solr_conn == NULL) - solr_conn = solr_connection_init(set->url, set->debug); + if (fuser == NULL) { + *error_r = "Invalid fts_solr setting"; + return -1; + } + + if (solr_conn == NULL) { + solr_conn = solr_connection_init(fuser->set.url, + fuser->set.debug); + } str = solr_escape_id_str(_backend->ns->user->username); backend->id_username = i_strdup(str); diff -r d044963bf65c -r c3e487d82df7 src/plugins/fts-solr/fts-backend-solr.c --- a/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:33:12 2013 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:46:29 2013 +0300 @@ -156,14 +156,18 @@ } static int -fts_backend_solr_init(struct fts_backend *_backend, - const char **error_r ATTR_UNUSED) +fts_backend_solr_init(struct fts_backend *_backend, const char **error_r) { struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user); - const struct fts_solr_settings *set = &fuser->set; - if (solr_conn == NULL) - solr_conn = solr_connection_init(set->url, set->debug); + if (fuser == NULL) { + *error_r = "Invalid fts_solr setting"; + return -1; + } + if (solr_conn == NULL) { + solr_conn = solr_connection_init(fuser->set.url, + fuser->set.debug); + } return 0; } From dovecot at dovecot.org Tue Apr 23 13:47:51 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 13:47:51 +0300 Subject: dovecot-2.2: fts-solr: Don't crash if fts_solr setting is invalid. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d728b4682b0a changeset: 16311:d728b4682b0a user: Timo Sirainen date: Tue Apr 23 13:47:46 2013 +0300 description: fts-solr: Don't crash if fts_solr setting is invalid. diffstat: src/plugins/fts-solr/fts-backend-solr-old.c | 7 +++++-- src/plugins/fts-solr/fts-backend-solr.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diffs (39 lines): diff -r 2bf265dc0e68 -r d728b4682b0a src/plugins/fts-solr/fts-backend-solr-old.c --- a/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:33:12 2013 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr-old.c Tue Apr 23 13:47:46 2013 +0300 @@ -229,11 +229,14 @@ { struct solr_fts_backend *backend = (struct solr_fts_backend *)_backend; struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user); - const struct fts_solr_settings *set = &fuser->set; const char *str; + if (fuser == NULL) { + *error_r = "Invalid fts_solr setting"; + return -1; + } if (solr_conn == NULL) { - if (solr_connection_init(set->url, set->debug, + if (solr_connection_init(fuser->set.url, fuser->set.debug, &solr_conn, error_r) < 0) return -1; } diff -r 2bf265dc0e68 -r d728b4682b0a src/plugins/fts-solr/fts-backend-solr.c --- a/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:33:12 2013 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr.c Tue Apr 23 13:47:46 2013 +0300 @@ -158,10 +158,13 @@ fts_backend_solr_init(struct fts_backend *_backend, const char **error_r) { struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(_backend->ns->user); - const struct fts_solr_settings *set = &fuser->set; + if (fuser == NULL) { + *error_r = "Invalid fts_solr setting"; + return -1; + } if (solr_conn == NULL) { - if (solr_connection_init(set->url, set->debug, + if (solr_connection_init(fuser->set.url, fuser->set.debug, &solr_conn, error_r) < 0) return -1; } From dovecot at dovecot.org Tue Apr 23 16:21:03 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 16:21:03 +0300 Subject: dovecot-2.2: lib-http: Makefile fix Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/43e7606b31e2 changeset: 16312:43e7606b31e2 user: Timo Sirainen date: Tue Apr 23 16:20:48 2013 +0300 description: lib-http: Makefile fix diffstat: src/lib-http/Makefile.am | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r d728b4682b0a -r 43e7606b31e2 src/lib-http/Makefile.am --- a/src/lib-http/Makefile.am Tue Apr 23 13:47:46 2013 +0300 +++ b/src/lib-http/Makefile.am Tue Apr 23 16:20:48 2013 +0300 @@ -50,7 +50,7 @@ $(MODULE_LIBS) test_deps = \ - $(noinst_LTLIBRARIES) + $(noinst_LTLIBRARIES) \ ../lib-test/libtest.la \ ../lib/liblib.la From dovecot at dovecot.org Tue Apr 23 17:21:57 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 17:21:57 +0300 Subject: dovecot-2.2: istream-seekable: Don't crash when seeking forwards... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/2784b88a4260 changeset: 16313:2784b88a4260 user: Timo Sirainen date: Tue Apr 23 17:21:46 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 | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diffs (32 lines): diff -r 43e7606b31e2 -r 2784b88a4260 src/lib/istream-seekable.c --- a/src/lib/istream-seekable.c Tue Apr 23 16:20:48 2013 +0300 +++ b/src/lib/istream-seekable.c Tue Apr 23 17:21:46 2013 +0300 @@ -345,6 +345,20 @@ return 0; } +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_nonseekable(stream, v_offset, mark); + } +} + struct istream * i_streams_merge(struct istream *input[], size_t max_buffer_size, int (*fd_callback)(const char **path_r, void *context), @@ -388,6 +402,7 @@ sstream->istream.read = i_stream_seekable_read; 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 Tue Apr 23 20:51:47 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 20:51:47 +0300 Subject: dovecot-2.2: dbox: Close file's fd only after its istream is des... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6d19a0f32a1b changeset: 16314:6d19a0f32a1b user: Timo Sirainen date: Tue Apr 23 20:51:34 2013 +0300 description: dbox: Close file's fd only after its istream is destroyed. For example zlib plugin keeps the stream open as a cache even after the dbox_file has been destroyed. diffstat: src/lib-storage/index/dbox-common/dbox-file.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diffs (27 lines): diff -r 2784b88a4260 -r 6d19a0f32a1b src/lib-storage/index/dbox-common/dbox-file.c --- a/src/lib-storage/index/dbox-common/dbox-file.c Tue Apr 23 17:21:46 2013 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-file.c Tue Apr 23 20:51:34 2013 +0300 @@ -215,7 +215,7 @@ } } - file->input = i_stream_create_fd(file->fd, DBOX_READ_BLOCK_SIZE, FALSE); + file->input = i_stream_create_fd(file->fd, DBOX_READ_BLOCK_SIZE, TRUE); i_stream_set_name(file->input, file->cur_path); i_stream_set_init_buffer_size(file->input, DBOX_READ_BLOCK_SIZE); return dbox_file_read_header(file); @@ -286,9 +286,12 @@ void dbox_file_close(struct dbox_file *file) { dbox_file_unlock(file); - if (file->input != NULL) + if (file->input != NULL) { + /* stream autocloses the fd when it gets destroyed. note that + the stream may outlive the struct dbox_file. */ i_stream_unref(&file->input); - if (file->fd != -1) { + file->fd = -1; + } else if (file->fd != -1) { if (close(file->fd) < 0) dbox_file_set_syscall_error(file, "close()"); file->fd = -1; From dovecot at dovecot.org Tue Apr 23 20:54:19 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 20:54:19 +0300 Subject: dovecot-2.2: istream-[b]zlib: Don't break if parent stream gets ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/ba63c27667ff changeset: 16315:ba63c27667ff user: Timo Sirainen date: Tue Apr 23 20:53:53 2013 +0300 description: istream-[b]zlib: Don't break if parent stream gets seeked in the middle of reads. diffstat: src/lib-compression/istream-bzlib.c | 65 +++++++++++++++------------------- src/lib-compression/istream-zlib.c | 68 ++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 74 deletions(-) diffs (243 lines): diff -r 6d19a0f32a1b -r ba63c27667ff src/lib-compression/istream-bzlib.c --- a/src/lib-compression/istream-bzlib.c Tue Apr 23 20:51:34 2013 +0300 +++ b/src/lib-compression/istream-bzlib.c Tue Apr 23 20:53:53 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; @@ -49,7 +49,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); @@ -98,42 +98,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: @@ -159,7 +153,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; } @@ -167,11 +161,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) @@ -206,7 +200,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 6d19a0f32a1b -r ba63c27667ff src/lib-compression/istream-zlib.c --- a/src/lib-compression/istream-zlib.c Tue Apr 23 20:51:34 2013 +0300 +++ b/src/lib-compression/istream-zlib.c Tue Apr 23 20:53:53 2013 +0300 @@ -122,6 +122,7 @@ pos += 2; } i_stream_skip(stream->parent, pos); + zstream->prev_size = 0; return 1; } @@ -172,7 +173,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); @@ -208,7 +209,6 @@ if (ret <= 0) return ret; zstream->header_read = TRUE; - zstream->prev_size = 0; } if (stream->pos < zstream->high_pos) { @@ -248,44 +248,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: @@ -307,10 +302,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 @@ -322,11 +314,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 dovecot at dovecot.org Tue Apr 23 21:06:10 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 21:06:10 +0300 Subject: dovecot-2.2: lib-storage: Fixed crash with mailbox_list_index=ye... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/d3d380221043 changeset: 16316:d3d380221043 user: Timo Sirainen date: Tue Apr 23 21:06:00 2013 +0300 description: lib-storage: Fixed crash with mailbox_list_index=yes after re-reading index. diffstat: src/lib-storage/list/mailbox-list-index.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r ba63c27667ff -r d3d380221043 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Tue Apr 23 20:53:53 2013 +0300 +++ b/src/lib-storage/list/mailbox-list-index.c Tue Apr 23 21:06:00 2013 +0300 @@ -27,8 +27,8 @@ { i_assert(ilist->iter_refcount == 0); - hash_table_clear(ilist->mailbox_names, FALSE); - hash_table_clear(ilist->mailbox_hash, FALSE); + 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; From dovecot at dovecot.org Tue Apr 23 21:06:38 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 21:06:38 +0300 Subject: dovecot-2.2: maildir: Crashfix after dovecot-keywords file was r... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/dd6316615025 changeset: 16317:dd6316615025 user: Timo Sirainen date: Tue Apr 23 21:06:34 2013 +0300 description: maildir: Crashfix after dovecot-keywords file was re-read. diffstat: src/lib-storage/index/maildir/maildir-keywords.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r d3d380221043 -r dd6316615025 src/lib-storage/index/maildir/maildir-keywords.c --- a/src/lib-storage/index/maildir/maildir-keywords.c Tue Apr 23 21:06:00 2013 +0300 +++ b/src/lib-storage/index/maildir/maildir-keywords.c Tue Apr 23 21:06:34 2013 +0300 @@ -104,7 +104,7 @@ static void maildir_keywords_clear(struct maildir_keywords *mk) { array_clear(&mk->list); - hash_table_clear(mk->hash, FALSE); + hash_table_clear(mk->hash, TRUE); p_clear(mk->pool); } From dovecot at dovecot.org Tue Apr 23 21:08:35 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 21:08:35 +0300 Subject: dovecot-2.2: hash_table_clear(): Added a comment about API usage. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/25679980d267 changeset: 16318:25679980d267 user: Timo Sirainen date: Tue Apr 23 21:08:31 2013 +0300 description: hash_table_clear(): Added a comment about API usage. diffstat: src/lib/hash.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r dd6316615025 -r 25679980d267 src/lib/hash.h --- a/src/lib/hash.h Tue Apr 23 21:06:34 2013 +0300 +++ b/src/lib/hash.h Tue Apr 23 21:08:31 2013 +0300 @@ -68,8 +68,8 @@ #define hash_table_destroy(table) \ hash_table_destroy(&(*table)._table) /* Remove all nodes from hash table. If free_collisions is TRUE, the - memory allocated from node_pool is freed, or discarded with - alloconly pools. */ + memory allocated from node_pool is freed, or discarded with alloconly pools. + WARNING: If you p_clear() the node_pool, the free_collisions must be TRUE. */ void hash_table_clear(struct hash_table *table, bool free_collisions); #define hash_table_clear(table, free_collisions) \ hash_table_clear((table)._table, free_collisions) From dovecot at dovecot.org Tue Apr 23 21:32:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 21:32:44 +0300 Subject: dovecot-2.2: lib-master: Added master_service_is_master_stopped() Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/b8be0d35228e changeset: 16319:b8be0d35228e user: Timo Sirainen date: Tue Apr 23 21:31:52 2013 +0300 description: lib-master: Added master_service_is_master_stopped() diffstat: src/lib-master/master-service.c | 5 +++++ src/lib-master/master-service.h | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diffs (28 lines): diff -r 25679980d267 -r b8be0d35228e src/lib-master/master-service.c --- a/src/lib-master/master-service.c Tue Apr 23 21:08:31 2013 +0300 +++ b/src/lib-master/master-service.c Tue Apr 23 21:31:52 2013 +0300 @@ -600,6 +600,11 @@ return service->killed; } +bool master_service_is_master_stopped(struct master_service *service) +{ + return service->io_status_error == NULL; +} + void master_service_anvil_send(struct master_service *service, const char *cmd) { ssize_t ret; diff -r 25679980d267 -r b8be0d35228e src/lib-master/master-service.h --- a/src/lib-master/master-service.h Tue Apr 23 21:08:31 2013 +0300 +++ b/src/lib-master/master-service.h Tue Apr 23 21:31:52 2013 +0300 @@ -141,6 +141,9 @@ void master_service_stop_new_connections(struct master_service *service); /* Returns TRUE if we've received a SIGINT/SIGTERM and we've decided to stop. */ bool master_service_is_killed(struct master_service *service); +/* Returns TRUE if our master process is already stopped. This process may or + may not be dying itself. */ +bool master_service_is_master_stopped(struct master_service *service); /* Send command to anvil process, if we have fd to it. */ void master_service_anvil_send(struct master_service *service, const char *cmd); From dovecot at dovecot.org Tue Apr 23 21:32:44 2013 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 23 Apr 2013 21:32:44 +0300 Subject: dovecot-2.2: stats plugin: Don't try to send notifications to al... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/83d83f55e5c2 changeset: 16320:83d83f55e5c2 user: Timo Sirainen date: Tue Apr 23 21:32:24 2013 +0300 description: stats plugin: Don't try to send notifications to already dead stats process. diffstat: src/plugins/stats/Makefile.am | 1 + src/plugins/stats/stats-connection.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diffs (35 lines): diff -r b8be0d35228e -r 83d83f55e5c2 src/plugins/stats/Makefile.am --- a/src/plugins/stats/Makefile.am Tue Apr 23 21:31:52 2013 +0300 +++ b/src/plugins/stats/Makefile.am Tue Apr 23 21:32:24 2013 +0300 @@ -2,6 +2,7 @@ -I$(top_srcdir)/src/lib \ -I$(top_srcdir)/src/lib-settings \ -I$(top_srcdir)/src/lib-mail \ + -I$(top_srcdir)/src/lib-master \ -I$(top_srcdir)/src/lib-index \ -I$(top_srcdir)/src/lib-storage diff -r b8be0d35228e -r 83d83f55e5c2 src/plugins/stats/stats-connection.c --- a/src/plugins/stats/stats-connection.c Tue Apr 23 21:31:52 2013 +0300 +++ b/src/plugins/stats/stats-connection.c Tue Apr 23 21:32:24 2013 +0300 @@ -5,6 +5,7 @@ #include "net.h" #include "str.h" #include "strescape.h" +#include "master-service.h" #include "mail-storage.h" #include "stats-plugin.h" #include "stats-connection.h" @@ -71,6 +72,12 @@ static bool pipe_warned = FALSE; ssize_t ret; + /* if master process has been stopped (and restarted), don't even try + to notify the stats process anymore. even if one exists, it doesn't + know about us. */ + if (master_service_is_master_stopped(master_service)) + return; + if (conn->fd == -1) { if (!stats_connection_open(conn)) return; From pigeonhole at rename-it.nl Tue Apr 23 23:55:09 2013 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 23 Apr 2013 22:55:09 +0200 Subject: dovecot-2.2-pigeonhole: doveadm-sieve: Fixed mtime updates. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/5892c2ab9b0d changeset: 1758:5892c2ab9b0d user: Stephan Bosch date: Tue Apr 23 22:55:03 2013 +0200 description: doveadm-sieve: Fixed mtime updates. Patch by Timo Sirainen. diffstat: src/lib-sievestorage/sieve-storage-private.h | 3 +- src/lib-sievestorage/sieve-storage-save.c | 5 +- src/lib-sievestorage/sieve-storage-script.c | 23 ++++----- src/lib-sievestorage/sieve-storage-script.h | 4 +- src/lib-sievestorage/sieve-storage.c | 53 +++++++++-------------- src/managesieve/cmd-setactive.c | 4 +- src/plugins/doveadm-sieve/doveadm-sieve-plugin.c | 10 ++-- 7 files changed, 44 insertions(+), 58 deletions(-) diffs (291 lines): diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/lib-sievestorage/sieve-storage-private.h --- a/src/lib-sievestorage/sieve-storage-private.h Sat Apr 20 21:27:15 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-private.h Tue Apr 23 22:55:03 2013 +0200 @@ -49,12 +49,11 @@ struct sieve_error_handler *ehandler; enum sieve_storage_flags flags; + time_t prev_mtime; }; struct sieve_script *sieve_storage_script_init_from_path (struct sieve_storage *storage, const char *path, const char *scriptname); -void sieve_storage_mark_modified(struct sieve_storage *storage); - #endif diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Sat Apr 20 21:27:15 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.c Tue Apr 23 22:55:03 2013 +0200 @@ -375,11 +375,10 @@ 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); } T_END; - if ( (*ctx)->mtime != (time_t)-1 ) - sieve_storage_update_mtime(dest_path, (*ctx)->mtime); - sieve_storage_save_destroy(ctx); return ( failed ? -1 : 0 ); diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Sat Apr 20 21:27:15 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.c Tue Apr 23 22:55:03 2013 +0200 @@ -302,19 +302,18 @@ { struct stat st; -#if 0 /* Try direct lstat first */ if (lstat(storage->active_path, &st) == 0) { - *last_change_r = st.st_mtime; - return 0; + if (!S_ISLNK(st.st_mode)) { + *last_change_r = st.st_mtime; + return 0; + } } - /* Check error */ - if (errno != ENOENT) { + else if (errno != ENOENT) { sieve_storage_set_critical(storage, "lstat(%s) failed: %m", storage->active_path); } -#endif /* Fall back to statting storage directory */ return sieve_storage_get_last_change(storage, last_change_r); @@ -450,7 +449,7 @@ return FALSE; } -int sieve_storage_deactivate(struct sieve_storage *storage) +int sieve_storage_deactivate(struct sieve_storage *storage, time_t mtime) { int ret; @@ -470,7 +469,7 @@ } } - sieve_storage_mark_modified(storage); + sieve_storage_set_modified(storage, mtime); return 1; } @@ -530,7 +529,7 @@ return 1; } -static int _sieve_storage_script_activate(struct sieve_script *script) +static int _sieve_storage_script_activate(struct sieve_script *script, time_t mtime) { struct sieve_storage_script *st_script = (struct sieve_storage_script *) script; @@ -589,16 +588,16 @@ } } - sieve_storage_mark_modified(storage); + sieve_storage_set_modified(storage, mtime); return activated; } -int sieve_storage_script_activate(struct sieve_script *script) +int sieve_storage_script_activate(struct sieve_script *script, time_t mtime) { int ret; T_BEGIN { - ret = _sieve_storage_script_activate(script); + ret = _sieve_storage_script_activate(script, mtime); } T_END; return ret; diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/lib-sievestorage/sieve-storage-script.h --- a/src/lib-sievestorage/sieve-storage-script.h Sat Apr 20 21:27:15 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.h Tue Apr 23 22:55:03 2013 +0200 @@ -23,9 +23,9 @@ int sieve_storage_active_script_get_last_change (struct sieve_storage *storage, time_t *last_change_r); -int sieve_storage_deactivate(struct sieve_storage *storage); +int sieve_storage_deactivate(struct sieve_storage *storage, time_t mtime); int sieve_storage_script_is_active(struct sieve_script *script); -int sieve_storage_script_activate(struct sieve_script *script); +int sieve_storage_script_activate(struct sieve_script *script, time_t mtime); int sieve_storage_script_delete(struct sieve_script **script); int sieve_storage_script_rename (struct sieve_script *script, const char *newname); diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Sat Apr 20 21:27:15 2013 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Tue Apr 23 22:55:03 2013 +0200 @@ -381,6 +381,17 @@ "using sieve script storage directory: %s", storage_dir); } + /* get the storage mtime before we modify it ourself. FIXME: do this + later, only just before modifying the sieve dir */ + struct stat st; + if (stat(storage_dir, &st) < 0) { + if (errno != ENOENT) { + i_error("stat(%s) failed: %m", storage_dir); + return NULL; + } + st.st_mtime = 0; + } + /* Get permissions */ sieve_storage_get_permissions @@ -416,6 +427,7 @@ storage->user = p_strdup(pool, user); storage->active_path = p_strdup(pool, active_path); storage->active_fname = p_strdup(pool, active_fname); + storage->prev_mtime = st.st_mtime; storage->dir_create_mode = dir_create_mode; storage->file_create_mode = file_create_mode; @@ -458,7 +470,6 @@ (unsigned long long int) storage->max_scripts); } } - return storage; } @@ -486,18 +497,7 @@ int sieve_storage_get_last_change (struct sieve_storage *storage, time_t *last_change_r) { - struct stat st; - - if (stat(storage->dir, &st) < 0) { - if (errno == ENOENT) { - *last_change_r = 0; - return 0; - } - sieve_storage_set_critical(storage, "stat(%s) failed: %m", - storage->dir); - return -1; - } - *last_change_r = st.st_mtime; + *last_change_r = storage->prev_mtime; return 0; } @@ -507,10 +507,12 @@ struct utimbuf times = { .actime = mtime, .modtime = mtime }; time_t cur_mtime; - if ( sieve_storage_get_last_change(storage, &cur_mtime) >= 0 && - cur_mtime > mtime ) - return; - + if ( mtime != (time_t)-1 ) { + if ( sieve_storage_get_last_change(storage, &cur_mtime) >= 0 && + cur_mtime > mtime ) + return; + } + if ( utime(storage->dir, ×) < 0 ) { switch ( errno ) { case ENOENT: @@ -521,21 +523,8 @@ default: i_error("sieve-storage: utime(%s) failed: %m", storage->dir); } - } -} - -void sieve_storage_mark_modified(struct sieve_storage *storage) -{ - if ( utime(storage->dir, NULL) < 0 ) { - switch ( errno ) { - case ENOENT: - break; - case EACCES: - i_error("sieve-storage: %s", eacces_error_get("utime", storage->dir)); - break; - default: - i_error("sieve-storage: utime(%s) failed: %m", storage->dir); - } + } else { + storage->prev_mtime = mtime; } } diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/managesieve/cmd-setactive.c --- a/src/managesieve/cmd-setactive.c Sat Apr 20 21:27:15 2013 +0200 +++ b/src/managesieve/cmd-setactive.c Tue Apr 23 22:55:03 2013 +0200 @@ -68,7 +68,7 @@ /* Refresh activation no matter what; this can also resolve some erroneous * situations. */ - ret = sieve_storage_script_activate(script); + ret = sieve_storage_script_activate(script, (time_t)-1); if ( ret < 0 ) { client_send_storage_error(client, storage); } else { @@ -90,7 +90,7 @@ /* ... deactivate */ } else { - ret = sieve_storage_deactivate(storage); + ret = sieve_storage_deactivate(storage, (time_t)-1); if ( ret < 0 ) client_send_storage_error(client, storage); diff -r 94cd5a1c85cf -r 5892c2ab9b0d src/plugins/doveadm-sieve/doveadm-sieve-plugin.c --- a/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Sat Apr 20 21:27:15 2013 +0200 +++ b/src/plugins/doveadm-sieve/doveadm-sieve-plugin.c Tue Apr 23 22:55:03 2013 +0200 @@ -164,7 +164,7 @@ } /* deactivate current script */ - if (sieve_storage_deactivate(svstorage) < 0) { + if (sieve_storage_deactivate(svstorage, value->last_change) < 0) { mail_storage_set_critical(storage, "Failed to deactivate Sieve: %s", sieve_storage_get_last_error(svstorage, NULL)); @@ -176,7 +176,7 @@ /* activate specified script */ script = sieve_storage_script_init(svstorage, scriptname); ret = script == NULL ? -1 : - sieve_storage_script_activate(script); + sieve_storage_script_activate(script, value->last_change); if (ret < 0) { mail_storage_set_critical(storage, "Failed to activate Sieve script '%s': %s", scriptname, @@ -190,7 +190,7 @@ static int sieve_attribute_unset_active_script(struct mail_storage *storage, - struct sieve_storage *svstorage) + struct sieve_storage *svstorage, time_t last_change) { int ret; @@ -200,7 +200,7 @@ return ret; } - if (sieve_storage_deactivate(svstorage) < 0) { + if (sieve_storage_deactivate(svstorage, last_change) < 0) { mail_storage_set_critical(storage, "Failed to deactivate sieve: %s", sieve_storage_get_last_error(svstorage, NULL)); @@ -222,7 +222,7 @@ input = value->value_stream; i_stream_ref(input); } else { - return sieve_attribute_unset_active_script(storage, svstorage); + return sieve_attribute_unset_active_script(storage, svstorage, value->last_change); } if (sieve_storage_save_as_active_script