From dovecot at dovecot.org Mon Jan 2 16:30:44 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 02 Jan 2012 16:30:44 +0200 Subject: dovecot-2.1: lib-storage: Added initial support for pop3c backend. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d4c909d2306f changeset: 13880:d4c909d2306f user: Timo Sirainen date: Mon Jan 02 16:30:06 2012 +0200 description: lib-storage: Added initial support for pop3c backend. diffstat: configure.in | 15 +- src/lib-storage/index/Makefile.am | 2 +- src/lib-storage/index/pop3c/Makefile.am | 28 + src/lib-storage/index/pop3c/pop3c-client.c | 781 +++++++++++++++++++++++++++ src/lib-storage/index/pop3c/pop3c-client.h | 69 ++ src/lib-storage/index/pop3c/pop3c-mail.c | 184 ++++++ src/lib-storage/index/pop3c/pop3c-settings.c | 87 +++ src/lib-storage/index/pop3c/pop3c-settings.h | 21 + src/lib-storage/index/pop3c/pop3c-storage.c | 282 +++++++++ src/lib-storage/index/pop3c/pop3c-storage.h | 35 + src/lib-storage/index/pop3c/pop3c-sync.c | 298 ++++++++++ src/lib-storage/index/pop3c/pop3c-sync.h | 14 + 12 files changed, 1812 insertions(+), 4 deletions(-) diffs (truncated from 1900 to 300 lines): diff -r 193c66096bb3 -r d4c909d2306f configure.in --- a/configure.in Fri Dec 30 17:44:23 2011 +0200 +++ b/configure.in Mon Jan 02 16:30:06 2012 +0200 @@ -242,12 +242,12 @@ want_gc=no) AC_ARG_WITH(storages, -AS_HELP_STRING([--with-storages], [Build with specified mail storage formats (mdbox sdbox maildir mbox cydir imapc)]), [ +AS_HELP_STRING([--with-storages], [Build with specified mail storage formats (mdbox sdbox maildir mbox cydir imapc pop3c)]), [ if test "$withval" = "yes" || test "$withval" = "no"; then AC_MSG_ERROR([--with-storages needs storage list as parameter]) fi mail_storages="shared `echo "$withval"|sed 's/,/ /g'`" ], - mail_storages="shared mdbox sdbox maildir mbox cydir imapc") + mail_storages="shared mdbox sdbox maildir mbox cydir imapc pop3c") AC_SUBST(mail_storages) mail_storages="$mail_storages raw" # drop duplicates @@ -2448,7 +2448,8 @@ sdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la' mdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-multi/libstorage_dbox_multi.la' cydir_libs='$(top_builddir)/src/lib-storage/index/cydir/libstorage_cydir.la' -imapc_libs='$(top_builddir)/src/lib-storage/index/imapc/libstorage_imapc.la $(top_builddir)/src/lib-imap-client/libimap_client.la $(top_builddir)/src/lib-ssl-iostream/libssl_iostream.la' +imapc_libs='$(top_builddir)/src/lib-storage/index/imapc/libstorage_imapc.la $(top_builddir)/src/lib-imap-client/libimap_client.la' +pop3c_libs='$(top_builddir)/src/lib-storage/index/pop3c/libstorage_pop3c.la' raw_libs='$(top_builddir)/src/lib-storage/index/raw/libstorage_raw.la' shared_libs='$(top_builddir)/src/lib-storage/index/shared/libstorage_shared.la' @@ -2470,8 +2471,15 @@ fi if test $storage = imapc; then mailbox_list_drivers="$mailbox_list_drivers imapc" + want_ssl_libs=yes + fi + if test $storage = pop3c; then + want_ssl_libs=yes fi done +if test "$want_ssl_libs" = yes; then + LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS \$(top_builddir)/src/lib-ssl-iostream/libssl_iostream.la" +fi AC_SUBST(LINKED_STORAGE_LIBS) AC_SUBST(mailbox_list_drivers) AC_DEFINE_UNQUOTED(MAIL_STORAGES, "$mail_storages", List of compiled in mail storages) @@ -2737,6 +2745,7 @@ src/lib-storage/list/Makefile src/lib-storage/index/Makefile src/lib-storage/index/imapc/Makefile +src/lib-storage/index/pop3c/Makefile src/lib-storage/index/maildir/Makefile src/lib-storage/index/mbox/Makefile src/lib-storage/index/dbox-common/Makefile diff -r 193c66096bb3 -r d4c909d2306f src/lib-storage/index/Makefile.am --- a/src/lib-storage/index/Makefile.am Fri Dec 30 17:44:23 2011 +0200 +++ b/src/lib-storage/index/Makefile.am Mon Jan 02 16:30:06 2012 +0200 @@ -1,4 +1,4 @@ -SUBDIRS = maildir mbox dbox-common dbox-multi dbox-single cydir imapc raw shared +SUBDIRS = maildir mbox dbox-common dbox-multi dbox-single cydir imapc pop3c raw shared noinst_LTLIBRARIES = libstorage_index.la diff -r 193c66096bb3 -r d4c909d2306f src/lib-storage/index/pop3c/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-storage/index/pop3c/Makefile.am Mon Jan 02 16:30:06 2012 +0200 @@ -0,0 +1,28 @@ +noinst_LTLIBRARIES = libstorage_pop3c.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/lib-settings \ + -I$(top_srcdir)/src/lib-dns \ + -I$(top_srcdir)/src/lib-ssl-iostream \ + -I$(top_srcdir)/src/lib-mail \ + -I$(top_srcdir)/src/lib-imap \ + -I$(top_srcdir)/src/lib-index \ + -I$(top_srcdir)/src/lib-storage \ + -I$(top_srcdir)/src/lib-storage/index + +libstorage_pop3c_la_SOURCES = \ + pop3c-client.c \ + pop3c-mail.c \ + pop3c-settings.c \ + pop3c-storage.c \ + pop3c-sync.c + +headers = \ + pop3c-client.h \ + pop3c-settings.h \ + pop3c-storage.h \ + pop3c-sync.h + +pkginc_libdir=$(pkgincludedir) +pkginc_lib_HEADERS = $(headers) diff -r 193c66096bb3 -r d4c909d2306f src/lib-storage/index/pop3c/pop3c-client.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-storage/index/pop3c/pop3c-client.c Mon Jan 02 16:30:06 2012 +0200 @@ -0,0 +1,781 @@ +/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "ioloop.h" +#include "network.h" +#include "istream.h" +#include "istream-dot.h" +#include "istream-seekable.h" +#include "ostream.h" +#include "iostream-rawlog.h" +#include "iostream-ssl.h" +#include "close-keep-errno.h" +#include "safe-mkstemp.h" +#include "base64.h" +#include "str.h" +#include "dns-lookup.h" +#include "pop3c-client.h" + +#include + +#define POP3C_MAX_INBUF_SIZE (1024*32) +#define POP3C_DNS_LOOKUP_TIMEOUT_MSECS (1000*30) +#define POP3C_CONNECT_TIMEOUT_MSECS (1000*30) +#define POP3C_COMMAND_TIMEOUT_MSECS (1000*30) + +enum pop3c_client_state { + /* No connection */ + POP3C_CLIENT_STATE_DISCONNECTED = 0, + /* Trying to connect */ + POP3C_CLIENT_STATE_CONNECTING, + /* Connected, trying to authenticate */ + POP3C_CLIENT_STATE_USER, + POP3C_CLIENT_STATE_AUTH, + POP3C_CLIENT_STATE_PASS, + /* Post-authentication, asking for capabilities */ + POP3C_CLIENT_STATE_CAPA, + /* Authenticated, ready to accept commands */ + POP3C_CLIENT_STATE_DONE +}; + +struct pop3c_client { + pool_t pool; + struct pop3c_client_settings set; + struct ssl_iostream_context *ssl_ctx; + struct ip_addr ip; + + int fd; + struct io *io; + struct istream *input, *raw_input; + struct ostream *output, *raw_output; + struct ssl_iostream *ssl_iostream; + struct timeout *to; + + enum pop3c_client_state state; + enum pop3c_capability capabilities; + + pop3c_login_callback_t *login_callback; + void *login_context; + + unsigned int async_commands; + const char *input_line; + struct istream *dot_input; + + unsigned int handshake_failed:1; + unsigned int running:1; +}; + +static void +pop3c_dns_callback(const struct dns_lookup_result *result, void *context); + +struct pop3c_client * +pop3c_client_init(const struct pop3c_client_settings *set) +{ + struct pop3c_client *client; + struct ssl_iostream_settings ssl_set; + const char *source; + pool_t pool; + + pool = pool_alloconly_create("pop3c client", 1024); + client = p_new(pool, struct pop3c_client, 1); + client->pool = pool; + client->fd = -1; + + client->set.debug = set->debug; + client->set.host = p_strdup(pool, set->host); + client->set.port = set->port; + client->set.master_user = p_strdup(pool, set->master_user); + client->set.username = p_strdup(pool, set->username); + client->set.password = p_strdup(pool, set->password); + client->set.dns_client_socket_path = + p_strdup(pool, set->dns_client_socket_path); + client->set.temp_path_prefix = p_strdup(pool, set->temp_path_prefix); + client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir); + + 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_verify = set->ssl_verify; + + memset(&ssl_set, 0, sizeof(ssl_set)); + ssl_set.ca_dir = set->ssl_ca_dir; + 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("pop3c(%s): Couldn't initialize SSL context", + source); + } + } + return client; +} + +static void +client_login_callback(struct pop3c_client *client, + enum pop3c_command_state state, const char *reason) +{ + pop3c_login_callback_t *callback = client->login_callback; + void *context = client->login_context; + + if (client->login_callback != NULL) { + client->login_callback = NULL; + client->login_context = NULL; + callback(state, reason, context); + } +} + +static void pop3c_client_disconnect(struct pop3c_client *client) +{ + client->state = POP3C_CLIENT_STATE_DISCONNECTED; + client->async_commands = 0; + + if (client->running) + io_loop_stop(current_ioloop); + + if (client->to != NULL) + timeout_remove(&client->to); + if (client->io != NULL) + io_remove(&client->io); + if (client->input != NULL) + i_stream_destroy(&client->input); + if (client->output != NULL) + o_stream_destroy(&client->output); + if (client->ssl_iostream != NULL) + ssl_iostream_unref(&client->ssl_iostream); + if (client->fd != -1) { + if (close(client->fd) < 0) + i_error("close(pop3c) failed: %m"); + client->fd = -1; + } + client_login_callback(client, POP3C_COMMAND_STATE_DISCONNECTED, + "Disconnected"); +} + +void pop3c_client_deinit(struct pop3c_client **_client) +{ + struct pop3c_client *client = *_client; + + pop3c_client_disconnect(client); + if (client->ssl_ctx != NULL) + ssl_iostream_context_deinit(&client->ssl_ctx); + pool_unref(&client->pool); +} + +static void pop3c_client_ioloop_changed(struct pop3c_client *client) +{ + if (client->to != NULL) + io_loop_move_timeout(&client->to); + if (client->io != NULL) + client->io = io_loop_move_io(&client->io); + if (client->output != NULL) + o_stream_switch_ioloop(client->output); +} + +static void pop3c_client_timeout(struct pop3c_client *client) +{ + switch (client->state) { + case POP3C_CLIENT_STATE_CONNECTING: + i_error("pop3c(%s): connect(%s, %u) timed out after %u seconds", + client->set.host, net_ip2addr(&client->ip), + client->set.port, POP3C_CONNECT_TIMEOUT_MSECS/1000); + break; + case POP3C_CLIENT_STATE_DONE: + i_error("pop3c(%s): Command timed out after %u seconds", + client->set.host, POP3C_COMMAND_TIMEOUT_MSECS/1000); + break; + default: + i_error("pop3c(%s): Authentication timed out after %u seconds", + client->set.host, POP3C_CONNECT_TIMEOUT_MSECS/1000); + break; + } + pop3c_client_disconnect(client); +} + +void pop3c_client_run(struct pop3c_client *client) +{ + struct ioloop *ioloop, *prev_ioloop = current_ioloop; + bool timeout_added = FALSE; + + i_assert(client->fd != -1 || + client->state == POP3C_CLIENT_STATE_CONNECTING); + From dovecot at dovecot.org Tue Jan 3 13:13:07 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 13:13:07 +0200 Subject: dovecot-2.1: imap-login: LOGIN_MAX_INBUF_SIZE was too small, bec... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/614422fbbe8b changeset: 13881:614422fbbe8b user: Timo Sirainen date: Tue Jan 03 13:13:37 2012 +0200 description: imap-login: LOGIN_MAX_INBUF_SIZE was too small, because of SASL-IR extension diffstat: src/login-common/client-common.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (17 lines): diff -r d4c909d2306f -r 614422fbbe8b src/login-common/client-common.h --- a/src/login-common/client-common.h Mon Jan 02 16:30:06 2012 +0200 +++ b/src/login-common/client-common.h Tue Jan 03 13:13:37 2012 +0200 @@ -7,10 +7,11 @@ /* max. size of input buffer. this means: - IMAP: Max. length of a single parameter + IMAP: Max. length of a single parameter. SASL initial response can be + long with GSSAPI. POP3: Max. length of a command line (spec says 512 would be enough) */ -#define LOGIN_MAX_INBUF_SIZE 1024 +#define LOGIN_MAX_INBUF_SIZE 4096 /* max. size of output buffer. if it gets full, the client is disconnected. SASL authentication gives the largest output. */ #define LOGIN_MAX_OUTBUF_SIZE 4096 From dovecot at dovecot.org Tue Jan 3 13:13:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 13:13:41 +0200 Subject: dovecot-2.0: imap-login: LOGIN_MAX_INBUF_SIZE was too small, bec... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d06061408f6d changeset: 13006:d06061408f6d user: Timo Sirainen date: Tue Jan 03 13:13:03 2012 +0200 description: imap-login: LOGIN_MAX_INBUF_SIZE was too small, because of SASL-IR extension diffstat: src/login-common/client-common.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (17 lines): diff -r 49a77e9dad66 -r d06061408f6d src/login-common/client-common.h --- a/src/login-common/client-common.h Tue Dec 20 14:45:09 2011 +0200 +++ b/src/login-common/client-common.h Tue Jan 03 13:13:03 2012 +0200 @@ -7,10 +7,11 @@ /* max. size of input buffer. this means: - IMAP: Max. length of a single parameter + IMAP: Max. length of a single parameter. SASL initial response can be + long with GSSAPI. POP3: Max. length of a command line (spec says 512 would be enough) */ -#define LOGIN_MAX_INBUF_SIZE 1024 +#define LOGIN_MAX_INBUF_SIZE 4096 /* max. size of output buffer. if it gets full, the client is disconnected. SASL authentication gives the largest output. */ #define LOGIN_MAX_OUTBUF_SIZE 4096 From dovecot at dovecot.org Tue Jan 3 14:31:38 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 14:31:38 +0200 Subject: dovecot-2.0: dsync: Don't log unnecessary errors about not being... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/69c6d7436f7f changeset: 13007:69c6d7436f7f user: Timo Sirainen date: Tue Jan 03 14:32:08 2012 +0200 description: dsync: Don't log unnecessary errors about not being able to delete \Noselect mailbox dirs. diffstat: src/dsync/dsync-worker-local.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diffs (31 lines): diff -r d06061408f6d -r 69c6d7436f7f src/dsync/dsync-worker-local.c --- a/src/dsync/dsync-worker-local.c Tue Jan 03 13:13:03 2012 +0200 +++ b/src/dsync/dsync-worker-local.c Tue Jan 03 14:32:08 2012 +0200 @@ -1323,15 +1323,24 @@ (struct local_dsync_worker *)_worker; struct mail_namespace *ns; const char *storage_name; + enum mail_error error; storage_name = dsync_box->name; ns = mail_namespace_find(worker->user->namespaces, &storage_name); mailbox_list_set_changelog_timestamp(ns->list, dsync_box->last_change); if (mailbox_list_delete_dir(ns->list, storage_name) < 0) { - i_error("Can't delete mailbox directory %s: %s", - dsync_box->name, - mailbox_list_get_last_error(ns->list, NULL)); + (void)mailbox_list_get_last_error(ns->list, &error); + if (error == MAIL_ERROR_EXISTS) { + /* we're probably doing Maildir++ -> FS layout sync, + where a nonexistent Maildir++ mailbox had to be + created as \Noselect FS directory. + just ignore this. */ + } else { + i_error("Can't delete mailbox directory %s: %s", + dsync_box->name, + mailbox_list_get_last_error(ns->list, NULL)); + } } mailbox_list_set_changelog_timestamp(ns->list, (time_t)-1); } From dovecot at dovecot.org Tue Jan 3 14:33:19 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 14:33:19 +0200 Subject: dovecot-2.1: dsync: Don't log unnecessary errors about not being... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/12e59954a23f changeset: 13882:12e59954a23f user: Timo Sirainen date: Tue Jan 03 14:33:20 2012 +0200 description: dsync: Don't log unnecessary errors about not being able to delete \Noselect mailbox dirs. diffstat: src/doveadm/dsync/dsync-worker-local.c | 111 ++++++++++++++------------------ 1 files changed, 49 insertions(+), 62 deletions(-) diffs (209 lines): diff -r 614422fbbe8b -r 12e59954a23f src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 13:13:37 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 14:33:20 2012 +0200 @@ -94,7 +94,7 @@ struct hash_table *dir_changes_hash; char alt_char; - ARRAY_DEFINE(subs_namespaces, struct mail_namespace *); + ARRAY_DEFINE(wanted_namespaces, struct mail_namespace *); mailbox_guid_t selected_box_guid; struct mailbox *selected_box; @@ -151,56 +151,23 @@ return h; } -static struct mail_namespace * -namespace_find_set(struct mail_user *user, - const struct mail_namespace_settings *set) +static bool local_worker_want_namespace(struct mail_namespace *ns) +{ + return strcmp(ns->unexpanded_set->location, + SETTING_STRVAR_UNEXPANDED) == 0; +} + +static void dsync_check_namespaces(struct local_dsync_worker *worker) { struct mail_namespace *ns; - for (ns = user->namespaces; ns != NULL; ns = ns->next) { - /* compare settings pointers so that it'll work - for shared namespaces */ - if (ns->set == set) - return ns; + for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { + if (local_worker_want_namespace(ns)) + return; } - return NULL; -} - -static void dsync_drop_extra_namespaces(struct local_dsync_worker *worker) -{ - struct mail_user *user = worker->user; - struct mail_namespace_settings *const *ns_unset, *const *ns_set; - struct mail_namespace *ns; - unsigned int i, count, count2; - - if (!array_is_created(&user->unexpanded_set->namespaces)) - return; - - /* drop all namespaces that have a location defined internally */ - ns_unset = array_get(&user->unexpanded_set->namespaces, &count); - ns_set = array_get(&user->set->namespaces, &count2); - i_assert(count == count2); - for (i = 0; i < count; i++) { - if (strcmp(ns_unset[i]->location, - SETTING_STRVAR_UNEXPANDED) == 0) - continue; - - ns = namespace_find_set(user, ns_set[i]); - i_assert(ns != NULL); - if ((ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) { - /* remember the subscriptions=no namespaces so we can - handle their subscriptions in parent namespaces - properly */ - mail_namespace_ref(ns); - array_append(&worker->subs_namespaces, &ns, 1); - } - mail_namespace_destroy(ns); - } - if (user->namespaces == NULL) { - i_fatal("All your namespaces have a location setting. " - "It should be empty (default mail_location) in the " - "namespace to be converted."); - } + i_fatal("All your namespaces have a location setting. " + "It should be empty (default mail_location) in the " + "namespace to be converted."); } struct dsync_worker * @@ -220,8 +187,8 @@ mailbox_guid_hash, mailbox_guid_cmp); i_array_init(&worker->saved_uids, 128); i_array_init(&worker->msg_get_queue, 32); - p_array_init(&worker->subs_namespaces, pool, 8); - dsync_drop_extra_namespaces(worker); + p_array_init(&worker->wanted_namespaces, pool, 8); + dsync_check_namespaces(worker); mail_user_ref(worker->user); return &worker->worker; @@ -231,13 +198,9 @@ { struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; - struct mail_namespace **nsp; i_assert(worker->save_input == NULL); - array_foreach_modifiable(&worker->subs_namespaces, nsp) - mail_namespace_unref(nsp); - local_worker_msg_box_close(worker); local_worker_mailbox_close(worker); mail_user_unref(&worker->user); @@ -417,7 +380,7 @@ hash_table_create(default_pool, worker->pool, 0, dir_change_hash, dir_change_cmp); for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { - if (ns->alias_for != NULL) + if (ns->alias_for != NULL || !local_worker_want_namespace(ns)) continue; if (dsync_worker_get_list_mailbox_log(worker, ns->list) < 0) @@ -537,7 +500,10 @@ memset(dsync_box_r, 0, sizeof(*dsync_box_r)); - info = mailbox_list_iter_next(iter->list_iter); + while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { + if (local_worker_want_namespace(info->ns)) + break; + } if (info == NULL) return iter_next_deleted(iter, worker, dsync_box_r); @@ -646,16 +612,18 @@ struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; struct local_dsync_worker_subs_iter *iter; - enum mailbox_list_iter_flags list_flags = + const enum mailbox_list_iter_flags list_flags = MAILBOX_LIST_ITER_SKIP_ALIASES | MAILBOX_LIST_ITER_SELECT_SUBSCRIBED; + const enum namespace_type namespace_mask = + NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC; static const char *patterns[] = { "*", NULL }; iter = i_new(struct local_dsync_worker_subs_iter, 1); iter->iter.worker = _worker; iter->list_iter = mailbox_list_iter_init_namespaces(worker->user->namespaces, - patterns, NAMESPACE_PRIVATE, + patterns, namespace_mask, list_flags); (void)dsync_worker_get_mailbox_log(worker); return &iter->iter; @@ -675,11 +643,18 @@ memset(rec_r, 0, sizeof(*rec_r)); - info = mailbox_list_iter_next(iter->list_iter); + while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { + if (local_worker_want_namespace(info->ns) || + (info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + break; + } if (info == NULL) return -1; storage_name = mailbox_list_get_storage_name(info->ns->list, info->name); + if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + storage_name = t_strconcat(info->ns->prefix, storage_name, NULL); + dsync_str_sha_to_guid(storage_name, &change_lookup.name_sha1); change_lookup.list = info->ns->list; @@ -691,7 +666,10 @@ change->unsubscribed = FALSE; rec_r->last_change = change->last_subs_change; } - rec_r->ns_prefix = info->ns->prefix; + if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + rec_r->ns_prefix = ""; + else + rec_r->ns_prefix = info->ns->prefix; rec_r->vname = info->name; rec_r->storage_name = storage_name; return 1; @@ -1288,15 +1266,24 @@ (struct local_dsync_worker *)_worker; struct mail_namespace *ns; const char *storage_name; + enum mail_error error; ns = mail_namespace_find(worker->user->namespaces, dsync_box->name); storage_name = mailbox_list_get_storage_name(ns->list, dsync_box->name); mailbox_list_set_changelog_timestamp(ns->list, dsync_box->last_change); if (mailbox_list_delete_dir(ns->list, storage_name) < 0) { - i_error("Can't delete mailbox directory %s: %s", - dsync_box->name, - mailbox_list_get_last_error(ns->list, NULL)); + (void)mailbox_list_get_last_error(ns->list, &error); + if (error == MAIL_ERROR_EXISTS) { + /* we're probably doing Maildir++ -> FS layout sync, + where a nonexistent Maildir++ mailbox had to be + created as \Noselect FS directory. + just ignore this. */ + } else { + i_error("Can't delete mailbox directory %s: %s", + dsync_box->name, + mailbox_list_get_last_error(ns->list, NULL)); + } } mailbox_list_set_changelog_timestamp(ns->list, (time_t)-1); } From dovecot at dovecot.org Tue Jan 3 14:42:17 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 14:42:17 +0200 Subject: dovecot-2.1: dsync: Previous commit did too many changes, revert... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/ea9ab24972ed changeset: 13883:ea9ab24972ed user: Timo Sirainen date: Tue Jan 03 14:41:44 2012 +0200 description: dsync: Previous commit did too many changes, reverting. diffstat: src/doveadm/dsync/dsync-worker-local.c | 111 ++++++++++++++++++-------------- 1 files changed, 62 insertions(+), 49 deletions(-) diffs (209 lines): diff -r 12e59954a23f -r ea9ab24972ed src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 14:33:20 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 14:41:44 2012 +0200 @@ -94,7 +94,7 @@ struct hash_table *dir_changes_hash; char alt_char; - ARRAY_DEFINE(wanted_namespaces, struct mail_namespace *); + ARRAY_DEFINE(subs_namespaces, struct mail_namespace *); mailbox_guid_t selected_box_guid; struct mailbox *selected_box; @@ -151,23 +151,56 @@ return h; } -static bool local_worker_want_namespace(struct mail_namespace *ns) -{ - return strcmp(ns->unexpanded_set->location, - SETTING_STRVAR_UNEXPANDED) == 0; -} - -static void dsync_check_namespaces(struct local_dsync_worker *worker) +static struct mail_namespace * +namespace_find_set(struct mail_user *user, + const struct mail_namespace_settings *set) { struct mail_namespace *ns; - for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { - if (local_worker_want_namespace(ns)) - return; + for (ns = user->namespaces; ns != NULL; ns = ns->next) { + /* compare settings pointers so that it'll work + for shared namespaces */ + if (ns->set == set) + return ns; } - i_fatal("All your namespaces have a location setting. " - "It should be empty (default mail_location) in the " - "namespace to be converted."); + return NULL; +} + +static void dsync_drop_extra_namespaces(struct local_dsync_worker *worker) +{ + struct mail_user *user = worker->user; + struct mail_namespace_settings *const *ns_unset, *const *ns_set; + struct mail_namespace *ns; + unsigned int i, count, count2; + + if (!array_is_created(&user->unexpanded_set->namespaces)) + return; + + /* drop all namespaces that have a location defined internally */ + ns_unset = array_get(&user->unexpanded_set->namespaces, &count); + ns_set = array_get(&user->set->namespaces, &count2); + i_assert(count == count2); + for (i = 0; i < count; i++) { + if (strcmp(ns_unset[i]->location, + SETTING_STRVAR_UNEXPANDED) == 0) + continue; + + ns = namespace_find_set(user, ns_set[i]); + i_assert(ns != NULL); + if ((ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) { + /* remember the subscriptions=no namespaces so we can + handle their subscriptions in parent namespaces + properly */ + mail_namespace_ref(ns); + array_append(&worker->subs_namespaces, &ns, 1); + } + mail_namespace_destroy(ns); + } + if (user->namespaces == NULL) { + i_fatal("All your namespaces have a location setting. " + "It should be empty (default mail_location) in the " + "namespace to be converted."); + } } struct dsync_worker * @@ -187,8 +220,8 @@ mailbox_guid_hash, mailbox_guid_cmp); i_array_init(&worker->saved_uids, 128); i_array_init(&worker->msg_get_queue, 32); - p_array_init(&worker->wanted_namespaces, pool, 8); - dsync_check_namespaces(worker); + p_array_init(&worker->subs_namespaces, pool, 8); + dsync_drop_extra_namespaces(worker); mail_user_ref(worker->user); return &worker->worker; @@ -198,9 +231,13 @@ { struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; + struct mail_namespace **nsp; i_assert(worker->save_input == NULL); + array_foreach_modifiable(&worker->subs_namespaces, nsp) + mail_namespace_unref(nsp); + local_worker_msg_box_close(worker); local_worker_mailbox_close(worker); mail_user_unref(&worker->user); @@ -380,7 +417,7 @@ hash_table_create(default_pool, worker->pool, 0, dir_change_hash, dir_change_cmp); for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { - if (ns->alias_for != NULL || !local_worker_want_namespace(ns)) + if (ns->alias_for != NULL) continue; if (dsync_worker_get_list_mailbox_log(worker, ns->list) < 0) @@ -500,10 +537,7 @@ memset(dsync_box_r, 0, sizeof(*dsync_box_r)); - while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { - if (local_worker_want_namespace(info->ns)) - break; - } + info = mailbox_list_iter_next(iter->list_iter); if (info == NULL) return iter_next_deleted(iter, worker, dsync_box_r); @@ -612,18 +646,16 @@ struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; struct local_dsync_worker_subs_iter *iter; - const enum mailbox_list_iter_flags list_flags = + enum mailbox_list_iter_flags list_flags = MAILBOX_LIST_ITER_SKIP_ALIASES | MAILBOX_LIST_ITER_SELECT_SUBSCRIBED; - const enum namespace_type namespace_mask = - NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC; static const char *patterns[] = { "*", NULL }; iter = i_new(struct local_dsync_worker_subs_iter, 1); iter->iter.worker = _worker; iter->list_iter = mailbox_list_iter_init_namespaces(worker->user->namespaces, - patterns, namespace_mask, + patterns, NAMESPACE_PRIVATE, list_flags); (void)dsync_worker_get_mailbox_log(worker); return &iter->iter; @@ -643,18 +675,11 @@ memset(rec_r, 0, sizeof(*rec_r)); - while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { - if (local_worker_want_namespace(info->ns) || - (info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) - break; - } + info = mailbox_list_iter_next(iter->list_iter); if (info == NULL) return -1; storage_name = mailbox_list_get_storage_name(info->ns->list, info->name); - if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) - storage_name = t_strconcat(info->ns->prefix, storage_name, NULL); - dsync_str_sha_to_guid(storage_name, &change_lookup.name_sha1); change_lookup.list = info->ns->list; @@ -666,10 +691,7 @@ change->unsubscribed = FALSE; rec_r->last_change = change->last_subs_change; } - if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) - rec_r->ns_prefix = ""; - else - rec_r->ns_prefix = info->ns->prefix; + rec_r->ns_prefix = info->ns->prefix; rec_r->vname = info->name; rec_r->storage_name = storage_name; return 1; @@ -1266,24 +1288,15 @@ (struct local_dsync_worker *)_worker; struct mail_namespace *ns; const char *storage_name; - enum mail_error error; ns = mail_namespace_find(worker->user->namespaces, dsync_box->name); storage_name = mailbox_list_get_storage_name(ns->list, dsync_box->name); mailbox_list_set_changelog_timestamp(ns->list, dsync_box->last_change); if (mailbox_list_delete_dir(ns->list, storage_name) < 0) { - (void)mailbox_list_get_last_error(ns->list, &error); - if (error == MAIL_ERROR_EXISTS) { - /* we're probably doing Maildir++ -> FS layout sync, - where a nonexistent Maildir++ mailbox had to be - created as \Noselect FS directory. - just ignore this. */ - } else { - i_error("Can't delete mailbox directory %s: %s", - dsync_box->name, - mailbox_list_get_last_error(ns->list, NULL)); - } + i_error("Can't delete mailbox directory %s: %s", + dsync_box->name, + mailbox_list_get_last_error(ns->list, NULL)); } mailbox_list_set_changelog_timestamp(ns->list, (time_t)-1); } From dovecot at dovecot.org Tue Jan 3 14:42:17 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 Jan 2012 14:42:17 +0200 Subject: dovecot-2.1: dsync: Don't log unnecessary errors about not being... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/997a2855fd74 changeset: 13884:997a2855fd74 user: Timo Sirainen date: Tue Jan 03 14:42:51 2012 +0200 description: dsync: Don't log unnecessary errors about not being able to delete \Noselect mailbox dirs. diffstat: src/doveadm/dsync/dsync-worker-local.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diffs (31 lines): diff -r ea9ab24972ed -r 997a2855fd74 src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 14:41:44 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Tue Jan 03 14:42:51 2012 +0200 @@ -1288,15 +1288,24 @@ (struct local_dsync_worker *)_worker; struct mail_namespace *ns; const char *storage_name; + enum mail_error error; ns = mail_namespace_find(worker->user->namespaces, dsync_box->name); storage_name = mailbox_list_get_storage_name(ns->list, dsync_box->name); mailbox_list_set_changelog_timestamp(ns->list, dsync_box->last_change); if (mailbox_list_delete_dir(ns->list, storage_name) < 0) { - i_error("Can't delete mailbox directory %s: %s", - dsync_box->name, - mailbox_list_get_last_error(ns->list, NULL)); + (void)mailbox_list_get_last_error(ns->list, &error); + if (error == MAIL_ERROR_EXISTS) { + /* we're probably doing Maildir++ -> FS layout sync, + where a nonexistent Maildir++ mailbox had to be + created as \Noselect FS directory. + just ignore this. */ + } else { + i_error("Can't delete mailbox directory %s: %s", + dsync_box->name, + mailbox_list_get_last_error(ns->list, NULL)); + } } mailbox_list_set_changelog_timestamp(ns->list, (time_t)-1); } From dovecot at dovecot.org Wed Jan 4 12:00:24 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 12:00:24 +0200 Subject: dovecot-2.1: istream: Don't treat max_block_size=0 as unlimited. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/59f5238c6e61 changeset: 13885:59f5238c6e61 user: Timo Sirainen date: Wed Jan 04 12:00:13 2012 +0200 description: istream: Don't treat max_block_size=0 as unlimited. diffstat: src/lib/file-copy.c | 2 +- src/lib/istream.c | 5 +++-- src/plugins/fts-squat/squat-test.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diffs (46 lines): diff -r 997a2855fd74 -r 59f5238c6e61 src/lib/file-copy.c --- a/src/lib/file-copy.c Tue Jan 03 14:42:51 2012 +0200 +++ b/src/lib/file-copy.c Wed Jan 04 12:00:13 2012 +0200 @@ -69,7 +69,7 @@ if (fchown(fd_out, (uid_t)-1, st.st_gid) < 0 && errno != EPERM) i_error("fchown(%s) failed: %m", tmppath); - input = i_stream_create_fd(fd_in, 0, FALSE); + input = i_stream_create_fd(fd_in, IO_BLOCK_SIZE, FALSE); output = o_stream_create_fd_file(fd_out, 0, FALSE); while ((ret = o_stream_send_istream(output, input)) > 0) ; diff -r 997a2855fd74 -r 59f5238c6e61 src/lib/istream.c --- a/src/lib/istream.c Tue Jan 03 14:42:51 2012 +0200 +++ b/src/lib/istream.c Wed Jan 04 12:00:13 2012 +0200 @@ -460,6 +460,8 @@ { size_t old_size; + i_assert(stream->max_buffer_size > 0); + old_size = stream->buffer_size; stream->buffer_size = stream->pos + bytes; @@ -468,8 +470,7 @@ else stream->buffer_size = nearest_power(stream->buffer_size); - if (stream->max_buffer_size > 0 && - stream->buffer_size > stream->max_buffer_size) + if (stream->buffer_size > stream->max_buffer_size) stream->buffer_size = stream->max_buffer_size; if (stream->buffer_size <= old_size) diff -r 997a2855fd74 -r 59f5238c6e61 src/plugins/fts-squat/squat-test.c --- a/src/plugins/fts-squat/squat-test.c Tue Jan 03 14:42:51 2012 +0200 +++ b/src/plugins/fts-squat/squat-test.c Wed Jan 04 12:00:13 2012 +0200 @@ -69,7 +69,7 @@ return 1; valid = buffer_create_dynamic(default_pool, 4096); - input = i_stream_create_fd(fd, 0, FALSE); + input = i_stream_create_fd(fd, (size_t)-1, FALSE); ret = 0; while (ret == 0 && (line = i_stream_read_next_line(input)) != NULL) { if (last != input->v_offset/(1024*100)) { From dovecot at dovecot.org Wed Jan 4 15:08:44 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 15:08:44 +0200 Subject: dovecot-2.1: Added MAILBOX_LIST_ITER_SELECT_SPECIALUSE option an... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/0aa94d55dcff changeset: 13886:0aa94d55dcff user: Timo Sirainen date: Wed Jan 04 15:08:39 2012 +0200 description: Added MAILBOX_LIST_ITER_SELECT_SPECIALUSE option and enable it for IMAP. RECURSIVEMATCH option doesn't currently work properly with it. diffstat: src/imap/cmd-list.c | 5 ++++- src/lib-storage/mailbox-list-iter.c | 33 +++++++++++++++++++++++---------- src/lib-storage/mailbox-list.h | 2 ++ 3 files changed, 29 insertions(+), 11 deletions(-) diffs (94 lines): diff -r 59f5238c6e61 -r 0aa94d55dcff src/imap/cmd-list.c --- a/src/imap/cmd-list.c Wed Jan 04 12:00:13 2012 +0200 +++ b/src/imap/cmd-list.c Wed Jan 04 15:08:39 2012 +0200 @@ -115,6 +115,8 @@ MAILBOX_LIST_ITER_RETURN_SUBSCRIBED; } else if (strcasecmp(str, "RECURSIVEMATCH") == 0) list_flags |= MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH; + else if (strcasecmp(str, "SPECIAL-USE") == 0) + list_flags |= MAILBOX_LIST_ITER_SELECT_SPECIALUSE; else if (strcasecmp(str, "REMOTE") == 0) { /* not supported, ignore */ } else { @@ -127,7 +129,8 @@ } if ((list_flags & MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH) != 0 && - (list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0) { + (list_flags & (MAILBOX_LIST_ITER_SELECT_SUBSCRIBED | + MAILBOX_LIST_ITER_SELECT_SPECIALUSE)) == 0) { client_send_command_error(ctx->cmd, "RECURSIVEMATCH must not be the only selection."); return FALSE; diff -r 59f5238c6e61 -r 0aa94d55dcff src/lib-storage/mailbox-list-iter.c --- a/src/lib-storage/mailbox-list-iter.c Wed Jan 04 12:00:13 2012 +0200 +++ b/src/lib-storage/mailbox-list-iter.c Wed Jan 04 15:08:39 2012 +0200 @@ -528,8 +528,12 @@ actx->new_info.flags |= MAILBOX_NOCHILDREN; match = imap_match(ctx->glob, actx->new_info.name); - if (match == IMAP_MATCH_YES) + if (match == IMAP_MATCH_YES) { + actx->new_info.special_use = + *autobox->set->special_use == '\0' ? NULL : + autobox->set->special_use; return TRUE; + } if ((match & IMAP_MATCH_PARENT) != 0 && !autobox->child_listed) { enum mailbox_info_flags old_flags = actx->new_info.flags; char sep = mail_namespace_get_sep(ctx->list->ns); @@ -602,24 +606,33 @@ autoboxes = array_get(&actx->boxes, &count); while (actx->idx < count) { autobox = &autoboxes[actx->idx++]; - if (autocreate_iter_autobox(ctx, autobox)) { - actx->new_info.special_use = - *autobox->set->special_use == '\0' ? NULL : - autobox->set->special_use; + if (autocreate_iter_autobox(ctx, autobox)) return &actx->new_info; - } } i_assert(array_count(&actx->boxes) == array_count(&actx->box_sets)); return NULL; } +static bool +special_use_selection(struct mailbox_list_iterate_context *ctx, + const struct mailbox_info *info) +{ + return (ctx->flags & MAILBOX_LIST_ITER_SELECT_SPECIALUSE) == 0 || + info->special_use != NULL; +} + const struct mailbox_info * mailbox_list_iter_next(struct mailbox_list_iterate_context *ctx) { - if (ctx->autocreate_ctx != NULL) - return autocreate_iter_next(ctx); - else - return mailbox_list_iter_next_call(ctx); + const struct mailbox_info *info; + + do { + if (ctx->autocreate_ctx != NULL) + info = autocreate_iter_next(ctx); + else + info = mailbox_list_iter_next_call(ctx); + } while (info != NULL && !special_use_selection(ctx, info)); + return info; } int mailbox_list_iter_deinit(struct mailbox_list_iterate_context **_ctx) diff -r 59f5238c6e61 -r 0aa94d55dcff src/lib-storage/mailbox-list.h --- a/src/lib-storage/mailbox-list.h Wed Jan 04 12:00:13 2012 +0200 +++ b/src/lib-storage/mailbox-list.h Wed Jan 04 15:08:39 2012 +0200 @@ -79,6 +79,8 @@ /* Return MAILBOX_CHILD_* if mailbox's children match selection criteria, even if the mailbox itself wouldn't match. */ MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH = 0x000200, + /* Return only mailboxes that have special use flags */ + MAILBOX_LIST_ITER_SELECT_SPECIALUSE = 0x000400, /* Don't return any flags unless it can be done without cost */ MAILBOX_LIST_ITER_RETURN_NO_FLAGS = 0x001000, From dovecot at dovecot.org Wed Jan 4 15:22:36 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 15:22:36 +0200 Subject: dovecot-2.1: imap-acl: Don't log errors when trying to change AC... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/11a5bb865eba changeset: 13887:11a5bb865eba user: Timo Sirainen date: Wed Jan 04 15:22:26 2012 +0200 description: imap-acl: Don't log errors when trying to change ACLs for nonexistent mailboxes. diffstat: src/plugins/imap-acl/imap-acl-plugin.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diffs (33 lines): diff -r 0aa94d55dcff -r 11a5bb865eba src/plugins/imap-acl/imap-acl-plugin.c --- a/src/plugins/imap-acl/imap-acl-plugin.c Wed Jan 04 15:08:39 2012 +0200 +++ b/src/plugins/imap-acl/imap-acl-plugin.c Wed Jan 04 15:22:26 2012 +0200 @@ -54,6 +54,7 @@ { struct mail_namespace *ns; struct mailbox *box; + enum mailbox_existence existence = MAILBOX_EXISTENCE_NONE; int ret; if (ACL_USER_CONTEXT(cmd->client->user) == NULL) { @@ -69,12 +70,16 @@ if mailbox isn't selectable but is listable. */ box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); - ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); - if (ret > 0) - return box; + if (mailbox_exists(box, TRUE, &existence) == 0 && + existence == MAILBOX_EXISTENCE_SELECT) { + ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); + if (ret > 0) + return box; + } - /* not an administrator. */ - if (acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_LOOKUP) <= 0) { + /* mailbox doesn't exist / not an administrator. */ + if (existence != MAILBOX_EXISTENCE_SELECT || + acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_LOOKUP) <= 0) { client_send_tagline(cmd, t_strdup_printf( "NO ["IMAP_RESP_CODE_NONEXISTENT"] " MAIL_ERRSTR_MAILBOX_NOT_FOUND, name)); From dovecot at dovecot.org Wed Jan 4 16:46:22 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 16:46:22 +0200 Subject: dovecot-2.1: dsync: Don't remove other namespaces entirely, just... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4f995c6e971b changeset: 13888:4f995c6e971b user: Timo Sirainen date: Wed Jan 04 16:46:12 2012 +0200 description: dsync: Don't remove other namespaces entirely, just skip the unwanted ones. This fixes incorrectly removing subscriptions=no namespaces entries from subscriptions. diffstat: src/doveadm/dsync/dsync-worker-local.c | 96 +++++++++++++-------------------- 1 files changed, 37 insertions(+), 59 deletions(-) diffs (181 lines): diff -r 11a5bb865eba -r 4f995c6e971b src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Wed Jan 04 15:22:26 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Wed Jan 04 16:46:12 2012 +0200 @@ -94,7 +94,7 @@ struct hash_table *dir_changes_hash; char alt_char; - ARRAY_DEFINE(subs_namespaces, struct mail_namespace *); + ARRAY_DEFINE(wanted_namespaces, struct mail_namespace *); mailbox_guid_t selected_box_guid; struct mailbox *selected_box; @@ -151,56 +151,23 @@ return h; } -static struct mail_namespace * -namespace_find_set(struct mail_user *user, - const struct mail_namespace_settings *set) +static bool local_worker_want_namespace(struct mail_namespace *ns) +{ + return strcmp(ns->unexpanded_set->location, + SETTING_STRVAR_UNEXPANDED) == 0; +} + +static void dsync_check_namespaces(struct local_dsync_worker *worker) { struct mail_namespace *ns; - for (ns = user->namespaces; ns != NULL; ns = ns->next) { - /* compare settings pointers so that it'll work - for shared namespaces */ - if (ns->set == set) - return ns; + for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { + if (local_worker_want_namespace(ns)) + return; } - return NULL; -} - -static void dsync_drop_extra_namespaces(struct local_dsync_worker *worker) -{ - struct mail_user *user = worker->user; - struct mail_namespace_settings *const *ns_unset, *const *ns_set; - struct mail_namespace *ns; - unsigned int i, count, count2; - - if (!array_is_created(&user->unexpanded_set->namespaces)) - return; - - /* drop all namespaces that have a location defined internally */ - ns_unset = array_get(&user->unexpanded_set->namespaces, &count); - ns_set = array_get(&user->set->namespaces, &count2); - i_assert(count == count2); - for (i = 0; i < count; i++) { - if (strcmp(ns_unset[i]->location, - SETTING_STRVAR_UNEXPANDED) == 0) - continue; - - ns = namespace_find_set(user, ns_set[i]); - i_assert(ns != NULL); - if ((ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) { - /* remember the subscriptions=no namespaces so we can - handle their subscriptions in parent namespaces - properly */ - mail_namespace_ref(ns); - array_append(&worker->subs_namespaces, &ns, 1); - } - mail_namespace_destroy(ns); - } - if (user->namespaces == NULL) { - i_fatal("All your namespaces have a location setting. " - "It should be empty (default mail_location) in the " - "namespace to be converted."); - } + i_fatal("All your namespaces have a location setting. " + "It should be empty (default mail_location) in the " + "namespace to be converted."); } struct dsync_worker * @@ -220,8 +187,8 @@ mailbox_guid_hash, mailbox_guid_cmp); i_array_init(&worker->saved_uids, 128); i_array_init(&worker->msg_get_queue, 32); - p_array_init(&worker->subs_namespaces, pool, 8); - dsync_drop_extra_namespaces(worker); + p_array_init(&worker->wanted_namespaces, pool, 8); + dsync_check_namespaces(worker); mail_user_ref(worker->user); return &worker->worker; @@ -231,13 +198,9 @@ { struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; - struct mail_namespace **nsp; i_assert(worker->save_input == NULL); - array_foreach_modifiable(&worker->subs_namespaces, nsp) - mail_namespace_unref(nsp); - local_worker_msg_box_close(worker); local_worker_mailbox_close(worker); mail_user_unref(&worker->user); @@ -417,7 +380,7 @@ hash_table_create(default_pool, worker->pool, 0, dir_change_hash, dir_change_cmp); for (ns = worker->user->namespaces; ns != NULL; ns = ns->next) { - if (ns->alias_for != NULL) + if (ns->alias_for != NULL || !local_worker_want_namespace(ns)) continue; if (dsync_worker_get_list_mailbox_log(worker, ns->list) < 0) @@ -537,7 +500,10 @@ memset(dsync_box_r, 0, sizeof(*dsync_box_r)); - info = mailbox_list_iter_next(iter->list_iter); + while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { + if (local_worker_want_namespace(info->ns)) + break; + } if (info == NULL) return iter_next_deleted(iter, worker, dsync_box_r); @@ -646,16 +612,18 @@ struct local_dsync_worker *worker = (struct local_dsync_worker *)_worker; struct local_dsync_worker_subs_iter *iter; - enum mailbox_list_iter_flags list_flags = + const enum mailbox_list_iter_flags list_flags = MAILBOX_LIST_ITER_SKIP_ALIASES | MAILBOX_LIST_ITER_SELECT_SUBSCRIBED; + const enum namespace_type namespace_mask = + NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC; static const char *patterns[] = { "*", NULL }; iter = i_new(struct local_dsync_worker_subs_iter, 1); iter->iter.worker = _worker; iter->list_iter = mailbox_list_iter_init_namespaces(worker->user->namespaces, - patterns, NAMESPACE_PRIVATE, + patterns, namespace_mask, list_flags); (void)dsync_worker_get_mailbox_log(worker); return &iter->iter; @@ -675,11 +643,18 @@ memset(rec_r, 0, sizeof(*rec_r)); - info = mailbox_list_iter_next(iter->list_iter); + while ((info = mailbox_list_iter_next(iter->list_iter)) != NULL) { + if (local_worker_want_namespace(info->ns) || + (info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + break; + } if (info == NULL) return -1; storage_name = mailbox_list_get_storage_name(info->ns->list, info->name); + if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + storage_name = t_strconcat(info->ns->prefix, storage_name, NULL); + dsync_str_sha_to_guid(storage_name, &change_lookup.name_sha1); change_lookup.list = info->ns->list; @@ -691,7 +666,10 @@ change->unsubscribed = FALSE; rec_r->last_change = change->last_subs_change; } - rec_r->ns_prefix = info->ns->prefix; + if ((info->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) + rec_r->ns_prefix = ""; + else + rec_r->ns_prefix = info->ns->prefix; rec_r->vname = info->name; rec_r->storage_name = storage_name; return 1; From dovecot at dovecot.org Wed Jan 4 17:26:35 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 17:26:35 +0200 Subject: dovecot-2.0: lib-index: Avoid assert-crashing on keyword-update ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5ef791398c8c changeset: 13008:5ef791398c8c user: Timo Sirainen date: Wed Jan 04 17:26:25 2012 +0200 description: lib-index: Avoid assert-crashing on keyword-update record with empty keyword. diffstat: src/lib-index/mail-index-sync-keywords.c | 7 ++----- src/lib-index/mail-index-sync.c | 2 ++ src/lib-index/mail-transaction-log-view.c | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diffs (51 lines): diff -r 69c6d7436f7f -r 5ef791398c8c src/lib-index/mail-index-sync-keywords.c --- a/src/lib-index/mail-index-sync-keywords.c Tue Jan 03 14:32:08 2012 +0200 +++ b/src/lib-index/mail-index-sync-keywords.c Wed Jan 04 17:26:25 2012 +0200 @@ -261,6 +261,8 @@ unsigned int keyword_idx; int ret; + i_assert(rec->name_size > 0); + seqset_offset = sizeof(*rec) + rec->name_size; if ((seqset_offset % 4) != 0) seqset_offset += 4 - (seqset_offset % 4); @@ -270,11 +272,6 @@ end = CONST_PTR_OFFSET(rec, hdr->size); keyword_name = t_strndup(rec + 1, rec->name_size); - if (*keyword_name == '\0') { - mail_index_sync_set_corrupted(ctx, - "Trying to use empty keyword"); - return -1; - } if (!keyword_lookup(ctx, keyword_name, &keyword_idx)) keywords_header_add(ctx, keyword_name, &keyword_idx); diff -r 69c6d7436f7f -r 5ef791398c8c src/lib-index/mail-index-sync.c --- a/src/lib-index/mail-index-sync.c Tue Jan 03 14:32:08 2012 +0200 +++ b/src/lib-index/mail-index-sync.c Wed Jan 04 17:26:25 2012 +0200 @@ -83,6 +83,8 @@ uint32_t uid; size_t uidset_offset, i, size; + i_assert(u->name_size > 0); + uidset_offset = sizeof(*u) + u->name_size; if ((uidset_offset % 4) != 0) uidset_offset += 4 - (uidset_offset % 4); diff -r 69c6d7436f7f -r 5ef791398c8c src/lib-index/mail-transaction-log-view.c --- a/src/lib-index/mail-transaction-log-view.c Tue Jan 03 14:32:08 2012 +0200 +++ b/src/lib-index/mail-transaction-log-view.c Wed Jan 04 17:26:25 2012 +0200 @@ -527,6 +527,11 @@ if ((seqset_offset % 4) != 0) seqset_offset += 4 - (seqset_offset % 4); + if (rec->name_size == 0) { + mail_transaction_log_file_set_corrupted(file, + "Trying to use empty keyword"); + return FALSE; + } if (seqset_offset > rec_size) { mail_transaction_log_file_set_corrupted(file, "Invalid keyword update record size"); From dovecot at dovecot.org Wed Jan 4 17:26:45 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 Jan 2012 17:26:45 +0200 Subject: dovecot-2.1: lib-index: Avoid assert-crashing on keyword-update ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/931436c5f2cc changeset: 13889:931436c5f2cc user: Timo Sirainen date: Wed Jan 04 17:26:25 2012 +0200 description: lib-index: Avoid assert-crashing on keyword-update record with empty keyword. diffstat: src/lib-index/mail-index-sync-keywords.c | 7 ++----- src/lib-index/mail-index-sync.c | 2 ++ src/lib-index/mail-transaction-log-view.c | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diffs (51 lines): diff -r 4f995c6e971b -r 931436c5f2cc src/lib-index/mail-index-sync-keywords.c --- a/src/lib-index/mail-index-sync-keywords.c Wed Jan 04 16:46:12 2012 +0200 +++ b/src/lib-index/mail-index-sync-keywords.c Wed Jan 04 17:26:25 2012 +0200 @@ -261,6 +261,8 @@ unsigned int keyword_idx; int ret; + i_assert(rec->name_size > 0); + seqset_offset = sizeof(*rec) + rec->name_size; if ((seqset_offset % 4) != 0) seqset_offset += 4 - (seqset_offset % 4); @@ -270,11 +272,6 @@ end = CONST_PTR_OFFSET(rec, hdr->size); keyword_name = t_strndup(rec + 1, rec->name_size); - if (*keyword_name == '\0') { - mail_index_sync_set_corrupted(ctx, - "Trying to use empty keyword"); - return -1; - } if (!keyword_lookup(ctx, keyword_name, &keyword_idx)) keywords_header_add(ctx, keyword_name, &keyword_idx); diff -r 4f995c6e971b -r 931436c5f2cc src/lib-index/mail-index-sync.c --- a/src/lib-index/mail-index-sync.c Wed Jan 04 16:46:12 2012 +0200 +++ b/src/lib-index/mail-index-sync.c Wed Jan 04 17:26:25 2012 +0200 @@ -83,6 +83,8 @@ uint32_t uid; size_t uidset_offset, i, size; + i_assert(u->name_size > 0); + uidset_offset = sizeof(*u) + u->name_size; if ((uidset_offset % 4) != 0) uidset_offset += 4 - (uidset_offset % 4); diff -r 4f995c6e971b -r 931436c5f2cc src/lib-index/mail-transaction-log-view.c --- a/src/lib-index/mail-transaction-log-view.c Wed Jan 04 16:46:12 2012 +0200 +++ b/src/lib-index/mail-transaction-log-view.c Wed Jan 04 17:26:25 2012 +0200 @@ -519,6 +519,11 @@ if ((seqset_offset % 4) != 0) seqset_offset += 4 - (seqset_offset % 4); + if (rec->name_size == 0) { + mail_transaction_log_file_set_corrupted(file, + "Trying to use empty keyword"); + return FALSE; + } if (seqset_offset > rec_size) { mail_transaction_log_file_set_corrupted(file, "Invalid keyword update record size"); From dovecot at dovecot.org Fri Jan 6 13:09:57 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 13:09:57 +0200 Subject: dovecot-2.1: istream-data: Avoid assert crashing due to recently... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/899a2359450a changeset: 13890:899a2359450a user: Timo Sirainen date: Fri Jan 06 13:09:51 2012 +0200 description: istream-data: Avoid assert crashing due to recently added assert. diffstat: src/lib/istream-data.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 931436c5f2cc -r 899a2359450a src/lib/istream-data.c --- a/src/lib/istream-data.c Wed Jan 04 17:26:25 2012 +0200 +++ b/src/lib/istream-data.c Fri Jan 06 13:09:51 2012 +0200 @@ -23,6 +23,7 @@ stream = i_new(struct istream_private, 1); stream->buffer = data; stream->pos = size; + stream->max_buffer_size = (size_t)-1; stream->read = i_stream_data_read; stream->seek = i_stream_data_seek; From dovecot at dovecot.org Fri Jan 6 13:26:44 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 13:26:44 +0200 Subject: dovecot-2.1: fts-solr: Avoid using too much memory unnecessarily... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/380b0667e0a5 changeset: 13891:380b0667e0a5 user: Timo Sirainen date: Fri Jan 06 13:26:30 2012 +0200 description: fts-solr: Avoid using too much memory unnecessarily. Log a warning about huge headers. diffstat: src/plugins/fts-solr/fts-backend-solr.c | 59 +++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 7 deletions(-) diffs (110 lines): diff -r 899a2359450a -r 380b0667e0a5 src/plugins/fts-solr/fts-backend-solr.c --- a/src/plugins/fts-solr/fts-backend-solr.c Fri Jan 06 13:09:51 2012 +0200 +++ b/src/plugins/fts-solr/fts-backend-solr.c Fri Jan 06 13:26:30 2012 +0200 @@ -16,6 +16,8 @@ #include #define SOLR_CMDBUF_SIZE (1024*64) +#define SOLR_CMDBUF_FLUSH_SIZE (SOLR_CMDBUF_SIZE-128) +#define SOLR_BUFFER_WARN_SIZE (1024*1024) #define SOLR_MAX_MULTI_ROWS 100000 struct solr_fts_backend { @@ -39,6 +41,7 @@ ARRAY_DEFINE(fields, struct solr_fts_field); uint32_t last_indexed_uid; + uint32_t size_warned_uid; unsigned int last_indexed_uid_set:1; unsigned int body_open:1; @@ -63,13 +66,18 @@ return chr < 0x10ffff; } -static void -xml_encode_data(string_t *dest, const unsigned char *data, unsigned int len) +static unsigned int +xml_encode_data_max(string_t *dest, const unsigned char *data, unsigned int len, + unsigned int max_len) { unichar_t chr; unsigned int i; - for (i = 0; i < len; i++) { + i_assert(max_len > 0 || len == 0); + + if (max_len > len) + max_len = len; + for (i = 0; i < max_len; i++) { switch (data[i]) { case '&': str_append(dest, "&"); @@ -111,6 +119,13 @@ break; } } + return i; +} + +static void +xml_encode_data(string_t *dest, const unsigned char *data, unsigned int len) +{ + (void)xml_encode_data_max(dest, data, len, len); } static void xml_encode(string_t *dest, const char *str) @@ -477,19 +492,49 @@ { struct solr_fts_backend_update_context *ctx = (struct solr_fts_backend_update_context *)_ctx; + unsigned int len; if (_ctx->failed) return -1; - xml_encode_data(ctx->cur_value, data, size); - if (ctx->cur_value2 != NULL) - xml_encode_data(ctx->cur_value2, data, size); + if (ctx->cur_value2 == NULL && ctx->cur_value == ctx->cmd) { + /* we're writing to message body. if size is huge, + flush it once in a while */ + while (size >= SOLR_CMDBUF_FLUSH_SIZE) { + if (str_len(ctx->cmd) >= SOLR_CMDBUF_FLUSH_SIZE) { + solr_connection_post_more(ctx->post, + str_data(ctx->cmd), + str_len(ctx->cmd)); + str_truncate(ctx->cmd, 0); + } + len = xml_encode_data_max(ctx->cmd, data, size, + SOLR_CMDBUF_FLUSH_SIZE - + str_len(ctx->cmd)); + i_assert(len > 0); + data += len; + size -= len; + } + } else { + xml_encode_data(ctx->cur_value, data, size); + if (ctx->cur_value2 != NULL) + xml_encode_data(ctx->cur_value2, data, size); + } - if (str_len(ctx->cmd) > SOLR_CMDBUF_SIZE-128) { + if (str_len(ctx->cmd) >= SOLR_CMDBUF_FLUSH_SIZE) { solr_connection_post_more(ctx->post, str_data(ctx->cmd), str_len(ctx->cmd)); str_truncate(ctx->cmd, 0); } + if (str_len(ctx->cur_value) >= SOLR_BUFFER_WARN_SIZE && + ctx->size_warned_uid != ctx->prev_uid) { + /* a large header */ + i_assert(ctx->cur_value != ctx->cmd); + + ctx->size_warned_uid = ctx->prev_uid; + i_warning("fts-solr(%s): Mailbox %s UID=%u header size is huge", + ctx->cur_box->storage->user->username, + mailbox_get_vname(ctx->cur_box), ctx->prev_uid); + } return 0; } From dovecot at dovecot.org Fri Jan 6 13:50:29 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 13:50:29 +0200 Subject: dovecot-2.1: auth: If master_user is specified by userdb, don't ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/f0d11bd4e5f5 changeset: 13892:f0d11bd4e5f5 user: Timo Sirainen date: Fri Jan 06 13:50:07 2012 +0200 description: auth: If master_user is specified by userdb, don't add another one to reply. The one specified by userdb should have overridden the other one though. diffstat: src/auth/auth-request-handler.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 380b0667e0a5 -r f0d11bd4e5f5 src/auth/auth-request-handler.c --- a/src/auth/auth-request-handler.c Fri Jan 06 13:26:30 2012 +0200 +++ b/src/auth/auth-request-handler.c Fri Jan 06 13:50:07 2012 +0200 @@ -597,7 +597,9 @@ case USERDB_RESULT_OK: auth_stream_reply_add(reply, "USER", NULL); auth_stream_reply_add(reply, NULL, dec2str(request->id)); - if (request->master_user != NULL) { + if (request->master_user != NULL && + auth_stream_reply_find(request->userdb_reply, + "master_user") == NULL) { auth_stream_reply_add(request->userdb_reply, "master_user", request->master_user); From dovecot at dovecot.org Fri Jan 6 14:27:27 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 14:27:27 +0200 Subject: dovecot-2.1: doveadm: Renamed dsync commands. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/383286ae9071 changeset: 13893:383286ae9071 user: Timo Sirainen date: Fri Jan 06 14:21:25 2012 +0200 description: doveadm: Renamed dsync commands. diffstat: src/doveadm/dsync/doveadm-dsync.c | 67 +++++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 23 deletions(-) diffs (145 lines): diff -r f0d11bd4e5f5 -r 383286ae9071 src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 13:50:07 2012 +0200 +++ b/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 14:21:25 2012 +0200 @@ -87,11 +87,14 @@ p = strchr(argv[0], '/'); if (p == NULL) p = argv[0]; - if (strstr(p, "dsync") == NULL) { - /* we're executing doveadm (not dsync) */ - p = "dsync"; array_append(&cmd_args, &p, 1); + if (strstr(p, "dsync") != NULL) { + /* we're executing dsync */ + p = "server"; + } else { + /* we're executing doveadm */ + p = "dsync-server"; } - p = "server"; array_append(&cmd_args, &p, 1); + array_append(&cmd_args, &p, 1); (void)array_append_space(&cmd_args); *cmd_args_r = array_idx(&cmd_args, 0); } @@ -141,8 +144,7 @@ array_append(&cmd_args, &ssh_cmd, 1); array_append(&cmd_args, &host, 1); p = "doveadm"; array_append(&cmd_args, &p, 1); - p = "dsync"; array_append(&cmd_args, &p, 1); - p = "server"; array_append(&cmd_args, &p, 1); + p = "dsync-server"; array_append(&cmd_args, &p, 1); if (*user != '\0') { p = "-u"; array_append(&cmd_args, &p, 1); array_append(&cmd_args, &user, 1); @@ -256,7 +258,7 @@ const char *username = ""; if (args[0] == NULL) - doveadm_mail_help_name("dsync"); + doveadm_mail_help_name(_ctx->cmd->name); lib_signals_ignore(SIGHUP, TRUE); @@ -272,7 +274,7 @@ if (!mirror_get_remote_cmd(args, username, &ctx->remote_cmd_args)) { /* it's a mail_location */ if (args[1] != NULL) - doveadm_mail_help_name("dsync"); + doveadm_mail_help_name(_ctx->cmd->name); ctx->local_location = args[0]; } @@ -298,6 +300,9 @@ struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx; switch (c) { + case 'E': + /* dsync backup wrapper detection flag */ + break; case 'f': ctx->brain_flags |= DSYNC_BRAIN_FLAG_FULL_SYNC; break; @@ -318,7 +323,7 @@ struct dsync_cmd_context *ctx; ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context); - ctx->ctx.getopt_args = "fRm:"; + ctx->ctx.getopt_args = "EfRm:"; ctx->ctx.v.parse_arg = cmd_mailbox_dsync_parse_arg; ctx->ctx.v.preinit = cmd_dsync_preinit; ctx->ctx.v.init = cmd_dsync_init; @@ -367,14 +372,14 @@ } struct doveadm_mail_cmd cmd_dsync_mirror = { - cmd_dsync_alloc, "dsync mirror", "[-fR] [-m ] " + cmd_dsync_alloc, "sync", "[-fR] [-m ] " }; struct doveadm_mail_cmd cmd_dsync_backup = { - cmd_dsync_backup_alloc, "dsync backup", + cmd_dsync_backup_alloc, "backup", "[-fR] [-m ] " }; struct doveadm_mail_cmd cmd_dsync_server = { - cmd_dsync_server_alloc, "dsync server", NULL + cmd_dsync_server_alloc, "dsync-server", NULL }; void doveadm_dsync_main(int *_argc, char **_argv[]) @@ -383,9 +388,10 @@ const char *getopt_str; char **argv = *_argv; char **new_argv, *mailbox = NULL, *alt_char = NULL; - char *p, *dup, new_flags[5]; + char *p, *dup, new_flags[6]; int max_argc, src, dest, i, j; bool flag_f = FALSE, flag_R = FALSE, flag_m, flag_C, has_arg; + bool backup_flag = FALSE; p = strrchr(argv[0], '/'); if (p == NULL) p = argv[0]; @@ -453,20 +459,35 @@ "dsync_alt_char=", alt_char, NULL); } - new_argv[dest++] = "dsync"; - if (src < argc) { - /* mirror|backup|server */ - if (strcmp(argv[src], "dsync") == 0) { - /* looks like we executed doveconf, which - re-executed ourself with new parameters. - no need to change them anymore. */ - return; - } - new_argv[dest++] = argv[src++]; + /* mirror|backup|server */ + if (src == argc) + i_fatal("Missing mirror or backup parameter"); + if (strcmp(argv[src], "sync") == 0 || + strcmp(argv[src], "dsync-server") == 0) { + /* we're re-executing dsync due to doveconf. + "backup" re-exec detection is later. */ + return; + } + if (strcmp(argv[src], "mirror") == 0) + new_argv[dest] = "sync"; + else if (strcmp(argv[src], "backup") == 0) { + backup_flag = TRUE; + new_argv[dest] = "backup"; + } else if (strcmp(argv[src], "server") == 0) + new_argv[dest] = "dsync-server"; + else + i_fatal("Invalid parameter: %s", argv[src]); + src++; dest++; + + if (src < argc && strncmp(argv[src], "-E", 2) == 0) { + /* we're re-executing dsync due to doveconf */ + return; } /* dsync flags */ new_flags[0] = '-'; i = 1; + if (backup_flag) + new_flags[i++] = 'E'; if (flag_f) new_flags[i++] = 'f'; if (flag_R) From dovecot at dovecot.org Fri Jan 6 14:27:27 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 14:27:27 +0200 Subject: dovecot-2.1: doveadm: Hide "dsync-server" from list of commands. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/08e5bc9cd64a changeset: 13894:08e5bc9cd64a user: Timo Sirainen date: Fri Jan 06 14:24:06 2012 +0200 description: doveadm: Hide "dsync-server" from list of commands. diffstat: src/doveadm/doveadm-mail.c | 3 +++ src/doveadm/doveadm-mail.h | 1 + src/doveadm/dsync/doveadm-dsync.c | 2 +- 3 files changed, 5 insertions(+), 1 deletions(-) diffs (43 lines): diff -r 383286ae9071 -r 08e5bc9cd64a src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Fri Jan 06 14:21:25 2012 +0200 +++ b/src/doveadm/doveadm-mail.c Fri Jan 06 14:24:06 2012 +0200 @@ -29,6 +29,7 @@ void (*hook_doveadm_mail_init)(struct doveadm_mail_cmd_context *ctx); struct doveadm_mail_cmd_module_register doveadm_mail_cmd_module_register = { 0 }; +char doveadm_mail_cmd_hide = '\0'; static int killed_signo = 0; @@ -518,6 +519,8 @@ const struct doveadm_mail_cmd *cmd; array_foreach(&doveadm_mail_cmds, cmd) { + if (cmd->usage_args == &doveadm_mail_cmd_hide) + continue; str_printfa(out, "%s\t[-u |-A] [-S ]", cmd->name); if (cmd->usage_args != NULL) diff -r 383286ae9071 -r 08e5bc9cd64a src/doveadm/doveadm-mail.h --- a/src/doveadm/doveadm-mail.h Fri Jan 06 14:21:25 2012 +0200 +++ b/src/doveadm/doveadm-mail.h Fri Jan 06 14:24:06 2012 +0200 @@ -72,6 +72,7 @@ extern ARRAY_TYPE(doveadm_mail_cmd) doveadm_mail_cmds; extern void (*hook_doveadm_mail_init)(struct doveadm_mail_cmd_context *ctx); extern struct doveadm_mail_cmd_module_register doveadm_mail_cmd_module_register; +extern char doveadm_mail_cmd_hide; bool doveadm_mail_try_run(const char *cmd_name, int argc, char *argv[]); void doveadm_mail_register_cmd(const struct doveadm_mail_cmd *cmd); diff -r 383286ae9071 -r 08e5bc9cd64a src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 14:21:25 2012 +0200 +++ b/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 14:24:06 2012 +0200 @@ -379,7 +379,7 @@ "[-fR] [-m ] " }; struct doveadm_mail_cmd cmd_dsync_server = { - cmd_dsync_server_alloc, "dsync-server", NULL + cmd_dsync_server_alloc, "dsync-server", &doveadm_mail_cmd_hide }; void doveadm_dsync_main(int *_argc, char **_argv[]) From dovecot at dovecot.org Fri Jan 6 14:29:43 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 14:29:43 +0200 Subject: dovecot-2.0: auth: If master_user is specified by userdb, don't ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/684381041dc4 changeset: 13009:684381041dc4 user: Timo Sirainen date: Fri Jan 06 14:29:38 2012 +0200 description: auth: If master_user is specified by userdb, don't add another one to reply. The one specified by userdb should have overridden the other one though. diffstat: src/auth/auth-request-handler.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 5ef791398c8c -r 684381041dc4 src/auth/auth-request-handler.c --- a/src/auth/auth-request-handler.c Wed Jan 04 17:26:25 2012 +0200 +++ b/src/auth/auth-request-handler.c Fri Jan 06 14:29:38 2012 +0200 @@ -587,7 +587,9 @@ case USERDB_RESULT_OK: auth_stream_reply_add(reply, "USER", NULL); auth_stream_reply_add(reply, NULL, dec2str(request->id)); - if (request->master_user != NULL) { + if (request->master_user != NULL && + auth_stream_reply_find(request->userdb_reply, + "master_user") == NULL) { auth_stream_reply_add(request->userdb_reply, "master_user", request->master_user); From dovecot at dovecot.org Fri Jan 6 15:17:27 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 15:17:27 +0200 Subject: dovecot-2.1: lib-storage: Renamed mail_save_context.copying to c... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7f549b7eb77f changeset: 13895:7f549b7eb77f user: Timo Sirainen date: Fri Jan 06 15:17:20 2012 +0200 description: lib-storage: Renamed mail_save_context.copying to copying_via_save. diffstat: src/lib-storage/mail-copy.c | 2 +- src/lib-storage/mail-storage-private.h | 4 ++-- src/plugins/notify/notify-storage.c | 2 +- src/plugins/quota/quota-storage.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diffs (50 lines): diff -r 08e5bc9cd64a -r 7f549b7eb77f src/lib-storage/mail-copy.c --- a/src/lib-storage/mail-copy.c Fri Jan 06 14:24:06 2012 +0200 +++ b/src/lib-storage/mail-copy.c Fri Jan 06 15:17:20 2012 +0200 @@ -29,7 +29,7 @@ const char *from_envelope, *guid; time_t received_date; - ctx->copying = TRUE; + ctx->copying_via_save = TRUE; /* we need to open the file in any case. caching metadata is unlikely to help anything. */ diff -r 08e5bc9cd64a -r 7f549b7eb77f src/lib-storage/mail-storage-private.h --- a/src/lib-storage/mail-storage-private.h Fri Jan 06 14:24:06 2012 +0200 +++ b/src/lib-storage/mail-storage-private.h Fri Jan 06 15:17:20 2012 +0200 @@ -447,8 +447,8 @@ bool (*part_is_attachment)(struct mail_save_context *ctx, const struct mail_attachment_part *part); - /* we came here from mailbox_copy() */ - unsigned int copying:1; + /* mail was copied using saving */ + unsigned int copying_via_save:1; }; struct mailbox_sync_context { diff -r 08e5bc9cd64a -r 7f549b7eb77f src/plugins/notify/notify-storage.c --- a/src/plugins/notify/notify-storage.c Fri Jan 06 14:24:06 2012 +0200 +++ b/src/plugins/notify/notify-storage.c Fri Jan 06 15:17:20 2012 +0200 @@ -128,7 +128,7 @@ { union mailbox_module_context *lbox = NOTIFY_CONTEXT(ctx->transaction->box); - struct mail *dest_mail = ctx->copying ? NULL : ctx->dest_mail; + struct mail *dest_mail = ctx->copying_via_save ? NULL : ctx->dest_mail; if (lbox->super.save_finish(ctx) < 0) return -1; diff -r 08e5bc9cd64a -r 7f549b7eb77f src/plugins/quota/quota-storage.c --- a/src/plugins/quota/quota-storage.c Fri Jan 06 14:24:06 2012 +0200 +++ b/src/plugins/quota/quota-storage.c Fri Jan 06 15:17:20 2012 +0200 @@ -171,7 +171,7 @@ return -1; /* if copying used saving internally, we already checked the quota */ - return ctx->copying ? 0 : quota_check(t, ctx->dest_mail); + return ctx->copying_via_save ? 0 : quota_check(t, ctx->dest_mail); } static int From dovecot at dovecot.org Fri Jan 6 15:24:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 15:24:04 +0200 Subject: dovecot-2.1: lib-storage: Added mailbox_save_using_mail() Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1e58372ee6f0 changeset: 13896:1e58372ee6f0 user: Timo Sirainen date: Fri Jan 06 15:22:52 2012 +0200 description: lib-storage: Added mailbox_save_using_mail() diffstat: src/lib-storage/mail-storage-private.h | 2 ++ src/lib-storage/mail-storage.c | 7 +++++++ src/lib-storage/mail-storage.h | 4 ++++ 3 files changed, 13 insertions(+), 0 deletions(-) diffs (50 lines): diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage-private.h --- a/src/lib-storage/mail-storage-private.h Fri Jan 06 15:17:20 2012 +0200 +++ b/src/lib-storage/mail-storage-private.h Fri Jan 06 15:22:52 2012 +0200 @@ -449,6 +449,8 @@ /* mail was copied using saving */ unsigned int copying_via_save:1; + /* mail is being saved, not copied */ + unsigned int saving:1; }; struct mailbox_sync_context { diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Fri Jan 06 15:17:20 2012 +0200 +++ b/src/lib-storage/mail-storage.c Fri Jan 06 15:22:52 2012 +0200 @@ -1613,6 +1613,7 @@ return -1; } + (*ctx)->saving = TRUE; if (box->v.save_begin == NULL) { mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE, "Saving messages not supported"); @@ -1685,6 +1686,12 @@ return ret; } +int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail) +{ + (*ctx)->saving = TRUE; + return mailbox_copy(ctx, mail); +} + bool mailbox_is_inconsistent(struct mailbox *box) { return box->mailbox_deleted || box->v.is_inconsistent(box); diff -r 7f549b7eb77f -r 1e58372ee6f0 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Fri Jan 06 15:17:20 2012 +0200 +++ b/src/lib-storage/mail-storage.h Fri Jan 06 15:22:52 2012 +0200 @@ -666,6 +666,10 @@ /* Copy the given message. You'll need to specify the flags etc. using the mailbox_save_*() functions. */ int mailbox_copy(struct mail_save_context **ctx, struct mail *mail); +/* Same as mailbox_copy(), but treat the message as if it's being saved, + not copied. (For example: New mail delivered to multiple maildirs, with + each mails being hard link copies.) */ +int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail); struct mail *mail_alloc(struct mailbox_transaction_context *t, enum mail_fetch_field wanted_fields, From dovecot at dovecot.org Fri Jan 6 15:24:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 15:24:04 +0200 Subject: dovecot-2.1: lib-lda: Use mailbox_save_using_mail() instead of m... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/dfe7158a48ff changeset: 13897:dfe7158a48ff user: Timo Sirainen date: Fri Jan 06 15:23:12 2012 +0200 description: lib-lda: Use mailbox_save_using_mail() instead of mailbox_copy() for saving mails. diffstat: src/lib-lda/mail-deliver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 1e58372ee6f0 -r dfe7158a48ff src/lib-lda/mail-deliver.c --- a/src/lib-lda/mail-deliver.c Fri Jan 06 15:22:52 2012 +0200 +++ b/src/lib-lda/mail-deliver.c Fri Jan 06 15:23:12 2012 +0200 @@ -308,7 +308,7 @@ mailbox_save_set_dest_mail(save_ctx, ctx->dest_mail); mail_deliver_deduplicate_guid_if_needed(ctx->session, save_ctx); - if (mailbox_copy(&save_ctx, ctx->src_mail) < 0) + if (mailbox_save_using_mail(&save_ctx, ctx->src_mail) < 0) ret = -1; else mail_deliver_log_cache_var_expand_table(ctx); From dovecot at dovecot.org Fri Jan 6 15:24:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 15:24:04 +0200 Subject: dovecot-2.1: mail-log: Log all mail deliveries with "save" event... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e749d3171acd changeset: 13898:e749d3171acd user: Timo Sirainen date: Fri Jan 06 15:23:53 2012 +0200 description: mail-log: Log all mail deliveries with "save" event, even if it happened via copying. diffstat: src/plugins/mail-log/mail-log-plugin.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diffs (25 lines): diff -r dfe7158a48ff -r e749d3171acd src/plugins/mail-log/mail-log-plugin.c --- a/src/plugins/mail-log/mail-log-plugin.c Fri Jan 06 15:23:12 2012 +0200 +++ b/src/plugins/mail-log/mail-log-plugin.c Fri Jan 06 15:23:53 2012 +0200 @@ -360,15 +360,17 @@ (struct mail_log_mail_txn_context *)txn; const char *desc; - if (strcmp(src->box->storage->name, "raw") == 0) { - /* special case: lda/lmtp is saving a mail */ - desc = "save"; + if (dst->saving) { + /* we came from mailbox_save_using_mail() */ + mail_log_append_mail_message(ctx, dst, + MAIL_LOG_EVENT_SAVE, "save"); } else { desc = t_strdup_printf("copy from %s", str_sanitize(mailbox_get_name(src->box), MAILBOX_NAME_LOG_LEN)); + mail_log_append_mail_message(ctx, dst, + MAIL_LOG_EVENT_COPY, desc); } - mail_log_append_mail_message(ctx, dst, MAIL_LOG_EVENT_COPY, desc); } static void mail_log_mail_expunge(void *txn, struct mail *mail) From dovecot at dovecot.org Fri Jan 6 16:01:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 16:01:06 +0200 Subject: dovecot-2.1: log: Removed unnecessary code. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/66facb0594a1 changeset: 13899:66facb0594a1 user: Timo Sirainen date: Fri Jan 06 16:00:45 2012 +0200 description: log: Removed unnecessary code. diffstat: src/log/log-connection.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diffs (12 lines): diff -r e749d3171acd -r 66facb0594a1 src/log/log-connection.c --- a/src/log/log-connection.c Fri Jan 06 15:23:53 2012 +0200 +++ b/src/log/log-connection.c Fri Jan 06 16:00:45 2012 +0200 @@ -95,8 +95,6 @@ line, net_ip2addr(&client->ip)); } } - prefix = client != NULL && client->prefix != NULL ? - client->prefix : log->default_prefix; i_set_failure_prefix(prefix); i_log_type(&failure_ctx, "master: %s", line); i_set_failure_prefix("log: "); From dovecot at dovecot.org Fri Jan 6 18:42:57 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:42:57 +0200 Subject: dovecot-2.0: Released v2.0.17. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/53cccb1b4168 changeset: 13010:53cccb1b4168 user: Timo Sirainen date: Fri Jan 06 16:04:15 2012 +0200 description: Released v2.0.17. diffstat: NEWS | 8 ++++++++ configure.in | 2 +- 2 files changed, 9 insertions(+), 1 deletions(-) diffs (25 lines): diff -r 684381041dc4 -r 53cccb1b4168 NEWS --- a/NEWS Fri Jan 06 14:29:38 2012 +0200 +++ b/NEWS Fri Jan 06 16:04:15 2012 +0200 @@ -1,3 +1,11 @@ +v2.0.17 2012-01-06 Timo Sirainen + + + Proxying now supports sending SSL client certificate to server with + ssl_client_cert/key settings. + + doveadm dump: Added support for dumping dbox headers/metadata. + - Fixed memory leaks in login processes with SSL connections + - vpopmail support was broken in v2.0.16 + v2.0.16 2011-11-17 Timo Sirainen * VSZ limits weren't being enforced for any processes. On server with diff -r 684381041dc4 -r 53cccb1b4168 configure.in --- a/configure.in Fri Jan 06 14:29:38 2012 +0200 +++ b/configure.in Fri Jan 06 16:04:15 2012 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.0.16],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.0.17],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Fri Jan 6 18:42:57 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:42:57 +0200 Subject: dovecot-2.0: Added tag 2.0.17 for changeset 53cccb1b4168 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/7c592f93aa14 changeset: 13011:7c592f93aa14 user: Timo Sirainen date: Fri Jan 06 16:04:15 2012 +0200 description: Added tag 2.0.17 for changeset 53cccb1b4168 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 53cccb1b4168 -r 7c592f93aa14 .hgtags --- a/.hgtags Fri Jan 06 16:04:15 2012 +0200 +++ b/.hgtags Fri Jan 06 16:04:15 2012 +0200 @@ -67,3 +67,4 @@ aa68f38c04f080fe4d3142fb3f73425b78ef98bd 2.0.14 11ef524500964054ae8e4e6150f890b1864139eb 2.0.15 7a321a6a96d9d0bd345685f822ba1751334e7402 2.0.16 +53cccb1b4168f9c8322145d0e8d1636021f2efff 2.0.17 From dovecot at dovecot.org Fri Jan 6 18:42:57 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:42:57 +0200 Subject: dovecot-2.0: Added signature for changeset 53cccb1b4168 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/38972af8bd29 changeset: 13012:38972af8bd29 user: Timo Sirainen date: Fri Jan 06 16:04:20 2012 +0200 description: Added signature for changeset 53cccb1b4168 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 7c592f93aa14 -r 38972af8bd29 .hgsigs --- a/.hgsigs Fri Jan 06 16:04:15 2012 +0200 +++ b/.hgsigs Fri Jan 06 16:04:20 2012 +0200 @@ -30,3 +30,4 @@ aa68f38c04f080fe4d3142fb3f73425b78ef98bd 0 iEYEABECAAYFAk5bEKIACgkQyUhSUUBVislRhwCePWvqh3c+EitvNe1XlMqxpwWvDDgAoJKjDnmLwk0U62IhIQ+x90DEIgl6 11ef524500964054ae8e4e6150f890b1864139eb 0 iEYEABECAAYFAk5zUvIACgkQyUhSUUBVisnDTgCdHVHSwKeZjHV4KrlTmqipFoO26mkAoIMqPTna3Y1ETIGnPq6XRCB90C8p 7a321a6a96d9d0bd345685f822ba1751334e7402 0 iEYEABECAAYFAk7EQKAACgkQyUhSUUBVisld+ACbBWyJWJmyfyvb6mpvdGnHg6tl5eUAni8p1sYBzklUoFwwfe3CGUOyHiB9 +53cccb1b4168f9c8322145d0e8d1636021f2efff 0 iEYEABECAAYFAk8G/18ACgkQyUhSUUBVisl6NQCgpZXFFmbO06eA0cjsUPrMxsLqlVAAn0OcG9df71+/3q/EP4TfFb5fUkgu From dovecot at dovecot.org Fri Jan 6 18:43:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:43:03 +0200 Subject: dovecot-2.1: Released v2.1.rc2. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a14b7333ae45 changeset: 13900:a14b7333ae45 user: Timo Sirainen date: Fri Jan 06 16:02:33 2012 +0200 description: Released v2.1.rc2. diffstat: NEWS | 20 ++++++++++++++++++++ TODO | 10 ++++++---- configure.in | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diffs (65 lines): diff -r 66facb0594a1 -r a14b7333ae45 NEWS --- a/NEWS Fri Jan 06 16:00:45 2012 +0200 +++ b/NEWS Fri Jan 06 16:02:33 2012 +0200 @@ -1,3 +1,22 @@ +v2.1.rc2 2012-01-06 Timo Sirainen + + * dsync was merged into doveadm. There is still "dsync" symlink + pointing to "doveadm", which you can use the old way for now. + The preferred ways to run dsync are "doveadm sync" (for old "dsync + mirror") and "doveadm backup". + + + IMAP SPECIAL-USE extension to describe mailboxes + + Added mailbox {} sections, which deprecate autocreate plugin + + lib-fs: Added "mode" parameter to "posix" backend to specify mode + for created files/dirs (for mail_attachment_dir). + + inet_listener names are now used to figure out what type the socket + is when useful. For example naming service auth { inet_listener } to + auth-client vs. auth-userdb has different behavior. + + Added pop3c (= POP3 client) storage backend. + - LMTP proxying code was simplified, hopefully fixing its problems. + - dsync: Don't remove user's subscriptions for subscriptions=no + namespaces. + v2.1.rc1 2011-11-24 Timo Sirainen * Plugins now use UTF-8 mailbox names rather than mUTF-7: @@ -18,6 +37,7 @@ + FTS finally supports "OR" search operation + FTS supports indexing attachments via external programs + IMAP FUZZY extension, supported by Lucene and Solr FTS backends + + IMAP SPECIAL-USE extension to describe mailboxes + Mailbox list indexes + Statistics tracking via stats service. Exported via doveadm stats. + Autocreate plugin creates/subscribes mailboxes physically only when diff -r 66facb0594a1 -r a14b7333ae45 TODO --- a/TODO Fri Jan 06 16:00:45 2012 +0200 +++ b/TODO Fri Jan 06 16:02:33 2012 +0200 @@ -1,11 +1,13 @@ - imapc: - prefetching to THREAD and SORT - check all imap extensions and see if some don't work (condstore) - - imapc: replacing existing imapc stream in error recovery crashes with - file index-mail.c: line 812 (index_mail_stream_destroy_callback): - assertion failed: (mail->data.destroying_stream) - - per-namespace imapc_* settings? + - per-namespace imapc_* settings? create a way to "copy" a settings struct, + so mail_storage_settings are copied to mail_namespace_settings. use the + change tracking to figure out what settings are namespace-specific. + - imap: list (special-use recursivematch) "" % doesn't work + - passdb, userdb { username_format } that doesn't permanently change + the username - mdbox/sdbox index rebuild -> quota rebuild? - solr separate attachments (patch) - sql connection pooling: Count lookup latencies, avoid servers with diff -r 66facb0594a1 -r a14b7333ae45 configure.in --- a/configure.in Fri Jan 06 16:00:45 2012 +0200 +++ b/configure.in Fri Jan 06 16:02:33 2012 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.rc1],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.rc2],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Fri Jan 6 18:43:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:43:03 +0200 Subject: dovecot-2.1: Added tag 2.1.rc2 for changeset a14b7333ae45 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/18d201efd02e changeset: 13901:18d201efd02e user: Timo Sirainen date: Fri Jan 06 16:02:33 2012 +0200 description: Added tag 2.1.rc2 for changeset a14b7333ae45 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r a14b7333ae45 -r 18d201efd02e .hgtags --- a/.hgtags Fri Jan 06 16:02:33 2012 +0200 +++ b/.hgtags Fri Jan 06 16:02:33 2012 +0200 @@ -70,3 +70,4 @@ f9e744ffe02135f6dc75e62db366bd39a8e19f99 2.1.alpha2 437ae2c24872b59056d08c7e67a0db5354710065 2.1.beta1 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 2.1.rc1 +a14b7333ae458eb669ebbe5ec85488b81e223267 2.1.rc2 From dovecot at dovecot.org Fri Jan 6 18:43:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 18:43:03 +0200 Subject: dovecot-2.1: Added signature for changeset a14b7333ae45 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3f96b6427e69 changeset: 13902:3f96b6427e69 user: Timo Sirainen date: Fri Jan 06 16:02:36 2012 +0200 description: Added signature for changeset a14b7333ae45 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 18d201efd02e -r 3f96b6427e69 .hgsigs --- a/.hgsigs Fri Jan 06 16:02:33 2012 +0200 +++ b/.hgsigs Fri Jan 06 16:02:36 2012 +0200 @@ -33,3 +33,4 @@ f9e744ffe02135f6dc75e62db366bd39a8e19f99 0 iEYEABECAAYFAk5zVngACgkQyUhSUUBVisntgQCfaceKIsHTtbu6LpUd2Tjj8lIHXZYAn3mCNW+Fc43t6M1tIE/ZUEwiWzCv 437ae2c24872b59056d08c7e67a0db5354710065 0 iEYEABECAAYFAk65qLwACgkQyUhSUUBVismRQACfad1LMF1iLd3vsFmxsONlDFEgxVwAnRmJRtv17mIUxvuzixLgc6bEtJvX 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 0 iEUEABECAAYFAk7NkY0ACgkQyUhSUUBVisl8xgCfSg6EA1Bz+7vShYM1YzRQCXNJx7UAlRBpHQmMenUfxRi/98DUsQs0uN0= +a14b7333ae458eb669ebbe5ec85488b81e223267 0 iEYEABECAAYFAk8G/vkACgkQyUhSUUBVisnObQCePLKBz9KeNrU2YadqtlzDe65V7zwAn1+M0om2SFMlzTG251xszcN4g4gn From dovecot at dovecot.org Fri Jan 6 19:15:12 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 19:15:12 +0200 Subject: dovecot-2.1: Makefile: added missing file Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5f4b1539b406 changeset: 13903:5f4b1539b406 user: Timo Sirainen date: Fri Jan 06 19:15:03 2012 +0200 description: Makefile: added missing file diffstat: src/doveadm/dsync/Makefile.am | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 3f96b6427e69 -r 5f4b1539b406 src/doveadm/dsync/Makefile.am --- a/src/doveadm/dsync/Makefile.am Fri Jan 06 16:02:36 2012 +0200 +++ b/src/doveadm/dsync/Makefile.am Fri Jan 06 19:15:03 2012 +0200 @@ -28,6 +28,7 @@ dsync-worker-local.c noinst_HEADERS = \ + doveadm-dsync.h \ dsync-brain.h \ dsync-brain-private.h \ dsync-data.h \ From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: master: log/anvil listener names weren't set correc... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/326b05f0246b changeset: 13904:326b05f0246b user: Timo Sirainen date: Fri Jan 06 19:29:23 2012 +0200 description: master: log/anvil listener names weren't set correctly. Also this fixes a long standing static analyzer "error". diffstat: src/master/service-process.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-) diffs (80 lines): diff -r 5f4b1539b406 -r 326b05f0246b src/master/service-process.c --- a/src/master/service-process.c Fri Jan 06 19:15:03 2012 +0200 +++ b/src/master/service-process.c Fri Jan 06 19:29:23 2012 +0200 @@ -40,7 +40,8 @@ struct service_listener *const *listeners; ARRAY_TYPE(dup2) dups; string_t *listener_names; - unsigned int i, count, n = 0, socket_listener_count, ssl_socket_count; + int fd = MASTER_LISTEN_FD_FIRST; + unsigned int i, count, socket_listener_count, ssl_socket_count; /* stdin/stdout is already redirected to /dev/null. Other master fds should have been opened with fd_close_on_exec() so we don't have to @@ -56,20 +57,18 @@ switch (service->type) { case SERVICE_TYPE_LOG: - i_assert(n == 0); - services_log_dup2(&dups, service->list, MASTER_LISTEN_FD_FIRST, + i_assert(fd == MASTER_LISTEN_FD_FIRST); + services_log_dup2(&dups, service->list, fd, &socket_listener_count); - n += socket_listener_count; + fd += socket_listener_count; break; case SERVICE_TYPE_ANVIL: dup2_append(&dups, service_anvil_global->log_fdpass_fd[0], MASTER_ANVIL_LOG_FDPASS_FD); /* nonblocking anvil fd must be the first one. anvil treats it as the master's fd */ - dup2_append(&dups, service_anvil_global->nonblocking_fd[0], - MASTER_LISTEN_FD_FIRST + n++); - dup2_append(&dups, service_anvil_global->blocking_fd[0], - MASTER_LISTEN_FD_FIRST + n++); + dup2_append(&dups, service_anvil_global->nonblocking_fd[0], fd++); + dup2_append(&dups, service_anvil_global->blocking_fd[0], fd++); socket_listener_count += 2; break; default: @@ -77,7 +76,7 @@ } /* anvil/log fds have no names */ - for (i = MASTER_LISTEN_FD_FIRST; i < n; i++) + for (i = MASTER_LISTEN_FD_FIRST; i < (unsigned int)fd; i++) str_append_c(listener_names, '\t'); /* first add non-ssl listeners */ @@ -87,9 +86,8 @@ !listeners[i]->set.inetset.set->ssl)) { str_tabescape_write(listener_names, listeners[i]->name); str_append_c(listener_names, '\t'); - dup2_append(&dups, listeners[i]->fd, - MASTER_LISTEN_FD_FIRST + n); - n++; socket_listener_count++; + dup2_append(&dups, listeners[i]->fd, fd++); + socket_listener_count++; } } /* then ssl-listeners */ @@ -100,9 +98,8 @@ listeners[i]->set.inetset.set->ssl) { str_tabescape_write(listener_names, listeners[i]->name); str_append_c(listener_names, '\t'); - dup2_append(&dups, listeners[i]->fd, - MASTER_LISTEN_FD_FIRST + n); - n++; socket_listener_count++; + dup2_append(&dups, listeners[i]->fd, fd++); + socket_listener_count++; ssl_socket_count++; } } @@ -156,6 +153,7 @@ if (dup2_array(&dups) < 0) i_fatal("service(%s): dup2s failed", service->set->name); + i_assert(fd == MASTER_LISTEN_FD_FIRST + (int)socket_listener_count); env_put(t_strdup_printf("SOCKET_COUNT=%d", socket_listener_count)); env_put(t_strdup_printf("SSL_SOCKET_COUNT=%d", ssl_socket_count)); env_put(t_strdup_printf("SOCKET_NAMES=%s", str_c(listener_names))); From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: Make static analyzer happier. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3dc9c253880d changeset: 13905:3dc9c253880d user: Timo Sirainen date: Fri Jan 06 19:54:03 2012 +0200 description: Make static analyzer happier. diffstat: src/doveadm/dsync/doveadm-dsync.c | 2 ++ src/doveadm/dsync/dsync-proxy.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diffs (28 lines): diff -r 326b05f0246b -r 3dc9c253880d src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 19:29:23 2012 +0200 +++ b/src/doveadm/dsync/doveadm-dsync.c Fri Jan 06 19:54:03 2012 +0200 @@ -79,6 +79,8 @@ unsigned int i; const char *p; + i_assert(argv[0] != NULL); + t_array_init(&cmd_args, 16); for (i = 0; argv[i] != NULL; i++) { p = argv[i]; diff -r 326b05f0246b -r 3dc9c253880d src/doveadm/dsync/dsync-proxy.c --- a/src/doveadm/dsync/dsync-proxy.c Fri Jan 06 19:29:23 2012 +0200 +++ b/src/doveadm/dsync/dsync-proxy.c Fri Jan 06 19:54:03 2012 +0200 @@ -345,10 +345,8 @@ return -1; } - args += i; - count -= i; - if (dsync_proxy_cache_fields_import(args, pool, &box_r->cache_fields, - error_r) < 0) + if (dsync_proxy_cache_fields_import(args + i, pool, + &box_r->cache_fields, error_r) < 0) return -1; return 0; } From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: Compiler warning fix. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4c06fb461cd4 changeset: 13906:4c06fb461cd4 user: Timo Sirainen date: Fri Jan 06 20:39:48 2012 +0200 description: Compiler warning fix. diffstat: src/lib-storage/mail-storage.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r 3dc9c253880d -r 4c06fb461cd4 src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Fri Jan 06 19:54:03 2012 +0200 +++ b/src/lib-storage/mail-storage.c Fri Jan 06 20:39:48 2012 +0200 @@ -289,8 +289,7 @@ /* allow multiple independent shared namespaces */ return FALSE; } - - return storage; + return TRUE; } static struct mail_storage * From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: Released v2.1.rc3. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5398bdb8613f changeset: 13907:5398bdb8613f user: Timo Sirainen date: Fri Jan 06 21:34:33 2012 +0200 description: Released v2.1.rc3. diffstat: NEWS | 4 ++++ TODO | 2 ++ configure.in | 2 +- 3 files changed, 7 insertions(+), 1 deletions(-) diffs (30 lines): diff -r 4c06fb461cd4 -r 5398bdb8613f NEWS --- a/NEWS Fri Jan 06 20:39:48 2012 +0200 +++ b/NEWS Fri Jan 06 21:34:33 2012 +0200 @@ -1,3 +1,7 @@ +v2.1.rc3 2012-01-06 Timo Sirainen + + - Added missing file that prevented v2.1.rc2 from compiling.. + v2.1.rc2 2012-01-06 Timo Sirainen * dsync was merged into doveadm. There is still "dsync" symlink diff -r 4c06fb461cd4 -r 5398bdb8613f TODO --- a/TODO Fri Jan 06 20:39:48 2012 +0200 +++ b/TODO Fri Jan 06 21:34:33 2012 +0200 @@ -1,3 +1,5 @@ + - add message/mime limits + - stephan's message-parser patch - imapc: - prefetching to THREAD and SORT - check all imap extensions and see if some don't work (condstore) diff -r 4c06fb461cd4 -r 5398bdb8613f configure.in --- a/configure.in Fri Jan 06 20:39:48 2012 +0200 +++ b/configure.in Fri Jan 06 21:34:33 2012 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.rc2],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.rc3],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: Added tag 2.1.rc3 for changeset 5398bdb8613f Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/f1a1941bbf5a changeset: 13908:f1a1941bbf5a user: Timo Sirainen date: Fri Jan 06 21:34:33 2012 +0200 description: Added tag 2.1.rc3 for changeset 5398bdb8613f diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 5398bdb8613f -r f1a1941bbf5a .hgtags --- a/.hgtags Fri Jan 06 21:34:33 2012 +0200 +++ b/.hgtags Fri Jan 06 21:34:33 2012 +0200 @@ -71,3 +71,4 @@ 437ae2c24872b59056d08c7e67a0db5354710065 2.1.beta1 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 2.1.rc1 a14b7333ae458eb669ebbe5ec85488b81e223267 2.1.rc2 +5398bdb8613fbe05f24a2c655e0408e6fa4d764f 2.1.rc3 From dovecot at dovecot.org Fri Jan 6 21:42:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 06 Jan 2012 21:42:37 +0200 Subject: dovecot-2.1: Added signature for changeset 5398bdb8613f Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a0f9887133e6 changeset: 13909:a0f9887133e6 user: Timo Sirainen date: Fri Jan 06 21:34:36 2012 +0200 description: Added signature for changeset 5398bdb8613f diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r f1a1941bbf5a -r a0f9887133e6 .hgsigs --- a/.hgsigs Fri Jan 06 21:34:33 2012 +0200 +++ b/.hgsigs Fri Jan 06 21:34:36 2012 +0200 @@ -34,3 +34,4 @@ 437ae2c24872b59056d08c7e67a0db5354710065 0 iEYEABECAAYFAk65qLwACgkQyUhSUUBVismRQACfad1LMF1iLd3vsFmxsONlDFEgxVwAnRmJRtv17mIUxvuzixLgc6bEtJvX 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 0 iEUEABECAAYFAk7NkY0ACgkQyUhSUUBVisl8xgCfSg6EA1Bz+7vShYM1YzRQCXNJx7UAlRBpHQmMenUfxRi/98DUsQs0uN0= a14b7333ae458eb669ebbe5ec85488b81e223267 0 iEYEABECAAYFAk8G/vkACgkQyUhSUUBVisnObQCePLKBz9KeNrU2YadqtlzDe65V7zwAn1+M0om2SFMlzTG251xszcN4g4gn +5398bdb8613fbe05f24a2c655e0408e6fa4d764f 0 iEYEABECAAYFAk8HTMkACgkQyUhSUUBVisknigCgkg1AEAFgPq0xdyBYYDdm55+De1UAoKDSnvoGetcQRB4j86B5c968PjxV From pigeonhole at rename-it.nl Sat Jan 7 00:03:18 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 06 Jan 2012 23:03:18 +0100 Subject: dovecot-2.1-pigeonhole: Updated documentation and example config. Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/2e94c8350e36 changeset: 1589:2e94c8350e36 user: Stephan Bosch date: Fri Jan 06 23:03:12 2012 +0100 description: Updated documentation and example config. diffstat: doc/editheader.txt | 4 +- doc/example-config/conf.d/20-managesieve.conf | 27 ++++---- doc/example-config/conf.d/90-sieve.conf | 60 +++++++++++++++---- doc/spamtest-virustest.txt | 27 ++++---- doc/vacation.txt | 90 ++++++++++++++--------------- 5 files changed, 118 insertions(+), 90 deletions(-) diffs (truncated from 339 to 300 lines): diff -r d17f4a699ad2 -r 2e94c8350e36 doc/editheader.txt --- a/doc/editheader.txt Tue Dec 27 22:21:34 2011 +0100 +++ b/doc/editheader.txt Fri Jan 06 23:03:12 2012 +0100 @@ -23,14 +23,14 @@ sieve_editheader_max_header_size = 2048 The maximum size in bytes of a header field value passed to the addheader - command. The minumum value for this setting is 1024 bytes. The value is in + command. The minimum value for this setting is 1024 bytes. The value is in bytes, unless followed by a k(ilo). sieve_editheader_protected = A space-separated list of headers that cannot be added to nor removed from the message header. The `Received:' and `Auto-Submitted:' fields are always protected and the `Subject:' header cannot be protected, as required by the - RFC specificiation; adding one of these headers to this setting has no effect. + RFC specification; adding one of these headers to this setting has no effect. Invalid values for the settings above will make the Sieve interpreter log a warning and revert to the default values. diff -r d17f4a699ad2 -r 2e94c8350e36 doc/example-config/conf.d/20-managesieve.conf --- a/doc/example-config/conf.d/20-managesieve.conf Tue Dec 27 22:21:34 2011 +0100 +++ b/doc/example-config/conf.d/20-managesieve.conf Fri Jan 06 23:03:12 2012 +0100 @@ -37,16 +37,17 @@ protocol sieve { # Maximum ManageSieve command line length in bytes. ManageSieve usually does - # not involve overly long command lines, so this setting will not normally need - # adjustment + # not involve overly long command lines, so this setting will not normally + # need adjustment #managesieve_max_line_length = 65536 - # Maximum number of ManageSieve connections allowed for a user from each IP address. + # Maximum number of ManageSieve connections allowed for a user from each IP + # address. # NOTE: The username is compared case-sensitively. #mail_max_userip_connections = 10 - # Space separated list of plugins to load (none known to be useful so far). Do NOT - # try to load IMAP plugins here. + # Space separated list of plugins to load (none known to be useful so far). + # Do NOT try to load IMAP plugins here. #mail_plugins = # MANAGESIEVE logout format string: @@ -54,20 +55,20 @@ # %o - total number of bytes sent to client #managesieve_logout_format = bytes=%i/%o - # To fool ManageSieve clients that are focused on CMU's timesieved you can specify - # the IMPLEMENTATION capability that the dovecot reports to clients. + # To fool ManageSieve clients that are focused on CMU's timesieved you can + # specify the IMPLEMENTATION capability that Dovecot reports to clients. # For example: 'Cyrus timsieved v2.2.13' #managesieve_implementation_string = Dovecot Pigeonhole - # Explicitly specify the SIEVE and NOTIFY capability reported by the server before - # login. If left unassigned these will be reported dynamically according to what - # the Sieve interpreter supports by default (after login this may differ depending - # on the user). + # Explicitly specify the SIEVE and NOTIFY capability reported by the server + # before login. If left unassigned these will be reported dynamically + # according to what the Sieve interpreter supports by default (after login + # this may differ depending on the user). #managesieve_sieve_capability = #managesieve_notify_capability = - # The maximum number of compile errors that are returned to the client upon script - # upload or script verification. + # The maximum number of compile errors that are returned to the client upon + # script upload or script verification. #managesieve_max_compile_errors = 5 # Refer to 90-sieve.conf for script quota configuration and configuration of diff -r d17f4a699ad2 -r 2e94c8350e36 doc/example-config/conf.d/90-sieve.conf --- a/doc/example-config/conf.d/90-sieve.conf Tue Dec 27 22:21:34 2011 +0100 +++ b/doc/example-config/conf.d/90-sieve.conf Fri Jan 06 23:03:12 2012 +0100 @@ -6,32 +6,64 @@ # by adding it to the respective mail_plugins= settings. plugin { - # The path to the user's main active script. + # The path to the user's main active script. If ManageSieve is used, this the + # location of the symbolic link controlled by ManageSieve. sieve = ~/.dovecot.sieve - # A path to a global sieve script file, which gets executed ONLY - # if user's private Sieve script doesn't exist. Be sure to - # pre-compile this script manually using the sievec command line - # tool. + # The default Sieve script when the user has none. This is a path to a global + # sieve script file, which gets executed ONLY if user's private Sieve script + # doesn't exist. Be sure to pre-compile this script manually using the sievec + # command line tool. + # --> See sieve_before fore executing scripts before the user's personal + # script. #sieve_global_path = /var/lib/dovecot/sieve/default.sieve - # Directory for :personal include scripts for the include extension. + # Directory for :personal include scripts for the include extension. This + # is also where the ManageSieve service stores the user's scripts. sieve_dir = ~/sieve # Directory for :global include scripts for the include extension. #sieve_global_dir = - # Which Sieve language extensions are available to users. By default, - # all supported extensions are available, except for deprecated - # extensions or those that are still under development. Some system - # administrators may want to disable certain Sieve extensions or - # enable those that are not available by default. This setting can - # use '+' and '-' to specify differences relative to the default. - # For example `sieve_extensions = +imapflags' will enable the - # deprecated imapflags extension in addition to all extensions + # Path to a script file or a directory containing script files that need to be + # executed before the user's script. If the path points to a directory, all + # the Sieve scripts contained therein (with the proper .sieve extension) are + # executed. The order of execution is determined by the file names, using a + # normal 8bit per-character comparison. + #sieve_before = + + # Identical to sieve_before, only the specified scripts are executed after the + # user's script (only when keep is still in effect!). + #sieve_after = + + # Which Sieve language extensions are available to users. By default, all + # supported extensions are available, except for deprecated extensions or + # those that are still under development. Some system administrators may want + # to disable certain Sieve extensions or enable those that are not available + # by default. This setting can use '+' and '-' to specify differences relative + # to the default. For example `sieve_extensions = +imapflags' will enable the + # deprecated imapflags extension in addition to all extensions were already # enabled by default. #sieve_extensions = +notify +imapflags + # Which Sieve language extensions are ONLY available in global scripts. This + # can be used to restrict the use of certain Sieve extensions to administrator + # control, for instance when these extensions can cause security concerns. + # This setting has higher precedence than the `sieve_extensions' setting + # (above), meaning that the extensions enabled with this setting are never + # available to the user's personal script no matter what is specified for the + # `sieve_extensions' setting. The syntax of this setting is similar to the + # `sieve_extensions' setting, with the difference that extensions are + # enabled or disabled for exclusive use in global scripts. Currently, no + # extensions are marked as such by default. + #sieve_global_extensions = + + # 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. + #sieve_plugins = + # The separator that is expected between the :user and :detail # address parts introduced by the subaddress extension. This may # also be a sequence of characters (e.g. '--'). The current diff -r d17f4a699ad2 -r 2e94c8350e36 doc/spamtest-virustest.txt --- a/doc/spamtest-virustest.txt Tue Dec 27 22:21:34 2011 +0100 +++ b/doc/spamtest-virustest.txt Fri Jan 06 23:03:12 2012 +0100 @@ -15,8 +15,8 @@ field value. They only need to know how to use the spamtest (spamtestplus) and virustest extensions. This also gives GUI-based Sieve editors the means to provide a portable and easy to install interface for spam and virus filter -configuration. The burden of specifying which headers need to be checked and -how the scanner output is represented falls onto the Sieve administrator. +configuration. The burden of specifying which headers need to be checked and how +the scanner output is represented falls onto the Sieve administrator. Configuration ============= @@ -37,14 +37,14 @@ sieve_spamtest_status_header = [ ":" ] This specifies the header field that contains the result information of the - spam scanner and it may express the syntax of the content of the header. If - no matching header is found in the message, the spamtest command will match + spam scanner and it may express the syntax of the content of the header. If no + matching header is found in the message, the spamtest command will match against "0". This is a structured setting. The first part specifies the header field name. - Optionally, a POSIX regular expression follows the header field name, + Optionally, a POSIX regular expression follows the header field name, separated by a colon. Any whitespace directly following the colon is not part - of the regular expression. If the regular expression is ommitted, any header + of the regular expression. If the regular expression is omitted, any header content is accepted and the full header value is used. When a regular expression is used, it must specify one match value (inside brackets) that yields the desired spam scanner result. If the header does not match the @@ -62,18 +62,17 @@ `sieve_spamtext_status_header' setting. sieve_spamtest_text_valueX = - When the `sieve_spamtest_status_type' setting is set to "text", these - settings specify that the spamtest command will match against "X" when - the specified string is equal to the text (extracted) from the status - header. For spamtest, values of X between 0 and 10 are recognized, while - virustest only uses values between 0 and 5. + When the `sieve_spamtest_status_type' setting is set to "text", these settings + specify that the spamtest command will match against "X" when the specified + string is equal to the text (extracted) from the status header. For spamtest, + values of X between 0 and 10 are recognized, while virustest only uses values + between 0 and 5. Examples ======== -This section shows several configuration examples. Each example shows a -specimen of valid virus/spam test headers that the given configuration will -work on. +This section shows several configuration examples. Each example shows a specimen +of valid virus/spam test headers that the given configuration will work on. Example 1 --------- diff -r d17f4a699ad2 -r 2e94c8350e36 doc/vacation.txt --- a/doc/vacation.txt Tue Dec 27 22:21:34 2011 +0100 +++ b/doc/vacation.txt Fri Jan 06 23:03:12 2012 +0100 @@ -9,76 +9,72 @@ Description =========== -The Sieve vacation extension [RFC5230] defines a mechanism to generate -automatic replies to incoming email messages. It takes various -precautions to make sure replies are only sent when appropriate. Script -authors specify how often replies are sent to a particular contact. -In the original vacation extension, this interval is specified in days -with a minimum of one day. When more granularity is necessary and -particularly when replies must be sent more frequently than one day, -the vacation-seconds extension [RFC6131] can be used. This allows -specifying the minimum reply interval in seconds with a minimum of zero -(reply is then always sent), depending on administrator configuration. +The Sieve vacation extension [RFC5230] defines a mechanism to generate automatic +replies to incoming email messages. It takes various precautions to make sure +replies are only sent when appropriate. Script authors specify how often replies +are sent to a particular contact. In the original vacation extension, this +interval is specified in days with a minimum of one day. When more granularity +is necessary and particularly when replies must be sent more frequently than one +day, the vacation-seconds extension [RFC6131] can be used. This allows +specifying the minimum reply interval in seconds with a minimum of zero (reply +is then always sent), depending on administrator configuration. Configuration ============= The vacation extension is available by default. In contrast, the -vacation-seconds extension - which implies the vacation extension when -used - is not available by default and needs to be enabled explicitly by -adding it to the sieve_extensions setting. The configuration also needs -to be adjusted accordingly to allow a non-reply period of less than a -day. +vacation-seconds extension - which implies the vacation extension when used - is +not available by default and needs to be enabled explicitly by adding it to the +sieve_extensions setting. The configuration also needs to be adjusted +accordingly to allow a non-reply period of less than a day. -The vacation and vacation-seconds extensions have their own specific -settings. The settings that specify a period are specified in -s(econds), unless followed by a d(ay), h(our) or m(inute) specifier -character. +The vacation and vacation-seconds extensions have their own specific settings. +The settings that specify a period are specified in s(econds), unless followed +by a d(ay), h(our) or m(inute) specifier character. The following settings can be configured for the vacation extension (default values are indicated): sieve_vacation_min_period = 1d - This specifies the minimum period that can be specified for the :days - and :seconds tags of the vacation command. A minimum of 0 indicates that - users are allowed to make the Sieve interpreter send a vacation response - message for every incoming message that meets the other reply criteria - (refer to RFC5230). A value of zero is however not recommended. + This specifies the minimum period that can be specified for the :days and + :seconds tags of the vacation command. A minimum of 0 indicates that users are + allowed to make the Sieve interpreter send a vacation response message for + every incoming message that meets the other reply criteria (refer to RFC5230). + A value of zero is however not recommended. sieve_vacation_max_period = 0 - This specifies the maximum period that can be specified for the :days tag - of the vacation command. The configured value must be larger than the + This specifies the maximum period that can be specified for the :days tag of + the vacation command. The configured value must be larger than the sieve_vacation_min_period setting. A value of 0 has a special meaning: it indicates that there is no upper limit. sieve_vacation_default_period = 7d - This specifies the default period that is used when no :days or :seconds - tag is specified. The configured value must lie between the + This specifies the default period that is used when no :days or :seconds tag + is specified. The configured value must lie between the sieve_vacation_min_period and sieve_vacation_max_period. sieve_vacation_use_original_recipient = no - This specifies whether the original envelope recipient should be used in - the check for implicit delivery. The vacation command checks headers of - the incoming message, such as To: and Cc: for the address of the - recipient, to verify that the message is explicitly addressed at the From pigeonhole at rename-it.nl Sat Jan 7 00:21:04 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 06 Jan 2012 23:21:04 +0100 Subject: dovecot-2.1-pigeonhole: Fixed indentation problems in documentat... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/8602aa5093be changeset: 1590:8602aa5093be user: Stephan Bosch date: Fri Jan 06 23:20:59 2012 +0100 description: Fixed indentation problems in documentation. diffstat: INSTALL | 6 +++--- doc/editheader.txt | 8 ++++---- doc/include.txt | 8 ++++---- doc/spamtest-virustest.txt | 4 ++-- doc/vacation.txt | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diffs (109 lines): diff -r 2e94c8350e36 -r 8602aa5093be INSTALL --- a/INSTALL Fri Jan 06 23:03:12 2012 +0100 +++ b/INSTALL Fri Jan 06 23:20:59 2012 +0100 @@ -105,15 +105,15 @@ that are still under development. Some system administrators may want to disable certain Sieve extensions or enable those that are not available by default. This setting can use '+' and '-' to specify differences relative to - the default. For example `sieve_extensions = +imapflags' will enable the - deprecated imapflags extension in addition to all extensions were already + the default. For example `sieve_extensions = +imapflags' will enable the + deprecated imapflags extension in addition to all extensions were already enabled by default. sieve_global_extensions = Which Sieve language extensions are ONLY avalable in global scripts. This can be used to restrict the use of certain Sieve extensions to administrator control, for instance when these extensions can cause security concerns. This - setting has higher precedence than the `sieve_extensions' setting (above), + setting has higher precedence than the `sieve_extensions' setting (above), meaning that the extensions enabled with this setting are never available to the user's personal script no matter what is specified for the `sieve_extensions' setting. The syntax of this setting is similar to diff -r 2e94c8350e36 -r 8602aa5093be doc/editheader.txt --- a/doc/editheader.txt Fri Jan 06 23:03:12 2012 +0100 +++ b/doc/editheader.txt Fri Jan 06 23:20:59 2012 +0100 @@ -3,7 +3,7 @@ Relevant specifications ======================= - RFC5293 - doc/rfc/editheader.rfc5293.txt + RFC5293 - doc/rfc/editheader.rfc5293.txt Description =========== @@ -24,12 +24,12 @@ sieve_editheader_max_header_size = 2048 The maximum size in bytes of a header field value passed to the addheader command. The minimum value for this setting is 1024 bytes. The value is in - bytes, unless followed by a k(ilo). + bytes, unless followed by a k(ilo). sieve_editheader_protected = A space-separated list of headers that cannot be added to nor removed from the - message header. The `Received:' and `Auto-Submitted:' fields are always - protected and the `Subject:' header cannot be protected, as required by the + message header. The `Received:' and `Auto-Submitted:' fields are always + protected and the `Subject:' header cannot be protected, as required by the RFC specification; adding one of these headers to this setting has no effect. Invalid values for the settings above will make the Sieve interpreter log diff -r 2e94c8350e36 -r 8602aa5093be doc/include.txt --- a/doc/include.txt Fri Jan 06 23:03:12 2012 +0100 +++ b/doc/include.txt Fri Jan 06 23:20:59 2012 +0100 @@ -3,7 +3,7 @@ Relevant Specifications ======================= -draft-ietf-sieve-include-05 - doc/rfc/draft-ietf-sieve-include-05.txt + draft-ietf-sieve-include-05 - doc/rfc/draft-ietf-sieve-include-05.txt Description =========== @@ -25,8 +25,8 @@ extension (default values are indicated): sieve_include_max_includes = 255 - The maximum number of scripts that may be included. This is the total number - of scripts involved in the include tree. + The maximum number of scripts that may be included. This is the total number + of scripts involved in the include tree. sieve_include_max_nesting_depth = 10 - The maximum nesting depth for the include tree. + The maximum nesting depth for the include tree. diff -r 2e94c8350e36 -r 8602aa5093be doc/spamtest-virustest.txt --- a/doc/spamtest-virustest.txt Fri Jan 06 23:03:12 2012 +0100 +++ b/doc/spamtest-virustest.txt Fri Jan 06 23:20:59 2012 +0100 @@ -3,7 +3,7 @@ Relevant Specifications ======================= - RFC5235 - doc/rfc/spamvirustest.rfc5235.txt + RFC5235 - doc/rfc/spamvirustest.rfc5235.txt Description =========== @@ -128,7 +128,7 @@ sieve_spamtest_status_header = \ X-Spam-Score: score=(-?[[:digit:]]+\.[[:digit:]]).* sieve_spamtest_max_header = \ - X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]] required=([[:digit:]]+\.[[:digit:]]) + X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]] required=([[:digit:]]+\.[[:digit:]]) sieve_virustest_status_type = text sieve_virustest_status_header = X-Virus-Scan: Found to be (.+)\. diff -r 2e94c8350e36 -r 8602aa5093be doc/vacation.txt --- a/doc/vacation.txt Fri Jan 06 23:03:12 2012 +0100 +++ b/doc/vacation.txt Fri Jan 06 23:20:59 2012 +0100 @@ -3,8 +3,8 @@ Relevant specifications ======================= - RFC5230 - doc/rfc/vacation.rfc5230.txt - RFC6131 - doc/rfc/vacation-seconds.rfc6131.txt + RFC5230 - doc/rfc/vacation.rfc5230.txt + RFC6131 - doc/rfc/vacation-seconds.rfc6131.txt Description =========== From pigeonhole at rename-it.nl Sat Jan 7 13:42:09 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 07 Jan 2012 12:42:09 +0100 Subject: dovecot-2.1-pigeonhole: lib-sieve: added means to prohibit use o... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/83fc2f6edefa changeset: 1591:83fc2f6edefa user: Stephan Bosch date: Sat Jan 07 12:42:01 2012 +0100 description: lib-sieve: added means to prohibit use of redirect action. Setting sieve_max_redirects=0 now means that redirects are prohibited rather than unlimited. Now there is always a limit, but it can be enormous if the administrator wants to. diffstat: INSTALL | 20 ++++++++++---------- doc/example-config/conf.d/90-sieve.conf | 19 +++++++++++-------- src/lib-sieve/cmd-redirect.c | 14 ++++++++++++++ 3 files changed, 35 insertions(+), 18 deletions(-) diffs (123 lines): diff -r 8602aa5093be -r 83fc2f6edefa INSTALL --- a/INSTALL Fri Jan 06 23:20:59 2012 +0100 +++ b/INSTALL Sat Jan 07 12:42:01 2012 +0100 @@ -161,17 +161,16 @@ sieve_max_script_size = 1M The maximum size of a Sieve script. The compiler will refuse to compile any - script larger than this limit. + script larger than this limit. If set to 0, no limit on the script size is + enforced. sieve_max_actions = 32 The maximum number of actions that can be performed during a single script - execution. + execution. If set to 0, no limit on the total number of actions is enforced. sieve_max_redirects = 4 The maximum number of redirect actions that can be performed during a single - script execution. - -A value of 0 for these settings means that the limit is not enforced. + script execution. If set to 0, no redirect actions are allowed. Sieve Interpreter - Per-user Sieve script location -------------------------------------------------- @@ -495,15 +494,16 @@ the plugin section of the Dovecot configuration as follows: sieve_max_script_size = 1M - The maximum size of a Sieve script. + The maximum size of a Sieve script. If set to 0, no limit on the script size + is enforced. sieve_quota_max_scripts = 0 - The maximum number of personal Sieve scripts a single user can have. + The maximum number of personal Sieve scripts a single user can have. If set + to 0, no limit on the number of scripts is enforced. sieve_quota_max_storage = 0 - The maximum amount of disk storage a single user's scripts may occupy. - -A value of 0 for these settings means that no limit is enforced. + The maximum amount of disk storage a single user's scripts may occupy. If set + to 0, no limit on the used amount of disk storage is enforced. ManageSieve Service - Proxying ------------------------------ diff -r 8602aa5093be -r 83fc2f6edefa doc/example-config/conf.d/90-sieve.conf --- a/doc/example-config/conf.d/90-sieve.conf Fri Jan 06 23:20:59 2012 +0100 +++ b/doc/example-config/conf.d/90-sieve.conf Sat Jan 07 12:42:01 2012 +0100 @@ -73,23 +73,26 @@ # is also used by Dovecot's LMTP service. #recipient_delimiter = + - # The maximum size of a Sieve script. The compiler will refuse to - # compile any script larger than this limit. + # The maximum size of a Sieve script. The compiler will refuse to compile any + # script larger than this limit. If set to 0, no limit on the script size is + # enforced. #sieve_max_script_size = 1M - # The maximum number of actions that can be performed during a single - # script execution. + # The maximum number of actions that can be performed during a single script + # execution. If set to 0, no limit on the total number of actions is enforced. #sieve_max_actions = 32 - # The maximum number of redirect actions that can be performed during - # a single script execution. + # The maximum number of redirect actions that can be performed during a single + # script execution. If set to 0, no redirect actions are allowed. #sieve_max_redirects = 4 - # The maximum number of personal Sieve scripts a single user can have. + # The maximum number of personal Sieve scripts a single user can have. If set + # to 0, no limit on the number of scripts is enforced. # (Currently only relevant for ManageSieve) #sieve_quota_max_scripts = 0 - # The maximum amount of disk storage a single user's scripts may occupy. + # The maximum amount of disk storage a single user's scripts may occupy. If + # set to 0, no limit on the used amount of disk storage is enforced. # (Currently only relevant for ManageSieve) #sieve_quota_max_storage = 0 } diff -r 8602aa5093be -r 83fc2f6edefa src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Fri Jan 06 23:20:59 2012 +0100 +++ b/src/lib-sieve/cmd-redirect.c Sat Jan 07 12:42:01 2012 +0100 @@ -114,6 +114,7 @@ static bool cmd_redirect_validate (struct sieve_validator *validator, struct sieve_command *cmd) { + struct sieve_instance *svinst = sieve_validator_svinst(validator); struct sieve_ast_argument *arg = cmd->first_positional; /* Check and activate address argument */ @@ -152,6 +153,13 @@ return ( norm_address != NULL ); } + if ( svinst->max_redirects == 0 ) { + sieve_command_validate_error(validator, cmd, + "local policy prohibits the use of a redirect action"); + return FALSE; + } + + return TRUE; } @@ -233,6 +241,12 @@ norm_address = str_c(redirect); } + if ( svinst->max_redirects == 0 ) { + sieve_runtime_error(renv, NULL, + "local policy prohibits the use of a redirect action"); + return SIEVE_EXEC_FAILURE; + } + if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_ACTIONS) ) { sieve_runtime_trace(renv, 0, "redirect action"); sieve_runtime_trace_descend(renv); From pigeonhole at rename-it.nl Sat Jan 7 17:01:15 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 07 Jan 2012 16:01:15 +0100 Subject: dovecot-2.1-pigeonhole: LDA Sieve plugin: renamed sieve_global_p... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/bd5cffe2ed95 changeset: 1592:bd5cffe2ed95 user: Stephan Bosch date: Sat Jan 07 16:01:10 2012 +0100 description: LDA Sieve plugin: renamed sieve_global_path setting to sieve_default for clarity. Old name is now deprecated. Support for the even older global_script_path name for this setting is dropped. diffstat: INSTALL | 22 ++++++++++++---------- README | 2 +- doc/example-config/conf.d/90-sieve.conf | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.c | 8 ++++---- 4 files changed, 18 insertions(+), 16 deletions(-) diffs (89 lines): diff -r 83fc2f6edefa -r bd5cffe2ed95 INSTALL --- a/INSTALL Sat Jan 07 12:42:01 2012 +0100 +++ b/INSTALL Sat Jan 07 16:01:10 2012 +0100 @@ -87,11 +87,15 @@ sieve = ~/.dovecot.sieve The path to the user's main active script. - sieve_global_path - A path to a global sieve script file, which gets executed ONLY if user's - private Sieve script doesn't exist, e.g. /var/lib/dovecot/default.sieve. Be - sure to pre-compile this script manually using the sievec command line tool, - as explained in the README file. + sieve_default = + The path to the default personal sieve script file, which gets executed ONLY + if user's private Sieve script does no exist, e.g. + /var/lib/dovecot/default.sieve. This is usually a global script, so sure to + pre-compile this script manually using the sievec command line tool, as + explained in the README file. + + sieve_global_path = + This is the DEPRECATED former name of the sieve_default setting. sieve_global_dir = Directory for :global include scripts for the Sieve include extension. @@ -144,7 +148,7 @@ # If the user has no personal active script (i.e. if the file # indicated in sieve= does not exist), use this one: - sieve_global_path = /var/lib/dovecot/sieve/default.sieve + sieve_default = /var/lib/dovecot/sieve/default.sieve # The include extension fetches the :personal scripts from this # directory. When ManageSieve is used, this is also where scripts @@ -207,10 +211,8 @@ Pigeonhole's Sieve interpreter allows executing multiple Sieve scripts sequentially. The extra scripts can be executed before and after the user's private script. For example, this allows executing global Sieve policies before -the user's script. This is not possible using the sieve_global_path setting, -because that is only used as a default when the user's private script does not -exist. The following settings in the plugin section of the Dovecot config file -control the execution sequence: +the user's script. The following settings in the plugin section of the Dovecot +config file control the execution sequence: sieve_before = Path to a script file or a directory containing script files that need to be diff -r 83fc2f6edefa -r bd5cffe2ed95 README --- a/README Sat Jan 07 12:42:01 2012 +0100 +++ b/README Sat Jan 07 16:01:10 2012 +0100 @@ -209,7 +209,7 @@ sievec /var/lib/dovecot/sieve/global/ -This is necessary for scripts listed in the sieve_global_path, sieve_before and +This is necessary for scripts listed in the sieve_default, sieve_before and sieve_after settings. For global scripts that are only included in other scripts using the include extension, this step is not necessary, since included scripts are incorporated into the binary produced for the main script located in a diff -r 83fc2f6edefa -r bd5cffe2ed95 doc/example-config/conf.d/90-sieve.conf --- a/doc/example-config/conf.d/90-sieve.conf Sat Jan 07 12:42:01 2012 +0100 +++ b/doc/example-config/conf.d/90-sieve.conf Sat Jan 07 16:01:10 2012 +0100 @@ -16,7 +16,7 @@ # command line tool. # --> See sieve_before fore executing scripts before the user's personal # script. - #sieve_global_path = /var/lib/dovecot/sieve/default.sieve + #sieve_default = /var/lib/dovecot/sieve/default.sieve # Directory for :personal include scripts for the include extension. This # is also where the ManageSieve service stores the user's scripts. diff -r 83fc2f6edefa -r bd5cffe2ed95 src/plugins/lda-sieve/lda-sieve-plugin.c --- a/src/plugins/lda-sieve/lda-sieve-plugin.c Sat Jan 07 12:42:01 2012 +0100 +++ b/src/plugins/lda-sieve/lda-sieve-plugin.c Sat Jan 07 16:01:10 2012 +0100 @@ -202,11 +202,11 @@ { const char *script_path; - /* Use global script path, if one exists */ - script_path = mail_user_plugin_getenv(user, "sieve_global_path"); - if (script_path == NULL) { + /* Use default script path, if one exists */ + script_path = mail_user_plugin_getenv(user, "sieve_default"); + if ( script_path == NULL ) { /* For backwards compatibility */ - script_path = mail_user_plugin_getenv(user, "global_script_path"); + script_path = mail_user_plugin_getenv(user, "sieve_global_path"); } return script_path; From pigeonhole at rename-it.nl Sat Jan 7 17:29:30 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 07 Jan 2012 16:29:30 +0100 Subject: dovecot-2.0-pigeonhole: Revised documentation. Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/f7cee9f3c8a6 changeset: 1552:f7cee9f3c8a6 user: Stephan Bosch date: Sat Jan 07 16:22:20 2012 +0100 description: Revised documentation. diffstat: doc/example-config/conf.d/20-managesieve.conf | 27 ++++---- doc/example-config/conf.d/90-sieve.conf | 50 +++++++++++----- doc/include.txt | 8 +- doc/spamtest-virustest.txt | 31 +++++----- doc/vacation.txt | 94 +++++++++++++++---------------- 5 files changed, 113 insertions(+), 97 deletions(-) diffs (truncated from 358 to 300 lines): diff -r cc6d38c3f87f -r f7cee9f3c8a6 doc/example-config/conf.d/20-managesieve.conf --- a/doc/example-config/conf.d/20-managesieve.conf Sat Dec 17 18:58:48 2011 +0100 +++ b/doc/example-config/conf.d/20-managesieve.conf Sat Jan 07 16:22:20 2012 +0100 @@ -37,16 +37,17 @@ protocol sieve { # Maximum ManageSieve command line length in bytes. ManageSieve usually does - # not involve overly long command lines, so this setting will not normally need - # adjustment + # not involve overly long command lines, so this setting will not normally + # need adjustment #managesieve_max_line_length = 65536 - # Maximum number of ManageSieve connections allowed for a user from each IP address. + # Maximum number of ManageSieve connections allowed for a user from each IP + # address. # NOTE: The username is compared case-sensitively. #mail_max_userip_connections = 10 - # Space separated list of plugins to load (none known to be useful so far). Do NOT - # try to load IMAP plugins here. + # Space separated list of plugins to load (none known to be useful so far). + # Do NOT try to load IMAP plugins here. #mail_plugins = # MANAGESIEVE logout format string: @@ -54,20 +55,20 @@ # %o - total number of bytes sent to client #managesieve_logout_format = bytes=%i/%o - # To fool ManageSieve clients that are focused on CMU's timesieved you can specify - # the IMPLEMENTATION capability that the dovecot reports to clients. + # To fool ManageSieve clients that are focused on CMU's timesieved you can + # specify the IMPLEMENTATION capability that Dovecot reports to clients. # For example: 'Cyrus timsieved v2.2.13' #managesieve_implementation_string = Dovecot Pigeonhole - # Explicitly specify the SIEVE and NOTIFY capability reported by the server before - # login. If left unassigned these will be reported dynamically according to what - # the Sieve interpreter supports by default (after login this may differ depending - # on the user). + # Explicitly specify the SIEVE and NOTIFY capability reported by the server + # before login. If left unassigned these will be reported dynamically + # according to what the Sieve interpreter supports by default (after login + # this may differ depending on the user). #managesieve_sieve_capability = #managesieve_notify_capability = - # The maximum number of compile errors that are returned to the client upon script - # upload or script verification. + # The maximum number of compile errors that are returned to the client upon + # script upload or script verification. #managesieve_max_compile_errors = 5 # Refer to 90-sieve.conf for script quota configuration and configuration of diff -r cc6d38c3f87f -r f7cee9f3c8a6 doc/example-config/conf.d/90-sieve.conf --- a/doc/example-config/conf.d/90-sieve.conf Sat Dec 17 18:58:48 2011 +0100 +++ b/doc/example-config/conf.d/90-sieve.conf Sat Jan 07 16:22:20 2012 +0100 @@ -6,32 +6,52 @@ # by adding it to the respective mail_plugins= settings. plugin { - # The path to the user's main active script. + # The path to the user's main active script. If ManageSieve is used, this the + # location of the symbolic link controlled by ManageSieve. sieve = ~/.dovecot.sieve - # A path to a global sieve script file, which gets executed ONLY - # if user's private Sieve script doesn't exist. Be sure to - # pre-compile this script manually using the sievec command line - # tool. + # The default Sieve script when the user has none. This is a path to a global + # sieve script file, which gets executed ONLY if user's private Sieve script + # doesn't exist. Be sure to pre-compile this script manually using the sievec + # command line tool. + # --> See sieve_before fore executing scripts before the user's personal + # script. #sieve_global_path = /var/lib/dovecot/sieve/default.sieve - # Directory for :personal include scripts for the include extension. + # Directory for :personal include scripts for the include extension. This + # is also where the ManageSieve service stores the user's scripts. sieve_dir = ~/sieve # Directory for :global include scripts for the include extension. #sieve_global_dir = - # Which Sieve language extensions are available to users. By default, - # all supported extensions are available, except for deprecated - # extensions or those that are still under development. Some system - # administrators may want to disable certain Sieve extensions or - # enable those that are not available by default. This setting can - # use '+' and '-' to specify differences relative to the default. - # For example `sieve_extensions = +imapflags' will enable the - # deprecated imapflags extension in addition to all extensions - # enabled by default. + # Path to a script file or a directory containing script files that need to be + # executed before the user's script. If the path points to a directory, all + # the Sieve scripts contained therein (with the proper .sieve extension) are + # executed. The order of execution is determined by the file names, using a + # normal 8bit per-character comparison. + #sieve_before = + + # Identical to sieve_before, only the specified scripts are executed after the + # user's script (only when keep is still in effect!). + #sieve_after = + + # Which Sieve language extensions are available to users. By default, all + # supported extensions are available, except for deprecated extensions or + # those that are still under development. Some system administrators may want + # to disable certain Sieve extensions or enable those that are not available + # by default. This setting can use '+' and '-' to specify differences relative + # to the default. For example `sieve_extensions = +imapflags' will enable the + # deprecated imapflags extension in addition to all extensions thatwere + # already enabled by default. #sieve_extensions = +notify +imapflags + # 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. + #sieve_plugins = + # The separator that is expected between the :user and :detail # address parts introduced by the subaddress extension. This may # also be a sequence of characters (e.g. '--'). The current diff -r cc6d38c3f87f -r f7cee9f3c8a6 doc/include.txt --- a/doc/include.txt Sat Dec 17 18:58:48 2011 +0100 +++ b/doc/include.txt Sat Jan 07 16:22:20 2012 +0100 @@ -3,7 +3,7 @@ Relevant Specifications ======================= -draft-ietf-sieve-include-05 - doc/rfc/draft-ietf-sieve-include-05.txt + draft-ietf-sieve-include-05 - doc/rfc/draft-ietf-sieve-include-05.txt Description =========== @@ -25,8 +25,8 @@ extension (default values are indicated): sieve_include_max_includes = 255 - The maximum number of scripts that may be included. This is the total number - of scripts involved in the include tree. + The maximum number of scripts that may be included. This is the total number + of scripts involved in the include tree. sieve_include_max_nesting_depth = 10 - The maximum nesting depth for the include tree. + The maximum nesting depth for the include tree. diff -r cc6d38c3f87f -r f7cee9f3c8a6 doc/spamtest-virustest.txt --- a/doc/spamtest-virustest.txt Sat Dec 17 18:58:48 2011 +0100 +++ b/doc/spamtest-virustest.txt Sat Jan 07 16:22:20 2012 +0100 @@ -3,7 +3,7 @@ Relevant Specifications ======================= - RFC5235 - doc/rfc/spamvirustest.rfc5235.txt + RFC5235 - doc/rfc/spamvirustest.rfc5235.txt Description =========== @@ -15,8 +15,8 @@ field value. They only need to know how to use the spamtest (spamtestplus) and virustest extensions. This also gives GUI-based Sieve editors the means to provide a portable and easy to install interface for spam and virus filter -configuration. The burden of specifying which headers need to be checked and -how the scanner output is represented falls onto the Sieve administrator. +configuration. The burden of specifying which headers need to be checked and how +the scanner output is represented falls onto the Sieve administrator. Configuration ============= @@ -37,14 +37,14 @@ sieve_spamtest_status_header = [ ":" ] This specifies the header field that contains the result information of the - spam scanner and it may express the syntax of the content of the header. If - no matching header is found in the message, the spamtest command will match + spam scanner and it may express the syntax of the content of the header. If no + matching header is found in the message, the spamtest command will match against "0". This is a structured setting. The first part specifies the header field name. - Optionally, a POSIX regular expression follows the header field name, + Optionally, a POSIX regular expression follows the header field name, separated by a colon. Any whitespace directly following the colon is not part - of the regular expression. If the regular expression is ommitted, any header + of the regular expression. If the regular expression is omitted, any header content is accepted and the full header value is used. When a regular expression is used, it must specify one match value (inside brackets) that yields the desired spam scanner result. If the header does not match the @@ -62,18 +62,17 @@ `sieve_spamtext_status_header' setting. sieve_spamtest_text_valueX = - When the `sieve_spamtest_status_type' setting is set to "text", these - settings specify that the spamtest command will match against "X" when - the specified string is equal to the text (extracted) from the status - header. For spamtest, values of X between 0 and 10 are recognized, while - virustest only uses values between 0 and 5. + When the `sieve_spamtest_status_type' setting is set to "text", these settings + specify that the spamtest command will match against "X" when the specified + string is equal to the text (extracted) from the status header. For spamtest, + values of X between 0 and 10 are recognized, while virustest only uses values + between 0 and 5. Examples ======== -This section shows several configuration examples. Each example shows a -specimen of valid virus/spam test headers that the given configuration will -work on. +This section shows several configuration examples. Each example shows a specimen +of valid virus/spam test headers that the given configuration will work on. Example 1 --------- @@ -129,7 +128,7 @@ sieve_spamtest_status_header = \ X-Spam-Score: score=(-?[[:digit:]]+\.[[:digit:]]).* sieve_spamtest_max_header = \ - X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]] required=([[:digit:]]+\.[[:digit:]]) + X-Spam-Score: score=-?[[:digit:]]+\.[[:digit:]] required=([[:digit:]]+\.[[:digit:]]) sieve_virustest_status_type = text sieve_virustest_status_header = X-Virus-Scan: Found to be (.+)\. diff -r cc6d38c3f87f -r f7cee9f3c8a6 doc/vacation.txt --- a/doc/vacation.txt Sat Dec 17 18:58:48 2011 +0100 +++ b/doc/vacation.txt Sat Jan 07 16:22:20 2012 +0100 @@ -3,82 +3,78 @@ Relevant specifications ======================= - RFC5230 - doc/rfc/vacation.rfc5230.txt - RFC6131 - doc/rfc/vacation-seconds.rfc6131.txt + RFC5230 - doc/rfc/vacation.rfc5230.txt + RFC6131 - doc/rfc/vacation-seconds.rfc6131.txt Description =========== -The Sieve vacation extension [RFC5230] defines a mechanism to generate -automatic replies to incoming email messages. It takes various -precautions to make sure replies are only sent when appropriate. Script -authors specify how often replies are sent to a particular contact. -In the original vacation extension, this interval is specified in days -with a minimum of one day. When more granularity is necessary and -particularly when replies must be sent more frequently than one day, -the vacation-seconds extension [RFC6131] can be used. This allows -specifying the minimum reply interval in seconds with a minimum of zero -(reply is then always sent), depending on administrator configuration. +The Sieve vacation extension [RFC5230] defines a mechanism to generate automatic +replies to incoming email messages. It takes various precautions to make sure +replies are only sent when appropriate. Script authors specify how often replies +are sent to a particular contact. In the original vacation extension, this +interval is specified in days with a minimum of one day. When more granularity +is necessary and particularly when replies must be sent more frequently than one +day, the vacation-seconds extension [RFC6131] can be used. This allows +specifying the minimum reply interval in seconds with a minimum of zero (reply +is then always sent), depending on administrator configuration. Configuration ============= The vacation extension is available by default. In contrast, the -vacation-seconds extension - which implies the vacation extension when -used - is not available by default and needs to be enabled explicitly by -adding it to the sieve_extensions setting. The configuration also needs -to be adjusted accordingly to allow a non-reply period of less than a -day. +vacation-seconds extension - which implies the vacation extension when used - is +not available by default and needs to be enabled explicitly by adding it to the +sieve_extensions setting. The configuration also needs to be adjusted +accordingly to allow a non-reply period of less than a day. -The vacation and vacation-seconds extensions have their own specific -settings. The settings that specify a period are specified in -s(econds), unless followed by a d(ay), h(our) or m(inute) specifier -character. +The vacation and vacation-seconds extensions have their own specific settings. +The settings that specify a period are specified in s(econds), unless followed +by a d(ay), h(our) or m(inute) specifier character. The following settings can be configured for the vacation extension (default values are indicated): sieve_vacation_min_period = 1d - This specifies the minimum period that can be specified for the :days - and :seconds tags of the vacation command. A minimum of 0 indicates that - users are allowed to make the Sieve interpreter send a vacation response - message for every incoming message that meets the other reply criteria - (refer to RFC5230). A value of zero is however not recommended. + This specifies the minimum period that can be specified for the :days and + :seconds tags of the vacation command. A minimum of 0 indicates that users are + allowed to make the Sieve interpreter send a vacation response message for + every incoming message that meets the other reply criteria (refer to RFC5230). + A value of zero is however not recommended. sieve_vacation_max_period = 0 From pigeonhole at rename-it.nl Sat Jan 7 17:29:31 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 07 Jan 2012 16:29:31 +0100 Subject: dovecot-2.0-pigeonhole: Updated copyright notices to include yea... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/8715c044a7ee changeset: 1553:8715c044a7ee user: Stephan Bosch date: Sat Jan 07 16:29:23 2012 +0100 description: Updated copyright notices to include year 2012. diffstat: doc/man/pigeonhole.7.in | 4 ++-- doc/man/sieve-dump.1.in | 4 ++-- doc/man/sieve-filter.1.in | 4 ++-- doc/man/sieve-test.1.in | 4 ++-- doc/man/sievec.1.in | 4 ++-- 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/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/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/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-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.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 +- 301 files changed, 306 insertions(+), 306 deletions(-) diffs (truncated from 2719 to 300 lines): diff -r f7cee9f3c8a6 -r 8715c044a7ee doc/man/pigeonhole.7.in --- a/doc/man/pigeonhole.7.in Sat Jan 07 16:22:20 2012 +0100 +++ b/doc/man/pigeonhole.7.in Sat Jan 07 16:29:23 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "PIGEONHOLE" 7 "2010-03-05" "Pigeonhole for Dovecot v2.0" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "PIGEONHOLE" 7 "2012-01-07" "Pigeonhole for Dovecot v2.0" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME pigeonhole \- Overview of the Pigeonhole project\(aqs Sieve support for the diff -r f7cee9f3c8a6 -r 8715c044a7ee doc/man/sieve-dump.1.in --- a/doc/man/sieve-dump.1.in Sat Jan 07 16:22:20 2012 +0100 +++ b/doc/man/sieve-dump.1.in Sat Jan 07 16:29:23 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-DUMP" 1 "2011-10-04" "Pigeonhole for Dovecot v2.0" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-DUMP" 1 "2012-01-07" "Pigeonhole for Dovecot v2.0" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sieve\-dump \- Pigeonhole\(aqs Sieve script binary dump tool diff -r f7cee9f3c8a6 -r 8715c044a7ee doc/man/sieve-filter.1.in --- a/doc/man/sieve-filter.1.in Sat Jan 07 16:22:20 2012 +0100 +++ b/doc/man/sieve-filter.1.in Sat Jan 07 16:29:23 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-FILTER" 1 "2011-10-04" "Pigeonhole for Dovecot v2.0" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-FILTER" 1 "2012-01-07" "Pigeonhole for Dovecot v2.0" "Pigeonhole" .SH NAME sieve\-filter \- Pigeonhole\(aqs Sieve mailbox filter tool diff -r f7cee9f3c8a6 -r 8715c044a7ee doc/man/sieve-test.1.in --- a/doc/man/sieve-test.1.in Sat Jan 07 16:22:20 2012 +0100 +++ b/doc/man/sieve-test.1.in Sat Jan 07 16:29:23 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-TEST" 1 "2011-10-04" "Pigeonhole for Dovecot v2.0" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-TEST" 1 "2012-01-07" "Pigeonhole for Dovecot v2.0" "Pigeonhole" .SH NAME sieve\-test \- Pigeonhole\(aqs Sieve script tester .\"------------------------------------------------------------------------ diff -r f7cee9f3c8a6 -r 8715c044a7ee doc/man/sievec.1.in --- a/doc/man/sievec.1.in Sat Jan 07 16:22:20 2012 +0100 +++ b/doc/man/sievec.1.in Sat Jan 07 16:29:23 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVEC" 1 "2011-10-04" "Pigeonhole for Dovecot v2.0" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVEC" 1 "2012-01-07" "Pigeonhole for Dovecot v2.0" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sievec \- Pigeonhole\(aqs Sieve script compiler diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.h Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-managesieve/managesieve-quote.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-managesieve/managesieve-quote.h Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve-tool/mail-raw.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve-tool/mail-raw.h Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve-tool/sieve-tool.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve-tool/sieve-tool.h Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-discard.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-if.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-keep.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-redirect.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-require.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmd-stop.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/cmp-i-octet.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/ext-encoded-character.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension encoded-character diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/ext-envelope.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension envelope diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/ext-fileinto.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension fileinto diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/ext-reject.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension reject diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/mcht-contains.c --- a/src/lib-sieve/mcht-contains.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/mcht-contains.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':contains' diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/mcht-is.c --- a/src/lib-sieve/mcht-is.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/mcht-is.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':is': diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/mcht-matches.c --- a/src/lib-sieve/mcht-matches.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/mcht-matches.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':matches' diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/plugins/body/ext-body-common.c --- a/src/lib-sieve/plugins/body/ext-body-common.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/plugins/body/ext-body-common.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/plugins/body/ext-body-common.h --- a/src/lib-sieve/plugins/body/ext-body-common.h Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/plugins/body/ext-body-common.h Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __EXT_BODY_COMMON_H diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/plugins/body/ext-body.c --- a/src/lib-sieve/plugins/body/ext-body.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/plugins/body/ext-body.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension body diff -r f7cee9f3c8a6 -r 8715c044a7ee src/lib-sieve/plugins/body/tst-body.c --- a/src/lib-sieve/plugins/body/tst-body.c Sat Jan 07 16:22:20 2012 +0100 +++ b/src/lib-sieve/plugins/body/tst-body.c Sat Jan 07 16:29:23 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "sieve-extensions.h" diff -r f7cee9f3c8a6 -r 8715c044a7ee 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 Sat Jan 07 16:22:20 2012 +0100 From pigeonhole at rename-it.nl Sat Jan 7 17:36:02 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 07 Jan 2012 16:36:02 +0100 Subject: dovecot-2.1-pigeonhole: Updated copyright notices to include yea... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/c2e3b2c93c8c changeset: 1593:c2e3b2c93c8c user: Stephan Bosch date: Sat Jan 07 16:35:56 2012 +0100 description: Updated copyright notices to include year 2012. diffstat: doc/man/pigeonhole.7.in | 4 ++-- doc/man/sieve-dump.1.in | 4 ++-- doc/man/sieve-filter.1.in | 4 ++-- doc/man/sieve-test.1.in | 4 ++-- doc/man/sievec.1.in | 4 ++-- 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 | 3 +++ src/lib-sieve/edit-mail.h | 3 +++ 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/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-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.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 +- 309 files changed, 318 insertions(+), 312 deletions(-) diffs (truncated from 2793 to 300 lines): diff -r bd5cffe2ed95 -r c2e3b2c93c8c doc/man/pigeonhole.7.in --- a/doc/man/pigeonhole.7.in Sat Jan 07 16:01:10 2012 +0100 +++ b/doc/man/pigeonhole.7.in Sat Jan 07 16:35:56 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "PIGEONHOLE" 7 "2011-12-17" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "PIGEONHOLE" 7 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME pigeonhole \- Overview of the Pigeonhole project\(aqs Sieve support for the diff -r bd5cffe2ed95 -r c2e3b2c93c8c doc/man/sieve-dump.1.in --- a/doc/man/sieve-dump.1.in Sat Jan 07 16:01:10 2012 +0100 +++ b/doc/man/sieve-dump.1.in Sat Jan 07 16:35:56 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-DUMP" 1 "2011-12-17" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-DUMP" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sieve\-dump \- Pigeonhole\(aqs Sieve script binary dump tool diff -r bd5cffe2ed95 -r c2e3b2c93c8c doc/man/sieve-filter.1.in --- a/doc/man/sieve-filter.1.in Sat Jan 07 16:01:10 2012 +0100 +++ b/doc/man/sieve-filter.1.in Sat Jan 07 16:35:56 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-FILTER" 1 "2011-12-17" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-FILTER" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" .SH NAME sieve\-filter \- Pigeonhole\(aqs Sieve mailbox filter tool diff -r bd5cffe2ed95 -r c2e3b2c93c8c doc/man/sieve-test.1.in --- a/doc/man/sieve-test.1.in Sat Jan 07 16:01:10 2012 +0100 +++ b/doc/man/sieve-test.1.in Sat Jan 07 16:35:56 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVE\-TEST" 1 "2011-12-17" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVE\-TEST" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" .SH NAME sieve\-test \- Pigeonhole\(aqs Sieve script tester .\"------------------------------------------------------------------------ diff -r bd5cffe2ed95 -r c2e3b2c93c8c doc/man/sievec.1.in --- a/doc/man/sievec.1.in Sat Jan 07 16:01:10 2012 +0100 +++ b/doc/man/sievec.1.in Sat Jan 07 16:35:56 2012 +0100 @@ -1,5 +1,5 @@ -.\" Copyright (c) 2010-2011 Pigeonhole authors, see the included COPYING file -.TH "SIEVEC" 1 "2011-12-17" "Pigeonhole for Dovecot v2.1" "Pigeonhole" +.\" Copyright (c) 2010-2012 Pigeonhole authors, see the included COPYING file +.TH "SIEVEC" 1 "2012-01-07" "Pigeonhole for Dovecot v2.1" "Pigeonhole" .\"------------------------------------------------------------------------ .SH NAME sievec \- Pigeonhole\(aqs Sieve script compiler diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-managesieve/managesieve-quote.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-managesieve/managesieve-quote.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve-tool/mail-raw.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve-tool/mail-raw.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve-tool/sieve-tool.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve-tool/sieve-tool.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-discard.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-if.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-keep.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-redirect.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-require.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmd-stop.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "sieve-common.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/cmp-i-octet.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/edit-mail.c --- a/src/lib-sieve/edit-mail.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/edit-mail.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file + */ + #include "lib.h" #include "array.h" #include "str.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/edit-mail.h --- a/src/lib-sieve/edit-mail.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/edit-mail.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file + */ + #ifndef __EDIT_MAIL_H #define __EDIT_MAIL_H diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/ext-encoded-character.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension encoded-character diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/ext-envelope.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension envelope diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/ext-fileinto.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension fileinto diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/ext-reject.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Extension reject diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/mcht-contains.c --- a/src/lib-sieve/mcht-contains.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/mcht-contains.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':contains' diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/mcht-is.c --- a/src/lib-sieve/mcht-is.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/mcht-is.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':is': diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/mcht-matches.c --- a/src/lib-sieve/mcht-matches.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/mcht-matches.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ /* Match-type ':matches' diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/plugins/body/ext-body-common.c --- a/src/lib-sieve/plugins/body/ext-body-common.c Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/plugins/body/ext-body-common.c Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #include "lib.h" diff -r bd5cffe2ed95 -r c2e3b2c93c8c src/lib-sieve/plugins/body/ext-body-common.h --- a/src/lib-sieve/plugins/body/ext-body-common.h Sat Jan 07 16:01:10 2012 +0100 +++ b/src/lib-sieve/plugins/body/ext-body-common.h Sat Jan 07 16:35:56 2012 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file */ #ifndef __EXT_BODY_COMMON_H From dovecot at dovecot.org Sat Jan 7 20:28:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 07 Jan 2012 20:28:52 +0200 Subject: dovecot-2.1: Removed unnecessary code. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5173218ff7fe changeset: 13910:5173218ff7fe user: Timo Sirainen date: Sat Jan 07 20:28:42 2012 +0200 description: Removed unnecessary code. diffstat: src/auth/auth-request.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r a0f9887133e6 -r 5173218ff7fe src/auth/auth-request.c --- a/src/auth/auth-request.c Fri Jan 06 21:34:36 2012 +0200 +++ b/src/auth/auth-request.c Sat Jan 07 20:28:42 2012 +0200 @@ -647,7 +647,7 @@ PASSDB_RESULT_INTERNAL_FAILURE, request); } else if (passdb->blocking) { passdb_blocking_verify_plain(request); - } else if (passdb->iface.verify_plain != NULL) { + } else { passdb_template_export(passdb->default_fields_tmpl, request); passdb->iface.verify_plain(request, password, auth_request_verify_plain_callback); From dovecot at dovecot.org Mon Jan 9 16:35:34 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 16:35:34 +0200 Subject: dovecot-2.1: auth: Use linked list instead of array for storing ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/fd8fc3b7615e changeset: 13911:fd8fc3b7615e user: Timo Sirainen date: Mon Jan 09 16:29:37 2012 +0200 description: auth: Use linked list instead of array for storing list of auth connections. With arrays the removal was slower than necessary. diffstat: src/auth/auth-client-connection.c | 50 ++++++++++++-------------------------- src/auth/auth-client-connection.h | 4 +- src/auth/auth-master-connection.c | 38 +++++++++-------------------- src/auth/auth-master-connection.h | 7 +--- src/auth/main.c | 4 +- 5 files changed, 34 insertions(+), 69 deletions(-) diffs (253 lines): diff -r 5173218ff7fe -r fd8fc3b7615e src/auth/auth-client-connection.c --- a/src/auth/auth-client-connection.c Sat Jan 07 20:28:42 2012 +0200 +++ b/src/auth/auth-client-connection.c Mon Jan 09 16:29:37 2012 +0200 @@ -1,13 +1,13 @@ /* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */ #include "auth-common.h" -#include "array.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" #include "network.h" #include "hex-binary.h" #include "hostpid.h" +#include "llist.h" #include "str.h" #include "str-sanitize.h" #include "randgen.h" @@ -24,12 +24,12 @@ #define OUTBUF_THROTTLE_SIZE (1024*50) -static ARRAY_DEFINE(auth_client_connections, struct auth_client_connection *); - static void auth_client_disconnected(struct auth_client_connection **_conn); static void auth_client_connection_unref(struct auth_client_connection **_conn); static void auth_client_input(struct auth_client_connection *conn); +static struct auth_client_connection *auth_client_connections; + static const char *reply_line_hide_pass(const char *line) { const char *p, *p2; @@ -304,7 +304,7 @@ o_stream_set_flush_callback(conn->output, auth_client_output, conn); conn->io = io_add(fd, IO_READ, auth_client_input, conn); - array_append(&auth_client_connections, &conn, 1); + DLLIST_PREPEND(&auth_client_connections, conn); str = t_str_new(128); str_printfa(str, "VERSION\t%u\t%u\n%sSPID\t%s\nCUID\t%u\nCOOKIE\t", @@ -323,21 +323,12 @@ void auth_client_connection_destroy(struct auth_client_connection **_conn) { struct auth_client_connection *conn = *_conn; - struct auth_client_connection *const *clients; - unsigned int idx; *_conn = NULL; if (conn->fd == -1) return; - array_foreach(&auth_client_connections, clients) { - if (*clients == conn) { - idx = array_foreach_idx(&auth_client_connections, - clients); - array_delete(&auth_client_connections, idx, 1); - break; - } - } + DLLIST_REMOVE(&auth_client_connections, conn); i_stream_close(conn->input); o_stream_close(conn->output); @@ -398,30 +389,21 @@ struct auth_client_connection * auth_client_connection_lookup(unsigned int pid) { - struct auth_client_connection *const *clients; + struct auth_client_connection *conn; - array_foreach(&auth_client_connections, clients) { - struct auth_client_connection *client = *clients; - - if (client->pid == pid) - return client; + for (conn = auth_client_connections; conn != NULL; conn = conn->next) { + if (conn->pid == pid) + return conn; } - return NULL; } -void auth_client_connections_init(void) +void auth_client_connections_destroy_all(void) { - i_array_init(&auth_client_connections, 16); + struct auth_client_connection *conn; + + while (auth_client_connections != NULL) { + conn = auth_client_connections; + auth_client_connection_destroy(&conn); + } } - -void auth_client_connections_deinit(void) -{ - struct auth_client_connection **clients; - unsigned int i, count; - - clients = array_get_modifiable(&auth_client_connections, &count); - for (i = count; i > 0; i--) - auth_client_connection_destroy(&clients[i-1]); - array_free(&auth_client_connections); -} diff -r 5173218ff7fe -r fd8fc3b7615e src/auth/auth-client-connection.h --- a/src/auth/auth-client-connection.h Sat Jan 07 20:28:42 2012 +0200 +++ b/src/auth/auth-client-connection.h Mon Jan 09 16:29:37 2012 +0200 @@ -4,6 +4,7 @@ #include "master-auth.h" struct auth_client_connection { + struct auth_client_connection *prev, *next; struct auth *auth; int refcount; @@ -28,7 +29,6 @@ struct auth_client_connection * auth_client_connection_lookup(unsigned int pid); -void auth_client_connections_init(void); -void auth_client_connections_deinit(void); +void auth_client_connections_destroy_all(void); #endif diff -r 5173218ff7fe -r fd8fc3b7615e src/auth/auth-master-connection.c --- a/src/auth/auth-master-connection.c Sat Jan 07 20:28:42 2012 +0200 +++ b/src/auth/auth-master-connection.c Mon Jan 09 16:29:37 2012 +0200 @@ -1,8 +1,9 @@ /* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */ #include "auth-common.h" -#include "array.h" +#include "buffer.h" #include "hash.h" +#include "llist.h" #include "str.h" #include "strescape.h" #include "str-sanitize.h" @@ -41,7 +42,7 @@ static void master_input(struct auth_master_connection *conn); -ARRAY_TYPE(auth_master_connections) auth_master_connections; +static struct auth_master_connection *auth_master_connections; static const char * auth_master_reply_hide_passwords(struct auth_master_connection *conn, @@ -678,7 +679,7 @@ AUTH_MASTER_PROTOCOL_MINOR_VERSION, my_pid); (void)o_stream_send_str(conn->output, line); - array_append(&auth_master_connections, &conn, 1); + DLLIST_PREPEND(&auth_master_connections, conn); if (auth_master_connection_set_permissions(conn, socket_st) < 0) { auth_master_connection_destroy(&conn); @@ -690,22 +691,13 @@ void auth_master_connection_destroy(struct auth_master_connection **_conn) { struct auth_master_connection *conn = *_conn; - struct auth_master_connection *const *masters; - unsigned int idx; *_conn = NULL; if (conn->destroyed) return; conn->destroyed = TRUE; - array_foreach(&auth_master_connections, masters) { - if (*masters == conn) { - idx = array_foreach_idx(&auth_master_connections, - masters); - array_delete(&auth_master_connections, idx, 1); - break; - } - } + DLLIST_REMOVE(&auth_master_connections, conn); if (conn->input != NULL) i_stream_close(conn->input); @@ -749,18 +741,12 @@ i_free(conn); } -void auth_master_connections_init(void) +void auth_master_connections_destroy_all(void) { - i_array_init(&auth_master_connections, 16); + struct auth_master_connection *conn; + + while (auth_master_connections != NULL) { + conn = auth_master_connections; + auth_master_connection_destroy(&conn); + } } - -void auth_master_connections_deinit(void) -{ - struct auth_master_connection **masters; - unsigned int i, count; - - masters = array_get_modifiable(&auth_master_connections, &count); - for (i = count; i > 0; i--) - auth_master_connection_destroy(&masters[i-1]); - array_free(&auth_master_connections); -} diff -r 5173218ff7fe -r fd8fc3b7615e src/auth/auth-master-connection.h --- a/src/auth/auth-master-connection.h Sat Jan 07 20:28:42 2012 +0200 +++ b/src/auth/auth-master-connection.h Mon Jan 09 16:29:37 2012 +0200 @@ -5,6 +5,7 @@ struct auth_stream_reply; struct auth_master_connection { + struct auth_master_connection *prev, *next; struct auth *auth; int refcount; @@ -23,9 +24,6 @@ unsigned int destroyed:1; unsigned int userdb_only:1; }; -ARRAY_DEFINE_TYPE(auth_master_connections, struct auth_master_connection *); - -extern ARRAY_TYPE(auth_master_connections) auth_master_connections; struct auth_master_connection * auth_master_connection_create(struct auth *auth, int fd, @@ -39,7 +37,6 @@ void auth_master_request_callback(struct auth_stream_reply *reply, void *context); -void auth_master_connections_init(void); -void auth_master_connections_deinit(void); +void auth_master_connections_destroy_all(void); #endif diff -r 5173218ff7fe -r fd8fc3b7615e src/auth/main.c --- a/src/auth/main.c Sat Jan 07 20:28:42 2012 +0200 +++ b/src/auth/main.c Mon Jan 09 16:29:37 2012 +0200 @@ -261,8 +261,8 @@ /* there are no more auth requests */ auths_free(); - auth_client_connections_deinit(); - auth_master_connections_deinit(); + auth_client_connections_destroy_all(); + auth_master_connections_destroy_all(); if (auth_worker_client != NULL) auth_worker_client_destroy(&auth_worker_client); From dovecot at dovecot.org Mon Jan 9 16:35:34 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 16:35:34 +0200 Subject: dovecot-2.1: auth: Implemented support for Postfix's "TCP map" s... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/f562bcaca215 changeset: 13912:f562bcaca215 user: Timo Sirainen date: Mon Jan 09 16:35:22 2012 +0200 description: auth: Implemented support for Postfix's "TCP map" sockets for user existence lookups. diffstat: src/auth/Makefile.am | 2 + src/auth/auth-postfix-connection.c | 248 +++++++++++++++++++++++++++++++++++++ src/auth/auth-postfix-connection.h | 10 + src/auth/main.c | 12 +- 4 files changed, 269 insertions(+), 3 deletions(-) diffs (truncated from 342 to 300 lines): diff -r fd8fc3b7615e -r f562bcaca215 src/auth/Makefile.am --- a/src/auth/Makefile.am Mon Jan 09 16:29:37 2012 +0200 +++ b/src/auth/Makefile.am Mon Jan 09 16:35:22 2012 +0200 @@ -60,6 +60,7 @@ auth-cache.c \ auth-client-connection.c \ auth-master-connection.c \ + auth-postfix-connection.c \ mech-otp-skey-common.c \ mech-plain-common.c \ auth-penalty.c \ @@ -121,6 +122,7 @@ auth-client-connection.h \ auth-common.h \ auth-master-connection.h \ + auth-postfix-connection.h \ mech-otp-skey-common.h \ mech-plain-common.h \ auth-penalty.h \ diff -r fd8fc3b7615e -r f562bcaca215 src/auth/auth-postfix-connection.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/auth/auth-postfix-connection.c Mon Jan 09 16:35:22 2012 +0200 @@ -0,0 +1,248 @@ +/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */ + +#include "auth-common.h" +#include "ioloop.h" +#include "network.h" +#include "istream.h" +#include "ostream.h" +#include "llist.h" +#include "str.h" +#include "strescape.h" +#include "str-sanitize.h" +#include "master-service.h" +#include "userdb.h" +#include "auth-postfix-connection.h" + +#include + +#define MAX_INBUF_SIZE 1024 +#define MAX_OUTBUF_SIZE (1024*50) + +struct auth_postfix_connection { + struct auth_postfix_connection *prev, *next; + struct auth *auth; + int refcount; + + int fd; + char *path; + struct istream *input; + struct ostream *output; + struct io *io; + + unsigned int destroyed:1; +}; + +static void postfix_input(struct auth_postfix_connection *conn); +static void auth_postfix_connection_ref(struct auth_postfix_connection *conn); +static void auth_postfix_connection_destroy(struct auth_postfix_connection **_conn); +static void auth_postfix_connection_unref(struct auth_postfix_connection **_conn); + +static struct auth_postfix_connection *auth_postfix_connections; + +static int +postfix_input_auth_request(struct auth_postfix_connection *conn, + const char *username, + struct auth_request **request_r, const char **error_r) +{ + struct auth_request *auth_request; + + auth_request = auth_request_new_dummy(); + auth_request->id = 1; + auth_request->context = conn; + auth_postfix_connection_ref(conn); + + if (!auth_request_set_username(auth_request, username, error_r)) { + *request_r = auth_request; + return FALSE; + } + (void)auth_request_import_info(auth_request, "service", "postfix"); + + auth_request_init(auth_request); + *request_r = auth_request; + return TRUE; +} + +static void +user_callback(enum userdb_result result, struct auth_request *auth_request) +{ + struct auth_postfix_connection *conn = auth_request->context; + struct auth_stream_reply *reply = auth_request->userdb_reply; + string_t *str; + const char *value; + + if (auth_request->userdb_lookup_failed) + result = USERDB_RESULT_INTERNAL_FAILURE; + + str = t_str_new(128); + switch (result) { + case USERDB_RESULT_INTERNAL_FAILURE: + if (auth_request->userdb_lookup_failed) + value = auth_stream_reply_find(reply, "reason"); + else + value = NULL; + str_printfa(str, "400 %s", + value != NULL ? value: "Internal failure"); + break; + case USERDB_RESULT_USER_UNKNOWN: + str_append(str, "500 User not found"); + break; + case USERDB_RESULT_OK: + str_append(str, "200 1"); + break; + } + + if (conn->auth->set->debug) + i_debug("postfix out: %s", str_c(str)); + + str_append_c(str, '\n'); + (void)o_stream_send(conn->output, str_data(str), str_len(str)); + + i_assert(conn->io == NULL); + if (!conn->destroyed) + conn->io = io_add(conn->fd, IO_READ, postfix_input, conn); + + auth_request_unref(&auth_request); + auth_postfix_connection_unref(&conn); +} + +static bool +postfix_input_user(struct auth_postfix_connection *conn, const char *username) +{ + struct auth_request *auth_request; + const char *error; + + io_remove(&conn->io); + if (!postfix_input_auth_request(conn, username, + &auth_request, &error)) { + auth_request_log_info(auth_request, "postfix", "%s", error); + user_callback(USERDB_RESULT_USER_UNKNOWN, auth_request); + } else { + auth_request_set_state(auth_request, AUTH_REQUEST_STATE_USERDB); + auth_request_lookup_user(auth_request, user_callback); + } + return TRUE; +} + +static bool +auth_postfix_input_line(struct auth_postfix_connection *conn, const char *line) +{ + if (conn->auth->set->debug) + i_debug("postfix in: %s", line); + + if (strncasecmp(line, "get ", 4) == 0) + return postfix_input_user(conn, line + 4); + + i_error("BUG: Unknown command in postfix socket: %s", + str_sanitize(line, 80)); + return FALSE; +} + +static void postfix_input(struct auth_postfix_connection *conn) +{ + char *line; + bool ret; + + switch (i_stream_read(conn->input)) { + case 0: + return; + case -1: + /* disconnected */ + auth_postfix_connection_destroy(&conn); + return; + case -2: + /* buffer full */ + i_error("BUG: Postfix sent us more than %d bytes", + (int)MAX_INBUF_SIZE); + auth_postfix_connection_destroy(&conn); + return; + } + + while ((line = i_stream_next_line(conn->input)) != NULL) { + T_BEGIN { + ret = auth_postfix_input_line(conn, line); + } T_END; + if (!ret) { + auth_postfix_connection_destroy(&conn); + return; + } + } +} + +struct auth_postfix_connection * +auth_postfix_connection_create(struct auth *auth, int fd) +{ + struct auth_postfix_connection *conn; + + conn = i_new(struct auth_postfix_connection, 1); + conn->refcount = 1; + conn->fd = fd; + conn->auth = auth; + conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE); + conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE); + conn->io = io_add(fd, IO_READ, postfix_input, conn); + DLLIST_PREPEND(&auth_postfix_connections, conn); + return conn; +} + +static void +auth_postfix_connection_destroy(struct auth_postfix_connection **_conn) +{ + struct auth_postfix_connection *conn = *_conn; + + *_conn = NULL; + if (conn->destroyed) + return; + conn->destroyed = TRUE; + + DLLIST_REMOVE(&auth_postfix_connections, conn); + + if (conn->input != NULL) + i_stream_close(conn->input); + if (conn->output != NULL) + o_stream_close(conn->output); + if (conn->io != NULL) + io_remove(&conn->io); + if (conn->fd != -1) { + if (close(conn->fd) < 0) + i_error("close(%s): %m", conn->path); + conn->fd = -1; + } + + master_service_client_connection_destroyed(master_service); + auth_postfix_connection_unref(&conn); +} + +static void auth_postfix_connection_ref(struct auth_postfix_connection *conn) +{ + i_assert(conn->refcount > 0); + + conn->refcount++; +} + +static void +auth_postfix_connection_unref(struct auth_postfix_connection **_conn) +{ + struct auth_postfix_connection *conn = *_conn; + + *_conn = NULL; + i_assert(conn->refcount > 0); + + if (--conn->refcount > 0) + return; + + if (conn->input != NULL) + i_stream_unref(&conn->input); + if (conn->output != NULL) + o_stream_unref(&conn->output); + i_free(conn); +} + +void auth_postfix_connections_destroy_all(void) +{ + struct auth_postfix_connection *conn; + + while (auth_postfix_connections != NULL) { + conn = auth_postfix_connections; + auth_postfix_connection_destroy(&conn); + } +} diff -r fd8fc3b7615e -r f562bcaca215 src/auth/auth-postfix-connection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/auth/auth-postfix-connection.h Mon Jan 09 16:35:22 2012 +0200 @@ -0,0 +1,10 @@ +#ifndef AUTH_POSTFIX_CONNECTION_H +#define AUTH_POSTFIX_CONNECTION_H + +struct auth_postfix_connection * +auth_postfix_connection_create(struct auth *auth, int fd); + +void auth_postfix_connections_destroy_all(void); + +#endif + diff -r fd8fc3b7615e -r f562bcaca215 src/auth/main.c --- a/src/auth/main.c Mon Jan 09 16:29:37 2012 +0200 +++ b/src/auth/main.c Mon Jan 09 16:35:22 2012 +0200 @@ -26,6 +26,7 @@ #include "auth-worker-client.h" #include "auth-master-connection.h" #include "auth-client-connection.h" +#include "auth-postfix-connection.h" #include #include @@ -37,7 +38,8 @@ AUTH_SOCKET_CLIENT, AUTH_SOCKET_LOGIN_CLIENT, AUTH_SOCKET_MASTER, From dovecot at dovecot.org Mon Jan 9 20:31:59 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 20:31:59 +0200 Subject: dovecot-2.1: lib-lda: Make lmtp_client_state_to_string() more ve... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7c39b94ded90 changeset: 13913:7c39b94ded90 user: Timo Sirainen date: Mon Jan 09 20:31:53 2012 +0200 description: lib-lda: Make lmtp_client_state_to_string() more verbose. diffstat: src/lib-lda/lmtp-client.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diffs (33 lines): diff -r f562bcaca215 -r 7c39b94ded90 src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Mon Jan 09 16:35:22 2012 +0200 +++ b/src/lib-lda/lmtp-client.c Mon Jan 09 20:31:53 2012 +0200 @@ -153,6 +153,8 @@ const char *lmtp_client_state_to_string(struct lmtp_client *client) { + uoff_t size; + switch (client->input_state) { case LMTP_INPUT_STATE_GREET: return "greeting"; @@ -163,9 +165,18 @@ case LMTP_INPUT_STATE_RCPT_TO: return "RCPT TO"; case LMTP_INPUT_STATE_DATA_CONTINUE: - return "DATA"; + return "DATA init"; case LMTP_INPUT_STATE_DATA: - return "end-of-DATA"; + if (client->output_finished) + return "DATA reply"; + else if (i_stream_get_size(client->data_input, FALSE, &size) > 0) { + return t_strdup_printf( + "DATA (%"PRIuUOFF_T"/%"PRIuUOFF_T")", + client->data_input->v_offset, size); + } else { + return t_strdup_printf("DATA (%"PRIuUOFF_T"/?)", + client->data_input->v_offset); + } } return "??"; } From dovecot at dovecot.org Mon Jan 9 20:32:39 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 20:32:39 +0200 Subject: dovecot-2.0: lib-lda: Make lmtp_client_state_to_string() more ve... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5b8b296239a5 changeset: 13013:5b8b296239a5 user: Timo Sirainen date: Mon Jan 09 20:31:53 2012 +0200 description: lib-lda: Make lmtp_client_state_to_string() more verbose. diffstat: src/lib-lda/lmtp-client.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diffs (33 lines): diff -r 38972af8bd29 -r 5b8b296239a5 src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Fri Jan 06 16:04:20 2012 +0200 +++ b/src/lib-lda/lmtp-client.c Mon Jan 09 20:31:53 2012 +0200 @@ -153,6 +153,8 @@ const char *lmtp_client_state_to_string(struct lmtp_client *client) { + uoff_t size; + switch (client->input_state) { case LMTP_INPUT_STATE_GREET: return "greeting"; @@ -163,9 +165,18 @@ case LMTP_INPUT_STATE_RCPT_TO: return "RCPT TO"; case LMTP_INPUT_STATE_DATA_CONTINUE: - return "DATA"; + return "DATA init"; case LMTP_INPUT_STATE_DATA: - return "end-of-DATA"; + if (client->output_finished) + return "DATA reply"; + else if (i_stream_get_size(client->data_input, FALSE, &size) > 0) { + return t_strdup_printf( + "DATA (%"PRIuUOFF_T"/%"PRIuUOFF_T")", + client->data_input->v_offset, size); + } else { + return t_strdup_printf("DATA (%"PRIuUOFF_T"/?)", + client->data_input->v_offset); + } } return "??"; } From dovecot at dovecot.org Mon Jan 9 20:54:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 20:54:04 +0200 Subject: dovecot-2.1: auth: Check also masterdbs when checking if auth me... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/32f61c8498a4 changeset: 13914:32f61c8498a4 user: Timo Sirainen date: Mon Jan 09 20:53:51 2012 +0200 description: auth: Check also masterdbs when checking if auth mechanism can be used. Patch by Yubao Liu diffstat: src/auth/auth.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diffs (36 lines): diff -r 7c39b94ded90 -r 32f61c8498a4 src/auth/auth.c --- a/src/auth/auth.c Mon Jan 09 20:31:53 2012 +0200 +++ b/src/auth/auth.c Mon Jan 09 20:53:51 2012 +0200 @@ -51,6 +51,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.verify_plain != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.verify_plain != NULL) return TRUE; @@ -62,6 +66,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.lookup_credentials != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.lookup_credentials != NULL) return TRUE; @@ -73,6 +81,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.set_credentials != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.set_credentials != NULL) return TRUE; From dovecot at dovecot.org Mon Jan 9 20:54:19 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 20:54:19 +0200 Subject: dovecot-2.0: auth: Check also masterdbs when checking if auth me... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/bed15faedfd4 changeset: 13014:bed15faedfd4 user: Timo Sirainen date: Mon Jan 09 20:53:51 2012 +0200 description: auth: Check also masterdbs when checking if auth mechanism can be used. Patch by Yubao Liu diffstat: src/auth/auth.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diffs (36 lines): diff -r 5b8b296239a5 -r bed15faedfd4 src/auth/auth.c --- a/src/auth/auth.c Mon Jan 09 20:31:53 2012 +0200 +++ b/src/auth/auth.c Mon Jan 09 20:53:51 2012 +0200 @@ -111,6 +111,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.verify_plain != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.verify_plain != NULL) return TRUE; @@ -122,6 +126,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.lookup_credentials != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.lookup_credentials != NULL) return TRUE; @@ -133,6 +141,10 @@ { struct auth_passdb *passdb; + for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next) { + if (passdb->passdb->iface.set_credentials != NULL) + return TRUE; + } for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) { if (passdb->passdb->iface.set_credentials != NULL) return TRUE; From dovecot at dovecot.org Mon Jan 9 21:11:01 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 21:11:01 +0200 Subject: dovecot-2.1: imapc: Treat master_user="" the same as NULL. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/43aa5c4f0bfd changeset: 13915:43aa5c4f0bfd user: Timo Sirainen date: Mon Jan 09 21:10:30 2012 +0200 description: imapc: Treat master_user="" the same as NULL. diffstat: src/lib-imap-client/imapc-client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 32f61c8498a4 -r 43aa5c4f0bfd src/lib-imap-client/imapc-client.c --- a/src/lib-imap-client/imapc-client.c Mon Jan 09 20:53:51 2012 +0200 +++ b/src/lib-imap-client/imapc-client.c Mon Jan 09 21:10:30 2012 +0200 @@ -49,7 +49,7 @@ client->set.debug = set->debug; client->set.host = p_strdup(pool, set->host); client->set.port = set->port; - client->set.master_user = p_strdup(pool, set->master_user); + client->set.master_user = p_strdup_empty(pool, set->master_user); client->set.username = p_strdup(pool, set->username); client->set.password = p_strdup(pool, set->password); client->set.dns_client_socket_path = From dovecot at dovecot.org Mon Jan 9 21:11:01 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 21:11:01 +0200 Subject: dovecot-2.1: imapc: Added imapc_master_user setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b860d38f6b9e changeset: 13916:b860d38f6b9e user: Timo Sirainen date: Mon Jan 09 21:10:35 2012 +0200 description: imapc: Added imapc_master_user setting. diffstat: src/lib-storage/index/imapc/imapc-settings.c | 2 ++ src/lib-storage/index/imapc/imapc-settings.h | 1 + src/lib-storage/index/imapc/imapc-storage.c | 1 + 3 files changed, 4 insertions(+), 0 deletions(-) diffs (41 lines): diff -r 43aa5c4f0bfd -r b860d38f6b9e src/lib-storage/index/imapc/imapc-settings.c --- a/src/lib-storage/index/imapc/imapc-settings.c Mon Jan 09 21:10:30 2012 +0200 +++ b/src/lib-storage/index/imapc/imapc-settings.c Mon Jan 09 21:10:35 2012 +0200 @@ -18,6 +18,7 @@ DEF(SET_UINT, imapc_port), DEF(SET_STR_VARS, imapc_user), + DEF(SET_STR_VARS, imapc_master_user), DEF(SET_STR, imapc_password), DEF(SET_ENUM, imapc_ssl), @@ -35,6 +36,7 @@ .imapc_port = 143, .imapc_user = "%u", + .imapc_master_user = "", .imapc_password = "", .imapc_ssl = "no:imaps:starttls", diff -r 43aa5c4f0bfd -r b860d38f6b9e src/lib-storage/index/imapc/imapc-settings.h --- a/src/lib-storage/index/imapc/imapc-settings.h Mon Jan 09 21:10:30 2012 +0200 +++ b/src/lib-storage/index/imapc/imapc-settings.h Mon Jan 09 21:10:35 2012 +0200 @@ -6,6 +6,7 @@ unsigned int imapc_port; const char *imapc_user; + const char *imapc_master_user; const char *imapc_password; const char *imapc_ssl; diff -r 43aa5c4f0bfd -r b860d38f6b9e src/lib-storage/index/imapc/imapc-storage.c --- a/src/lib-storage/index/imapc/imapc-storage.c Mon Jan 09 21:10:30 2012 +0200 +++ b/src/lib-storage/index/imapc/imapc-storage.c Mon Jan 09 21:10:35 2012 +0200 @@ -222,6 +222,7 @@ } set.port = storage->set->imapc_port; set.username = storage->set->imapc_user; + set.master_user = storage->set->imapc_master_user; set.password = storage->set->imapc_password; if (*set.password == '\0') { *error_r = "missing imapc_password"; From dovecot at dovecot.org Mon Jan 9 23:57:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 23:57:37 +0200 Subject: dovecot-2.1: master: "Out of memory" message shows now the servi... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/16d32dda723c changeset: 13917:16d32dda723c user: Timo Sirainen date: Mon Jan 09 23:57:25 2012 +0200 description: master: "Out of memory" message shows now the service {} block around vsz_limit. diffstat: src/master/service-process.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (14 lines): diff -r b860d38f6b9e -r 16d32dda723c src/master/service-process.c --- a/src/master/service-process.c Mon Jan 09 21:10:35 2012 +0200 +++ b/src/master/service-process.c Mon Jan 09 23:57:25 2012 +0200 @@ -389,8 +389,9 @@ case FATAL_OUTOFMEM: if (service->vsz_limit == 0) return "Out of memory"; - return t_strdup_printf("Out of memory (vsz_limit=%u MB, " + return t_strdup_printf("Out of memory (service %s { vsz_limit=%u MB }, " "you may need to increase it)", + service->set->name, (unsigned int)(service->vsz_limit/1024/1024)); case FATAL_EXEC: return "exec() failed"; From dovecot at dovecot.org Mon Jan 9 23:57:50 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 Jan 2012 23:57:50 +0200 Subject: dovecot-2.0: master: "Out of memory" message shows now the servi... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/656386359374 changeset: 13015:656386359374 user: Timo Sirainen date: Mon Jan 09 23:57:25 2012 +0200 description: master: "Out of memory" message shows now the service {} block around vsz_limit. diffstat: src/master/service-process.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (14 lines): diff -r bed15faedfd4 -r 656386359374 src/master/service-process.c --- a/src/master/service-process.c Mon Jan 09 20:53:51 2012 +0200 +++ b/src/master/service-process.c Mon Jan 09 23:57:25 2012 +0200 @@ -365,8 +365,9 @@ case FATAL_OUTOFMEM: if (service->vsz_limit == 0) return "Out of memory"; - return t_strdup_printf("Out of memory (vsz_limit=%u MB, " + return t_strdup_printf("Out of memory (service %s { vsz_limit=%u MB }, " "you may need to increase it)", + service->set->name, (unsigned int)(service->vsz_limit/1024/1024)); case FATAL_EXEC: return "exec() failed"; From dovecot at dovecot.org Tue Jan 10 00:34:15 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 00:34:15 +0200 Subject: dovecot-2.1: login proxy: If server disconnects during auth, log... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/dd48e9094efb changeset: 13918:dd48e9094efb user: Timo Sirainen date: Tue Jan 10 00:34:09 2012 +0200 description: login proxy: If server disconnects during auth, log the connection duration. diffstat: src/login-common/client-common-auth.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (28 lines): diff -r 16d32dda723c -r dd48e9094efb src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Mon Jan 09 23:57:25 2012 +0200 +++ b/src/login-common/client-common-auth.c Tue Jan 10 00:34:09 2012 +0200 @@ -199,6 +199,7 @@ { struct istream *input; const char *line; + unsigned int duration; if (client->login_proxy == NULL) { /* we're just freeing the proxy */ @@ -225,11 +226,14 @@ client_proxy_failed(client, TRUE); return; case -1: + duration = ioloop_time - client->created; client_log_err(client, t_strdup_printf( - "proxy: Remote %s:%u disconnected: %s (state=%u)", + "proxy: Remote %s:%u disconnected: %s " + "(state=%u, duration=%us)", login_proxy_get_host(client->login_proxy), login_proxy_get_port(client->login_proxy), - get_disconnect_reason(input), client->proxy_state)); + get_disconnect_reason(input), + client->proxy_state, duration)); client_proxy_failed(client, TRUE); return; } From dovecot at dovecot.org Tue Jan 10 00:34:39 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 00:34:39 +0200 Subject: dovecot-2.0: login proxy: If server disconnects during auth, log... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/8438f66433a6 changeset: 13016:8438f66433a6 user: Timo Sirainen date: Tue Jan 10 00:34:09 2012 +0200 description: login proxy: If server disconnects during auth, log the connection duration. diffstat: src/login-common/client-common-auth.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (28 lines): diff -r 656386359374 -r 8438f66433a6 src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Mon Jan 09 23:57:25 2012 +0200 +++ b/src/login-common/client-common-auth.c Tue Jan 10 00:34:09 2012 +0200 @@ -199,6 +199,7 @@ { struct istream *input; const char *line; + unsigned int duration; if (client->login_proxy == NULL) { /* we're just freeing the proxy */ @@ -225,11 +226,14 @@ client_proxy_failed(client, TRUE); return; case -1: + duration = ioloop_time - client->created; client_log_err(client, t_strdup_printf( - "proxy: Remote %s:%u disconnected: %s (state=%u)", + "proxy: Remote %s:%u disconnected: %s " + "(state=%u, duration=%us)", login_proxy_get_host(client->login_proxy), login_proxy_get_port(client->login_proxy), - get_disconnect_reason(input), client->proxy_state)); + get_disconnect_reason(input), + client->proxy_state, duration)); client_proxy_failed(client, TRUE); return; } From dovecot at dovecot.org Tue Jan 10 02:27:33 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 02:27:33 +0200 Subject: dovecot-2.1: fts-solr: Make sure header name is lowercased in se... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/075591a4b6a8 changeset: 13919:075591a4b6a8 user: Timo Sirainen date: Tue Jan 10 02:27:26 2012 +0200 description: fts-solr: Make sure header name is lowercased in search queries. diffstat: src/plugins/fts-solr/fts-backend-solr.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r dd48e9094efb -r 075591a4b6a8 src/plugins/fts-solr/fts-backend-solr.c --- a/src/plugins/fts-solr/fts-backend-solr.c Tue Jan 10 00:34:09 2012 +0200 +++ b/src/plugins/fts-solr/fts-backend-solr.c Tue Jan 10 02:27:26 2012 +0200 @@ -600,7 +600,7 @@ if (arg->match_not) str_append_c(str, '-'); - str_append(str, arg->hdr_field_name); + str_append(str, t_str_lcase(arg->hdr_field_name)); str_append_c(str, ':'); solr_add_str_arg(str, arg); break; @@ -656,7 +656,7 @@ solr_quote_http(str, arg->value.str); else { /* checking potential existence of the header name */ - solr_quote_http(str, arg->hdr_field_name); + solr_quote_http(str, t_str_lcase(arg->hdr_field_name)); } break; default: From dovecot at dovecot.org Tue Jan 10 13:12:12 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 13:12:12 +0200 Subject: dovecot-2.1: s/Fallbacking/Falling back/ Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/ee7b18b1fc00 changeset: 13920:ee7b18b1fc00 user: Timo Sirainen date: Tue Jan 10 13:12:08 2012 +0200 description: s/Fallbacking/Falling back/ diffstat: src/auth/auth-request.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (30 lines): diff -r 075591a4b6a8 -r ee7b18b1fc00 src/auth/auth-request.c --- a/src/auth/auth-request.c Tue Jan 10 02:27:26 2012 +0200 +++ b/src/auth/auth-request.c Tue Jan 10 13:12:08 2012 +0200 @@ -571,7 +571,7 @@ request->mech_password, &result, TRUE)) { auth_request_log_info(request, "passdb", - "Fallbacking to expired data from cache"); + "Falling back to expired data from cache"); } } @@ -708,7 +708,7 @@ &cache_cred, &cache_scheme, &result, TRUE)) { auth_request_log_info(request, "passdb", - "Fallbacking to expired data from cache"); + "Falling back to expired data from cache"); passdb_handle_credentials( result, cache_cred, cache_scheme, auth_request_lookup_credentials_finish, @@ -891,7 +891,7 @@ &result, TRUE)) { request->userdb_reply = reply; auth_request_log_info(request, "userdb", - "Fallbacking to expired data from cache"); + "Falling back to expired data from cache"); } } From dovecot at dovecot.org Tue Jan 10 21:38:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 21:38:03 +0200 Subject: dovecot-2.1: director: If request is timed out, log an error. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c70965e8b27d changeset: 13921:c70965e8b27d user: Timo Sirainen date: Tue Jan 10 21:37:54 2012 +0200 description: director: If request is timed out, log an error. diffstat: src/director/director-connection.c | 4 ++-- src/director/director-request.c | 33 +++++++++++++++++++++++++++++++-- src/director/director-request.h | 3 ++- src/director/director.c | 11 ++++++++++- src/director/director.h | 2 ++ src/director/login-connection.c | 35 +++++++++++++++++++---------------- 6 files changed, 66 insertions(+), 22 deletions(-) diffs (218 lines): diff -r ee7b18b1fc00 -r c70965e8b27d src/director/director-connection.c --- a/src/director/director-connection.c Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/director-connection.c Tue Jan 10 21:37:54 2012 +0200 @@ -570,7 +570,7 @@ /* we're connected to both directors. see if the ring is finished by sending a SYNC. if we get it back, it's done. */ dir->sync_seq++; - dir->ring_synced = FALSE; + director_set_ring_unsynced(dir); director_connection_send(dir->right, t_strdup_printf("SYNC\t%s\t%u\t%u\n", net_ip2addr(&dir->self_ip), @@ -1130,7 +1130,7 @@ if (dir->left == NULL || dir->right == NULL) { /* we aren't synced until we're again connected to a ring */ dir->sync_seq++; - dir->ring_synced = FALSE; + director_set_ring_unsynced(dir); } } diff -r ee7b18b1fc00 -r c70965e8b27d src/director/director-request.c --- a/src/director/director-request.c Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/director-request.c Tue Jan 10 21:37:54 2012 +0200 @@ -3,6 +3,7 @@ #include "lib.h" #include "ioloop.h" #include "array.h" +#include "str.h" #include "mail-host.h" #include "user-directory.h" #include "director.h" @@ -21,9 +22,32 @@ void *context; }; +static const char * +director_request_get_timeout_error(struct director_request *request) +{ + string_t *str = t_str_new(128); + unsigned int secs; + + str_printfa(str, "Timeout - queued for %u secs (", + (unsigned int)(ioloop_time - request->create_time)); + + if (request->dir->ring_last_sync_time == 0) + str_append(str, "Ring has never been synced"); + else { + secs =ioloop_time - request->dir->ring_last_sync_time; + if (request->dir->ring_synced) + str_printfa(str, "Ring synced for %u secs", secs); + else + str_printfa(str, "Ring not synced for %u secs", secs); + } + str_append_c(str, ')'); + return str_c(str); +} + static void director_request_timeout(struct director *dir) { struct director_request **requestp, *request; + const char *errormsg; while (array_count(&dir->pending_requests) > 0) { requestp = array_idx_modifiable(&dir->pending_requests, 0); @@ -34,7 +58,10 @@ break; array_delete(&dir->pending_requests, 0, 1); - request->callback(NULL, request->context); + errormsg = director_request_get_timeout_error(request); + T_BEGIN { + request->callback(NULL, errormsg, request->context); + } T_END; i_free(request); } @@ -126,7 +153,9 @@ } director_update_user(dir, dir->self_host, user); - request->callback(&user->host->ip, request->context); + T_BEGIN { + request->callback(&user->host->ip, NULL, request->context); + } T_END; i_free(request); return TRUE; } diff -r ee7b18b1fc00 -r c70965e8b27d src/director/director-request.h --- a/src/director/director-request.h Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/director-request.h Tue Jan 10 21:37:54 2012 +0200 @@ -5,7 +5,8 @@ struct director_request; typedef void -director_request_callback(const struct ip_addr *ip, void *context); +director_request_callback(const struct ip_addr *ip, const char *errormsg, + void *context); void director_request(struct director *dir, const char *username, director_request_callback *callback, void *context); diff -r ee7b18b1fc00 -r c70965e8b27d src/director/director.c --- a/src/director/director.c Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/director.c Tue Jan 10 21:37:54 2012 +0200 @@ -226,9 +226,18 @@ } dir->ring_synced = TRUE; + dir->ring_last_sync_time = ioloop_time; director_set_state_changed(dir); } +void director_set_ring_unsynced(struct director *dir) +{ + if (dir->ring_synced) { + dir->ring_synced = FALSE; + dir->ring_last_sync_time = ioloop_time; + } +} + static void director_sync(struct director *dir) { if (dir->sync_frozen) { @@ -243,7 +252,7 @@ /* we're synced again when we receive this SYNC back */ dir->sync_seq++; - dir->ring_synced = FALSE; + director_set_ring_unsynced(dir); if (dir->debug) { i_debug("Ring is desynced (seq=%u, sending SYNC to %s)", diff -r ee7b18b1fc00 -r c70965e8b27d src/director/director.h --- a/src/director/director.h Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/director.h Tue Jan 10 21:37:54 2012 +0200 @@ -45,6 +45,7 @@ struct ipc_client *ipc_proxy; unsigned int sync_seq; + time_t ring_last_sync_time; /* director ring handshaking is complete. director can start serving clients. */ @@ -71,6 +72,7 @@ void director_set_ring_handshaked(struct director *dir); void director_set_ring_synced(struct director *dir); +void director_set_ring_unsynced(struct director *dir); void director_set_state_changed(struct director *dir); void director_update_host(struct director *dir, struct director_host *src, diff -r ee7b18b1fc00 -r c70965e8b27d src/director/login-connection.c --- a/src/director/login-connection.c Tue Jan 10 13:12:08 2012 +0200 +++ b/src/director/login-connection.c Tue Jan 10 21:37:54 2012 +0200 @@ -30,7 +30,7 @@ struct login_host_request { struct login_connection *conn; - char *line; + char *line, *username; }; static struct login_connection *login_connections; @@ -70,29 +70,31 @@ (void)o_stream_sendv(conn->output, iov, N_ELEMENTS(iov)); } -static void login_host_callback(const struct ip_addr *ip, void *context) +static void +login_host_callback(const struct ip_addr *ip, const char *errormsg, + void *context) { struct login_host_request *request = context; struct director *dir = request->conn->dir; const char *line; unsigned int secs; - T_BEGIN { - if (ip != NULL) { - secs = dir->set->director_user_expire / 2; - line = t_strdup_printf("%s\thost=%s\tproxy_refresh=%u", - request->line, net_ip2addr(ip), - secs); - } else { - i_assert(strncmp(request->line, "OK\t", 3) == 0); - line = t_strconcat("FAIL\t", - t_strcut(request->line + 3, '\t'), - "\ttemp", NULL); - } - login_connection_send_line(request->conn, line); - } T_END; + if (ip != NULL) { + secs = dir->set->director_user_expire / 2; + line = t_strdup_printf("%s\thost=%s\tproxy_refresh=%u", + request->line, net_ip2addr(ip), secs); + } else { + i_assert(strncmp(request->line, "OK\t", 3) == 0); + + i_error("director: User %s host lookup failed: %s", + request->username, errormsg); + line = t_strconcat("FAIL\t", t_strcut(request->line + 3, '\t'), + "\ttemp", NULL); + } + login_connection_send_line(request->conn, line); login_connection_unref(&request->conn); + i_free(request->username); i_free(request->line); i_free(request); } @@ -155,6 +157,7 @@ request = i_new(struct login_host_request, 1); request->conn = conn; request->line = i_strdup(line); + request->username = i_strdup(username); conn->refcount++; director_request(conn->dir, username, login_host_callback, request); From dovecot at dovecot.org Tue Jan 10 21:39:21 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 21:39:21 +0200 Subject: dovecot-2.1: master: default_idle_kill setting wasn't "time" type. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1362d8bda03c changeset: 13922:1362d8bda03c user: Timo Sirainen date: Tue Jan 10 21:39:13 2012 +0200 description: master: default_idle_kill setting wasn't "time" type. diffstat: src/master/master-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c70965e8b27d -r 1362d8bda03c src/master/master-settings.c --- a/src/master/master-settings.c Tue Jan 10 21:37:54 2012 +0200 +++ b/src/master/master-settings.c Tue Jan 10 21:39:13 2012 +0200 @@ -180,7 +180,7 @@ DEF(SET_STR, default_login_user), DEF(SET_UINT, default_process_limit), DEF(SET_UINT, default_client_limit), - DEF(SET_UINT, default_idle_kill), + DEF(SET_TIME, default_idle_kill), DEF(SET_SIZE, default_vsz_limit), DEF(SET_BOOL, version_ignore), From dovecot at dovecot.org Tue Jan 10 22:57:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 22:57:16 +0200 Subject: dovecot-2.1: Added t_strflocaltime(). Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/22cfba724675 changeset: 13923:22cfba724675 user: Timo Sirainen date: Tue Jan 10 22:51:52 2012 +0200 description: Added t_strflocaltime(). diffstat: src/lib/macros.h | 5 ++++- src/lib/time-util.c | 21 +++++++++++++++++++++ src/lib/time-util.h | 3 +++ 3 files changed, 28 insertions(+), 1 deletions(-) diffs (68 lines): diff -r 1362d8bda03c -r 22cfba724675 src/lib/macros.h --- a/src/lib/macros.h Tue Jan 10 21:39:13 2012 +0200 +++ b/src/lib/macros.h Tue Jan 10 22:51:52 2012 +0200 @@ -93,6 +93,8 @@ __attribute__((format_arg (arg_idx))) # define ATTR_SCANF(format_idx, arg_idx) \ __attribute__((format (scanf, format_idx, arg_idx))) +# define ATTR_STRFTIME(format_idx) \ + __attribute__((format (strftime, format_idx, 0))) # define ATTR_UNUSED __attribute__((unused)) # define ATTR_NORETURN __attribute__((noreturn)) # define ATTR_CONST __attribute__((const)) @@ -100,7 +102,8 @@ #else # define ATTR_FORMAT(format_idx, arg_idx) # define ATTR_FORMAT_ARG(arg_idx) -# define ATTR_SCANF +# define ATTR_SCANF(format_idx, arg_idx) +# define ATTR_STRFTIME(format_idx) # define ATTR_UNUSED # define ATTR_NORETURN # define ATTR_CONST diff -r 1362d8bda03c -r 22cfba724675 src/lib/time-util.c --- a/src/lib/time-util.c Tue Jan 10 21:39:13 2012 +0200 +++ b/src/lib/time-util.c Tue Jan 10 22:51:52 2012 +0200 @@ -3,6 +3,10 @@ #include "lib.h" #include "time-util.h" +#include + +#define STRFTIME_MAX_BUFSIZE (1024*64) + int timeval_cmp(const struct timeval *tv1, const struct timeval *tv2) { if (tv1->tv_sec < tv2->tv_sec) @@ -35,3 +39,20 @@ } return ((long long)secs * 1000000ULL) + usecs; } + +const char *t_strflocaltime(const char *fmt, time_t t) +{ + const struct tm *tm; + size_t bufsize = strlen(fmt) + 32; + char *buf = t_buffer_get(bufsize); + size_t ret; + + tm = localtime(&t); + while ((ret = strftime(buf, bufsize, fmt, tm)) == 0) { + bufsize *= 2; + i_assert(bufsize <= STRFTIME_MAX_BUFSIZE); + buf = t_buffer_get(bufsize); + } + t_buffer_alloc(ret + 1); + return buf; +} diff -r 1362d8bda03c -r 22cfba724675 src/lib/time-util.h --- a/src/lib/time-util.h Tue Jan 10 21:39:13 2012 +0200 +++ b/src/lib/time-util.h Tue Jan 10 22:51:52 2012 +0200 @@ -11,4 +11,7 @@ long long timeval_diff_usecs(const struct timeval *tv1, const struct timeval *tv2); +/* Wrapper to strftime() */ +const char *t_strflocaltime(const char *fmt, time_t t) ATTR_STRFTIME(1); + #endif From dovecot at dovecot.org Tue Jan 10 22:57:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 22:57:16 +0200 Subject: dovecot-2.1: Use t_strflocaltime() where possible. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d4c506d8f534 changeset: 13924:d4c506d8f534 user: Timo Sirainen date: Tue Jan 10 22:57:09 2012 +0200 description: Use t_strflocaltime() where possible. diffstat: src/doveadm/doveadm-util.c | 8 ++------ src/lib-storage/mail-storage.c | 11 ++++------- src/lib-storage/mailbox-list.c | 12 ++++-------- src/lib/iostream-rawlog.c | 8 ++------ src/util/rawlog.c | 11 +++-------- 5 files changed, 15 insertions(+), 35 deletions(-) diffs (138 lines): diff -r 22cfba724675 -r d4c506d8f534 src/doveadm/doveadm-util.c --- a/src/doveadm/doveadm-util.c Tue Jan 10 22:51:52 2012 +0200 +++ b/src/doveadm/doveadm-util.c Tue Jan 10 22:57:09 2012 +0200 @@ -3,6 +3,7 @@ #include "lib.h" #include "array.h" #include "network.h" +#include "time-util.h" #include "master-service.h" #include "module-dir.h" #include "doveadm-settings.h" @@ -76,12 +77,7 @@ const char *unixdate2str(time_t timestamp) { - static char buf[64]; - struct tm *tm; - - tm = localtime(×tamp); - strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm); - return buf; + return t_strflocaltime("%Y-%m-%d %H:%M:%S", timestamp); } const char *doveadm_plugin_getenv(const char *name) diff -r 22cfba724675 -r d4c506d8f534 src/lib-storage/mail-storage.c --- a/src/lib-storage/mail-storage.c Tue Jan 10 22:51:52 2012 +0200 +++ b/src/lib-storage/mail-storage.c Tue Jan 10 22:57:09 2012 +0200 @@ -8,6 +8,7 @@ #include "istream.h" #include "eacces-error.h" #include "mkdir-parents.h" +#include "time-util.h" #include "var-expand.h" #include "mail-index-private.h" #include "mail-index-alloc-cache.h" @@ -466,16 +467,12 @@ void mail_storage_set_internal_error(struct mail_storage *storage) { - struct tm *tm; - char str[256]; + const char *str; - tm = localtime(&ioloop_time); + str = t_strflocaltime(MAIL_ERRSTR_CRITICAL_MSG_STAMP, ioloop_time); i_free(storage->error_string); - storage->error_string = - strftime(str, sizeof(str), - MAIL_ERRSTR_CRITICAL_MSG_STAMP, tm) > 0 ? - i_strdup(str) : i_strdup(MAIL_ERRSTR_CRITICAL_MSG); + storage->error_string = i_strdup(str); storage->error = MAIL_ERROR_TEMP; } diff -r 22cfba724675 -r d4c506d8f534 src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Tue Jan 10 22:51:52 2012 +0200 +++ b/src/lib-storage/mailbox-list.c Tue Jan 10 22:57:09 2012 +0200 @@ -8,6 +8,7 @@ #include "sha1.h" #include "hash.h" #include "home-expand.h" +#include "time-util.h" #include "unichar.h" #include "settings-parser.h" #include "imap-utf7.h" @@ -1401,16 +1402,11 @@ void mailbox_list_set_internal_error(struct mailbox_list *list) { - struct tm *tm; - char str[256]; + const char *str; - tm = localtime(&ioloop_time); - + str = t_strflocaltime(MAIL_ERRSTR_CRITICAL_MSG_STAMP, ioloop_time); i_free(list->error_string); - list->error_string = - strftime(str, sizeof(str), - MAIL_ERRSTR_CRITICAL_MSG_STAMP, tm) > 0 ? - i_strdup(str) : i_strdup(MAIL_ERRSTR_CRITICAL_MSG); + list->error_string = i_strdup(str); list->error = MAIL_ERROR_TEMP; } diff -r 22cfba724675 -r d4c506d8f534 src/lib/iostream-rawlog.c --- a/src/lib/iostream-rawlog.c Tue Jan 10 22:51:52 2012 +0200 +++ b/src/lib/iostream-rawlog.c Tue Jan 10 22:57:09 2012 +0200 @@ -77,16 +77,12 @@ struct ostream **output) { static unsigned int counter = 0; - const char *in_path, *out_path; + const char *timestamp, *in_path, *out_path; struct istream *old_input; struct ostream *old_output; - struct tm *tm; - char timestamp[50]; int in_fd, out_fd; - tm = localtime(&ioloop_time); - if (strftime(timestamp, sizeof(timestamp), "%Y%m%d-%H%M%S", tm) <= 0) - i_fatal("strftime() failed"); + timestamp = t_strflocaltime("%Y%m%d-%H%M%S", ioloop_time); counter++; in_path = t_strdup_printf("%s/%s.%s.%u.in", diff -r 22cfba724675 -r d4c506d8f534 src/util/rawlog.c --- a/src/util/rawlog.c Tue Jan 10 22:51:52 2012 +0200 +++ b/src/util/rawlog.c Tue Jan 10 22:57:09 2012 +0200 @@ -11,6 +11,7 @@ #include "ostream.h" #include "process-title.h" #include "restrict-access.h" +#include "time-util.h" #include "master-service.h" #include @@ -226,15 +227,9 @@ static void proxy_open_logs(struct rawlog_proxy *proxy, const char *path) { - time_t now; - struct tm *tm; - const char *fname; - char timestamp[50]; + const char *fname, *timestamp; - now = time(NULL); - tm = localtime(&now); - if (strftime(timestamp, sizeof(timestamp), "%Y%m%d-%H%M%S", tm) <= 0) - i_fatal("strftime() failed"); + timestamp = t_strflocaltime("%Y%m%d-%H%M%S", time(NULL)); if ((proxy->flags & RAWLOG_FLAG_LOG_INPUT) != 0) { fname = t_strdup_printf("%s/%s-%s.in", path, timestamp, From dovecot at dovecot.org Tue Jan 10 23:10:10 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 23:10:10 +0200 Subject: dovecot-2.1: imap/pop3-login: Include hostname and timestamp in ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/81fa0597b8b6 changeset: 13925:81fa0597b8b6 user: Timo Sirainen date: Tue Jan 10 23:10:04 2012 +0200 description: imap/pop3-login: Include hostname and timestamp in "temporary auth failure" message. diffstat: src/imap-login/client-authenticate.c | 38 ++++++++++++++++++------------------ src/pop3-login/client-authenticate.c | 10 +++++++- 2 files changed, 27 insertions(+), 21 deletions(-) diffs (110 lines): diff -r d4c506d8f534 -r 81fa0597b8b6 src/imap-login/client-authenticate.c --- a/src/imap-login/client-authenticate.c Tue Jan 10 22:57:09 2012 +0200 +++ b/src/imap-login/client-authenticate.c Tue Jan 10 23:10:04 2012 +0200 @@ -3,12 +3,14 @@ #include "login-common.h" #include "base64.h" #include "buffer.h" +#include "hostpid.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" #include "safe-memset.h" #include "str.h" #include "str-sanitize.h" +#include "time-util.h" #include "imap-resp-code.h" #include "imap-parser.h" #include "auth-client.h" @@ -36,6 +38,7 @@ { struct imap_client *imap_client = (struct imap_client *)client; string_t *str; + const char *timestamp, *msg; if (reply->host != NULL) { /* IMAP referral @@ -71,27 +74,24 @@ client_destroy_success(client, "Login with referral"); return TRUE; } - } else if (reply->nologin) { - /* Authentication went ok, but for some reason user isn't - allowed to log in. Shouldn't probably happen. */ - if (reply->reason != NULL) { - client_send_line(client, - CLIENT_CMD_REPLY_AUTH_FAIL_REASON, - reply->reason); - } else if (reply->temp) { - client_send_line(client, - CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, - AUTH_TEMP_FAILED_MSG); - } else if (reply->authz_failure) { - client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED, - "Authorization failed"); - } else { - client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, - AUTH_FAILED_MSG); - } - } else { + } else if (!reply->nologin) { /* normal login/failure */ return FALSE; + } else if (reply->reason != NULL) { + client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_REASON, + reply->reason); + } else if (reply->temp) { + timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time); + msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]", + my_hostname, timestamp); + client_send_line(client, + CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg); + } else if (reply->authz_failure) { + client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED, + "Authorization failed"); + } else { + client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, + AUTH_FAILED_MSG); } i_assert(reply->nologin); diff -r d4c506d8f534 -r 81fa0597b8b6 src/pop3-login/client-authenticate.c --- a/src/pop3-login/client-authenticate.c Tue Jan 10 22:57:09 2012 +0200 +++ b/src/pop3-login/client-authenticate.c Tue Jan 10 23:10:04 2012 +0200 @@ -4,12 +4,14 @@ #include "base64.h" #include "buffer.h" #include "hex-binary.h" +#include "hostpid.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" #include "safe-memset.h" #include "str.h" #include "str-sanitize.h" +#include "time-util.h" #include "auth-client.h" #include "../pop3/pop3-capability.h" #include "ssl-proxy.h" @@ -52,6 +54,8 @@ bool pop3_client_auth_handle_reply(struct client *client, const struct client_auth_reply *reply) { + const char *timestamp, *msg; + if (!reply->nologin) return FALSE; @@ -59,8 +63,10 @@ client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, reply->reason); } else if (reply->temp) { - client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, - AUTH_TEMP_FAILED_MSG); + timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time); + msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]", + my_hostname, timestamp); + client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg); } else { client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, AUTH_FAILED_MSG); From dovecot at dovecot.org Tue Jan 10 23:28:26 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 23:28:26 +0200 Subject: dovecot-2.1: Don't assert-crash on mail search if decomposed tit... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/bc3b343b1999 changeset: 13927:bc3b343b1999 user: Timo Sirainen date: Tue Jan 10 23:28:03 2012 +0200 description: Don't assert-crash on mail search if decomposed titlecase of search key is empty. diffstat: src/lib-mail/message-search.c | 19 ++++++++----------- src/lib-mail/message-search.h | 5 ++++- src/lib-storage/index/index-search.c | 24 ++++++++++++++++++------ 3 files changed, 30 insertions(+), 18 deletions(-) diffs (97 lines): diff -r 0cd33404a201 -r bc3b343b1999 src/lib-mail/message-search.c --- a/src/lib-mail/message-search.c Tue Jan 10 23:14:18 2012 +0200 +++ b/src/lib-mail/message-search.c Tue Jan 10 23:28:03 2012 +0200 @@ -5,7 +5,6 @@ #include "istream.h" #include "str.h" #include "str-find.h" -#include "unichar.h" #include "rfc822-parser.h" #include "message-decoder.h" #include "message-parser.h" @@ -24,20 +23,18 @@ message_search_init(const char *key_utf8, enum message_search_flags flags) { + enum message_decoder_flags decoder_flags = 0; struct message_search_context *ctx; + i_assert(*key_utf8 != '\0'); + + if ((flags & MESSAGE_SEARCH_FLAG_DTCASE) != 0) + decoder_flags |= MESSAGE_DECODER_FLAG_DTCASE; + ctx = i_new(struct message_search_context, 1); ctx->flags = flags; - ctx->decoder = message_decoder_init(MESSAGE_DECODER_FLAG_DTCASE); - - T_BEGIN { - string_t *dtc = t_str_new(128); - - if (uni_utf8_to_decomposed_titlecase(key_utf8, strlen(key_utf8), - dtc) < 0) - i_panic("message_search_init(): key not utf8"); - ctx->str_find_ctx = str_find_init(default_pool, str_c(dtc)); - } T_END; + ctx->decoder = message_decoder_init(decoder_flags); + ctx->str_find_ctx = str_find_init(default_pool, key_utf8); return ctx; } diff -r 0cd33404a201 -r bc3b343b1999 src/lib-mail/message-search.h --- a/src/lib-mail/message-search.h Tue Jan 10 23:14:18 2012 +0200 +++ b/src/lib-mail/message-search.h Tue Jan 10 23:28:03 2012 +0200 @@ -7,7 +7,10 @@ enum message_search_flags { /* Skip the main header and all the MIME headers. */ - MESSAGE_SEARCH_FLAG_SKIP_HEADERS = 0x01 + MESSAGE_SEARCH_FLAG_SKIP_HEADERS = 0x01, + /* Search with decomposed titlecase (instead of exact case matching). + The search key must be given with dtcase also. */ + MESSAGE_SEARCH_FLAG_DTCASE = 0x02 }; /* The key must be given in UTF-8 charset */ diff -r 0cd33404a201 -r bc3b343b1999 src/lib-storage/index/index-search.c --- a/src/lib-storage/index/index-search.c Tue Jan 10 23:14:18 2012 +0200 +++ b/src/lib-storage/index/index-search.c Tue Jan 10 23:28:03 2012 +0200 @@ -7,6 +7,7 @@ #include "utc-offset.h" #include "str.h" #include "time-util.h" +#include "unichar.h" #include "imap-match.h" #include "message-address.h" #include "message-date.h" @@ -373,13 +374,24 @@ static struct message_search_context * msg_search_arg_context(struct mail_search_arg *arg) { - enum message_search_flags flags; + enum message_search_flags flags = MESSAGE_SEARCH_FLAG_DTCASE; - if (arg->context == NULL) { - flags = arg->type == SEARCH_BODY ? - MESSAGE_SEARCH_FLAG_SKIP_HEADERS : 0; - arg->context = message_search_init(arg->value.str, flags); - } + if (arg->context == NULL) T_BEGIN { + string_t *dtc = t_str_new(128); + + if (uni_utf8_to_decomposed_titlecase(arg->value.str, + strlen(arg->value.str), + dtc) < 0) + i_panic("search key not utf8: %s", arg->value.str); + + if (arg->type == SEARCH_BODY) + flags |= MESSAGE_SEARCH_FLAG_SKIP_HEADERS; + /* we don't get here if arg is "", but dtc can be "" if it + only contains characters that we need to ignore. handle + those searches by returning them as non-matched. */ + if (str_len(dtc) > 0) + arg->context = message_search_init(str_c(dtc), flags); + } T_END; return arg->context; } From dovecot at dovecot.org Tue Jan 10 23:28:25 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 23:28:25 +0200 Subject: dovecot-2.1: quota: Try to avoid logging NFS stale fhandle error... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/0cd33404a201 changeset: 13926:0cd33404a201 user: Timo Sirainen date: Tue Jan 10 23:14:18 2012 +0200 description: quota: Try to avoid logging NFS stale fhandle errors when closing maildirsize file. diffstat: src/plugins/quota/quota-maildir.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (31 lines): diff -r 81fa0597b8b6 -r 0cd33404a201 src/plugins/quota/quota-maildir.c --- a/src/plugins/quota/quota-maildir.c Tue Jan 10 23:10:04 2012 +0200 +++ b/src/plugins/quota/quota-maildir.c Tue Jan 10 23:14:18 2012 +0200 @@ -296,13 +296,10 @@ return -1; } - /* keep the fd open since we might want to update it later */ - if (file_dotlock_replace(&dotlock, - DOTLOCK_REPLACE_FLAG_DONT_CLOSE_FD) < 0) { + if (file_dotlock_replace(&dotlock, 0) < 0) { i_error("file_dotlock_replace(%s) failed: %m", path); return -1; } - root->fd = fd; return 0; } @@ -872,8 +869,11 @@ (void)close(root->fd); root->fd = -1; (void)maildirsize_recalculate(root); - } else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) + } else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) { + (void)close(root->fd); + root->fd = -1; maildirsize_rebuild_later(root); + } return 0; } From dovecot at dovecot.org Tue Jan 10 23:30:42 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 23:30:42 +0200 Subject: dovecot-2.1: decode2text.sh: Exit with 0 even if the decoding fa... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/24d79a3708c6 changeset: 13928:24d79a3708c6 user: Timo Sirainen date: Tue Jan 10 23:30:36 2012 +0200 description: decode2text.sh: Exit with 0 even if the decoding failed. There's nothing to be done anyway, since they are external programs. These errors just flood the error log unnecessarily. diffstat: src/plugins/fts/decode2text.sh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r bc3b343b1999 -r 24d79a3708c6 src/plugins/fts/decode2text.sh --- a/src/plugins/fts/decode2text.sh Tue Jan 10 23:28:03 2012 +0200 +++ b/src/plugins/fts/decode2text.sh Tue Jan 10 23:30:36 2012 +0200 @@ -91,3 +91,4 @@ echo "Buggy decoder script: $fmt not handled" >&2 exit 1 fi +exit 0 From dovecot at dovecot.org Tue Jan 10 23:34:49 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 Jan 2012 23:34:49 +0200 Subject: dovecot-2.1: Compiler warning fix. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/19700d683144 changeset: 13929:19700d683144 user: Timo Sirainen date: Tue Jan 10 23:34:43 2012 +0200 description: Compiler warning fix. diffstat: src/lib/iostream-rawlog.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 24d79a3708c6 -r 19700d683144 src/lib/iostream-rawlog.c --- a/src/lib/iostream-rawlog.c Tue Jan 10 23:30:36 2012 +0200 +++ b/src/lib/iostream-rawlog.c Tue Jan 10 23:34:43 2012 +0200 @@ -4,6 +4,7 @@ #include "hostpid.h" #include "ioloop.h" #include "write-full.h" +#include "time-util.h" #include "istream.h" #include "ostream.h" #include "istream-rawlog.h" From dovecot at dovecot.org Wed Jan 11 10:31:36 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 Jan 2012 10:31:36 +0200 Subject: dovecot-2.1: configure: Add -fno-builtin-strftime flag with gcc ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e0ff21d73630 changeset: 13930:e0ff21d73630 user: Timo Sirainen date: Wed Jan 11 10:31:25 2012 +0200 description: configure: Add -fno-builtin-strftime flag with gcc to avoid warning. diffstat: configure.in | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 19700d683144 -r e0ff21d73630 configure.in --- a/configure.in Tue Jan 10 23:34:43 2012 +0200 +++ b/configure.in Wed Jan 11 10:31:25 2012 +0200 @@ -301,6 +301,9 @@ # -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast" + # This is simply to avoid warning when building strftime() wrappers.. + CFLAGS="$CFLAGS -fno-builtin-strftime" + AC_TRY_COMPILE([ #if __GNUC__ < 4 # error old gcc From dovecot at dovecot.org Wed Jan 11 12:07:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 Jan 2012 12:07:52 +0200 Subject: dovecot-2.1: login proxy: Added extra logging for bug detection. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d72db2acf75b changeset: 13931:d72db2acf75b user: Timo Sirainen date: Wed Jan 11 12:07:44 2012 +0200 description: login proxy: Added extra logging for bug detection. diffstat: src/login-common/client-common-auth.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (23 lines): diff -r e0ff21d73630 -r d72db2acf75b src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Wed Jan 11 10:31:25 2012 +0200 +++ b/src/login-common/client-common-auth.c Wed Jan 11 12:07:44 2012 +0200 @@ -226,14 +226,17 @@ client_proxy_failed(client, TRUE); return; case -1: + line = i_stream_next_line(input); duration = ioloop_time - client->created; client_log_err(client, t_strdup_printf( "proxy: Remote %s:%u disconnected: %s " - "(state=%u, duration=%us)", + "(state=%u, duration=%us)%s", login_proxy_get_host(client->login_proxy), login_proxy_get_port(client->login_proxy), get_disconnect_reason(input), - client->proxy_state, duration)); + client->proxy_state, duration, + line == NULL ? "" : t_strdup_printf( + " - BUG: line not read: %s", line))); client_proxy_failed(client, TRUE); return; } From dovecot at dovecot.org Thu Jan 12 15:40:36 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 12 Jan 2012 15:40:36 +0200 Subject: dovecot-2.1: example-config: Updated vsz_limit default values. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1c77891b754b changeset: 13932:1c77891b754b user: Timo Sirainen date: Thu Jan 12 15:40:30 2012 +0200 description: example-config: Updated vsz_limit default values. diffstat: doc/example-config/conf.d/10-master.conf | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r d72db2acf75b -r 1c77891b754b doc/example-config/conf.d/10-master.conf --- a/doc/example-config/conf.d/10-master.conf Wed Jan 11 12:07:44 2012 +0200 +++ b/doc/example-config/conf.d/10-master.conf Thu Jan 12 15:40:30 2012 +0200 @@ -32,7 +32,7 @@ #process_min_avail = 0 # If you set service_count=0, you probably need to grow this. - #vsz_limit = 64M + #vsz_limit = $default_vsz_limit } service pop3-login { @@ -61,7 +61,7 @@ service imap { # Most of the memory goes to mmap()ing files. You may need to increase this # limit if you have huge mailboxes. - #vsz_limit = 256M + #vsz_limit = $default_vsz_limit # Max. number of IMAP processes (connections) #process_limit = 1024 From pigeonhole at rename-it.nl Thu Jan 12 19:43:21 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 12 Jan 2012 18:43:21 +0100 Subject: dovecot-2.1-pigeonhole: managesieve-login: Include hostname and ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/523eae0118b1 changeset: 1594:523eae0118b1 user: Stephan Bosch date: Thu Jan 12 18:43:13 2012 +0100 description: managesieve-login: Include hostname and timestamp in "temporary auth failure" message. diffstat: src/managesieve-login/client-authenticate.c | 38 +++++++++--------- 1 files changed, 19 insertions(+), 19 deletions(-) diffs (70 lines): diff -r c2e3b2c93c8c -r 523eae0118b1 src/managesieve-login/client-authenticate.c --- a/src/managesieve-login/client-authenticate.c Sat Jan 07 16:35:56 2012 +0100 +++ b/src/managesieve-login/client-authenticate.c Thu Jan 12 18:43:13 2012 +0100 @@ -4,12 +4,14 @@ #include "login-common.h" #include "base64.h" #include "buffer.h" +#include "hostpid.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" #include "safe-memset.h" #include "str.h" #include "str-sanitize.h" +#include "time-util.h" #include "auth-client.h" #include "managesieve-parser.h" @@ -52,6 +54,7 @@ { struct managesieve_client *msieve_client = (struct managesieve_client *) client; + const char *timestamp, *msg; if ( reply->host != NULL ) { string_t *resp_code; @@ -88,27 +91,24 @@ return TRUE; } client_send_noresp(client, str_c(resp_code), reason); - } else if ( reply->nologin ) { - /* Authentication went ok, but for some reason user isn't - allowed to log in. Shouldn't probably happen. */ - if (reply->reason != NULL) { - client_send_line(client, - CLIENT_CMD_REPLY_AUTH_FAIL_REASON, - reply->reason); - } else if (reply->temp) { - client_send_line(client, - CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, - AUTH_TEMP_FAILED_MSG); - } else if (reply->authz_failure) { - client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED, - "Authorization failed"); - } else { - client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, - AUTH_FAILED_MSG); - } - } else { + } else if (!reply->nologin) { /* normal login/failure */ return FALSE; + } else if (reply->reason != NULL) { + client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAIL_REASON, + reply->reason); + } else if (reply->temp) { + timestamp = t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_time); + msg = t_strdup_printf(AUTH_TEMP_FAILED_MSG" [%s:%s]", + my_hostname, timestamp); + client_send_line(client, + CLIENT_CMD_REPLY_AUTH_FAIL_TEMP, msg); + } else if (reply->authz_failure) { + client_send_line(client, CLIENT_CMD_REPLY_AUTHZ_FAILED, + "Authorization failed"); + } else { + client_send_line(client, CLIENT_CMD_REPLY_AUTH_FAILED, + AUTH_FAILED_MSG); } i_assert(reply->nologin); From dovecot at dovecot.org Thu Jan 12 21:53:44 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 12 Jan 2012 21:53:44 +0200 Subject: dovecot-2.1: login: Added logging if auth process doesn't respon... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/957e74f0d60f changeset: 13933:957e74f0d60f user: Timo Sirainen date: Thu Jan 12 21:53:31 2012 +0200 description: login: Added logging if auth process doesn't respond fast enough for greeting. diffstat: src/login-common/client-common-auth.c | 9 ++++++++- src/login-common/client-common.c | 12 ++++++++++++ src/login-common/client-common.h | 1 + 3 files changed, 21 insertions(+), 1 deletions(-) diffs (73 lines): diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Thu Jan 12 15:40:30 2012 +0200 +++ b/src/login-common/client-common-auth.c Thu Jan 12 21:53:31 2012 +0200 @@ -17,6 +17,7 @@ /* If we've been waiting auth server to respond for over this many milliseconds, send a "waiting" message. */ #define AUTH_WAITING_TIMEOUT_MSECS (30*1000) +#define GREETING_WARNING_TIMEOUT_MSECS (10*1000) #define CLIENT_AUTH_BUF_MAX_SIZE 8192 @@ -36,6 +37,10 @@ static void client_auth_waiting_timeout(struct client *client) { + if (!client->greeting_sent) { + client_log_warn(client, "Auth process not responding, " + "delayed sending greeting"); + } client_send_line(client, CLIENT_CMD_REPLY_STATUS, client->master_tag == 0 ? AUTH_SERVER_WAITING_MSG : AUTH_MASTER_WAITING_MSG); @@ -46,7 +51,9 @@ { i_assert(client->to_auth_waiting == NULL); client->to_auth_waiting = - timeout_add(AUTH_WAITING_TIMEOUT_MSECS, + timeout_add(!client->greeting_sent ? + GREETING_WARNING_TIMEOUT_MSECS : + AUTH_WAITING_TIMEOUT_MSECS, client_auth_waiting_timeout, client); } diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common.c --- a/src/login-common/client-common.c Thu Jan 12 15:40:30 2012 +0200 +++ b/src/login-common/client-common.c Thu Jan 12 21:53:31 2012 +0200 @@ -484,6 +484,13 @@ } T_END; } +void client_log_warn(struct client *client, const char *msg) +{ + T_BEGIN { + i_warning("%s", client_get_log_str(client, msg)); + } T_END; +} + bool client_is_trusted(struct client *client) { const char *const *net; @@ -520,6 +527,11 @@ return "(client didn't send a cert)"; } + if (!client->greeting_sent) + return t_strdup_printf( + "(disconnected before greeting, waited %u secs)", + (unsigned int)(ioloop_time - client->created)); + if (client->auth_attempts == 0) { return t_strdup_printf("(no auth attempts in %u secs)", (unsigned int)(ioloop_time - client->created)); diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common.h --- a/src/login-common/client-common.h Thu Jan 12 15:40:30 2012 +0200 +++ b/src/login-common/client-common.h Thu Jan 12 21:53:31 2012 +0200 @@ -152,6 +152,7 @@ void client_set_title(struct client *client); void client_log(struct client *client, const char *msg); void client_log_err(struct client *client, const char *msg); +void client_log_warn(struct client *client, const char *msg); const char *client_get_extra_disconnect_reason(struct client *client); bool client_is_trusted(struct client *client); void client_auth_failed(struct client *client); From dovecot at dovecot.org Thu Jan 12 23:09:31 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 12 Jan 2012 23:09:31 +0200 Subject: dovecot-2.1: dsync: Fixed handling -u parameter in backwards com... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1a722c7676bb changeset: 13934:1a722c7676bb user: Timo Sirainen date: Thu Jan 12 23:09:25 2012 +0200 description: dsync: Fixed handling -u parameter in backwards compatibility dsync mode. diffstat: src/doveadm/dsync/doveadm-dsync.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diffs (67 lines): diff -r 957e74f0d60f -r 1a722c7676bb src/doveadm/dsync/doveadm-dsync.c --- a/src/doveadm/dsync/doveadm-dsync.c Thu Jan 12 21:53:31 2012 +0200 +++ b/src/doveadm/dsync/doveadm-dsync.c Thu Jan 12 23:09:25 2012 +0200 @@ -389,10 +389,10 @@ int argc = *_argc; const char *getopt_str; char **argv = *_argv; - char **new_argv, *mailbox = NULL, *alt_char = NULL; + char **new_argv, *mailbox = NULL, *alt_char = NULL, *username = NULL; char *p, *dup, new_flags[6]; int max_argc, src, dest, i, j; - bool flag_f = FALSE, flag_R = FALSE, flag_m, flag_C, has_arg; + bool flag_f = FALSE, flag_R = FALSE, flag_m, flag_u, flag_C, has_arg; bool backup_flag = FALSE; p = strrchr(argv[0], '/'); @@ -402,7 +402,7 @@ /* @UNSAFE: this is called when the "doveadm" binary is called as "dsync" (for backwards compatibility) */ - max_argc = argc + 5; + max_argc = argc + 7; new_argv = calloc(sizeof(char *), max_argc); new_argv[0] = argv[0]; dest = 1; @@ -413,7 +413,7 @@ if (argv[src][0] != '-') break; - flag_m = FALSE; flag_C = FALSE; has_arg = FALSE; + flag_m = FALSE; flag_C = FALSE; has_arg = FALSE; flag_u = FALSE; dup = strdup(argv[src]); for (i = j = 1; argv[src][i] != '\0'; i++) { switch (argv[src][i]) { @@ -429,6 +429,9 @@ case 'm': flag_m = TRUE; break; + case 'u': + flag_u = TRUE; + break; default: p = strchr(getopt_str, argv[src][i]); if (p != NULL && p[1] == ':') @@ -448,6 +451,11 @@ i_fatal("-m missing parameter"); mailbox = argv[++src]; } + if (flag_u) { + if (src+1 == argc) + i_fatal("-u missing parameter"); + username = argv[++src]; + } if (flag_C) { if (src+1 == argc) i_fatal("-C missing parameter"); @@ -504,6 +512,10 @@ if (mailbox != NULL) new_argv[dest++] = mailbox; } + if (username != NULL) { + new_argv[dest++] = "-u"; + new_argv[dest++] = username; + } /* rest of the parameters */ for (; src < argc; src++) From dovecot at dovecot.org Tue Jan 17 15:44:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 15:44:41 +0200 Subject: dovecot-2.1: director: Find director's own IP earlier in init. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b8fa70a81c8c changeset: 13935:b8fa70a81c8c user: Timo Sirainen date: Tue Jan 17 15:44:26 2012 +0200 description: director: Find director's own IP earlier in init. diffstat: src/director/director.c | 3 +-- src/director/director.h | 1 + src/director/main.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diffs (42 lines): diff -r 1a722c7676bb -r b8fa70a81c8c src/director/director.c --- a/src/director/director.c Thu Jan 12 23:09:25 2012 +0200 +++ b/src/director/director.c Tue Jan 17 15:44:26 2012 +0200 @@ -48,7 +48,7 @@ i_fatal("director_servers doesn't list ourself"); } -static void director_find_self(struct director *dir) +void director_find_self(struct director *dir) { if (dir->self_host != NULL) return; @@ -126,7 +126,6 @@ struct director_host *const *hosts; unsigned int i, count, self_idx; - director_find_self(dir); self_idx = director_find_self_idx(dir); /* try to connect to first working server on our right side. diff -r 1a722c7676bb -r b8fa70a81c8c src/director/director.h --- a/src/director/director.h Thu Jan 12 23:09:25 2012 +0200 +++ b/src/director/director.h Tue Jan 17 15:44:26 2012 +0200 @@ -66,6 +66,7 @@ const struct ip_addr *listen_ip, unsigned int listen_port, director_state_change_callback_t *callback); void director_deinit(struct director **dir); +void director_find_self(struct director *dir); /* Start connecting to other directors */ void director_connect(struct director *dir); diff -r 1a722c7676bb -r b8fa70a81c8c src/director/main.c --- a/src/director/main.c Thu Jan 12 23:09:25 2012 +0200 +++ b/src/director/main.c Tue Jan 17 15:44:26 2012 +0200 @@ -150,6 +150,7 @@ director = director_init(set, &listen_ip, listen_port, director_state_changed); director_host_add_from_string(director, set->director_servers); + director_find_self(director); if (mail_hosts_parse_and_add(director->mail_hosts, set->director_mail_servers) < 0) i_fatal("Invalid value for director_mail_servers setting"); From dovecot at dovecot.org Tue Jan 17 16:07:18 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 16:07:18 +0200 Subject: dovecot-2.1: auth: Fixed loading passdb/userdb plugins. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/352d3f2f8bb7 changeset: 13936:352d3f2f8bb7 user: Timo Sirainen date: Tue Jan 17 16:07:13 2012 +0200 description: auth: Fixed loading passdb/userdb plugins. Patch by Stephan Bosch. diffstat: src/auth/passdb.c | 2 +- src/auth/userdb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diffs (24 lines): diff -r b8fa70a81c8c -r 352d3f2f8bb7 src/auth/passdb.c --- a/src/auth/passdb.c Tue Jan 17 15:44:26 2012 +0200 +++ b/src/auth/passdb.c Tue Jan 17 16:07:13 2012 +0200 @@ -191,7 +191,7 @@ unsigned int idx; iface = passdb_interface_find(set->driver); - if (iface == NULL) { + if (iface == NULL || iface->verify_plain == NULL) { /* maybe it's a plugin. try to load it. */ auth_module_load(t_strconcat("authdb_", set->driver, NULL)); iface = passdb_interface_find(set->driver); diff -r b8fa70a81c8c -r 352d3f2f8bb7 src/auth/userdb.c --- a/src/auth/userdb.c Tue Jan 17 15:44:26 2012 +0200 +++ b/src/auth/userdb.c Tue Jan 17 16:07:13 2012 +0200 @@ -137,7 +137,7 @@ unsigned int idx; iface = userdb_interface_find(set->driver); - if (iface == NULL) { + if (iface == NULL || iface->lookup == NULL) { /* maybe it's a plugin. try to load it. */ auth_module_load(t_strconcat("authdb_", set->driver, NULL)); iface = userdb_interface_find(set->driver); From dovecot at dovecot.org Tue Jan 17 16:18:15 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 16:18:15 +0200 Subject: dovecot-2.1: director: Drop privileges only after adding hosts. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1d54d2963392 changeset: 13937:1d54d2963392 user: Timo Sirainen date: Tue Jan 17 16:18:05 2012 +0200 description: director: Drop privileges only after adding hosts. This allows reading files from /etc/ before chrooting. diffstat: src/director/main.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (23 lines): diff -r 352d3f2f8bb7 -r 1d54d2963392 src/director/main.c --- a/src/director/main.c Tue Jan 17 16:07:13 2012 +0200 +++ b/src/director/main.c Tue Jan 17 16:18:05 2012 +0200 @@ -136,9 +136,6 @@ struct ip_addr listen_ip; unsigned int listen_port; - restrict_access_by_env(NULL, FALSE); - restrict_access_allow_coredumps(TRUE); - set = master_service_settings_get_others(master_service)[0]; listen_port = find_inet_listener_port(&listen_ip, set); @@ -155,6 +152,9 @@ set->director_mail_servers) < 0) i_fatal("Invalid value for director_mail_servers setting"); director->orig_config_hosts = mail_hosts_dup(director->mail_hosts); + + restrict_access_by_env(NULL, FALSE); + restrict_access_allow_coredumps(TRUE); } static void main_deinit(void) From dovecot at dovecot.org Tue Jan 17 17:17:32 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 17:17:32 +0200 Subject: dovecot-2.1: auth: DIGEST-MD5 didn't read nonce-count parameter ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/387707dc020e changeset: 13938:387707dc020e user: Timo Sirainen date: Tue Jan 17 17:17:24 2012 +0200 description: auth: DIGEST-MD5 didn't read nonce-count parameter correctly. Patch by Yubao Liu. diffstat: src/auth/mech-digest-md5.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 1d54d2963392 -r 387707dc020e src/auth/mech-digest-md5.c --- a/src/auth/mech-digest-md5.c Tue Jan 17 16:18:05 2012 +0200 +++ b/src/auth/mech-digest-md5.c Tue Jan 17 17:17:24 2012 +0200 @@ -323,7 +323,7 @@ return TRUE; } - if (strcmp(key, "nonce-count") == 0) { + if (strcmp(key, "nc") == 0) { if (request->nonce_count != NULL) { *error = "nonce-count must not exist more than once"; return FALSE; From dovecot at dovecot.org Tue Jan 17 17:17:45 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 17:17:45 +0200 Subject: dovecot-2.0: auth: DIGEST-MD5 didn't read nonce-count parameter ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/525a179f324f changeset: 13017:525a179f324f user: Timo Sirainen date: Tue Jan 17 17:17:24 2012 +0200 description: auth: DIGEST-MD5 didn't read nonce-count parameter correctly. Patch by Yubao Liu. diffstat: src/auth/mech-digest-md5.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 8438f66433a6 -r 525a179f324f src/auth/mech-digest-md5.c --- a/src/auth/mech-digest-md5.c Tue Jan 10 00:34:09 2012 +0200 +++ b/src/auth/mech-digest-md5.c Tue Jan 17 17:17:24 2012 +0200 @@ -324,7 +324,7 @@ return TRUE; } - if (strcmp(key, "nonce-count") == 0) { + if (strcmp(key, "nc") == 0) { if (request->nonce_count != NULL) { *error = "nonce-count must not exist more than once"; return FALSE; From dovecot at dovecot.org Tue Jan 17 17:18:23 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 17:18:23 +0200 Subject: dovecot-1.2: auth: DIGEST-MD5 didn't read nonce-count parameter ... Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/da3c7253b18c changeset: 9650:da3c7253b18c user: Timo Sirainen date: Tue Jan 17 17:17:24 2012 +0200 description: auth: DIGEST-MD5 didn't read nonce-count parameter correctly. Patch by Yubao Liu. diffstat: src/auth/mech-digest-md5.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 02c2ac9ddf8c -r da3c7253b18c src/auth/mech-digest-md5.c --- a/src/auth/mech-digest-md5.c Mon Aug 29 06:46:53 2011 +0300 +++ b/src/auth/mech-digest-md5.c Tue Jan 17 17:17:24 2012 +0200 @@ -325,7 +325,7 @@ return TRUE; } - if (strcmp(key, "nonce-count") == 0) { + if (strcmp(key, "nc") == 0) { if (request->nonce_count != NULL) { *error = "nonce-count must not exist more than once"; return FALSE; From dovecot at dovecot.org Tue Jan 17 17:20:12 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 17:20:12 +0200 Subject: dovecot-2.1: auth: DIGEST-MD5 supports authorization id now. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c9c271502b32 changeset: 13939:c9c271502b32 user: Timo Sirainen date: Tue Jan 17 17:20:07 2012 +0200 description: auth: DIGEST-MD5 supports authorization id now. Patch by Yubao Liu. diffstat: src/auth/mech-digest-md5.c | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diffs (70 lines): diff -r 387707dc020e -r c9c271502b32 src/auth/mech-digest-md5.c --- a/src/auth/mech-digest-md5.c Tue Jan 17 17:17:24 2012 +0200 +++ b/src/auth/mech-digest-md5.c Tue Jan 17 17:20:07 2012 +0200 @@ -45,6 +45,7 @@ char *nonce_count; char *qop_value; char *digest_uri; /* may be NULL */ + char *authzid; /* may be NULL, authorization ID */ unsigned char response[32]; unsigned long maxbuf; unsigned int nonce_found:1; @@ -132,7 +133,12 @@ { nonce-value, ":" nc-value, ":", cnonce-value, ":", qop-value, ":", HEX(H(A2)) })) - and since we don't support authzid yet: + and if authzid is not empty: + + A1 = { H( { username-value, ":", realm-value, ":", passwd } ), + ":", nonce-value, ":", cnonce-value, ":", authzid } + + else: A1 = { H( { username-value, ":", realm-value, ":", passwd } ), ":", nonce-value, ":", cnonce-value } @@ -154,6 +160,10 @@ md5_update(&ctx, request->nonce, strlen(request->nonce)); md5_update(&ctx, ":", 1); md5_update(&ctx, request->cnonce, strlen(request->cnonce)); + if (request->authzid != NULL) { + md5_update(&ctx, ":", 1); + md5_update(&ctx, request->authzid, strlen(request->authzid)); + } md5_final(&ctx, digest); a1_hex = binary_to_hex(digest, 16); @@ -416,8 +426,18 @@ } if (strcmp(key, "authzid") == 0) { - /* not supported, abort */ - return FALSE; + if (request->authzid != NULL) { + *error = "authzid must not exist more than once"; + return FALSE; + } + + if (*value == '\0') { + *error = "empty authzid"; + return FALSE; + } + + request->authzid = p_strdup(request->pool, value); + return TRUE; } /* unknown key, ignore */ @@ -534,7 +554,11 @@ username = request->username; } - if (auth_request_set_username(auth_request, username, &error)) { + if (auth_request_set_username(auth_request, username, &error) && + (request->authzid == NULL || + auth_request_set_login_username(auth_request, + request->authzid, + &error))) { auth_request_lookup_credentials(auth_request, "DIGEST-MD5", credentials_callback); return; From dovecot at dovecot.org Tue Jan 17 17:20:29 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 17:20:29 +0200 Subject: dovecot-2.0: auth: DIGEST-MD5 supports authorization id now. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/847ca219989d changeset: 13018:847ca219989d user: Timo Sirainen date: Tue Jan 17 17:20:07 2012 +0200 description: auth: DIGEST-MD5 supports authorization id now. Patch by Yubao Liu. diffstat: src/auth/mech-digest-md5.c | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diffs (70 lines): diff -r 525a179f324f -r 847ca219989d src/auth/mech-digest-md5.c --- a/src/auth/mech-digest-md5.c Tue Jan 17 17:17:24 2012 +0200 +++ b/src/auth/mech-digest-md5.c Tue Jan 17 17:20:07 2012 +0200 @@ -46,6 +46,7 @@ char *nonce_count; char *qop_value; char *digest_uri; /* may be NULL */ + char *authzid; /* may be NULL, authorization ID */ unsigned char response[32]; unsigned long maxbuf; unsigned int nonce_found:1; @@ -133,7 +134,12 @@ { nonce-value, ":" nc-value, ":", cnonce-value, ":", qop-value, ":", HEX(H(A2)) })) - and since we don't support authzid yet: + and if authzid is not empty: + + A1 = { H( { username-value, ":", realm-value, ":", passwd } ), + ":", nonce-value, ":", cnonce-value, ":", authzid } + + else: A1 = { H( { username-value, ":", realm-value, ":", passwd } ), ":", nonce-value, ":", cnonce-value } @@ -155,6 +161,10 @@ md5_update(&ctx, request->nonce, strlen(request->nonce)); md5_update(&ctx, ":", 1); md5_update(&ctx, request->cnonce, strlen(request->cnonce)); + if (request->authzid != NULL) { + md5_update(&ctx, ":", 1); + md5_update(&ctx, request->authzid, strlen(request->authzid)); + } md5_final(&ctx, digest); a1_hex = binary_to_hex(digest, 16); @@ -417,8 +427,18 @@ } if (strcmp(key, "authzid") == 0) { - /* not supported, abort */ - return FALSE; + if (request->authzid != NULL) { + *error = "authzid must not exist more than once"; + return FALSE; + } + + if (*value == '\0') { + *error = "empty authzid"; + return FALSE; + } + + request->authzid = p_strdup(request->pool, value); + return TRUE; } /* unknown key, ignore */ @@ -544,7 +564,11 @@ username = request->username; } - if (auth_request_set_username(auth_request, username, &error)) { + if (auth_request_set_username(auth_request, username, &error) && + (request->authzid == NULL || + auth_request_set_login_username(auth_request, + request->authzid, + &error))) { auth_request_lookup_credentials(auth_request, "DIGEST-MD5", credentials_callback); return; From dovecot at dovecot.org Tue Jan 17 22:32:46 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 22:32:46 +0200 Subject: dovecot-2.1: director: Make sure ring syncing doesn't get lost w... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/9e43af01f147 changeset: 13940:9e43af01f147 user: Timo Sirainen date: Tue Jan 17 22:21:57 2012 +0200 description: director: Make sure ring syncing doesn't get lost when directors get disconnected. diffstat: src/director/director-connection.c | 71 +++++++++++++++++++++++-------------- 1 files changed, 43 insertions(+), 28 deletions(-) diffs (90 lines): diff -r c9c271502b32 -r 9e43af01f147 src/director/director-connection.c --- a/src/director/director-connection.c Tue Jan 17 17:20:07 2012 +0200 +++ b/src/director/director-connection.c Tue Jan 17 22:21:57 2012 +0200 @@ -675,6 +675,41 @@ return FALSE; } +static void +director_connection_sync_host(struct director_connection *conn, + struct director_host *host, + uint32_t seq, const char *line) +{ + struct director *dir = conn->dir; + + if (host->self) { + if (dir->sync_seq != seq) { + /* stale SYNC event */ + return; + } + + if (!dir->ring_handshaked) { + /* the ring is handshaked */ + director_set_ring_handshaked(dir); + } else if (dir->ring_synced) { + /* duplicate SYNC (which was sent just in case the + previous one got lost) */ + } else { + if (dir->debug) { + i_debug("Ring is synced (%s sent seq=%u)", + conn->name, seq); + } + director_set_ring_synced(dir); + } + } else { + /* forward it to the connection on right */ + if (dir->right != NULL) { + director_connection_send(dir->right, + t_strconcat(line, "\n", NULL)); + } + } +} + static bool director_connection_sync(struct director_connection *conn, const char *const *args, const char *line) { @@ -693,36 +728,16 @@ /* find the originating director. if we don't see it, it was already removed and we can ignore this sync. */ host = director_host_lookup(dir, &ip, port); - if (host == NULL) - return TRUE; + if (host != NULL) + director_connection_sync_host(conn, host, seq, line); - if (host->self) { - if (dir->sync_seq != seq) { - /* stale SYNC event */ - return TRUE; - } - - if (!dir->ring_handshaked) { - /* the ring is handshaked */ - director_set_ring_handshaked(dir); - } else if (dir->ring_synced) { - i_error("Received SYNC from %s (seq=%u) " - "while already synced", conn->name, seq); - return TRUE; - } else { - if (dir->debug) { - i_debug("Ring is synced (%s sent seq=%u)", - conn->name, seq); - } - director_set_ring_synced(dir); - } - return TRUE; - } - - /* forward it to the connection on right */ - if (dir->right != NULL) { + if (!dir->ring_synced && dir->left != NULL && dir->right != NULL && + (host == NULL || !host->self)) { + /* send a new SYNC in case the previous one got dropped */ director_connection_send(dir->right, - t_strconcat(line, "\n", NULL)); + t_strdup_printf("SYNC\t%s\t%u\t%u\n", + net_ip2addr(&dir->self_ip), + dir->self_port, dir->sync_seq)); } return TRUE; } From dovecot at dovecot.org Tue Jan 17 22:54:20 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 22:54:20 +0200 Subject: dovecot-2.1: director: Added timeout to syncing to make sure we ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/493ebb2cfc73 changeset: 13941:493ebb2cfc73 user: Timo Sirainen date: Tue Jan 17 22:54:11 2012 +0200 description: director: Added timeout to syncing to make sure we don't hang if it somehow gets lost. diffstat: src/director/director-connection.c | 10 ++-------- src/director/director.c | 35 +++++++++++++++++++++++++++++++++++ src/director/director.h | 2 ++ 3 files changed, 39 insertions(+), 8 deletions(-) diffs (109 lines): diff -r 9e43af01f147 -r 493ebb2cfc73 src/director/director-connection.c --- a/src/director/director-connection.c Tue Jan 17 22:21:57 2012 +0200 +++ b/src/director/director-connection.c Tue Jan 17 22:54:11 2012 +0200 @@ -731,14 +731,8 @@ if (host != NULL) director_connection_sync_host(conn, host, seq, line); - if (!dir->ring_synced && dir->left != NULL && dir->right != NULL && - (host == NULL || !host->self)) { - /* send a new SYNC in case the previous one got dropped */ - director_connection_send(dir->right, - t_strdup_printf("SYNC\t%s\t%u\t%u\n", - net_ip2addr(&dir->self_ip), - dir->self_port, dir->sync_seq)); - } + if (host == NULL || !host->self) + director_resend_sync(dir); return TRUE; } diff -r 9e43af01f147 -r 493ebb2cfc73 src/director/director.c --- a/src/director/director.c Tue Jan 17 22:21:57 2012 +0200 +++ b/src/director/director.c Tue Jan 17 22:54:11 2012 +0200 @@ -17,6 +17,7 @@ #define DIRECTOR_RECONNECT_TIMEOUT_MSECS (30*1000) #define DIRECTOR_USER_MOVE_TIMEOUT_MSECS (30*1000) #define DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS (2*1000) +#define DIRECTOR_SYNC_TIMEOUT_MSECS (15*1000) static bool director_is_self_ip_set(struct director *dir) { @@ -224,17 +225,49 @@ timeout_remove(&dir->to_reconnect); } + if (dir->to_sync != NULL) + timeout_remove(&dir->to_sync); dir->ring_synced = TRUE; dir->ring_last_sync_time = ioloop_time; director_set_state_changed(dir); } +bool director_resend_sync(struct director *dir) +{ + if (!dir->ring_synced && dir->left != NULL && dir->right != NULL) { + /* send a new SYNC in case the previous one got dropped */ + director_connection_send(dir->right, + t_strdup_printf("SYNC\t%s\t%u\t%u\n", + net_ip2addr(&dir->self_ip), + dir->self_port, dir->sync_seq)); + if (dir->to_sync != NULL) + timeout_reset(dir->to_sync); + return TRUE; + } + return FALSE; +} + +static void director_sync_timeout(struct director *dir) +{ + i_assert(!dir->ring_synced); + + if (director_resend_sync(dir)) + i_error("Ring SYNC appears to have got lost, resending"); +} + void director_set_ring_unsynced(struct director *dir) { if (dir->ring_synced) { dir->ring_synced = FALSE; dir->ring_last_sync_time = ioloop_time; } + + if (dir->to_sync == NULL) { + dir->to_sync = timeout_add(DIRECTOR_SYNC_TIMEOUT_MSECS, + director_sync_timeout, dir); + } else { + timeout_reset(dir->to_sync); + } } static void director_sync(struct director *dir) @@ -618,6 +651,8 @@ timeout_remove(&dir->to_handshake_warning); if (dir->to_request != NULL) timeout_remove(&dir->to_request); + if (dir->to_sync != NULL) + timeout_remove(&dir->to_sync); array_foreach(&dir->dir_hosts, hostp) director_host_free(*hostp); array_free(&dir->pending_requests); diff -r 9e43af01f147 -r 493ebb2cfc73 src/director/director.h --- a/src/director/director.h Tue Jan 17 22:21:57 2012 +0200 +++ b/src/director/director.h Tue Jan 17 22:54:11 2012 +0200 @@ -24,6 +24,7 @@ /* all director connections */ struct director_connection *connections; struct timeout *to_reconnect; + struct timeout *to_sync; /* current mail hosts */ struct mail_host_list *mail_hosts; @@ -75,6 +76,7 @@ void director_set_ring_synced(struct director *dir); void director_set_ring_unsynced(struct director *dir); void director_set_state_changed(struct director *dir); +bool director_resend_sync(struct director *dir); void director_update_host(struct director *dir, struct director_host *src, struct director_host *orig_src, From dovecot at dovecot.org Tue Jan 17 23:12:36 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 23:12:36 +0200 Subject: dovecot-2.1: lmtp: Get banner text from login_greeting setting. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/05434bef2492 changeset: 13943:05434bef2492 user: Timo Sirainen date: Tue Jan 17 23:12:26 2012 +0200 description: lmtp: Get banner text from login_greeting setting. diffstat: src/lmtp/client.c | 12 ++++++++++-- src/lmtp/lmtp-settings.c | 4 +++- src/lmtp/lmtp-settings.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diffs (79 lines): diff -r ded87d81fc74 -r 05434bef2492 src/lmtp/client.c --- a/src/lmtp/client.c Tue Jan 17 23:11:16 2012 +0200 +++ b/src/lmtp/client.c Tue Jan 17 23:12:26 2012 +0200 @@ -8,6 +8,8 @@ #include "istream.h" #include "ostream.h" #include "hostpid.h" +#include "var-expand.h" +#include "settings-parser.h" #include "master-service.h" #include "master-service-settings.h" #include "mail-namespace.h" @@ -136,11 +138,13 @@ struct mail_storage_service_input input; const struct setting_parser_context *set_parser; const char *error; + void **sets; memset(&input, 0, sizeof(input)); input.module = input.service = "lmtp"; input.local_ip = client->local_ip; input.remote_ip = client->remote_ip; + input.username = ""; if (mail_storage_service_read_settings(storage_service, &input, client->pool, @@ -148,6 +152,10 @@ &set_parser, &error) < 0) i_fatal("%s", error); + sets = settings_parser_get_list(set_parser) + 1; + settings_var_expand(&lmtp_setting_parser_info, sets[2], client->pool, + mail_storage_service_get_var_expand_table(storage_service, &input)); + lmtp_settings_dup(set_parser, client->pool, &client->lmtp_set, &client->set); } @@ -221,8 +229,8 @@ DLLIST_PREPEND(&clients, client); clients_count++; - client_send_line(client, "220 %s Dovecot LMTP ready", - client->my_domain); + client_send_line(client, "220 %s %s", client->my_domain, + client->lmtp_set->login_greeting); i_info("Connect from %s", client_remote_id(client)); return client; } diff -r ded87d81fc74 -r 05434bef2492 src/lmtp/lmtp-settings.c --- a/src/lmtp/lmtp-settings.c Tue Jan 17 23:11:16 2012 +0200 +++ b/src/lmtp/lmtp-settings.c Tue Jan 17 23:12:26 2012 +0200 @@ -59,13 +59,15 @@ static const struct setting_define lmtp_setting_defines[] = { DEF(SET_BOOL, lmtp_proxy), DEF(SET_BOOL, lmtp_save_to_detail_mailbox), + DEF(SET_STR_VARS, login_greeting), SETTING_DEFINE_LIST_END }; static const struct lmtp_settings lmtp_default_settings = { .lmtp_proxy = FALSE, - .lmtp_save_to_detail_mailbox = FALSE + .lmtp_save_to_detail_mailbox = FALSE, + .login_greeting = PACKAGE_NAME" ready." }; static const struct setting_parser_info *lmtp_setting_dependencies[] = { diff -r ded87d81fc74 -r 05434bef2492 src/lmtp/lmtp-settings.h --- a/src/lmtp/lmtp-settings.h Tue Jan 17 23:11:16 2012 +0200 +++ b/src/lmtp/lmtp-settings.h Tue Jan 17 23:12:26 2012 +0200 @@ -7,6 +7,7 @@ struct lmtp_settings { bool lmtp_proxy; bool lmtp_save_to_detail_mailbox; + const char *login_greeting; }; extern const struct setting_parser_info lmtp_setting_parser_info; From dovecot at dovecot.org Tue Jan 17 23:12:36 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 23:12:36 +0200 Subject: dovecot-2.1: lib-storage: Added mail_storage_service_get_var_exp... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/ded87d81fc74 changeset: 13942:ded87d81fc74 user: Timo Sirainen date: Tue Jan 17 23:11:16 2012 +0200 description: lib-storage: Added mail_storage_service_get_var_expand_table(). diffstat: src/lib-storage/mail-storage-service.c | 12 ++++++++++++ src/lib-storage/mail-storage-service.h | 3 +++ 2 files changed, 15 insertions(+), 0 deletions(-) diffs (35 lines): diff -r 493ebb2cfc73 -r ded87d81fc74 src/lib-storage/mail-storage-service.c --- a/src/lib-storage/mail-storage-service.c Tue Jan 17 22:54:11 2012 +0200 +++ b/src/lib-storage/mail-storage-service.c Tue Jan 17 23:11:16 2012 +0200 @@ -392,6 +392,18 @@ return tab; } +const struct var_expand_table * +mail_storage_service_get_var_expand_table(struct mail_storage_service_ctx *ctx, + struct mail_storage_service_input *input) +{ + struct mail_storage_service_privileges priv; + + memset(&priv, 0, sizeof(priv)); + priv.uid = (uid_t)-1; + priv.gid = (gid_t)-1; + return get_var_expand_table(ctx->service, input, &priv); +} + static const char * user_expand_varstr(struct master_service *service, struct mail_storage_service_input *input, diff -r 493ebb2cfc73 -r ded87d81fc74 src/lib-storage/mail-storage-service.h --- a/src/lib-storage/mail-storage-service.h Tue Jan 17 22:54:11 2012 +0200 +++ b/src/lib-storage/mail-storage-service.h Tue Jan 17 23:11:16 2012 +0200 @@ -109,6 +109,9 @@ struct setting_parser_context * mail_storage_service_user_get_settings_parser(struct mail_storage_service_user *user); +const struct var_expand_table * +mail_storage_service_get_var_expand_table(struct mail_storage_service_ctx *ctx, + struct mail_storage_service_input *input); /* Return the settings pointed to by set_root parameter in _init() */ void *mail_storage_service_get_settings(struct master_service *service); From dovecot at dovecot.org Tue Jan 17 23:34:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 23:34:41 +0200 Subject: dovecot-2.1: lib-lda: Fixed LMTP client hanging on sending large... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8a9a803f8af4 changeset: 13944:8a9a803f8af4 user: Timo Sirainen date: Tue Jan 17 23:34:22 2012 +0200 description: lib-lda: Fixed LMTP client hanging on sending large mails. diffstat: src/lib-lda/lmtp-client.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 05434bef2492 -r 8a9a803f8af4 src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Tue Jan 17 23:12:26 2012 +0200 +++ b/src/lib-lda/lmtp-client.c Tue Jan 17 23:34:22 2012 +0200 @@ -312,6 +312,7 @@ break; if (ret == 0) { /* continue later */ + o_stream_set_flush_pending(client->output, TRUE); return; } } From dovecot at dovecot.org Tue Jan 17 23:34:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 23:34:41 +0200 Subject: dovecot-2.1: lmtp: Removed unnecessary code. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/bb848036f1b4 changeset: 13945:bb848036f1b4 user: Timo Sirainen date: Tue Jan 17 23:34:31 2012 +0200 description: lmtp: Removed unnecessary code. diffstat: src/lmtp/lmtp-proxy.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-) diffs (27 lines): diff -r 8a9a803f8af4 -r bb848036f1b4 src/lmtp/lmtp-proxy.c --- a/src/lmtp/lmtp-proxy.c Tue Jan 17 23:34:22 2012 +0200 +++ b/src/lmtp/lmtp-proxy.c Tue Jan 17 23:34:31 2012 +0200 @@ -255,13 +255,6 @@ return 0; } -static void lmtp_proxy_more_data_sent(void *context) -{ - struct lmtp_proxy_connection *conn = context; - - lmtp_client_send_more(conn->client); -} - static void lmtp_proxy_conn_timeout(struct lmtp_proxy_connection *conn) { const char *line; @@ -295,9 +288,6 @@ conn->to = timeout_add(proxy->max_timeout_msecs, lmtp_proxy_conn_timeout, conn); - lmtp_client_set_data_output_callback(conn->client, - lmtp_proxy_more_data_sent, - conn); conn->data_input = i_stream_create_limit(data_input, (uoff_t)-1); lmtp_client_set_data_header(conn->client, header); From dovecot at dovecot.org Tue Jan 17 23:35:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 Jan 2012 23:35:03 +0200 Subject: dovecot-2.0: lib-lda: Fixed LMTP client hanging on sending large... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/71084b799a6c changeset: 13019:71084b799a6c user: Timo Sirainen date: Tue Jan 17 23:34:22 2012 +0200 description: lib-lda: Fixed LMTP client hanging on sending large mails. diffstat: src/lib-lda/lmtp-client.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 847ca219989d -r 71084b799a6c src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Tue Jan 17 17:20:07 2012 +0200 +++ b/src/lib-lda/lmtp-client.c Tue Jan 17 23:34:22 2012 +0200 @@ -312,6 +312,7 @@ break; if (ret == 0) { /* continue later */ + o_stream_set_flush_pending(client->output, TRUE); return; } } From dovecot at dovecot.org Wed Jan 18 14:22:02 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 14:22:02 +0200 Subject: dovecot-2.1: master: Show the process_limit / client_limit value... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a4e61c99c7eb changeset: 13946:a4e61c99c7eb user: Timo Sirainen date: Wed Jan 18 14:21:53 2012 +0200 description: master: Show the process_limit / client_limit value when logging that it's been reached. diffstat: src/master/service-monitor.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (25 lines): diff -r bb848036f1b4 -r a4e61c99c7eb src/master/service-monitor.c --- a/src/master/service-monitor.c Tue Jan 17 23:34:31 2012 +0200 +++ b/src/master/service-monitor.c Wed Jan 18 14:21:53 2012 +0200 @@ -231,16 +231,19 @@ static void service_drop_connections(struct service_listener *l) { struct service *service = l->service; + unsigned int limit; int fd; if (service->last_drop_warning + SERVICE_DROP_WARN_INTERVAL_SECS < ioloop_time) { service->last_drop_warning = ioloop_time; - i_warning("service(%s): %s reached, " + limit = service->process_limit > 1 ? + service->process_limit : service->client_limit; + i_warning("service(%s): %s (%u) reached, " "client connections are being dropped", service->set->name, service->process_limit > 1 ? - "process_limit" : "client_limit"); + "process_limit" : "client_limit", limit); } if (service->type == SERVICE_TYPE_LOGIN) { From dovecot at dovecot.org Wed Jan 18 14:23:20 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 14:23:20 +0200 Subject: dovecot-2.0: master: Show the process_limit / client_limit value... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/687949948a83 changeset: 13020:687949948a83 user: Timo Sirainen date: Wed Jan 18 14:21:53 2012 +0200 description: master: Show the process_limit / client_limit value when logging that it's been reached. diffstat: src/master/service-monitor.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (25 lines): diff -r 71084b799a6c -r 687949948a83 src/master/service-monitor.c --- a/src/master/service-monitor.c Tue Jan 17 23:34:22 2012 +0200 +++ b/src/master/service-monitor.c Wed Jan 18 14:21:53 2012 +0200 @@ -228,16 +228,19 @@ static void service_drop_connections(struct service_listener *l) { struct service *service = l->service; + unsigned int limit; int fd; if (service->last_drop_warning + SERVICE_DROP_WARN_INTERVAL_SECS < ioloop_time) { service->last_drop_warning = ioloop_time; - i_warning("service(%s): %s reached, " + limit = service->process_limit > 1 ? + service->process_limit : service->client_limit; + i_warning("service(%s): %s (%u) reached, " "client connections are being dropped", service->set->name, service->process_limit > 1 ? - "process_limit" : "client_limit"); + "process_limit" : "client_limit", limit); } if (service->type == SERVICE_TYPE_LOGIN) { From dovecot at dovecot.org Wed Jan 18 16:52:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 16:52:37 +0200 Subject: dovecot-2.1: lib-storage: Preserve from_envelope in save context... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7ee2cfbcae2e changeset: 13947:7ee2cfbcae2e user: Timo Sirainen date: Wed Jan 18 16:51:22 2012 +0200 description: lib-storage: Preserve from_envelope in save context's dest_mail even if it's temporary. This allows looking it up while the mail is being saved. diffstat: src/lib-storage/index/index-mail.c | 16 ++++++++++++++++ src/lib-storage/index/index-mail.h | 2 ++ src/lib-storage/index/index-storage.c | 2 +- 3 files changed, 19 insertions(+), 1 deletions(-) diffs (64 lines): diff -r a4e61c99c7eb -r 7ee2cfbcae2e src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Wed Jan 18 14:21:53 2012 +0200 +++ b/src/lib-storage/index/index-mail.c Wed Jan 18 16:51:22 2012 +0200 @@ -1077,6 +1077,9 @@ *value_r = data->envelope; return 0; case MAIL_FETCH_FROM_ENVELOPE: + *value_r = data->from_envelope != NULL ? + data->from_envelope : ""; + return 0; case MAIL_FETCH_UIDL_FILE_NAME: case MAIL_FETCH_UIDL_BACKEND: case MAIL_FETCH_SEARCH_RELEVANCY: @@ -1749,3 +1752,16 @@ { return 0; } + +void index_mail_save_finish(struct mail_save_context *ctx) +{ + struct index_mail *imail = (struct index_mail *)ctx->dest_mail; + + if (imail == NULL) + return; + + if (ctx->from_envelope != NULL && imail->data.from_envelope == NULL) { + imail->data.from_envelope = + p_strdup(imail->data_pool, ctx->from_envelope); + } +} diff -r a4e61c99c7eb -r 7ee2cfbcae2e src/lib-storage/index/index-mail.h --- a/src/lib-storage/index/index-mail.h Wed Jan 18 14:21:53 2012 +0200 +++ b/src/lib-storage/index/index-mail.h Wed Jan 18 16:51:22 2012 +0200 @@ -78,6 +78,7 @@ struct message_part *parts; const char *envelope, *body, *bodystructure, *uid_string, *guid; + const char *from_envelope; struct message_part_envelope_data *envelope_data; uint32_t seq; @@ -235,5 +236,6 @@ int index_mail_cache_lookup_field(struct index_mail *mail, buffer_t *buf, unsigned int field_idx); +void index_mail_save_finish(struct mail_save_context *ctx); #endif diff -r a4e61c99c7eb -r 7ee2cfbcae2e src/lib-storage/index/index-storage.c --- a/src/lib-storage/index/index-storage.c Wed Jan 18 14:21:53 2012 +0200 +++ b/src/lib-storage/index/index-storage.c Wed Jan 18 16:51:22 2012 +0200 @@ -606,6 +606,7 @@ void index_save_context_free(struct mail_save_context *ctx) { + index_mail_save_finish(ctx); i_free_and_null(ctx->from_envelope); i_free_and_null(ctx->guid); i_free_and_null(ctx->pop3_uidl); @@ -698,4 +699,3 @@ } return 0; } - From dovecot at dovecot.org Wed Jan 18 16:52:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 16:52:37 +0200 Subject: dovecot-2.1: lib-lda: Added %e / %{from_envelope} variable to de... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/08cc9d2a79e6 changeset: 13948:08cc9d2a79e6 user: Timo Sirainen date: Wed Jan 18 16:52:14 2012 +0200 description: lib-lda: Added %e / %{from_envelope} variable to deliver_log_format. diffstat: src/lib-lda/mail-deliver.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diffs (34 lines): diff -r 7ee2cfbcae2e -r 08cc9d2a79e6 src/lib-lda/mail-deliver.c --- a/src/lib-lda/mail-deliver.c Wed Jan 18 16:51:22 2012 +0200 +++ b/src/lib-lda/mail-deliver.c Wed Jan 18 16:52:14 2012 +0200 @@ -46,11 +46,13 @@ { 'm', NULL, "msgid" }, { 's', NULL, "subject" }, { 'f', NULL, "from" }, + { 'e', NULL, "from_envelope" }, { 'p', NULL, "size" }, { 'w', NULL, "vsize" }, { '\0', NULL, NULL } }; struct var_expand_table *tab; + const char *str; uoff_t size; tab = t_malloc(sizeof(static_tab)); @@ -65,10 +67,14 @@ tab[2].value = str_sanitize(tab[2].value, 80); tab[3].value = str_sanitize(mail_deliver_get_address(mail, "From"), 80); + if (mail_get_special(mail, MAIL_FETCH_FROM_ENVELOPE, &str) < 0) + str = ""; + tab[4].value = str_sanitize(str, 80); + if (mail_get_physical_size(mail, &size) == 0) - tab[4].value = dec2str(size); + tab[5].value = dec2str(size); if (mail_get_virtual_size(mail, &size) == 0) - tab[5].value = dec2str(size); + tab[6].value = dec2str(size); return tab; } From dovecot at dovecot.org Wed Jan 18 17:59:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 17:59:04 +0200 Subject: dovecot-2.1: fs layout: Don't crash in mailbox listing if there ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/99ea6da7dc99 changeset: 13949:99ea6da7dc99 user: Timo Sirainen date: Wed Jan 18 17:58:53 2012 +0200 description: fs layout: Don't crash in mailbox listing if there are only invalid patterns. diffstat: src/lib-storage/list/mailbox-list-fs-iter.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 08cc9d2a79e6 -r 99ea6da7dc99 src/lib-storage/list/mailbox-list-fs-iter.c --- a/src/lib-storage/list/mailbox-list-fs-iter.c Wed Jan 18 16:52:14 2012 +0200 +++ b/src/lib-storage/list/mailbox-list-fs-iter.c Wed Jan 18 17:58:53 2012 +0200 @@ -617,7 +617,7 @@ fs_list_next_root(ctx); } - if (!ctx->inbox_found && + if (!ctx->inbox_found && ctx->ctx.glob != NULL && (ctx->ctx.list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0 && imap_match(ctx->ctx.glob, fs_list_get_inbox_vname(ctx)) == IMAP_MATCH_YES) { From dovecot at dovecot.org Wed Jan 18 23:36:21 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 23:36:21 +0200 Subject: dovecot-2.1: auth: Log a warning if userdb sql isn't used, but u... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8822aeae8d82 changeset: 13950:8822aeae8d82 user: Timo Sirainen date: Wed Jan 18 23:36:13 2012 +0200 description: auth: Log a warning if userdb sql isn't used, but user_query or iterate_query isn't default. This is intended to stop people from wondering why user_query doesn't do anything. diffstat: src/auth/db-sql.c | 29 +++++++++++++++++++++++++++-- src/auth/db-sql.h | 6 +++++- src/auth/passdb-sql.c | 5 +++-- src/auth/userdb-sql.c | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) diffs (130 lines): diff -r 99ea6da7dc99 -r 8822aeae8d82 src/auth/db-sql.c --- a/src/auth/db-sql.c Wed Jan 18 17:58:53 2012 +0200 +++ b/src/auth/db-sql.c Wed Jan 18 23:36:13 2012 +0200 @@ -23,6 +23,7 @@ DEF_STR(update_query), DEF_STR(iterate_query), DEF_STR(default_pass_scheme), + DEF_BOOL(userdb_warning_disable), { 0, NULL, 0 } }; @@ -34,7 +35,8 @@ .user_query = "SELECT home, uid, gid FROM users WHERE username = '%n' AND domain = '%d'", .update_query = "UPDATE users SET password = '%w' WHERE username = '%n' AND domain = '%d'", .iterate_query = "SELECT username, domain FROM users", - .default_pass_scheme = "MD5" + .default_pass_scheme = "MD5", + .userdb_warning_disable = FALSE }; static struct sql_connection *connections = NULL; @@ -58,13 +60,15 @@ &conn->set, key, value); } -struct sql_connection *db_sql_init(const char *config_path) +struct sql_connection *db_sql_init(const char *config_path, bool userdb) { struct sql_connection *conn; pool_t pool; conn = sql_conn_find(config_path); if (conn != NULL) { + if (userdb) + conn->userdb_used = TRUE; conn->refcount++; return conn; } @@ -75,6 +79,7 @@ pool = pool_alloconly_create("sql_connection", 1024); conn = p_new(pool, struct sql_connection, 1); conn->pool = pool; + conn->userdb_used = userdb; conn->refcount = 1; @@ -124,4 +129,24 @@ pool_unref(&conn->pool); } +void db_sql_check_userdb_warning(struct sql_connection *conn) +{ + if (worker || conn->userdb_used || conn->set.userdb_warning_disable) + return; + + if (strcmp(conn->set.user_query, + default_sql_settings.user_query) != 0) { + i_warning("sql: Ignoring changed user_query in %s, " + "because userdb sql not used. " + "(If this is intentional, set userdb_warning_disable=yes)", + conn->config_path); + } else if (strcmp(conn->set.iterate_query, + default_sql_settings.iterate_query) != 0) { + i_warning("sql: Ignoring changed iterate_query in %s, " + "because userdb sql not used. " + "(If this is intentional, set userdb_warning_disable=yes)", + conn->config_path); + } +} + #endif diff -r 99ea6da7dc99 -r 8822aeae8d82 src/auth/db-sql.h --- a/src/auth/db-sql.h Wed Jan 18 17:58:53 2012 +0200 +++ b/src/auth/db-sql.h Wed Jan 18 23:36:13 2012 +0200 @@ -11,6 +11,7 @@ const char *update_query; const char *iterate_query; const char *default_pass_scheme; + bool userdb_warning_disable; }; struct sql_connection { @@ -27,9 +28,12 @@ unsigned int default_user_query:1; unsigned int default_update_query:1; unsigned int default_iterate_query:1; + unsigned int userdb_used:1; }; -struct sql_connection *db_sql_init(const char *config_path); +struct sql_connection *db_sql_init(const char *config_path, bool userdb); void db_sql_unref(struct sql_connection **conn); +void db_sql_check_userdb_warning(struct sql_connection *conn); + #endif diff -r 99ea6da7dc99 -r 8822aeae8d82 src/auth/passdb-sql.c --- a/src/auth/passdb-sql.c Wed Jan 18 17:58:53 2012 +0200 +++ b/src/auth/passdb-sql.c Wed Jan 18 23:36:13 2012 +0200 @@ -251,7 +251,7 @@ struct sql_connection *conn; module = p_new(pool, struct sql_passdb_module, 1); - module->conn = conn = db_sql_init(args); + module->conn = conn = db_sql_init(args, FALSE); module->module.cache_key = auth_cache_parse_key(pool, conn->set.password_query); @@ -269,7 +269,8 @@ module->module.blocking = (flags & SQL_DB_FLAG_BLOCKING) != 0; if (!module->module.blocking || worker) - sql_connect(module->conn->db); + sql_connect(module->conn->db); + db_sql_check_userdb_warning(module->conn); } static void passdb_sql_deinit(struct passdb_module *_module) diff -r 99ea6da7dc99 -r 8822aeae8d82 src/auth/userdb-sql.c --- a/src/auth/userdb-sql.c Wed Jan 18 17:58:53 2012 +0200 +++ b/src/auth/userdb-sql.c Wed Jan 18 23:36:13 2012 +0200 @@ -261,7 +261,7 @@ struct sql_userdb_module *module; module = p_new(pool, struct sql_userdb_module, 1); - module->conn = db_sql_init(args); + module->conn = db_sql_init(args, TRUE); module->module.cache_key = auth_cache_parse_key(pool, module->conn->set.user_query); From dovecot at dovecot.org Wed Jan 18 23:44:46 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 18 Jan 2012 23:44:46 +0200 Subject: dovecot-2.1: auth: Log a warning if userdb ldap isn't used, but ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/826ac15f8a13 changeset: 13951:826ac15f8a13 user: Timo Sirainen date: Wed Jan 18 23:44:40 2012 +0200 description: auth: Log a warning if userdb ldap isn't used, but user_* or iterate_* aren't defaults. This is intended to stop people from wondering why their changes don't do anything. diffstat: src/auth/db-ldap.c | 36 ++++++++++++++++++++++++++++++++++-- src/auth/db-ldap.h | 5 ++++- src/auth/passdb-ldap.c | 3 ++- src/auth/userdb-ldap.c | 2 +- 4 files changed, 41 insertions(+), 5 deletions(-) diffs (144 lines): diff -r 8822aeae8d82 -r 826ac15f8a13 src/auth/db-ldap.c --- a/src/auth/db-ldap.c Wed Jan 18 23:36:13 2012 +0200 +++ b/src/auth/db-ldap.c Wed Jan 18 23:44:40 2012 +0200 @@ -107,6 +107,7 @@ DEF_STR(iterate_attrs), DEF_STR(iterate_filter), DEF_STR(default_pass_scheme), + DEF_BOOL(userdb_warning_disable), { 0, NULL, 0 } }; @@ -141,7 +142,8 @@ .pass_filter = "(&(objectClass=posixAccount)(uid=%u))", .iterate_attrs = "uid=user", .iterate_filter = "(objectClass=posixAccount)", - .default_pass_scheme = "crypt" + .default_pass_scheme = "crypt", + .userdb_warning_disable = FALSE }; static struct ldap_connection *ldap_connections = NULL; @@ -1253,7 +1255,7 @@ return NULL; } -struct ldap_connection *db_ldap_init(const char *config_path) +struct ldap_connection *db_ldap_init(const char *config_path, bool userdb) { struct ldap_connection *conn; const char *str; @@ -1262,6 +1264,8 @@ /* see if it already exists */ conn = ldap_conn_find(config_path); if (conn != NULL) { + if (userdb) + conn->userdb_used = TRUE; conn->refcount++; return conn; } @@ -1274,6 +1278,7 @@ conn->pool = pool; conn->refcount = 1; + conn->userdb_used = userdb; conn->conn_state = LDAP_CONN_STATE_DISCONNECTED; conn->default_bind_msgid = -1; conn->fd = -1; @@ -1348,6 +1353,33 @@ pool_unref(&conn->pool); } +void db_ldap_check_userdb_warning(struct ldap_connection *conn) +{ + const struct ldap_settings *def = &default_ldap_settings; + const char *set_name; + + if (worker || conn->userdb_used || conn->set.userdb_warning_disable) + return; + + if (strcmp(conn->set.user_attrs, def->user_attrs) != 0) + set_name = "user_attrs"; + else if (strcmp(conn->set.user_filter, def->user_filter) != 0) + set_name = "user_filter"; + else if (strcmp(conn->set.iterate_attrs, def->iterate_attrs) != 0) + set_name = "iterate_attrs"; + else if (strcmp(conn->set.iterate_filter, def->iterate_filter) != 0) + set_name = "iterate_filter"; + else + set_name = NULL; + + if (set_name != NULL) { + i_warning("ldap: Ignoring changed %s in %s, " + "because userdb ldap not used. " + "(If this is intentional, set userdb_warning_disable=yes)", + set_name, conn->config_path); + } +} + #ifndef BUILTIN_LDAP /* Building a plugin */ extern struct passdb_module_interface passdb_ldap_plugin; diff -r 8822aeae8d82 -r 826ac15f8a13 src/auth/db-ldap.h --- a/src/auth/db-ldap.h Wed Jan 18 23:36:13 2012 +0200 +++ b/src/auth/db-ldap.h Wed Jan 18 23:44:40 2012 +0200 @@ -63,6 +63,7 @@ const char *iterate_filter; const char *default_pass_scheme; + bool userdb_warning_disable; /* ... */ int ldap_deref, ldap_scope; @@ -147,6 +148,7 @@ char **pass_attr_names, **user_attr_names, **iterate_attr_names; struct hash_table *pass_attr_map, *user_attr_map, *iterate_attr_map; + bool userdb_used; }; /* Send/queue request */ @@ -157,9 +159,10 @@ char ***attr_names_r, struct hash_table *attr_map, const char *skip_attr); -struct ldap_connection *db_ldap_init(const char *config_path); +struct ldap_connection *db_ldap_init(const char *config_path, bool userdb); void db_ldap_unref(struct ldap_connection **conn); +void db_ldap_check_userdb_warning(struct ldap_connection *conn); int db_ldap_connect(struct ldap_connection *conn); void db_ldap_enable_input(struct ldap_connection *conn, bool enable); diff -r 8822aeae8d82 -r 826ac15f8a13 src/auth/passdb-ldap.c --- a/src/auth/passdb-ldap.c Wed Jan 18 23:36:13 2012 +0200 +++ b/src/auth/passdb-ldap.c Wed Jan 18 23:44:40 2012 +0200 @@ -407,7 +407,7 @@ struct ldap_connection *conn; module = p_new(pool, struct ldap_passdb_module, 1); - module->conn = conn = db_ldap_init(args); + module->conn = conn = db_ldap_init(args, FALSE); conn->pass_attr_map = hash_table_create(default_pool, conn->pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp); @@ -434,6 +434,7 @@ /* Credential lookups can't be done with authentication binds */ _module->iface.lookup_credentials = NULL; } + db_ldap_check_userdb_warning(module->conn); } static void passdb_ldap_deinit(struct passdb_module *_module) diff -r 8822aeae8d82 -r 826ac15f8a13 src/auth/userdb-ldap.c --- a/src/auth/userdb-ldap.c Wed Jan 18 23:36:13 2012 +0200 +++ b/src/auth/userdb-ldap.c Wed Jan 18 23:44:40 2012 +0200 @@ -260,7 +260,7 @@ struct ldap_connection *conn; module = p_new(pool, struct ldap_userdb_module, 1); - module->conn = conn = db_ldap_init(args); + module->conn = conn = db_ldap_init(args, TRUE); conn->user_attr_map = hash_table_create(default_pool, conn->pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp); From dovecot at dovecot.org Thu Jan 19 15:57:20 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 15:57:20 +0200 Subject: dovecot-2.1: lib-auth: Treat cert_username="" and initial_resp_b... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/141d1e26b13a changeset: 13952:141d1e26b13a user: Timo Sirainen date: Thu Jan 19 15:41:16 2012 +0200 description: lib-auth: Treat cert_username="" and initial_resp_base64="" the same as NULLs. diffstat: src/lib-auth/auth-client-request.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (15 lines): diff -r 826ac15f8a13 -r 141d1e26b13a src/lib-auth/auth-client-request.c --- a/src/lib-auth/auth-client-request.c Wed Jan 18 23:44:40 2012 +0200 +++ b/src/lib-auth/auth-client-request.c Thu Jan 19 15:41:16 2012 +0200 @@ -82,9 +82,9 @@ request->request_info.mech = p_strdup(pool, request_info->mech); request->request_info.service = p_strdup(pool, request_info->service); request->request_info.cert_username = - p_strdup(pool, request_info->cert_username); + p_strdup_empty(pool, request_info->cert_username); request->request_info.initial_resp_base64 = - p_strdup(pool, request_info->initial_resp_base64); + p_strdup_empty(pool, request_info->initial_resp_base64); request->callback = callback; request->context = context; From dovecot at dovecot.org Thu Jan 19 15:57:29 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 15:57:29 +0200 Subject: dovecot-2.1: imap-login: Handle SASL-IR without overflowing mast... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b86f7dd170c6 changeset: 13953:b86f7dd170c6 user: Timo Sirainen date: Thu Jan 19 15:53:42 2012 +0200 description: imap-login: Handle SASL-IR without overflowing master_auth_request's buffer. diffstat: src/imap-login/client-authenticate.c | 45 ++++++++++++++----- src/imap-login/client-authenticate.h | 2 +- src/imap-login/client.c | 79 +++++++++++++++++++++------------- src/imap-login/client.h | 3 + src/lib-master/master-auth.h | 5 +- src/login-common/client-common-auth.c | 10 ++-- src/login-common/client-common.h | 10 +++- 7 files changed, 99 insertions(+), 55 deletions(-) diffs (286 lines): diff -r 141d1e26b13a -r b86f7dd170c6 src/imap-login/client-authenticate.c --- a/src/imap-login/client-authenticate.c Thu Jan 19 15:41:16 2012 +0200 +++ b/src/imap-login/client-authenticate.c Thu Jan 19 15:53:42 2012 +0200 @@ -118,22 +118,43 @@ return client_auth_begin(&imap_client->common, mech_name, init_resp); } -int cmd_authenticate(struct imap_client *imap_client, - const struct imap_arg *args) +int cmd_authenticate(struct imap_client *imap_client) { - const char *mech_name, *init_resp; + /* NOTE: This command's input is handled specially because the + SASL-IR can be large. */ + struct client *client = &imap_client->common; + const unsigned char *data; + size_t i, size; + int ret; /* [] */ - if (!imap_arg_get_atom(&args[0], &mech_name) || *mech_name == '\0') - return -1; - if (imap_arg_get_atom(&args[1], &init_resp)) - args++; - else - init_resp = NULL; - if (!IMAP_ARG_IS_EOL(&args[1])) - return -1; + if (client->auth_mech_name == NULL) { + data = i_stream_get_data(client->input, &size); + for (i = 0; i < size; i++) { + if (data[i] == ' ' || + data[i] == '\r' || data[i] == '\n') + break; + } + if (i == size) + return 0; + if (i == 0) { + /* empty mechanism name */ + imap_client->skip_line = TRUE; + return -1; + } + client->auth_mech_name = i_strndup(data, i); + if (data[i] == ' ') + i++; + i_stream_skip(client->input, i); + } - return imap_client_auth_begin(imap_client, mech_name, init_resp); + /* get SASL-IR, if any */ + if ((ret = client_auth_read_line(client)) <= 0) + return ret; + + return imap_client_auth_begin(imap_client, + t_strdup(client->auth_mech_name), + str_c(client->auth_response)); } int cmd_login(struct imap_client *imap_client, const struct imap_arg *args) diff -r 141d1e26b13a -r b86f7dd170c6 src/imap-login/client-authenticate.h --- a/src/imap-login/client-authenticate.h Thu Jan 19 15:41:16 2012 +0200 +++ b/src/imap-login/client-authenticate.h Thu Jan 19 15:53:42 2012 +0200 @@ -9,6 +9,6 @@ const struct client_auth_reply *reply); int cmd_login(struct imap_client *client, const struct imap_arg *args); -int cmd_authenticate(struct imap_client *client, const struct imap_arg *args); +int cmd_authenticate(struct imap_client *client); #endif diff -r 141d1e26b13a -r b86f7dd170c6 src/imap-login/client.c --- a/src/imap-login/client.c Thu Jan 19 15:41:16 2012 +0200 +++ b/src/imap-login/client.c Thu Jan 19 15:53:42 2012 +0200 @@ -169,8 +169,6 @@ cmd = t_str_ucase(cmd); if (strcmp(cmd, "LOGIN") == 0) return cmd_login(client, args); - if (strcmp(cmd, "AUTHENTICATE") == 0) - return cmd_authenticate(client, args); if (strcmp(cmd, "CAPABILITY") == 0) return cmd_capability(client); if (strcmp(cmd, "STARTTLS") == 0) @@ -214,12 +212,43 @@ return TRUE; } +static int client_parse_command(struct imap_client *client, + const struct imap_arg **args_r) +{ + const char *msg; + bool fatal; + + switch (imap_parser_read_args(client->parser, 0, 0, args_r)) { + case -1: + /* error */ + msg = imap_parser_get_error(client->parser, &fatal); + if (fatal) { + client_send_line(&client->common, + CLIENT_CMD_REPLY_BYE, msg); + client_destroy(&client->common, + t_strconcat("Disconnected: ", msg, NULL)); + return FALSE; + } + + client_send_line(&client->common, CLIENT_CMD_REPLY_BAD, msg); + client->cmd_finished = TRUE; + client->skip_line = TRUE; + return -1; + case -2: + /* not enough data */ + return 0; + default: + /* we read the entire line - skip over the CRLF */ + if (!client_skip_line(client)) + i_unreached(); + return 1; + } +} + static bool client_handle_input(struct imap_client *client) { const struct imap_arg *args; - const char *msg; int ret; - bool fatal; i_assert(!client->common.authenticating); @@ -245,7 +274,8 @@ client->cmd_tag = imap_parser_read_word(client->parser); if (client->cmd_tag == NULL) return FALSE; /* need more data */ - if (!imap_is_valid_tag(client->cmd_tag)) { + if (!imap_is_valid_tag(client->cmd_tag) || + strlen(client->cmd_tag) > IMAP_TAG_MAX_LEN) { /* the tag is invalid, don't allow it and don't send it back. this attempts to prevent any potentially dangerous replies in case someone tries @@ -260,34 +290,21 @@ return FALSE; /* need more data */ } - switch (imap_parser_read_args(client->parser, 0, 0, &args)) { - case -1: - /* error */ - msg = imap_parser_get_error(client->parser, &fatal); - if (fatal) { - client_send_line(&client->common, - CLIENT_CMD_REPLY_BYE, msg); - client_destroy(&client->common, - t_strconcat("Disconnected: ", msg, NULL)); + if (strcasecmp(client->cmd_name, "AUTHENTICATE") == 0) { + /* SASL-IR may need more space than input buffer's size, + so we'll handle it as a special case. */ + ret = cmd_authenticate(client); + if (ret == 0) return FALSE; - } - - client_send_line(&client->common, CLIENT_CMD_REPLY_BAD, msg); - client->cmd_finished = TRUE; - client->skip_line = TRUE; - return TRUE; - case -2: - /* not enough data */ - return FALSE; + } else { + ret = client_parse_command(client, &args); + if (ret < 0) + return TRUE; + if (ret == 0) + return FALSE; + ret = *client->cmd_tag == '\0' ? -1 : + client_command_execute(client, client->cmd_name, args); } - /* we read the entire line - skip over the CRLF */ - if (!client_skip_line(client)) - i_unreached(); - - if (*client->cmd_tag == '\0') - ret = -1; - else - ret = client_command_execute(client, client->cmd_name, args); client->cmd_finished = TRUE; if (ret == -2 && strcasecmp(client->cmd_tag, "LOGIN") == 0) { diff -r 141d1e26b13a -r b86f7dd170c6 src/imap-login/client.h --- a/src/imap-login/client.h Thu Jan 19 15:41:16 2012 +0200 +++ b/src/imap-login/client.h Thu Jan 19 15:53:42 2012 +0200 @@ -4,6 +4,9 @@ #include "network.h" #include "client-common.h" +/* Master prefix is: <1|0> */ +#define IMAP_TAG_MAX_LEN (LOGIN_MAX_MASTER_PREFIX_LEN-2) + struct imap_client { struct client common; diff -r 141d1e26b13a -r b86f7dd170c6 src/lib-master/master-auth.h --- a/src/lib-master/master-auth.h Thu Jan 19 15:41:16 2012 +0200 +++ b/src/lib-master/master-auth.h Thu Jan 19 15:53:42 2012 +0200 @@ -13,9 +13,8 @@ /* Authentication client process's cookie size */ #define MASTER_AUTH_COOKIE_SIZE (128/8) -/* This should be kept in sync with LOGIN_MAX_INBUF_SIZE. Multiply it by two - to make sure there's space to transfer the command tag */ -#define MASTER_AUTH_MAX_DATA_SIZE (1024*2) +/* LOGIN_MAX_INBUF_SIZE should be based on this.*/ +#define MASTER_AUTH_MAX_DATA_SIZE 1024 #define MASTER_AUTH_ERRMSG_INTERNAL_FAILURE \ "Internal error occurred. Refer to server log for more information." diff -r 141d1e26b13a -r b86f7dd170c6 src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Thu Jan 19 15:41:16 2012 +0200 +++ b/src/login-common/client-common-auth.c Thu Jan 19 15:53:42 2012 +0200 @@ -335,7 +335,7 @@ return client->v.auth_handle_reply(client, reply); } -static int client_auth_read_line(struct client *client) +int client_auth_read_line(struct client *client) { const unsigned char *data; size_t i, size; @@ -351,6 +351,8 @@ if (data[i] == '\n') break; } + if (client->auth_response == NULL) + client->auth_response = str_new(default_pool, I_MAX(i+1, 256)); if (str_len(client->auth_response) + i > CLIENT_AUTH_BUF_MAX_SIZE) { client_destroy(client, "Authentication response too large"); return -1; @@ -480,7 +482,8 @@ if (client->to_auth_waiting != NULL) timeout_remove(&client->to_auth_waiting); - str_truncate(client->auth_response, 0); + if (client->auth_response != NULL) + str_truncate(client->auth_response, 0); i_assert(client->io == NULL); client->auth_waiting = TRUE; @@ -508,9 +511,6 @@ } - if (client->auth_response == NULL) - client->auth_response = str_new(default_pool, 256); - client_ref(client); client->auth_initializing = TRUE; sasl_server_auth_begin(client, login_binary->protocol, mech_name, diff -r 141d1e26b13a -r b86f7dd170c6 src/login-common/client-common.h --- a/src/login-common/client-common.h Thu Jan 19 15:41:16 2012 +0200 +++ b/src/login-common/client-common.h Thu Jan 19 15:53:42 2012 +0200 @@ -5,13 +5,16 @@ #include "login-proxy.h" #include "sasl-server.h" +#define LOGIN_MAX_MASTER_PREFIX_LEN 128 + /* max. size of input buffer. this means: - IMAP: Max. length of a single parameter. SASL initial response can be - long with GSSAPI. + IMAP: Max. length of command's all parameters. SASL-IR is read into + a separate larger buffer. POP3: Max. length of a command line (spec says 512 would be enough) */ -#define LOGIN_MAX_INBUF_SIZE 4096 +#define LOGIN_MAX_INBUF_SIZE \ + (MASTER_AUTH_MAX_DATA_SIZE - LOGIN_MAX_MASTER_PREFIX_LEN) /* max. size of output buffer. if it gets full, the client is disconnected. SASL authentication gives the largest output. */ #define LOGIN_MAX_OUTBUF_SIZE 4096 @@ -171,6 +174,7 @@ int client_auth_begin(struct client *client, const char *mech_name, const char *init_resp); bool client_check_plaintext_auth(struct client *client, bool pass_sent); +int client_auth_read_line(struct client *client); void client_proxy_finish_destroy_client(struct client *client); void client_proxy_log_failure(struct client *client, const char *line); From dovecot at dovecot.org Thu Jan 19 16:18:02 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 16:18:02 +0200 Subject: dovecot-2.1: auth: Don't crash when setting valueless default/ov... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/234de9c2240f changeset: 13954:234de9c2240f user: Timo Sirainen date: Thu Jan 19 16:15:03 2012 +0200 description: auth: Don't crash when setting valueless default/override_fields to passdb. diffstat: src/auth/passdb-template.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r b86f7dd170c6 -r 234de9c2240f src/auth/passdb-template.c --- a/src/auth/passdb-template.c Thu Jan 19 15:53:42 2012 +0200 +++ b/src/auth/passdb-template.c Thu Jan 19 16:15:03 2012 +0200 @@ -51,7 +51,7 @@ i_assert((count % 2) == 0); for (i = 0; i < count; i += 2) { if (args[i+1] == NULL) - value = NULL; + value = ""; else { str_truncate(str, 0); var_expand(str, args[i+1], table); From dovecot at dovecot.org Thu Jan 19 16:18:02 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 16:18:02 +0200 Subject: dovecot-2.1: auth: Minor optimization. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/057477461add changeset: 13955:057477461add user: Timo Sirainen date: Thu Jan 19 16:16:56 2012 +0200 description: auth: Minor optimization. diffstat: src/auth/auth-stream.c | 7 +++++++ src/auth/auth-stream.h | 1 + src/auth/userdb-blocking.c | 3 +-- 3 files changed, 9 insertions(+), 2 deletions(-) diffs (41 lines): diff -r 234de9c2240f -r 057477461add src/auth/auth-stream.c --- a/src/auth/auth-stream.c Thu Jan 19 16:15:03 2012 +0200 +++ b/src/auth/auth-stream.c Thu Jan 19 16:16:56 2012 +0200 @@ -108,6 +108,13 @@ } } +bool auth_stream_reply_exists(struct auth_stream_reply *reply, const char *key) +{ + unsigned int idx, len; + + return auth_stream_reply_find_area(reply, key, &idx, &len); +} + void auth_stream_reply_reset(struct auth_stream_reply *reply) { str_truncate(reply->str, 0); diff -r 234de9c2240f -r 057477461add src/auth/auth-stream.h --- a/src/auth/auth-stream.h Thu Jan 19 16:15:03 2012 +0200 +++ b/src/auth/auth-stream.h Thu Jan 19 16:16:56 2012 +0200 @@ -11,6 +11,7 @@ const char *auth_stream_reply_find(struct auth_stream_reply *reply, const char *key); +bool auth_stream_reply_exists(struct auth_stream_reply *reply, const char *key); void auth_stream_reply_import(struct auth_stream_reply *reply, const char *str); const char *auth_stream_reply_export(struct auth_stream_reply *reply); diff -r 234de9c2240f -r 057477461add src/auth/userdb-blocking.c --- a/src/auth/userdb-blocking.c Thu Jan 19 16:15:03 2012 +0200 +++ b/src/auth/userdb-blocking.c Thu Jan 19 16:16:56 2012 +0200 @@ -39,8 +39,7 @@ if (*args != '\0') { request->userdb_reply = auth_stream_reply_init(request->pool); auth_stream_reply_import(request->userdb_reply, args); - if (auth_stream_reply_find(request->userdb_reply, - "tempfail") != NULL) + if (auth_stream_reply_exists(request->userdb_reply, "tempfail")) request->userdb_lookup_failed = TRUE; } From dovecot at dovecot.org Thu Jan 19 16:18:02 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 16:18:02 +0200 Subject: dovecot-2.1: auth: Avoid adding duplicate extra fields to auth r... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/05940646a0f4 changeset: 13956:05940646a0f4 user: Timo Sirainen date: Thu Jan 19 16:17:52 2012 +0200 description: auth: Avoid adding duplicate extra fields to auth replies. This especially fixes default_fields/override_fields. diffstat: src/auth/auth-request.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 057477461add -r 05940646a0f4 src/auth/auth-request.c --- a/src/auth/auth-request.c Thu Jan 19 16:16:56 2012 +0200 +++ b/src/auth/auth-request.c Thu Jan 19 16:17:52 2012 +0200 @@ -1151,6 +1151,7 @@ if (request->extra_fields == NULL) request->extra_fields = auth_stream_reply_init(request->pool); + auth_stream_reply_remove(request->extra_fields, name); auth_stream_reply_add(request->extra_fields, name, value); } @@ -1366,6 +1367,7 @@ name = "system_groups_user"; } + auth_stream_reply_remove(request->userdb_reply, name); auth_stream_reply_add(request->userdb_reply, name, value); } From dovecot at dovecot.org Thu Jan 19 16:33:24 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 16:33:24 +0200 Subject: dovecot-2.1: auth: Show a better auth worker process title. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/1fa75cada826 changeset: 13957:1fa75cada826 user: Timo Sirainen date: Thu Jan 19 16:33:13 2012 +0200 description: auth: Show a better auth worker process title. diffstat: src/auth/auth-common.h | 1 + src/auth/auth-worker-client.c | 8 ++++++++ src/auth/auth-worker-client.h | 2 ++ src/auth/main.c | 20 +++++++++++++------- 4 files changed, 24 insertions(+), 7 deletions(-) diffs (121 lines): diff -r 05940646a0f4 -r 1fa75cada826 src/auth/auth-common.h --- a/src/auth/auth-common.h Thu Jan 19 16:17:52 2012 +0200 +++ b/src/auth/auth-common.h Thu Jan 19 16:33:13 2012 +0200 @@ -9,6 +9,7 @@ extern struct auth_penalty *auth_penalty; void auth_refresh_proctitle(void); +void auth_worker_refresh_proctitle(const char *state); void auth_module_load(const char *names); #endif diff -r 05940646a0f4 -r 1fa75cada826 src/auth/auth-worker-client.c --- a/src/auth/auth-worker-client.c Thu Jan 19 16:17:52 2012 +0200 +++ b/src/auth/auth-worker-client.c Thu Jan 19 16:33:13 2012 +0200 @@ -16,6 +16,9 @@ #define OUTBUF_THROTTLE_SIZE (1024*10) +#define CLIENT_STATE_HANDSHAKE "handshaking" +#define CLIENT_STATE_IDLE "idling" + struct auth_worker_client { int refcount; @@ -534,6 +537,7 @@ return FALSE; } + auth_worker_refresh_proctitle(args[1]); if (strcmp(args[1], "PASSV") == 0) ret = auth_worker_handle_passv(client, id, args + 2); else if (strcmp(args[1], "PASSL") == 0) @@ -548,6 +552,7 @@ i_error("BUG: Auth-worker received unknown command: %s", args[1]); } + auth_worker_refresh_proctitle(CLIENT_STATE_IDLE); return ret; } @@ -616,6 +621,7 @@ return; } client->dbhash_received = TRUE; + auth_worker_refresh_proctitle(CLIENT_STATE_IDLE); } client->refcount++; @@ -664,6 +670,7 @@ client->output = o_stream_create_fd(fd, (size_t)-1, FALSE); o_stream_set_flush_callback(client->output, auth_worker_output, client); client->io = io_add(fd, IO_READ, auth_worker_input, client); + auth_worker_refresh_proctitle(CLIENT_STATE_HANDSHAKE); auth_worker_client = client; return client; @@ -687,6 +694,7 @@ client->fd = -1; auth_worker_client_unref(&client); + auth_worker_refresh_proctitle(NULL); auth_worker_client = NULL; master_service_client_connection_destroyed(master_service); } diff -r 05940646a0f4 -r 1fa75cada826 src/auth/auth-worker-client.h --- a/src/auth/auth-worker-client.h Thu Jan 19 16:17:52 2012 +0200 +++ b/src/auth/auth-worker-client.h Thu Jan 19 16:33:13 2012 +0200 @@ -11,4 +11,6 @@ void auth_worker_client_destroy(struct auth_worker_client **client); void auth_worker_client_unref(struct auth_worker_client **client); +const char *auth_worker_client_get_state(struct auth_worker_client *client); + #endif diff -r 05940646a0f4 -r 1fa75cada826 src/auth/main.c --- a/src/auth/main.c Thu Jan 19 16:17:52 2012 +0200 +++ b/src/auth/main.c Thu Jan 19 16:33:13 2012 +0200 @@ -59,16 +59,11 @@ void auth_refresh_proctitle(void) { - const char *auth_worker_prefix; - - if (!global_auth_settings->verbose_proctitle) + if (!global_auth_settings->verbose_proctitle || worker) return; - auth_worker_prefix = worker ? "worker " : ""; - process_title_set(t_strdup_printf( - "%s[%u wait, %u passdb, %u userdb]", - auth_worker_prefix, + "[%u wait, %u passdb, %u userdb]", auth_request_state_count[AUTH_REQUEST_STATE_NEW] + auth_request_state_count[AUTH_REQUEST_STATE_MECH_CONTINUE] + auth_request_state_count[AUTH_REQUEST_STATE_FINISHED], @@ -76,6 +71,16 @@ auth_request_state_count[AUTH_REQUEST_STATE_USERDB])); } +void auth_worker_refresh_proctitle(const char *state) +{ + if (!global_auth_settings->verbose_proctitle || !worker) + return; + + if (state == NULL) + state = "waiting for connection"; + process_title_set(t_strdup_printf("worker: %s", state)); +} + static const char *const *read_global_settings(void) { struct master_service_settings_output set_output; @@ -244,6 +249,7 @@ passdb_cache_init(global_auth_settings); } auth_refresh_proctitle(); + auth_worker_refresh_proctitle(NULL); } static void main_deinit(void) From dovecot at dovecot.org Thu Jan 19 17:47:08 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 19 Jan 2012 17:47:08 +0200 Subject: dovecot-2.1: auth: Throttle SQL auth worker process creation if ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7175320feafc changeset: 13958:7175320feafc user: Timo Sirainen date: Thu Jan 19 17:46:52 2012 +0200 description: auth: Throttle SQL auth worker process creation if they can't connect to database. diffstat: src/auth/auth-settings.c | 5 +++ src/auth/auth-worker-client.c | 41 +++++++++++++++++++++++++- src/auth/auth-worker-client.h | 3 + src/auth/auth-worker-server.c | 68 +++++++++++++++++++++++++++++++++++++++++- src/auth/db-sql.c | 20 ++++++++++++ src/auth/db-sql.h | 3 + src/auth/main.c | 16 ++------- src/auth/passdb-sql.c | 4 +- src/auth/userdb-sql.c | 6 +++- 9 files changed, 149 insertions(+), 17 deletions(-) diffs (truncated from 377 to 300 lines): diff -r 1fa75cada826 -r 7175320feafc src/auth/auth-settings.c --- a/src/auth/auth-settings.c Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/auth-settings.c Thu Jan 19 17:46:52 2012 +0200 @@ -282,6 +282,11 @@ if (set->debug) set->verbose = TRUE; + if (set->worker_max_count == 0) { + *error_r = "auth_worker_max_count must be above zero"; + return FALSE; + } + if (set->cache_size > 0 && set->cache_size < 1024) { /* probably a configuration error. older versions used megabyte numbers */ diff -r 1fa75cada826 -r 7175320feafc src/auth/auth-worker-client.c --- a/src/auth/auth-worker-client.c Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/auth-worker-client.c Thu Jan 19 17:46:52 2012 +0200 @@ -8,6 +8,7 @@ #include "ostream.h" #include "hex-binary.h" #include "str.h" +#include "process-title.h" #include "master-service.h" #include "auth-request.h" #include "auth-worker-client.h" @@ -30,6 +31,7 @@ unsigned int version_received:1; unsigned int dbhash_received:1; + unsigned int error_sent:1; }; struct auth_worker_list_context { @@ -40,10 +42,23 @@ }; struct auth_worker_client *auth_worker_client; +static bool auth_worker_client_error = FALSE; static void auth_worker_input(struct auth_worker_client *client); static int auth_worker_output(struct auth_worker_client *client); +void auth_worker_refresh_proctitle(const char *state) +{ + if (!global_auth_settings->verbose_proctitle || !worker) + return; + + if (auth_worker_client_error) + state = "error"; + else if (auth_worker_client == NULL) + state = "waiting for connection"; + process_title_set(t_strdup_printf("worker: %s", state)); +} + static void auth_worker_client_check_throttle(struct auth_worker_client *client) { @@ -673,6 +688,8 @@ auth_worker_refresh_proctitle(CLIENT_STATE_HANDSHAKE); auth_worker_client = client; + if (auth_worker_client_error) + auth_worker_client_send_error(); return client; } @@ -694,8 +711,8 @@ client->fd = -1; auth_worker_client_unref(&client); - auth_worker_refresh_proctitle(NULL); auth_worker_client = NULL; + auth_worker_refresh_proctitle(""); master_service_client_connection_destroyed(master_service); } @@ -712,3 +729,25 @@ o_stream_unref(&client->output); i_free(client); } + +void auth_worker_client_send_error(void) +{ + auth_worker_client_error = TRUE; + if (auth_worker_client != NULL && + !auth_worker_client->error_sent) { + o_stream_send_str(auth_worker_client->output, "ERROR\n"); + auth_worker_client->error_sent = TRUE; + } + auth_worker_refresh_proctitle(""); +} + +void auth_worker_client_send_success(void) +{ + auth_worker_client_error = FALSE; + if (auth_worker_client != NULL && + auth_worker_client->error_sent) { + o_stream_send_str(auth_worker_client->output, "SUCCESS\n"); + auth_worker_client->error_sent = FALSE; + } + auth_worker_refresh_proctitle(CLIENT_STATE_IDLE); +} diff -r 1fa75cada826 -r 7175320feafc src/auth/auth-worker-client.h --- a/src/auth/auth-worker-client.h Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/auth-worker-client.h Thu Jan 19 17:46:52 2012 +0200 @@ -11,6 +11,9 @@ void auth_worker_client_destroy(struct auth_worker_client **client); void auth_worker_client_unref(struct auth_worker_client **client); +void auth_worker_client_send_error(void); +void auth_worker_client_send_success(void); + const char *auth_worker_client_get_state(struct auth_worker_client *client); #endif diff -r 1fa75cada826 -r 7175320feafc src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/auth-worker-server.c Thu Jan 19 17:46:52 2012 +0200 @@ -41,14 +41,16 @@ struct auth_worker_request *request; unsigned int id_counter; + unsigned int received_error:1; unsigned int shutdown:1; }; static ARRAY_DEFINE(connections, struct auth_worker_connection *) = ARRAY_INIT; -static unsigned int idle_count; +static unsigned int idle_count = 0, auth_workers_with_errors = 0; static ARRAY_DEFINE(worker_request_array, struct auth_worker_request *); static struct aqueue *worker_request_queue; static time_t auth_worker_last_warn; +static unsigned int auth_workers_throttle_count; static const char *worker_socket_path; @@ -150,7 +152,7 @@ struct auth_worker_connection *conn; int fd; - if (array_count(&connections) >= global_auth_settings->worker_max_count) + if (array_count(&connections) >= auth_workers_throttle_count) return NULL; fd = net_connect_unix_with_retries(worker_socket_path, 5000); @@ -189,6 +191,12 @@ *_conn = NULL; + if (conn->received_error) { + i_assert(auth_workers_with_errors > 0); + i_assert(auth_workers_with_errors <= array_count(&connections)); + auth_workers_with_errors--; + } + array_foreach(&connections, conns) { if (*conns == conn) { idx = array_foreach_idx(&connections, conns); @@ -260,6 +268,51 @@ io_remove(&conn->io); } +static bool auth_worker_error(struct auth_worker_connection *conn) +{ + if (conn->received_error) + return TRUE; + conn->received_error = TRUE; + auth_workers_with_errors++; + i_assert(auth_workers_with_errors <= array_count(&connections)); + + if (auth_workers_with_errors == 1) { + /* this is the only failing auth worker connection. + don't create new ones until this one sends SUCCESS. */ + auth_workers_throttle_count = array_count(&connections); + return TRUE; + } + + /* too many auth workers, reduce them */ + i_assert(array_count(&connections) > 1); + if (auth_workers_throttle_count >= array_count(&connections)) + auth_workers_throttle_count = array_count(&connections)-1; + else if (auth_workers_throttle_count > 1) + auth_workers_throttle_count--; + auth_worker_destroy(&conn, "Internal auth worker failure", FALSE); + return FALSE; +} + +static void auth_worker_success(struct auth_worker_connection *conn) +{ + unsigned int max_count = global_auth_settings->worker_max_count; + + if (!conn->received_error) + return; + + i_assert(auth_workers_with_errors > 0); + i_assert(auth_workers_with_errors <= array_count(&connections)); + auth_workers_with_errors--; + + if (auth_workers_with_errors == 0) { + /* all workers are succeeding now, set the limit back to + original. */ + auth_workers_throttle_count = max_count; + } else if (auth_workers_throttle_count < max_count) + auth_workers_throttle_count++; + conn->received_error = FALSE; +} + static void worker_input(struct auth_worker_connection *conn) { const char *line, *id_str; @@ -286,6 +339,15 @@ conn->shutdown = TRUE; continue; } + if (strcmp(line, "ERROR") == 0) { + if (!auth_worker_error(conn)) + return; + continue; + } + if (strcmp(line, "SUCCESS") == 0) { + auth_worker_success(conn); + continue; + } id_str = line; line = strchr(line, '\t'); if (line == NULL || @@ -358,6 +420,8 @@ void auth_worker_server_init(void) { worker_socket_path = "auth-worker"; + auth_workers_throttle_count = global_auth_settings->worker_max_count; + i_assert(auth_workers_throttle_count > 0); i_array_init(&worker_request_array, 128); worker_request_queue = aqueue_init(&worker_request_array.arr); diff -r 1fa75cada826 -r 7175320feafc src/auth/db-sql.c --- a/src/auth/db-sql.c Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/db-sql.c Thu Jan 19 17:46:52 2012 +0200 @@ -6,6 +6,7 @@ #include "settings.h" #include "auth-request.h" +#include "auth-worker-client.h" #include "db-sql.h" #include @@ -129,6 +130,25 @@ pool_unref(&conn->pool); } +void db_sql_connect(struct sql_connection *conn) +{ + if (sql_connect(conn->db) < 0 && worker) { + /* auth worker's sql connection failed. we can't do anything + useful until the connection works. there's no point in + having tons of worker processes all logging failures, + so tell the auth master to stop creating new workers (and + maybe close old ones). this handling is especially useful if + we reach the max. number of connections for sql server. */ + auth_worker_client_send_error(); + } +} + +void db_sql_success(struct sql_connection *conn ATTR_UNUSED) +{ + if (worker) + auth_worker_client_send_success(); +} + void db_sql_check_userdb_warning(struct sql_connection *conn) { if (worker || conn->userdb_used || conn->set.userdb_warning_disable) diff -r 1fa75cada826 -r 7175320feafc src/auth/db-sql.h --- a/src/auth/db-sql.h Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/db-sql.h Thu Jan 19 17:46:52 2012 +0200 @@ -34,6 +34,9 @@ struct sql_connection *db_sql_init(const char *config_path, bool userdb); void db_sql_unref(struct sql_connection **conn); +void db_sql_connect(struct sql_connection *conn); +void db_sql_success(struct sql_connection *conn); + void db_sql_check_userdb_warning(struct sql_connection *conn); #endif diff -r 1fa75cada826 -r 7175320feafc src/auth/main.c --- a/src/auth/main.c Thu Jan 19 16:33:13 2012 +0200 +++ b/src/auth/main.c Thu Jan 19 17:46:52 2012 +0200 @@ -71,16 +71,6 @@ auth_request_state_count[AUTH_REQUEST_STATE_USERDB])); } -void auth_worker_refresh_proctitle(const char *state) -{ - if (!global_auth_settings->verbose_proctitle || !worker) - return; - - if (state == NULL) - state = "waiting for connection"; From dovecot at dovecot.org Fri Jan 20 16:37:20 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 16:37:20 +0200 Subject: dovecot-2.1: lib-auth: Improved warning message about aborting a... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3dae51fd4565 changeset: 13959:3dae51fd4565 user: Timo Sirainen date: Fri Jan 20 16:37:10 2012 +0200 description: lib-auth: Improved warning message about aborting auth requests. diffstat: src/lib-auth/auth-client-request.c | 7 ++++ src/lib-auth/auth-client-request.h | 1 + src/lib-auth/auth-client.c | 4 +- src/lib-auth/auth-client.h | 2 +- src/lib-auth/auth-server-connection.c | 58 ++++++++++++++++++++++++---------- src/lib-auth/auth-server-connection.h | 3 +- src/login-common/client-common.c | 2 +- src/login-common/main.c | 2 +- 8 files changed, 55 insertions(+), 24 deletions(-) diffs (278 lines): diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-client-request.c --- a/src/lib-auth/auth-client-request.c Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-client-request.c Fri Jan 20 16:37:10 2012 +0200 @@ -15,6 +15,7 @@ struct auth_server_connection *conn; unsigned int id; + time_t created; struct auth_request_info request_info; @@ -91,6 +92,7 @@ request->id = auth_server_connection_add_request(request->conn, request); + request->created = ioloop_time; T_BEGIN { auth_server_send_new_request(request->conn, request); } T_END; @@ -159,6 +161,11 @@ return request->callback == NULL; } +time_t auth_client_request_get_create_time(struct auth_client_request *request) +{ + return request->created; +} + void auth_client_request_server_input(struct auth_client_request *request, enum auth_request_status status, const char *const *args) diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-client-request.h --- a/src/lib-auth/auth-client-request.h Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-client-request.h Fri Jan 20 16:37:10 2012 +0200 @@ -4,6 +4,7 @@ struct auth_server_connection; bool auth_client_request_is_aborted(struct auth_client_request *request); +time_t auth_client_request_get_create_time(struct auth_client_request *request); void auth_client_request_server_input(struct auth_client_request *request, enum auth_request_status status, diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-client.c --- a/src/lib-auth/auth-client.c Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-client.c Fri Jan 20 16:37:10 2012 +0200 @@ -37,9 +37,9 @@ auth_server_connection_connect(client->conn); } -void auth_client_disconnect(struct auth_client *client) +void auth_client_disconnect(struct auth_client *client, const char *reason) { - auth_server_connection_disconnect(client->conn); + auth_server_connection_disconnect(client->conn, reason); } bool auth_client_is_connected(struct auth_client *client) diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-client.h --- a/src/lib-auth/auth-client.h Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-client.h Fri Jan 20 16:37:10 2012 +0200 @@ -61,7 +61,7 @@ void auth_client_deinit(struct auth_client **client); void auth_client_connect(struct auth_client *client); -void auth_client_disconnect(struct auth_client *client); +void auth_client_disconnect(struct auth_client *client, const char *reason); bool auth_client_is_connected(struct auth_client *client); bool auth_client_is_disconnected(struct auth_client *client); void auth_client_set_connect_notify(struct auth_client *client, diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-server-connection.c --- a/src/lib-auth/auth-server-connection.c Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-server-connection.c Fri Jan 20 16:37:10 2012 +0200 @@ -3,6 +3,7 @@ #include "lib.h" #include "array.h" #include "hash.h" +#include "hostpid.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" @@ -20,7 +21,8 @@ #define AUTH_SERVER_RECONNECT_TIMEOUT_SECS 5 static void -auth_server_connection_reconnect(struct auth_server_connection *conn); +auth_server_connection_reconnect(struct auth_server_connection *conn, + const char *disconnect_reason); static int auth_server_input_mech(struct auth_server_connection *conn, @@ -235,7 +237,7 @@ static void auth_server_connection_input(struct auth_server_connection *conn) { struct istream *input; - const char *line; + const char *line, *error; int ret; switch (i_stream_read(conn->input)) { @@ -243,13 +245,15 @@ return; case -1: /* disconnected */ - auth_server_connection_reconnect(conn); + error = conn->input->stream_errno != 0 ? + strerror(conn->input->stream_errno) : "EOF"; + auth_server_connection_reconnect(conn, error); return; case -2: /* buffer full - can't happen unless auth is buggy */ i_error("BUG: Auth server sent us more than %d bytes of data", AUTH_SERVER_CONN_MAX_LINE_LENGTH); - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, "buffer full"); return; } @@ -264,7 +268,8 @@ AUTH_CLIENT_PROTOCOL_MAJOR_VERSION)) { i_error("Authentication server not compatible with " "this client (mixed old and new binaries?)"); - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, + "incompatible serevr"); return; } conn->version_received = TRUE; @@ -278,7 +283,8 @@ } T_END; if (ret < 0) { - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, t_strdup_printf( + "Received broken input: %s", line)); break; } } @@ -303,31 +309,45 @@ } static void -auth_server_connection_remove_requests(struct auth_server_connection *conn) +auth_server_connection_remove_requests(struct auth_server_connection *conn, + const char *disconnect_reason) { static const char *const temp_failure_args[] = { "temp", NULL }; struct hash_iterate_context *iter; void *key, *value; - unsigned int request_count = hash_table_count(conn->requests); + time_t created, oldest = 0; + unsigned int request_count = 0; - if (request_count == 0) + if (hash_table_count(conn->requests) == 0) return; - i_warning("Auth connection closed with %u pending requests", - request_count); iter = hash_table_iterate_init(conn->requests); while (hash_table_iterate(iter, &key, &value)) { struct auth_client_request *request = value; + if (!auth_client_request_is_aborted(request)) { + request_count++; + created = auth_client_request_get_create_time(request); + if (oldest > created || oldest == 0) + oldest = created; + } + auth_client_request_server_input(request, AUTH_REQUEST_STATUS_INTERNAL_FAIL, temp_failure_args); } + + i_warning("Auth connection closed with %u pending requests " + "(max %u secs, pid=%s, %s)", request_count, + (unsigned int)(ioloop_time - oldest), + my_pid, disconnect_reason); + hash_table_iterate_deinit(&iter); hash_table_clear(conn->requests, FALSE); } -void auth_server_connection_disconnect(struct auth_server_connection *conn) +void auth_server_connection_disconnect(struct auth_server_connection *conn, + const char *reason) { conn->handshake_received = FALSE; conn->version_received = FALSE; @@ -350,7 +370,7 @@ conn->fd = -1; } - auth_server_connection_remove_requests(conn); + auth_server_connection_remove_requests(conn, reason); if (conn->client->connect_notify_callback != NULL) { conn->client->connect_notify_callback(conn->client, FALSE, @@ -364,11 +384,12 @@ } static void -auth_server_connection_reconnect(struct auth_server_connection *conn) +auth_server_connection_reconnect(struct auth_server_connection *conn, + const char *disconnect_reason) { time_t next_connect; - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, disconnect_reason); next_connect = conn->last_connect + AUTH_SERVER_RECONNECT_TIMEOUT_SECS; conn->to = timeout_add(ioloop_time >= next_connect ? 0 : @@ -382,7 +403,7 @@ *_conn = NULL; - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, "deinitializing"); i_assert(hash_table_count(conn->requests) == 0); hash_table_destroy(&conn->requests); array_free(&conn->available_auth_mechs); @@ -394,7 +415,7 @@ i_error("Timeout waiting for handshake from auth server. " "my pid=%u, input bytes=%"PRIuUOFF_T, conn->client->client_pid, conn->input->v_offset); - auth_server_connection_reconnect(conn); + auth_server_connection_reconnect(conn, "auth server timeout"); } int auth_server_connection_connect(struct auth_server_connection *conn) @@ -434,7 +455,8 @@ conn->client->client_pid); if (o_stream_send_str(conn->output, handshake) < 0) { i_warning("Error sending handshake to auth server: %m"); - auth_server_connection_disconnect(conn); + auth_server_connection_disconnect(conn, + strerror(conn->output->last_failed_errno)); return -1; } diff -r 7175320feafc -r 3dae51fd4565 src/lib-auth/auth-server-connection.h --- a/src/lib-auth/auth-server-connection.h Thu Jan 19 17:46:52 2012 +0200 +++ b/src/lib-auth/auth-server-connection.h Fri Jan 20 16:37:10 2012 +0200 @@ -31,7 +31,8 @@ void auth_server_connection_deinit(struct auth_server_connection **conn); int auth_server_connection_connect(struct auth_server_connection *conn); -void auth_server_connection_disconnect(struct auth_server_connection *conn); +void auth_server_connection_disconnect(struct auth_server_connection *conn, + const char *reason); unsigned int auth_server_connection_add_request(struct auth_server_connection *conn, diff -r 7175320feafc -r 3dae51fd4565 src/login-common/client-common.c --- a/src/login-common/client-common.c Thu Jan 19 17:46:52 2012 +0200 +++ b/src/login-common/client-common.c Fri Jan 20 16:37:10 2012 +0200 @@ -162,7 +162,7 @@ authentication anymore, so close the connection. do this only with initial service_count=1, in case there are other clients with pending authentications */ - auth_client_disconnect(auth_client); + auth_client_disconnect(auth_client, "unnecessary connection"); } login_client_destroyed(); login_refresh_proctitle(); diff -r 7175320feafc -r 3dae51fd4565 src/login-common/main.c --- a/src/login-common/main.c Thu Jan 19 17:46:52 2012 +0200 +++ b/src/login-common/main.c Fri Jan 20 16:37:10 2012 +0200 @@ -73,7 +73,7 @@ { i_assert(clients == NULL); - auth_client_disconnect(auth_client); + auth_client_disconnect(auth_client, "idle disconnect"); timeout_remove(&auth_client_to); } From dovecot at dovecot.org Fri Jan 20 16:40:11 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 16:40:11 +0200 Subject: dovecot-2.1: lib-auth: Don't log the "auth connection closed" wa... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/569e1fd8d97e changeset: 13960:569e1fd8d97e user: Timo Sirainen date: Fri Jan 20 16:40:06 2012 +0200 description: lib-auth: Don't log the "auth connection closed" warning if there were 0 non-aborted requests. diffstat: src/lib-auth/auth-server-connection.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diffs (25 lines): diff -r 3dae51fd4565 -r 569e1fd8d97e src/lib-auth/auth-server-connection.c --- a/src/lib-auth/auth-server-connection.c Fri Jan 20 16:37:10 2012 +0200 +++ b/src/lib-auth/auth-server-connection.c Fri Jan 20 16:40:06 2012 +0200 @@ -336,14 +336,15 @@ AUTH_REQUEST_STATUS_INTERNAL_FAIL, temp_failure_args); } - - i_warning("Auth connection closed with %u pending requests " - "(max %u secs, pid=%s, %s)", request_count, - (unsigned int)(ioloop_time - oldest), - my_pid, disconnect_reason); - hash_table_iterate_deinit(&iter); hash_table_clear(conn->requests, FALSE); + + if (request_count > 0) { + i_warning("Auth connection closed with %u pending requests " + "(max %u secs, pid=%s, %s)", request_count, + (unsigned int)(ioloop_time - oldest), + my_pid, disconnect_reason); + } } void auth_server_connection_disconnect(struct auth_server_connection *conn, From dovecot at dovecot.org Fri Jan 20 16:54:28 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 16:54:28 +0200 Subject: dovecot-2.1: eacces_error(): Removed bogus message about UNIX pe... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8714ccb35848 changeset: 13961:8714ccb35848 user: Timo Sirainen date: Fri Jan 20 16:54:17 2012 +0200 description: eacces_error(): Removed bogus message about UNIX perms appearing to be ok. diffstat: src/lib/eacces-error.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diffs (12 lines): diff -r 569e1fd8d97e -r 8714ccb35848 src/lib/eacces-error.c --- a/src/lib/eacces-error.c Fri Jan 20 16:40:06 2012 +0200 +++ b/src/lib/eacces-error.c Fri Jan 20 16:54:17 2012 +0200 @@ -254,8 +254,6 @@ } else if (missing_mode != 0 && (((st.st_mode & 0700) >> 6) & missing_mode) == 0) { str_append(errmsg, ", dir owner missing perms"); - } else { - str_append(errmsg, ", UNIX perms appear ok (ACL/MAC wrong?)"); } if (ret == 0 && gr_name != NULL && st.st_gid != getegid()) { if (i_getgrgid(st.st_gid, &group) > 0 && From dovecot at dovecot.org Fri Jan 20 17:06:12 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 17:06:12 +0200 Subject: dovecot-2.1: Maildir++ quota: Close maildirsize file after writi... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/00a27339f541 changeset: 13962:00a27339f541 user: Timo Sirainen date: Fri Jan 20 17:06:06 2012 +0200 description: Maildir++ quota: Close maildirsize file after writing to it to force NFS to write it. This should fix the "Stale NFS file handle" errors with maildirsize. diffstat: src/plugins/quota/quota-maildir.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diffs (31 lines): diff -r 8714ccb35848 -r 00a27339f541 src/plugins/quota/quota-maildir.c --- a/src/plugins/quota/quota-maildir.c Fri Jan 20 16:54:17 2012 +0200 +++ b/src/plugins/quota/quota-maildir.c Fri Jan 20 17:06:06 2012 +0200 @@ -706,6 +706,14 @@ i_error("write_full(%s) failed: %m", root->maildirsize_path); } + } else { + /* close the file to force a flush with NFS */ + if (close(root->fd) < 0) { + ret = -1; + if (errno != ESTALE) + i_error("close(%s) failed: %m", root->maildirsize_path); + } + root->fd = -1; } return ret; } @@ -870,8 +878,10 @@ root->fd = -1; (void)maildirsize_recalculate(root); } else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) { - (void)close(root->fd); - root->fd = -1; + if (root->fd != -1) { + (void)close(root->fd); + root->fd = -1; + } maildirsize_rebuild_later(root); } From dovecot at dovecot.org Fri Jan 20 17:43:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 17:43:06 +0200 Subject: dovecot-2.1: script-login: If we fail to finish, exit with 0 to ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/db37a5818b92 changeset: 13963:db37a5818b92 user: Timo Sirainen date: Fri Jan 20 17:42:15 2012 +0200 description: script-login: If we fail to finish, exit with 0 to avoid master logging error unnecessarily. diffstat: src/util/script-login.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diffs (27 lines): diff -r 00a27339f541 -r db37a5818b92 src/util/script-login.c --- a/src/util/script-login.c Fri Jan 20 17:06:06 2012 +0200 +++ b/src/util/script-login.c Fri Jan 20 17:42:15 2012 +0200 @@ -177,12 +177,19 @@ } str_append_c(reply, '\n'); + /* finish by sending the fd to the mail process */ ret = fd_send(SCRIPT_COMM_FD, STDOUT_FILENO, str_data(reply), str_len(reply)); - if (ret < 0) - i_fatal("fd_send() failed: %m"); - else if (ret != (ssize_t)str_len(reply)) - i_fatal("fd_send() sent partial output"); + if (ret == (ssize_t)str_len(reply)) { + /* success */ + } else { + if (ret < 0) + i_error("fd_send() failed: %m"); + else + i_error("fd_send() sent partial output"); + /* exit with 0 even though we failed. non-0 exit just makes + master log an unnecessary error. */ + } } int main(int argc, char *argv[]) From dovecot at dovecot.org Fri Jan 20 17:43:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 17:43:06 +0200 Subject: dovecot-2.1: imap, pop3: Added -t parameter to specify post-logi... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/9015f0b8fa4d changeset: 13964:9015f0b8fa4d user: Timo Sirainen date: Fri Jan 20 17:42:47 2012 +0200 description: imap, pop3: Added -t parameter to specify post-login script timeout. diffstat: src/imap/main.c | 27 ++++++++++++++++++--------- src/lib-master/master-login.c | 23 ++++++++++++----------- src/lib-master/master-login.h | 17 +++++++++++++---- src/pop3/main.c | 27 ++++++++++++++++++--------- 4 files changed, 61 insertions(+), 33 deletions(-) diffs (222 lines): diff -r db37a5818b92 -r 9015f0b8fa4d src/imap/main.c --- a/src/imap/main.c Fri Jan 20 17:42:15 2012 +0200 +++ b/src/imap/main.c Fri Jan 20 17:42:47 2012 +0200 @@ -306,11 +306,15 @@ &imap_setting_parser_info, NULL }; + struct master_login_settings login_set; enum master_service_flags service_flags = 0; enum mail_storage_service_flags storage_service_flags = 0; - const char *postlogin_socket_path, *username = NULL; + const char *username = NULL; int c; + memset(&login_set, 0, sizeof(login_set)); + login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT; + if (IS_STANDALONE() && getuid() == 0 && net_getpeername(1, NULL, NULL) == 0) { printf("* BAD [ALERT] imap binary must not be started from " @@ -328,9 +332,14 @@ } master_service = master_service_init("imap", service_flags, - &argc, &argv, "u:"); + &argc, &argv, "t:u:"); while ((c = master_getopt(master_service)) > 0) { switch (c) { + case 't': + if (str_to_uint(optarg, &login_set.postlogin_timeout_secs) < 0 || + login_set.postlogin_timeout_secs == 0) + i_fatal("Invalid -t parameter: %s", optarg); + break; case 'u': storage_service_flags |= MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP; @@ -340,8 +349,12 @@ return FATAL_DEFAULT; } } - postlogin_socket_path = argv[optind] == NULL ? NULL : - t_abspath(argv[optind]); + + login_set.auth_socket_path = t_abspath("auth-master"); + if (argv[optind] != NULL) + login_set.postlogin_socket_path = t_abspath(argv[optind]); + login_set.callback = login_client_connected; + login_set.failure_callback = login_client_failed; master_service_init_finish(master_service); master_service_set_die_callback(master_service, imap_die); @@ -363,11 +376,7 @@ main_stdio_run(username); } T_END; } else { - master_login = master_login_init(master_service, - t_abspath("auth-master"), - postlogin_socket_path, - login_client_connected, - login_client_failed); + master_login = master_login_init(master_service, &login_set); io_loop_set_running(current_ioloop); } diff -r db37a5818b92 -r 9015f0b8fa4d src/lib-master/master-login.c --- a/src/lib-master/master-login.c Fri Jan 20 17:42:15 2012 +0200 +++ b/src/lib-master/master-login.c Fri Jan 20 17:42:47 2012 +0200 @@ -15,8 +15,6 @@ #include #include -#define MASTER_LOGIN_POSTLOGIN_TIMEOUT_MSECS (60*1000) - #define master_login_conn_is_closed(conn) \ ((conn)->fd == -1) #define master_login_conn_has_clients(conn) \ @@ -51,6 +49,7 @@ struct master_login_connection *conns; struct master_login_auth *auth; char *postlogin_socket_path; + unsigned int postlogin_timeout_secs; unsigned int stopping:1; }; @@ -59,19 +58,21 @@ static void master_login_conn_unref(struct master_login_connection **_conn); struct master_login * -master_login_init(struct master_service *service, const char *auth_socket_path, - const char *postlogin_socket_path, - master_login_callback_t *callback, - master_login_failure_callback_t *failure_callback) +master_login_init(struct master_service *service, + const struct master_login_settings *set) { struct master_login *login; + i_assert(set->postlogin_socket_path == NULL || + set->postlogin_timeout_secs > 0); + login = i_new(struct master_login, 1); login->service = service; - login->callback = callback; - login->failure_callback = failure_callback; - login->auth = master_login_auth_init(auth_socket_path); - login->postlogin_socket_path = i_strdup(postlogin_socket_path); + login->callback = set->callback; + login->failure_callback = set->failure_callback; + login->auth = master_login_auth_init(set->auth_socket_path); + login->postlogin_socket_path = i_strdup(set->postlogin_socket_path); + login->postlogin_timeout_secs = set->postlogin_timeout_secs; i_assert(service->login == NULL); service->login = login; @@ -337,7 +338,7 @@ pl->username = i_strdup(auth_args[0]); pl->fd = fd; pl->io = io_add(fd, IO_READ, master_login_postlogin_input, pl); - pl->to = timeout_add(MASTER_LOGIN_POSTLOGIN_TIMEOUT_MSECS, + pl->to = timeout_add(login->postlogin_timeout_secs * 1000, master_login_postlogin_timeout, pl); pl->input = str_new(default_pool, 512); return 0; diff -r db37a5818b92 -r 9015f0b8fa4d src/lib-master/master-login.h --- a/src/lib-master/master-login.h Fri Jan 20 17:42:15 2012 +0200 +++ b/src/lib-master/master-login.h Fri Jan 20 17:42:47 2012 +0200 @@ -3,6 +3,8 @@ #include "master-auth.h" +#define MASTER_POSTLOGIN_TIMEOUT_DEFAULT 60 + struct master_login_client { struct master_login_connection *conn; int fd; @@ -18,11 +20,18 @@ master_login_failure_callback_t(const struct master_login_client *client, const char *errormsg); +struct master_login_settings { + const char *auth_socket_path; + const char *postlogin_socket_path; + unsigned int postlogin_timeout_secs; + + master_login_callback_t *callback; + master_login_failure_callback_t *failure_callback; +}; + struct master_login * -master_login_init(struct master_service *service, const char *auth_socket_path, - const char *postlogin_socket_path, - master_login_callback_t *callback, - master_login_failure_callback_t *failure_callback); +master_login_init(struct master_service *service, + const struct master_login_settings *set); void master_login_deinit(struct master_login **login); void master_login_add(struct master_login *login, int fd); diff -r db37a5818b92 -r 9015f0b8fa4d src/pop3/main.c --- a/src/pop3/main.c Fri Jan 20 17:42:15 2012 +0200 +++ b/src/pop3/main.c Fri Jan 20 17:42:47 2012 +0200 @@ -192,11 +192,15 @@ &pop3_setting_parser_info, NULL }; + struct master_login_settings login_set; enum master_service_flags service_flags = 0; enum mail_storage_service_flags storage_service_flags = 0; - const char *postlogin_socket_path, *username = NULL; + const char *username = NULL; int c; + memset(&login_set, 0, sizeof(login_set)); + login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT; + if (IS_STANDALONE() && getuid() == 0 && net_getpeername(1, NULL, NULL) == 0) { printf("-ERR pop3 binary must not be started from " @@ -214,9 +218,14 @@ } master_service = master_service_init("pop3", service_flags, - &argc, &argv, "u:"); + &argc, &argv, "t:u:"); while ((c = master_getopt(master_service)) > 0) { switch (c) { + case 't': + if (str_to_uint(optarg, &login_set.postlogin_timeout_secs) < 0 || + login_set.postlogin_timeout_secs == 0) + i_fatal("Invalid -t parameter: %s", optarg); + break; case 'u': storage_service_flags |= MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP; @@ -226,8 +235,12 @@ return FATAL_DEFAULT; } } - postlogin_socket_path = argv[optind] == NULL ? NULL : - t_abspath(argv[optind]); + + login_set.auth_socket_path = t_abspath("auth-master"); + if (argv[optind] != NULL) + login_set.postlogin_socket_path = t_abspath(argv[optind]); + login_set.callback = login_client_connected; + login_set.failure_callback = login_client_failed; master_service_init_finish(master_service); master_service_set_die_callback(master_service, pop3_die); @@ -245,11 +258,7 @@ main_stdio_run(username); } T_END; } else { - master_login = master_login_init(master_service, - t_abspath("auth-master"), - postlogin_socket_path, - login_client_connected, - login_client_failed); + master_login = master_login_init(master_service, &login_set); io_loop_set_running(current_ioloop); } From dovecot at dovecot.org Fri Jan 20 17:56:51 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 17:56:51 +0200 Subject: dovecot-2.1: decode2text.sh: Hide catdoc/catppt/xls2csv segmenta... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4d60dcf35bbe changeset: 13965:4d60dcf35bbe user: Timo Sirainen date: Fri Jan 20 17:56:32 2012 +0200 description: decode2text.sh: Hide catdoc/catppt/xls2csv segmentation faults. We can't do anything about them anyway. diffstat: src/plugins/fts/decode2text.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (18 lines): diff -r 9015f0b8fa4d -r 4d60dcf35bbe src/plugins/fts/decode2text.sh --- a/src/plugins/fts/decode2text.sh Fri Jan 20 17:42:47 2012 +0200 +++ b/src/plugins/fts/decode2text.sh Fri Jan 20 17:56:32 2012 +0200 @@ -74,11 +74,11 @@ if [ $fmt = "pdf" ]; then /usr/bin/pdftotext $path - 2>/dev/null elif [ $fmt = "doc" ]; then - /usr/bin/catdoc $path 2>/dev/null + (/usr/bin/catdoc $path; true) 2>/dev/null elif [ $fmt = "ppt" ]; then - /usr/bin/catppt $path 2>/dev/null + (/usr/bin/catppt $path; true) 2>/dev/null elif [ $fmt = "xls" ]; then - /usr/bin/xls2csv $path 2>/dev/null + (/usr/bin/xls2csv $path; true) 2>/dev/null elif [ $fmt = "odt" -o $fmt = "ods" -o $fmt = "odp" ]; then xmlunzip "content.xml" elif [ $fmt = "docx" ]; then From dovecot at dovecot.org Fri Jan 20 18:10:01 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:10:01 +0200 Subject: dovecot-2.1: script: Set alarm() for the script being run only i... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5f33a67d5e25 changeset: 13966:5f33a67d5e25 user: Timo Sirainen date: Fri Jan 20 18:09:41 2012 +0200 description: script: Set alarm() for the script being run only if alarm= parameter is given. diffstat: src/util/script.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (30 lines): diff -r 4d60dcf35bbe -r 5f33a67d5e25 src/util/script.c --- a/src/util/script.c Fri Jan 20 17:56:32 2012 +0200 +++ b/src/util/script.c Fri Jan 20 18:09:41 2012 +0200 @@ -78,6 +78,7 @@ /* Input contains: VERSION .. + [timeout=] | "-" arg 1 @@ -130,6 +131,7 @@ } buffer_set_used_size(input, scanpos); } + alarm(0); /* drop the last LF */ buffer_set_used_size(input, scanpos-1); @@ -137,6 +139,10 @@ args = t_strsplit(str_c(input), "\n"); script_verify_version(*args); args++; if (*args != NULL) { + if (strncmp(*args, "alarm=", 6) == 0) { + alarm(atoi(*args + 6)); + args++; + } if (strcmp(*args, "noreply") == 0) { /* no need to fork and check exit status */ exec_child(conn, args + 1); From dovecot at dovecot.org Fri Jan 20 18:10:01 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:10:01 +0200 Subject: dovecot-2.1: fts: Run decoder script with 10 second alarm. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/01480afe283f changeset: 13967:01480afe283f user: Timo Sirainen date: Fri Jan 20 18:09:54 2012 +0200 description: fts: Run decoder script with 10 second alarm. diffstat: src/plugins/fts/fts-parser-script.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 5f33a67d5e25 -r 01480afe283f src/plugins/fts/fts-parser-script.c --- a/src/plugins/fts/fts-parser-script.c Fri Jan 20 18:09:41 2012 +0200 +++ b/src/plugins/fts/fts-parser-script.c Fri Jan 20 18:09:54 2012 +0200 @@ -15,7 +15,7 @@ #define SCRIPT_USER_CONTEXT(obj) \ MODULE_CONTEXT(obj, fts_parser_script_user_module) -#define SCRIPT_HANDSHAKE "VERSION\tscript\t3\t0\nnoreply\n" +#define SCRIPT_HANDSHAKE "VERSION\tscript\t3\t0\nalarm=10\nnoreply\n" struct content { const char *content_type; From dovecot at dovecot.org Fri Jan 20 18:14:49 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:14:49 +0200 Subject: dovecot-2.1: Typofix. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a6a53c658cab changeset: 13968:a6a53c658cab user: Timo Sirainen date: Fri Jan 20 18:14:43 2012 +0200 description: Typofix. diffstat: src/master/service-process.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 01480afe283f -r a6a53c658cab src/master/service-process.c --- a/src/master/service-process.c Fri Jan 20 18:09:54 2012 +0200 +++ b/src/master/service-process.c Fri Jan 20 18:14:43 2012 +0200 @@ -190,7 +190,7 @@ } } -static void service_rpocess_setup_config_environment(struct service *service) +static void service_process_setup_config_environment(struct service *service) { const struct master_service_settings *set = service->list->service_set; @@ -222,7 +222,7 @@ master_service_env_clean(); env_put(MASTER_IS_PARENT_ENV"=1"); - service_rpocess_setup_config_environment(service); + service_process_setup_config_environment(service); env_put(t_strdup_printf(MASTER_CLIENT_LIMIT_ENV"=%u", service->client_limit)); env_put(t_strdup_printf(MASTER_PROCESS_LIMIT_ENV"=%u", From dovecot at dovecot.org Fri Jan 20 18:28:45 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:28:45 +0200 Subject: dovecot-2.1: lib-master: Send service's idle_kill value to proce... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3963862a4086 changeset: 13969:3963862a4086 user: Timo Sirainen date: Fri Jan 20 18:27:44 2012 +0200 description: lib-master: Send service's idle_kill value to process in environment. 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 | 4 ++++ src/master/service-process.c | 2 ++ 5 files changed, 21 insertions(+), 0 deletions(-) diffs (78 lines): diff -r a6a53c658cab -r 3963862a4086 src/lib-master/master-interface.h --- a/src/lib-master/master-interface.h Fri Jan 20 18:14:43 2012 +0200 +++ b/src/lib-master/master-interface.h Fri Jan 20 18:27:44 2012 +0200 @@ -52,6 +52,10 @@ process can finish handling before it should kill itself. */ #define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT" +/* getenv(MASTER_SERVICE_IDLE_KILL_ENV) specifies service's idle_kill timeout + in seconds. */ +#define MASTER_SERVICE_IDLE_KILL_ENV "IDLE_KILL" + /* getenv(MASTER_CONFIG_FILE_ENV) provides path to configuration file/socket */ #define MASTER_CONFIG_FILE_ENV "CONFIG_FILE" diff -r a6a53c658cab -r 3963862a4086 src/lib-master/master-service-private.h --- a/src/lib-master/master-service-private.h Fri Jan 20 18:14:43 2012 +0200 +++ b/src/lib-master/master-service-private.h Fri Jan 20 18:27:44 2012 +0200 @@ -37,6 +37,7 @@ unsigned int service_count_left; unsigned int total_available_count; unsigned int process_limit; + unsigned int idle_kill_secs; struct master_status master_status; unsigned int last_sent_status_avail_count; diff -r a6a53c658cab -r 3963862a4086 src/lib-master/master-service.c --- a/src/lib-master/master-service.c Fri Jan 20 18:14:43 2012 +0200 +++ b/src/lib-master/master-service.c Fri Jan 20 18:27:44 2012 +0200 @@ -218,6 +218,11 @@ if (value != NULL && str_to_uint(value, &count) == 0 && count > 0) master_service_set_service_count(service, count); + + /* set the idle kill timeout */ + value = getenv(MASTER_SERVICE_IDLE_KILL_ENV); + if (value != NULL && str_to_uint(value, &count) == 0) + service->idle_kill_secs = count; } else { master_service_set_client_limit(service, 1); master_service_set_service_count(service, 1); @@ -453,6 +458,11 @@ return service->process_limit; } +unsigned int master_service_get_idle_kill_secs(struct master_service *service) +{ + return service->idle_kill_secs; +} + void master_service_set_service_count(struct master_service *service, unsigned int count) { diff -r a6a53c658cab -r 3963862a4086 src/lib-master/master-service.h --- a/src/lib-master/master-service.h Fri Jan 20 18:14:43 2012 +0200 +++ b/src/lib-master/master-service.h Fri Jan 20 18:27:44 2012 +0200 @@ -96,6 +96,10 @@ /* 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 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. */ +unsigned int master_service_get_idle_kill_secs(struct master_service *service); /* Set maximum number of client connections we will handle before shutting down. */ diff -r a6a53c658cab -r 3963862a4086 src/master/service-process.c --- a/src/master/service-process.c Fri Jan 20 18:14:43 2012 +0200 +++ b/src/master/service-process.c Fri Jan 20 18:27:44 2012 +0200 @@ -227,6 +227,8 @@ service->client_limit)); env_put(t_strdup_printf(MASTER_PROCESS_LIMIT_ENV"=%u", service->process_limit)); + env_put(t_strdup_printf(MASTER_SERVICE_IDLE_KILL_ENV"=%u", + service->idle_kill)); if (service->set->service_count != 0) { env_put(t_strdup_printf(MASTER_SERVICE_COUNT_ENV"=%u", service->set->service_count)); From dovecot at dovecot.org Fri Jan 20 18:28:46 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:28:46 +0200 Subject: dovecot-2.1: auth: Make idle_kill work with auth worker processes. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/58556a90259f changeset: 13970:58556a90259f user: Timo Sirainen date: Fri Jan 20 18:28:40 2012 +0200 description: auth: Make idle_kill work with auth worker processes. diffstat: src/auth/auth-common.h | 2 +- src/auth/auth-worker-client.c | 30 ++++++++++++++++++++++++++++-- src/auth/auth-worker-client.h | 3 +-- src/auth/auth-worker-server.c | 9 ++++++++- src/auth/main.c | 9 +++++++-- src/auth/passdb-pam.c | 2 +- 6 files changed, 46 insertions(+), 9 deletions(-) diffs (179 lines): diff -r 3963862a4086 -r 58556a90259f src/auth/auth-common.h --- a/src/auth/auth-common.h Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/auth-common.h Fri Jan 20 18:28:40 2012 +0200 @@ -4,7 +4,7 @@ #include "lib.h" #include "auth.h" -extern bool worker, shutdown_request; +extern bool worker, worker_restart_request; extern time_t process_start_time; extern struct auth_penalty *auth_penalty; diff -r 3963862a4086 -r 58556a90259f src/auth/auth-worker-client.c --- a/src/auth/auth-worker-client.c Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/auth-worker-client.c Fri Jan 20 18:28:40 2012 +0200 @@ -28,6 +28,7 @@ struct io *io; struct istream *input; struct ostream *output; + struct timeout *to_idle; unsigned int version_received:1; unsigned int dbhash_received:1; @@ -99,8 +100,8 @@ static void auth_worker_send_reply(struct auth_worker_client *client, string_t *str) { - if (shutdown_request) - o_stream_send_str(client->output, "SHUTDOWN\n"); + if (worker_restart_request) + o_stream_send_str(client->output, "RESTART\n"); o_stream_send(client->output, str_data(str), str_len(str)); } @@ -594,6 +595,9 @@ char *line; bool ret; + if (client->to_idle != NULL) + timeout_reset(client->to_idle); + switch (i_stream_read(client->input)) { case 0: return; @@ -670,10 +674,17 @@ return 1; } +static void +auth_worker_client_idle_kill(struct auth_worker_client *client ATTR_UNUSED) +{ + auth_worker_client_send_shutdown(); +} + struct auth_worker_client * auth_worker_client_create(struct auth *auth, int fd) { struct auth_worker_client *client; + unsigned int idle_kill_secs; client = i_new(struct auth_worker_client, 1); client->refcount = 1; @@ -687,6 +698,13 @@ client->io = io_add(fd, IO_READ, auth_worker_input, client); auth_worker_refresh_proctitle(CLIENT_STATE_HANDSHAKE); + idle_kill_secs = master_service_get_idle_kill_secs(master_service); + if (idle_kill_secs > 0) { + client->to_idle = timeout_add(idle_kill_secs * 1000, + auth_worker_client_idle_kill, + client); + } + auth_worker_client = client; if (auth_worker_client_error) auth_worker_client_send_error(); @@ -704,6 +722,8 @@ i_stream_close(client->input); o_stream_close(client->output); + if (client->to_idle != NULL) + timeout_remove(&client->to_idle); if (client->io != NULL) io_remove(&client->io); @@ -751,3 +771,9 @@ } auth_worker_refresh_proctitle(CLIENT_STATE_IDLE); } + +void auth_worker_client_send_shutdown(void) +{ + if (auth_worker_client != NULL) + o_stream_send_str(auth_worker_client->output, "SHUTDOWN\n"); +} diff -r 3963862a4086 -r 58556a90259f src/auth/auth-worker-client.h --- a/src/auth/auth-worker-client.h Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/auth-worker-client.h Fri Jan 20 18:28:40 2012 +0200 @@ -13,7 +13,6 @@ void auth_worker_client_send_error(void); void auth_worker_client_send_success(void); - -const char *auth_worker_client_get_state(struct auth_worker_client *client); +void auth_worker_client_send_shutdown(void); #endif diff -r 3963862a4086 -r 58556a90259f src/auth/auth-worker-server.c --- a/src/auth/auth-worker-server.c Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/auth-worker-server.c Fri Jan 20 18:28:40 2012 +0200 @@ -42,6 +42,7 @@ unsigned int id_counter; unsigned int received_error:1; + unsigned int restart:1; unsigned int shutdown:1; }; @@ -335,6 +336,10 @@ } while ((line = i_stream_next_line(conn->input)) != NULL) { + if (strcmp(line, "RESTART") == 0) { + conn->restart = TRUE; + continue; + } if (strcmp(line, "SHUTDOWN") == 0) { conn->shutdown = TRUE; continue; @@ -372,8 +377,10 @@ if (conn->request != NULL) { /* there's still a pending request */ - } else if (conn->shutdown) + } else if (conn->restart) auth_worker_destroy(&conn, "Max requests limit", TRUE); + else if (conn->shutdown) + auth_worker_destroy(&conn, "Idle kill", FALSE); else auth_worker_request_send_next(conn); } diff -r 3963862a4086 -r 58556a90259f src/auth/main.c --- a/src/auth/main.c Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/main.c Fri Jan 20 18:28:40 2012 +0200 @@ -48,7 +48,7 @@ char *path; }; -bool worker = FALSE, shutdown_request = FALSE; +bool worker = FALSE, worker_restart_request = FALSE; time_t process_start_time; struct auth_penalty *auth_penalty; @@ -339,7 +339,12 @@ static void auth_die(void) { - /* do nothing. auth clients should disconnect soon. */ + if (!worker) { + /* do nothing. auth clients should disconnect soon. */ + } else { + /* ask auth master to disconnect us */ + auth_worker_client_send_shutdown(); + } } int main(int argc, char *argv[]) diff -r 3963862a4086 -r 58556a90259f src/auth/passdb-pam.c --- a/src/auth/passdb-pam.c Fri Jan 20 18:27:44 2012 +0200 +++ b/src/auth/passdb-pam.c Fri Jan 20 18:28:40 2012 +0200 @@ -312,7 +312,7 @@ if (module->requests_left > 0) { if (--module->requests_left == 0) - shutdown_request = TRUE; + worker_restart_request = TRUE; } expanded_service = t_str_new(64); From dovecot at dovecot.org Fri Jan 20 18:44:57 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:44:57 +0200 Subject: dovecot-2.1: mysql: If query fails with "MySQL server gone away"... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a817cfc3979d changeset: 13971:a817cfc3979d user: Timo Sirainen date: Fri Jan 20 18:44:49 2012 +0200 description: mysql: If query fails with "MySQL server gone away", log also how long it idled. diffstat: src/lib-sql/driver-mysql.c | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diffs (64 lines): diff -r 58556a90259f -r a817cfc3979d src/lib-sql/driver-mysql.c --- a/src/lib-sql/driver-mysql.c Fri Jan 20 18:28:40 2012 +0200 +++ b/src/lib-sql/driver-mysql.c Fri Jan 20 18:44:49 2012 +0200 @@ -21,6 +21,7 @@ const char *ssl_cert, *ssl_key, *ssl_ca, *ssl_ca_path, *ssl_cipher; const char *option_file, *option_group; unsigned int port, client_flags; + time_t last_success; MYSQL *mysql; unsigned int next_query_connection; @@ -128,6 +129,7 @@ i_info("%s: Connected to database %s%s", mysql_prefix(db), db->dbname, db->ssl_set ? " using SSL" : ""); + db->last_success = ioloop_time; sql_db_set_state(&db->api, SQL_DB_STATE_IDLE); return 1; } @@ -354,6 +356,7 @@ { struct mysql_result *result = (struct mysql_result *)_result; struct mysql_db *db = (struct mysql_db *)_result->db; + int ret; if (result->result == NULL) { /* no results */ @@ -362,9 +365,14 @@ result->row = mysql_fetch_row(result->result); if (result->row != NULL) - return 1; - - return mysql_errno(db->mysql) != 0 ? -1 : 0; + ret = 1; + else { + if (mysql_errno(db->mysql) != 0) + return -1; + ret = 0; + } + db->last_success = ioloop_time; + return ret; } static void driver_mysql_result_fetch_fields(struct mysql_result *result) @@ -454,8 +462,17 @@ static const char *driver_mysql_result_get_error(struct sql_result *_result) { struct mysql_db *db = (struct mysql_db *)_result->db; + const char *errstr; + unsigned int idle_time; - return mysql_error(db->mysql); + errstr = mysql_error(db->mysql); + if (mysql_errno(db->mysql) == CR_SERVER_GONE_ERROR && + db->last_success != 0) { + idle_time = ioloop_time - db->last_success; + errstr = t_strdup_printf("%s (idled for %u secs)", + errstr, idle_time); + } + return errstr; } static struct sql_transaction_context * From dovecot at dovecot.org Fri Jan 20 18:59:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 18:59:37 +0200 Subject: dovecot-2.1: master: Added instance_name setting, which is used ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e1f21a4ef417 changeset: 13972:e1f21a4ef417 user: Timo Sirainen date: Fri Jan 20 18:59:16 2012 +0200 description: master: Added instance_name setting, which is used to prefix processes in ps output. diffstat: doc/example-config/dovecot.conf | 3 +++ src/master/main.c | 3 ++- src/master/master-settings.c | 2 ++ src/master/master-settings.h | 1 + 4 files changed, 8 insertions(+), 1 deletions(-) diffs (56 lines): diff -r a817cfc3979d -r e1f21a4ef417 doc/example-config/dovecot.conf --- a/doc/example-config/dovecot.conf Fri Jan 20 18:44:49 2012 +0200 +++ b/doc/example-config/dovecot.conf Fri Jan 20 18:59:16 2012 +0200 @@ -28,6 +28,9 @@ # Base directory where to store runtime data. #base_dir = /var/run/dovecot/ +# Name of this instance. Used to prefix all Dovecot processes in ps output. +#instance_name = dovecot + # Greeting message for clients. #login_greeting = Dovecot ready. diff -r a817cfc3979d -r e1f21a4ef417 src/master/main.c --- a/src/master/main.c Fri Jan 20 18:44:49 2012 +0200 +++ b/src/master/main.c Fri Jan 20 18:59:16 2012 +0200 @@ -79,7 +79,8 @@ if (p != NULL) argv[0] = p+1; /* prefix with dovecot/ */ - argv[0] = t_strconcat(PACKAGE"/", argv[0], NULL); + argv[0] = t_strdup_printf("%s/%s", services->set->instance_name, + argv[0]); (void)execv_const(executable, argv); } diff -r a817cfc3979d -r e1f21a4ef417 src/master/master-settings.c --- a/src/master/master-settings.c Fri Jan 20 18:44:49 2012 +0200 +++ b/src/master/master-settings.c Fri Jan 20 18:59:16 2012 +0200 @@ -172,6 +172,7 @@ static const struct setting_define master_setting_defines[] = { DEF(SET_STR, base_dir), DEF(SET_STR, libexec_dir), + DEF(SET_STR, instance_name), DEF(SET_STR, import_environment), DEF(SET_STR, protocols), DEF(SET_STR, listen), @@ -211,6 +212,7 @@ static const struct master_settings master_default_settings = { .base_dir = PKG_RUNDIR, .libexec_dir = PKG_LIBEXECDIR, + .instance_name = PACKAGE, .import_environment = "TZ" ENV_SYSTEMD ENV_GDB, .protocols = "imap pop3 lmtp", .listen = "*, ::", diff -r a817cfc3979d -r e1f21a4ef417 src/master/master-settings.h --- a/src/master/master-settings.h Fri Jan 20 18:44:49 2012 +0200 +++ b/src/master/master-settings.h Fri Jan 20 18:59:16 2012 +0200 @@ -6,6 +6,7 @@ struct master_settings { const char *base_dir; const char *libexec_dir; + const char *instance_name; const char *import_environment; const char *protocols; const char *listen; From dovecot at dovecot.org Fri Jan 20 21:11:15 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 21:11:15 +0200 Subject: dovecot-2.1: notify plugin: Added mailbox_update and mailbox_set... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/eaf3152a33d6 changeset: 13973:eaf3152a33d6 user: Timo Sirainen date: Fri Jan 20 21:11:09 2012 +0200 description: notify plugin: Added mailbox_update and mailbox_set_subscribed notifications. diffstat: src/plugins/notify/notify-plugin-private.h | 3 +++ src/plugins/notify/notify-plugin.c | 21 +++++++++++++++++++++ src/plugins/notify/notify-plugin.h | 3 ++- src/plugins/notify/notify-storage.c | 26 ++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletions(-) diffs (128 lines): diff -r e1f21a4ef417 -r eaf3152a33d6 src/plugins/notify/notify-plugin-private.h --- a/src/plugins/notify/notify-plugin-private.h Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/notify/notify-plugin-private.h Fri Jan 20 21:11:09 2012 +0200 @@ -15,11 +15,14 @@ struct mail_transaction_commit_changes *changes); void notify_contexts_mail_transaction_rollback(struct mailbox_transaction_context *t); void notify_contexts_mailbox_create(struct mailbox *box); +void notify_contexts_mailbox_update(struct mailbox *box); void notify_contexts_mailbox_delete_begin(struct mailbox *box); void notify_contexts_mailbox_delete_commit(struct mailbox *box); void notify_contexts_mailbox_delete_rollback(void); void notify_contexts_mailbox_rename(struct mailbox *src, struct mailbox *dest, bool rename_children); +void notify_contexts_mailbox_set_subscribed(struct mailbox *box, + bool subscribed); void notify_plugin_init_storage(struct module *module); void notify_plugin_deinit_storage(void); diff -r e1f21a4ef417 -r eaf3152a33d6 src/plugins/notify/notify-plugin.c --- a/src/plugins/notify/notify-plugin.c Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/notify/notify-plugin.c Fri Jan 20 21:11:09 2012 +0200 @@ -157,6 +157,16 @@ } } +void notify_contexts_mailbox_update(struct mailbox *box) +{ + struct notify_context *ctx; + + for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) { + if (ctx->v.mailbox_update != NULL) + ctx->v.mailbox_update(box); + } +} + void notify_contexts_mailbox_delete_begin(struct mailbox *box) { struct notify_context *ctx; @@ -201,6 +211,17 @@ ctx->v.mailbox_rename(src, dest, rename_children); } +void notify_contexts_mailbox_set_subscribed(struct mailbox *box, + bool subscribed) +{ + struct notify_context *ctx; + + for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) { + if (ctx->v.mailbox_set_subscribed != NULL) + ctx->v.mailbox_set_subscribed(box, subscribed); + } +} + struct notify_context * notify_register(const struct notify_vfuncs *v) { diff -r e1f21a4ef417 -r eaf3152a33d6 src/plugins/notify/notify-plugin.h --- a/src/plugins/notify/notify-plugin.h Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/notify/notify-plugin.h Fri Jan 20 21:11:09 2012 +0200 @@ -24,14 +24,15 @@ struct mail_transaction_commit_changes *changes); void (*mail_transaction_rollback)(void *txn); void (*mailbox_create)(struct mailbox *box); + void (*mailbox_update)(struct mailbox *box); void *(*mailbox_delete_begin)(struct mailbox *box); void (*mailbox_delete_commit)(void *txn, struct mailbox *box); void (*mailbox_delete_rollback)(void *txn); void (*mailbox_rename)(struct mailbox *src, struct mailbox *dest, bool rename_children); + void (*mailbox_set_subscribed)(struct mailbox *box, bool subscribed); }; -void notify_noop_mailbox_create(struct mailbox *box); struct notify_context * notify_register(const struct notify_vfuncs *vfuncs); void notify_unregister(struct notify_context *ctx); diff -r e1f21a4ef417 -r eaf3152a33d6 src/plugins/notify/notify-storage.c --- a/src/plugins/notify/notify-storage.c Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/notify/notify-storage.c Fri Jan 20 21:11:09 2012 +0200 @@ -202,6 +202,18 @@ } static int +notify_mailbox_update(struct mailbox *box, const struct mailbox_update *update) +{ + union mailbox_module_context *lbox = NOTIFY_CONTEXT(box); + + if (lbox->super.update(box, update) < 0) + return -1; + + notify_contexts_mailbox_update(box); + return 0; +} + +static int notify_mailbox_delete(struct mailbox *box) { union mailbox_module_context *lbox = NOTIFY_CONTEXT(box); @@ -228,6 +240,18 @@ return 0; } +static int +notify_mailbox_set_subscribed(struct mailbox *box, bool set) +{ + union mailbox_module_context *lbox = NOTIFY_CONTEXT(box); + + if (lbox->super.set_subscribed(box, set) < 0) + return -1; + + notify_contexts_mailbox_set_subscribed(box, set); + return 0; +} + static void notify_mailbox_allocated(struct mailbox *box) { struct mailbox_vfuncs *v = box->vlast; @@ -244,8 +268,10 @@ v->transaction_commit = notify_transaction_commit; v->transaction_rollback = notify_transaction_rollback; v->create = notify_mailbox_create; + v->update = notify_mailbox_update; v->delete = notify_mailbox_delete; v->rename = notify_mailbox_rename; + v->set_subscribed = notify_mailbox_set_subscribed; MODULE_CONTEXT_SET_SELF(box, notify_storage_module, lbox); } From dovecot at dovecot.org Fri Jan 20 21:13:05 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 21:13:05 +0200 Subject: dovecot-2.1: notify plugin: Don't crash if user-plugin didn't se... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/62c33ed5e357 changeset: 13974:62c33ed5e357 user: Timo Sirainen date: Fri Jan 20 21:13:00 2012 +0200 description: notify plugin: Don't crash if user-plugin didn't set mailbox_rename. Patch by Ewald Dieterich. diffstat: src/plugins/notify/notify-plugin.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (16 lines): diff -r eaf3152a33d6 -r 62c33ed5e357 src/plugins/notify/notify-plugin.c --- a/src/plugins/notify/notify-plugin.c Fri Jan 20 21:11:09 2012 +0200 +++ b/src/plugins/notify/notify-plugin.c Fri Jan 20 21:13:00 2012 +0200 @@ -207,8 +207,10 @@ { struct notify_context *ctx; - for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) - ctx->v.mailbox_rename(src, dest, rename_children); + for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) { + if (ctx->v.mailbox_rename != NULL) + ctx->v.mailbox_rename(src, dest, rename_children); + } } void notify_contexts_mailbox_set_subscribed(struct mailbox *box, From dovecot at dovecot.org Fri Jan 20 21:14:10 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 21:14:10 +0200 Subject: dovecot-2.0: notify plugin: Don't crash if user-plugin didn't se... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d9499e268883 changeset: 13021:d9499e268883 user: Timo Sirainen date: Fri Jan 20 21:13:00 2012 +0200 description: notify plugin: Don't crash if user-plugin didn't set mailbox_rename. Patch by Ewald Dieterich. diffstat: src/plugins/notify/notify-plugin.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diffs (16 lines): diff -r 687949948a83 -r d9499e268883 src/plugins/notify/notify-plugin.c --- a/src/plugins/notify/notify-plugin.c Wed Jan 18 14:21:53 2012 +0200 +++ b/src/plugins/notify/notify-plugin.c Fri Jan 20 21:13:00 2012 +0200 @@ -197,8 +197,10 @@ { struct notify_context *ctx; - for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) - ctx->v.mailbox_rename(src, dest, rename_children); + for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) { + if (ctx->v.mailbox_rename != NULL) + ctx->v.mailbox_rename(src, dest, rename_children); + } } struct notify_context * From dovecot at dovecot.org Fri Jan 20 21:57:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 21:57:52 +0200 Subject: dovecot-2.1: fs layout: Don't list subscriptions file as a mailbox. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/958ef86e7f5b changeset: 13975:958ef86e7f5b user: Timo Sirainen date: Fri Jan 20 21:57:30 2012 +0200 description: fs layout: Don't list subscriptions file as a mailbox. diffstat: src/lib-storage/list/mailbox-list-fs-iter.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 62c33ed5e357 -r 958ef86e7f5b src/lib-storage/list/mailbox-list-fs-iter.c --- a/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jan 20 21:13:00 2012 +0200 +++ b/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jan 20 21:57:30 2012 +0200 @@ -177,7 +177,8 @@ /* non-absolute path. add the mailbox root dir as prefix. */ root = mailbox_list_get_path(ctx->ctx.list, NULL, MAILBOX_LIST_PATH_TYPE_MAILBOX); - path = t_strconcat(root, "/", path, NULL); + path = *path == '\0' ? root : + t_strconcat(root, "/", path, NULL); } *path_r = path; return TRUE; From dovecot at dovecot.org Fri Jan 20 22:13:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 Jan 2012 22:13:03 +0200 Subject: dovecot-2.1: fs layout: Fixed listing child mailboxes when child... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/54e74090fb42 changeset: 13976:54e74090fb42 user: Timo Sirainen date: Fri Jan 20 22:12:48 2012 +0200 description: fs layout: Fixed listing child mailboxes when children flags weren't requested. diffstat: src/lib-storage/list/mailbox-list-fs-iter.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 958ef86e7f5b -r 54e74090fb42 src/lib-storage/list/mailbox-list-fs-iter.c --- a/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jan 20 21:57:30 2012 +0200 +++ b/src/lib-storage/list/mailbox-list-fs-iter.c Fri Jan 20 22:12:48 2012 +0200 @@ -535,7 +535,7 @@ (child_dir_match & IMAP_MATCH_CHILDREN) == 0) { /* mailbox has children, but we don't want to list them */ } else if (((ctx->ctx.flags & MAILBOX_LIST_ITER_RETURN_CHILDREN) != 0 || - (match & IMAP_MATCH_CHILDREN) != 0) && + (child_dir_match & IMAP_MATCH_CHILDREN) != 0) && *entry->fname != '\0') { /* a) mailbox has children and we want to return them b) we don't want to return mailbox's children, but we need From pigeonhole at rename-it.nl Fri Jan 20 23:27:00 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 20 Jan 2012 22:27:00 +0100 Subject: dovecot-2.1-pigeonhole: managesieve: Added -t parameter to speci... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/66c9a4a82428 changeset: 1595:66c9a4a82428 user: Stephan Bosch date: Fri Jan 20 22:26:53 2012 +0100 description: managesieve: Added -t parameter to specify post-login script timeout (Dovecot change). diffstat: src/managesieve/main.c | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diffs (64 lines): diff -r 523eae0118b1 -r 66c9a4a82428 src/managesieve/main.c --- a/src/managesieve/main.c Thu Jan 12 18:43:13 2012 +0100 +++ b/src/managesieve/main.c Fri Jan 20 22:26:53 2012 +0100 @@ -225,11 +225,15 @@ &managesieve_setting_parser_info, NULL }; + struct master_login_settings login_set; enum master_service_flags service_flags = 0; enum mail_storage_service_flags storage_service_flags = 0; - const char *postlogin_socket_path, *username = NULL; + const char *username = NULL; int c; + memset(&login_set, 0, sizeof(login_set)); + login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT; + if (IS_STANDALONE() && getuid() == 0 && net_getpeername(1, NULL, NULL) == 0) { printf("NO \"managesieve binary must not be started from " @@ -247,9 +251,14 @@ } master_service = master_service_init("managesieve", service_flags, - &argc, &argv, "u:"); + &argc, &argv, "t:u:"); while ((c = master_getopt(master_service)) > 0) { switch (c) { + case 't': + if (str_to_uint(optarg, &login_set.postlogin_timeout_secs) < 0 || + login_set.postlogin_timeout_secs == 0) + i_fatal("Invalid -t parameter: %s", optarg); + break; case 'u': storage_service_flags |= MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP; @@ -259,8 +268,12 @@ return FATAL_DEFAULT; } } - postlogin_socket_path = argv[optind] == NULL ? NULL : - t_abspath(argv[optind]); + + login_set.auth_socket_path = t_abspath("auth-master"); + if (argv[optind] != NULL) + login_set.postlogin_socket_path = t_abspath(argv[optind]); + login_set.callback = login_client_connected; + login_set.failure_callback = login_client_failed; master_service_init_finish(master_service); master_service_set_die_callback(master_service, managesieve_die); @@ -287,11 +300,7 @@ main_stdio_run(username); } T_END; } else { - master_login = master_login_init(master_service, - t_abspath("auth-master"), - postlogin_socket_path, - login_client_connected, - login_client_failed); + master_login = master_login_init(master_service, &login_set); io_loop_set_running(current_ioloop); } From dovecot at dovecot.org Sat Jan 21 00:28:03 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 00:28:03 +0200 Subject: dovecot-2.1: lmtp: Make core dumping work also after the first m... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d5ba2d63ed6d changeset: 13977:d5ba2d63ed6d user: Timo Sirainen date: Sat Jan 21 00:27:52 2012 +0200 description: lmtp: Make core dumping work also after the first mail delivery. diffstat: src/lmtp/commands.c | 5 +++++ src/lmtp/main.c | 4 +++- src/lmtp/main.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diffs (55 lines): diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/commands.c --- a/src/lmtp/commands.c Fri Jan 20 22:12:48 2012 +0200 +++ b/src/lmtp/commands.c Sat Jan 21 00:27:52 2012 +0200 @@ -11,6 +11,7 @@ #include "ostream.h" #include "istream-dot.h" #include "safe-mkstemp.h" +#include "restrict-access.h" #include "master-service.h" #include "rfc822-parser.h" #include "message-date.h" @@ -706,6 +707,10 @@ lose e.g. config connection and need to reconnect to it. */ if (seteuid(0) < 0) i_fatal("seteuid(0) failed: %m"); + /* enable core dumping again. we need to chdir also to + root-owned directory to get core dumps. */ + restrict_access_allow_coredumps(TRUE); + (void)chdir(base_dir); } } diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/main.c --- a/src/lmtp/main.c Fri Jan 20 22:12:48 2012 +0200 +++ b/src/lmtp/main.c Sat Jan 21 00:27:52 2012 +0200 @@ -25,7 +25,7 @@ #define IS_STANDALONE() \ (getenv(MASTER_IS_PARENT_ENV) == NULL) -const char *dns_client_socket_path; +const char *dns_client_socket_path, *base_dir; struct mail_storage_service_ctx *storage_service; static void client_connected(struct master_service_connection *conn) @@ -107,6 +107,8 @@ } } + if (t_get_current_dir(&base_dir) < 0) + i_fatal("getcwd() failed: %m"); drop_privileges(); master_service_init_finish(master_service); master_service_init_log(master_service, diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/main.h --- a/src/lmtp/main.h Fri Jan 20 22:12:48 2012 +0200 +++ b/src/lmtp/main.h Sat Jan 21 00:27:52 2012 +0200 @@ -1,7 +1,7 @@ #ifndef MAIN_H #define MAIN_H -extern const char *dns_client_socket_path; +extern const char *dns_client_socket_path, *base_dir; extern struct mail_storage_service_ctx *storage_service; void listener_client_destroyed(void); From dovecot at dovecot.org Sat Jan 21 00:43:24 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 00:43:24 +0200 Subject: dovecot-2.1: lmtp: Fixed assert-crashing on 3rd client connection. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e9f68fdf6967 changeset: 13978:e9f68fdf6967 user: Timo Sirainen date: Sat Jan 21 00:43:13 2012 +0200 description: lmtp: Fixed assert-crashing on 3rd client connection. diffstat: src/lmtp/client.c | 12 ++++++------ src/lmtp/lmtp-settings.c | 4 ++-- src/lmtp/lmtp-settings.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diffs (58 lines): diff -r d5ba2d63ed6d -r e9f68fdf6967 src/lmtp/client.c --- a/src/lmtp/client.c Sat Jan 21 00:27:52 2012 +0200 +++ b/src/lmtp/client.c Sat Jan 21 00:43:13 2012 +0200 @@ -137,8 +137,9 @@ { struct mail_storage_service_input input; const struct setting_parser_context *set_parser; + struct lmtp_settings *lmtp_set; + struct lda_settings *lda_set; const char *error; - void **sets; memset(&input, 0, sizeof(input)); input.module = input.service = "lmtp"; @@ -152,12 +153,11 @@ &set_parser, &error) < 0) i_fatal("%s", error); - sets = settings_parser_get_list(set_parser) + 1; - settings_var_expand(&lmtp_setting_parser_info, sets[2], client->pool, + lmtp_settings_dup(set_parser, client->pool, &lmtp_set, &lda_set); + settings_var_expand(&lmtp_setting_parser_info, lmtp_set, client->pool, mail_storage_service_get_var_expand_table(storage_service, &input)); - - lmtp_settings_dup(set_parser, client->pool, - &client->lmtp_set, &client->set); + client->lmtp_set = lmtp_set; + client->set = lda_set; } static void client_generate_session_id(struct client *client) diff -r d5ba2d63ed6d -r e9f68fdf6967 src/lmtp/lmtp-settings.c --- a/src/lmtp/lmtp-settings.c Sat Jan 21 00:27:52 2012 +0200 +++ b/src/lmtp/lmtp-settings.c Sat Jan 21 00:43:13 2012 +0200 @@ -90,8 +90,8 @@ void lmtp_settings_dup(const struct setting_parser_context *set_parser, pool_t pool, - const struct lmtp_settings **lmtp_set_r, - const struct lda_settings **lda_set_r) + struct lmtp_settings **lmtp_set_r, + struct lda_settings **lda_set_r) { void **sets; diff -r d5ba2d63ed6d -r e9f68fdf6967 src/lmtp/lmtp-settings.h --- a/src/lmtp/lmtp-settings.h Sat Jan 21 00:27:52 2012 +0200 +++ b/src/lmtp/lmtp-settings.h Sat Jan 21 00:43:13 2012 +0200 @@ -14,7 +14,7 @@ void lmtp_settings_dup(const struct setting_parser_context *set_parser, pool_t pool, - const struct lmtp_settings **lmtp_set_r, - const struct lda_settings **lda_set_r); + struct lmtp_settings **lmtp_set_r, + struct lda_settings **lda_set_r); #endif From dovecot at dovecot.org Sat Jan 21 01:30:28 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 01:30:28 +0200 Subject: dovecot-2.0: master: Added instance_name setting, which is used ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/759e879c4c42 changeset: 13022:759e879c4c42 user: Timo Sirainen date: Fri Jan 20 18:59:16 2012 +0200 description: master: Added instance_name setting, which is used to prefix processes in ps output. diffstat: doc/example-config/dovecot.conf | 3 +++ src/master/main.c | 3 ++- src/master/master-settings.c | 2 ++ src/master/master-settings.h | 1 + 4 files changed, 8 insertions(+), 1 deletions(-) diffs (56 lines): diff -r d9499e268883 -r 759e879c4c42 doc/example-config/dovecot.conf --- a/doc/example-config/dovecot.conf Fri Jan 20 21:13:00 2012 +0200 +++ b/doc/example-config/dovecot.conf Fri Jan 20 18:59:16 2012 +0200 @@ -28,6 +28,9 @@ # Base directory where to store runtime data. #base_dir = /var/run/dovecot/ +# Name of this instance. Used to prefix all Dovecot processes in ps output. +#instance_name = dovecot + # Greeting message for clients. #login_greeting = Dovecot ready. diff -r d9499e268883 -r 759e879c4c42 src/master/main.c --- a/src/master/main.c Fri Jan 20 21:13:00 2012 +0200 +++ b/src/master/main.c Fri Jan 20 18:59:16 2012 +0200 @@ -79,7 +79,8 @@ if (p != NULL) argv[0] = p+1; /* prefix with dovecot/ */ - argv[0] = t_strconcat(PACKAGE"/", argv[0], NULL); + argv[0] = t_strdup_printf("%s/%s", services->set->instance_name, + argv[0]); (void)execv_const(executable, argv); } diff -r d9499e268883 -r 759e879c4c42 src/master/master-settings.c --- a/src/master/master-settings.c Fri Jan 20 21:13:00 2012 +0200 +++ b/src/master/master-settings.c Fri Jan 20 18:59:16 2012 +0200 @@ -171,6 +171,7 @@ static const struct setting_define master_setting_defines[] = { DEF(SET_STR, base_dir), DEF(SET_STR, libexec_dir), + DEF(SET_STR, instance_name), DEF(SET_STR, import_environment), DEF(SET_STR, protocols), DEF(SET_STR, listen), @@ -210,6 +211,7 @@ static const struct master_settings master_default_settings = { .base_dir = PKG_RUNDIR, .libexec_dir = PKG_LIBEXECDIR, + .instance_name = PACKAGE, .import_environment = "TZ" ENV_SYSTEMD ENV_GDB, .protocols = "imap pop3 lmtp", .listen = "*, ::", diff -r d9499e268883 -r 759e879c4c42 src/master/master-settings.h --- a/src/master/master-settings.h Fri Jan 20 21:13:00 2012 +0200 +++ b/src/master/master-settings.h Fri Jan 20 18:59:16 2012 +0200 @@ -6,6 +6,7 @@ struct master_settings { const char *base_dir; const char *libexec_dir; + const char *instance_name; const char *import_environment; const char *protocols; const char *listen; From dovecot at dovecot.org Sat Jan 21 18:31:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 18:31:37 +0200 Subject: dovecot-2.1: imap-login: Fixed handling second AUTHENTICATE comm... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/32cf5ed72e2d changeset: 13979:32cf5ed72e2d user: Timo Sirainen date: Sat Jan 21 18:31:25 2012 +0200 description: imap-login: Fixed handling second AUTHENTICATE command when the first one failed. diffstat: src/imap-login/client-authenticate.c | 12 +++++++++--- src/imap-login/client-authenticate.h | 2 +- src/imap-login/client.c | 5 +++-- src/imap-login/client.h | 1 + src/login-common/client-common-auth.c | 2 ++ 5 files changed, 16 insertions(+), 6 deletions(-) diffs (103 lines): diff -r e9f68fdf6967 -r 32cf5ed72e2d src/imap-login/client-authenticate.c --- a/src/imap-login/client-authenticate.c Sat Jan 21 00:43:13 2012 +0200 +++ b/src/imap-login/client-authenticate.c Sat Jan 21 18:31:25 2012 +0200 @@ -118,7 +118,7 @@ return client_auth_begin(&imap_client->common, mech_name, init_resp); } -int cmd_authenticate(struct imap_client *imap_client) +int cmd_authenticate(struct imap_client *imap_client, bool *parsed_r) { /* NOTE: This command's input is handled specially because the SASL-IR can be large. */ @@ -127,8 +127,10 @@ size_t i, size; int ret; + *parsed_r = FALSE; + /* [] */ - if (client->auth_mech_name == NULL) { + if (!imap_client->auth_mech_name_parsed) { data = i_stream_get_data(client->input, &size); for (i = 0; i < size; i++) { if (data[i] == ' ' || @@ -142,7 +144,9 @@ imap_client->skip_line = TRUE; return -1; } + i_free(client->auth_mech_name); client->auth_mech_name = i_strndup(data, i); + imap_client->auth_mech_name_parsed = TRUE; if (data[i] == ' ') i++; i_stream_skip(client->input, i); @@ -152,9 +156,11 @@ if ((ret = client_auth_read_line(client)) <= 0) return ret; + *parsed_r = TRUE; + imap_client->auth_mech_name_parsed = FALSE; return imap_client_auth_begin(imap_client, t_strdup(client->auth_mech_name), - str_c(client->auth_response)); + t_strdup(str_c(client->auth_response))); } int cmd_login(struct imap_client *imap_client, const struct imap_arg *args) diff -r e9f68fdf6967 -r 32cf5ed72e2d src/imap-login/client-authenticate.h --- a/src/imap-login/client-authenticate.h Sat Jan 21 00:43:13 2012 +0200 +++ b/src/imap-login/client-authenticate.h Sat Jan 21 18:31:25 2012 +0200 @@ -9,6 +9,6 @@ const struct client_auth_reply *reply); int cmd_login(struct imap_client *client, const struct imap_arg *args); -int cmd_authenticate(struct imap_client *client); +int cmd_authenticate(struct imap_client *imap_client, bool *parsed_r); #endif diff -r e9f68fdf6967 -r 32cf5ed72e2d src/imap-login/client.c --- a/src/imap-login/client.c Sat Jan 21 00:43:13 2012 +0200 +++ b/src/imap-login/client.c Sat Jan 21 18:31:25 2012 +0200 @@ -248,6 +248,7 @@ static bool client_handle_input(struct imap_client *client) { const struct imap_arg *args; + bool parsed; int ret; i_assert(!client->common.authenticating); @@ -293,8 +294,8 @@ if (strcasecmp(client->cmd_name, "AUTHENTICATE") == 0) { /* SASL-IR may need more space than input buffer's size, so we'll handle it as a special case. */ - ret = cmd_authenticate(client); - if (ret == 0) + ret = cmd_authenticate(client, &parsed); + if (ret == 0 && !parsed) return FALSE; } else { ret = client_parse_command(client, &args); diff -r e9f68fdf6967 -r 32cf5ed72e2d src/imap-login/client.h --- a/src/imap-login/client.h Sat Jan 21 00:43:13 2012 +0200 +++ b/src/imap-login/client.h Sat Jan 21 18:31:25 2012 +0200 @@ -23,6 +23,7 @@ unsigned int skip_line:1; unsigned int id_logged:1; unsigned int client_ignores_capability_resp_code:1; + unsigned int auth_mech_name_parsed:1; }; bool client_skip_line(struct imap_client *client); diff -r e9f68fdf6967 -r 32cf5ed72e2d src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Sat Jan 21 00:43:13 2012 +0200 +++ b/src/login-common/client-common-auth.c Sat Jan 21 18:31:25 2012 +0200 @@ -24,6 +24,8 @@ void client_auth_failed(struct client *client) { i_free_and_null(client->master_data_prefix); + if (client->auth_response != NULL) + str_truncate(client->auth_response, 0); if (client->auth_initializing || client->destroyed) return; From dovecot at dovecot.org Sat Jan 21 18:57:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 18:57:41 +0200 Subject: dovecot-2.1: pop3c: Fixed to work without indexes. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b6f9fa12dca6 changeset: 13980:b6f9fa12dca6 user: Timo Sirainen date: Sat Jan 21 18:57:31 2012 +0200 description: pop3c: Fixed to work without indexes. diffstat: src/lib-storage/index/pop3c/pop3c-storage.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (23 lines): diff -r 32cf5ed72e2d -r b6f9fa12dca6 src/lib-storage/index/pop3c/pop3c-storage.c --- a/src/lib-storage/index/pop3c/pop3c-storage.c Sat Jan 21 18:31:25 2012 +0200 +++ b/src/lib-storage/index/pop3c/pop3c-storage.c Sat Jan 21 18:57:31 2012 +0200 @@ -89,7 +89,8 @@ struct mailbox_list_settings *set) { set->layout = MAILBOX_LIST_NAME_FS; - if (*set->root_dir != '\0' && set->index_dir == NULL) { + if (set->root_dir != NULL && *set->root_dir != '\0' && + set->index_dir == NULL) { /* we don't really care about root_dir, but we just need to get index_dir autocreated. it happens when index_dir differs from root_dir. */ @@ -221,8 +222,7 @@ struct mail_storage pop3c_storage = { .name = POP3C_STORAGE_NAME, - .class_flags = MAIL_STORAGE_CLASS_FLAG_MAILBOX_IS_FILE | - MAIL_STORAGE_CLASS_FLAG_OPEN_STREAMS, + .class_flags = MAIL_STORAGE_CLASS_FLAG_NO_ROOT, .v = { pop3c_get_setting_parser_info, From dovecot at dovecot.org Sat Jan 21 22:23:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 21 Jan 2012 22:23:40 +0200 Subject: dovecot-2.1: pop3c: Change the default port to 110, not 143. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8f5cdb88d047 changeset: 13981:8f5cdb88d047 user: Timo Sirainen date: Sat Jan 21 22:23:28 2012 +0200 description: pop3c: Change the default port to 110, not 143. diffstat: src/lib-storage/index/pop3c/pop3c-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r b6f9fa12dca6 -r 8f5cdb88d047 src/lib-storage/index/pop3c/pop3c-settings.c --- a/src/lib-storage/index/pop3c/pop3c-settings.c Sat Jan 21 18:57:31 2012 +0200 +++ b/src/lib-storage/index/pop3c/pop3c-settings.c Sat Jan 21 22:23:28 2012 +0200 @@ -32,7 +32,7 @@ static const struct pop3c_settings pop3c_default_settings = { .pop3c_host = "", - .pop3c_port = 143, + .pop3c_port = 110, .pop3c_user = "%u", .pop3c_password = "", From dovecot at dovecot.org Sun Jan 22 21:39:00 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 22 Jan 2012 21:39:00 +0200 Subject: dovecot-2.1: login: Make SASL auth buffer size define public. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/83a2e1ba3ab6 changeset: 13982:83a2e1ba3ab6 user: Timo Sirainen date: Sun Jan 22 21:38:48 2012 +0200 description: login: Make SASL auth buffer size define public. diffstat: src/login-common/client-common-auth.c | 4 +--- src/login-common/client-common.h | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diffs (34 lines): diff -r 8f5cdb88d047 -r 83a2e1ba3ab6 src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Sat Jan 21 22:23:28 2012 +0200 +++ b/src/login-common/client-common-auth.c Sun Jan 22 21:38:48 2012 +0200 @@ -19,8 +19,6 @@ #define AUTH_WAITING_TIMEOUT_MSECS (30*1000) #define GREETING_WARNING_TIMEOUT_MSECS (10*1000) -#define CLIENT_AUTH_BUF_MAX_SIZE 8192 - void client_auth_failed(struct client *client) { i_free_and_null(client->master_data_prefix); @@ -355,7 +353,7 @@ } if (client->auth_response == NULL) client->auth_response = str_new(default_pool, I_MAX(i+1, 256)); - if (str_len(client->auth_response) + i > CLIENT_AUTH_BUF_MAX_SIZE) { + if (str_len(client->auth_response) + i > LOGIN_MAX_AUTH_BUF_SIZE) { client_destroy(client, "Authentication response too large"); return -1; } diff -r 8f5cdb88d047 -r 83a2e1ba3ab6 src/login-common/client-common.h --- a/src/login-common/client-common.h Sat Jan 21 22:23:28 2012 +0200 +++ b/src/login-common/client-common.h Sun Jan 22 21:38:48 2012 +0200 @@ -19,6 +19,9 @@ SASL authentication gives the largest output. */ #define LOGIN_MAX_OUTBUF_SIZE 4096 +/* Max. length of SASL authentication buffer. */ +#define LOGIN_MAX_AUTH_BUF_SIZE 8192 + /* Disconnect client after this many milliseconds if it hasn't managed to log in yet. */ #define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000) From pigeonhole at rename-it.nl Sun Jan 22 22:57:54 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sun, 22 Jan 2012 21:57:54 +0100 Subject: dovecot-2.1-pigeonhole: ManageSieve: added support for reading q... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/ae857042882b changeset: 1596:ae857042882b user: Stephan Bosch date: Sun Jan 22 21:57:45 2012 +0100 description: ManageSieve: added support for reading quoted and literal strings as a stream. Fixes support for handing large SASL responses. Also resolves long-standing FIXME regarding the second parameter of PUTSCRIPT: it can now be a quoted string. Includes a few small changes in the login daemon that were done in the dovecot equivalents before. diffstat: src/lib-managesieve/managesieve-parser.c | 226 ++++++++++++++++++++++++++++---- src/lib-managesieve/managesieve-parser.h | 54 ++++--- src/lib-sievestorage/sieve-storage-quota.c | 6 + src/lib-sievestorage/sieve-storage-quota.h | 3 + src/managesieve-login/client-authenticate.c | 203 ++++++++++++++++++++++------ src/managesieve-login/client.c | 153 +++++++++++++-------- src/managesieve-login/client.h | 7 + src/managesieve-login/managesieve-proxy.c | 2 +- src/managesieve/cmd-putscript.c | 164 +++++++++++++---------- src/managesieve/managesieve-client.c | 2 +- src/managesieve/managesieve-quota.c | 5 + src/managesieve/managesieve-quota.h | 2 + 12 files changed, 596 insertions(+), 231 deletions(-) diffs (truncated from 1385 to 300 lines): diff -r 66c9a4a82428 -r ae857042882b src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Fri Jan 20 22:26:53 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.c Sun Jan 22 21:57:45 2012 +0100 @@ -3,7 +3,7 @@ #include "lib.h" #include "unichar.h" -#include "istream.h" +#include "istream-private.h" #include "ostream.h" #include "strescape.h" #include "managesieve-parser.h" @@ -25,7 +25,6 @@ /* permanent */ pool_t pool; struct istream *input; - struct ostream *output; size_t max_line_size; enum managesieve_parser_flags flags; @@ -40,6 +39,8 @@ int str_first_escape; /* ARG_PARSE_STRING: index to first '\' */ uoff_t literal_size; /* ARG_PARSE_LITERAL: string size */ + struct istream *str_stream; + const char *error; unsigned int literal_skip_crlf:1; @@ -48,6 +49,9 @@ unsigned int fatal_error:1; }; +static struct istream *quoted_string_istream_create + (struct managesieve_parser *parser); + /* @UNSAFE */ #define LIST_REALLOC(parser, old_list, new_size) \ p_realloc((parser)->pool, old_list, \ @@ -65,15 +69,13 @@ } struct managesieve_parser * -managesieve_parser_create(struct istream *input, struct ostream *output, - size_t max_line_size) +managesieve_parser_create(struct istream *input, size_t max_line_size) { struct managesieve_parser *parser; parser = i_new(struct managesieve_parser, 1); parser->pool = pool_alloconly_create("MANAGESIEVE parser", 8192); parser->input = input; - parser->output = output; parser->max_line_size = max_line_size; managesieve_args_realloc(parser, LIST_ALLOC_SIZE); @@ -82,6 +84,9 @@ void managesieve_parser_destroy(struct managesieve_parser **parser) { + if ((*parser)->str_stream != NULL) + i_stream_unref(&(*parser)->str_stream); + pool_unref(&(*parser)->pool); i_free(*parser); *parser = NULL; @@ -107,10 +112,14 @@ parser->literal_skip_crlf = FALSE; parser->eol = FALSE; + if ( parser->str_stream != NULL ) + i_stream_unref(&parser->str_stream); + managesieve_args_realloc(parser, LIST_ALLOC_SIZE); } -const char *managesieve_parser_get_error(struct managesieve_parser *parser, bool *fatal) +const char *managesieve_parser_get_error +(struct managesieve_parser *parser, bool *fatal) { *fatal = parser->fatal_error; return parser->error; @@ -168,26 +177,29 @@ break; case ARG_PARSE_STRING: /* data is quoted and may contain escapes. */ - i_assert(size > 0); + if ((parser->flags & MANAGESIEVE_PARSE_FLAG_STRING_STREAM) != 0) { + arg->type = MANAGESIEVE_ARG_STRING_STREAM; + arg->_data.str_stream = parser->str_stream; + } else { + i_assert(size > 0); - arg->type = MANAGESIEVE_ARG_STRING; - arg->_data.str = p_strndup(parser->pool, data+1, size-1); + arg->type = MANAGESIEVE_ARG_STRING; + arg->_data.str = p_strndup(parser->pool, data+1, size-1); - /* remove the escapes */ - if (parser->str_first_escape >= 0 && - (parser->flags & MANAGESIEVE_PARSE_FLAG_NO_UNESCAPE) == 0) { - /* -1 because we skipped the '"' prefix */ - str_unescape(arg->_data.str + - parser->str_first_escape-1); + /* remove the escapes */ + if (parser->str_first_escape >= 0 && + (parser->flags & MANAGESIEVE_PARSE_FLAG_NO_UNESCAPE) == 0) { + /* -1 because we skipped the '"' prefix */ + str_unescape(arg->_data.str + + parser->str_first_escape-1); + } } break; case ARG_PARSE_LITERAL_DATA: - if ((parser->flags & MANAGESIEVE_PARSE_FLAG_LITERAL_SIZE) != 0) { - /* save literal size */ - arg->type = MANAGESIEVE_ARG_LITERAL_SIZE; - arg->_data.literal_size = parser->literal_size; - } else if ((parser->flags & - MANAGESIEVE_PARSE_FLAG_LITERAL_TYPE) != 0) { + if ((parser->flags & MANAGESIEVE_PARSE_FLAG_STRING_STREAM) != 0) { + arg->type = MANAGESIEVE_ARG_STRING_STREAM; + arg->_data.str_stream = parser->str_stream; + } else if ((parser->flags & MANAGESIEVE_PARSE_FLAG_LITERAL_TYPE) != 0) { arg->type = MANAGESIEVE_ARG_LITERAL; arg->_data.str = p_strndup(parser->pool, data, size); } else { @@ -273,7 +285,8 @@ i++; if ( !IS_QUOTED_SPECIAL(data[i]) ) { - parser->error = "Escaped quoted-string character is not a QUOTED-SPECIAL."; + parser->error = + "Escaped quoted-string character is not a QUOTED-SPECIAL."; return FALSE; } @@ -292,7 +305,7 @@ static int managesieve_parser_literal_end(struct managesieve_parser *parser) { - if ((parser->flags & MANAGESIEVE_PARSE_FLAG_LITERAL_SIZE) == 0) { + if ((parser->flags & MANAGESIEVE_PARSE_FLAG_STRING_STREAM) == 0) { if (parser->line_size >= parser->max_line_size || parser->literal_size > parser->max_line_size - parser->line_size) { @@ -387,7 +400,7 @@ i_assert(parser->cur_pos == 0); } - if ((parser->flags & MANAGESIEVE_PARSE_FLAG_LITERAL_SIZE) == 0) { + if ((parser->flags & MANAGESIEVE_PARSE_FLAG_STRING_STREAM) == 0) { /* now we just wait until we've read enough data */ if (data_size < parser->literal_size) { return FALSE; @@ -404,8 +417,10 @@ return TRUE; } } else { - /* we want to save only literal size, not the literal itself. */ + /* we don't read the data; we just create a stream for the literal */ parser->eol = TRUE; + parser->str_stream = i_stream_create_limit + (parser->input, parser->literal_size); managesieve_parser_save_arg(parser, NULL, 0); return TRUE; } @@ -461,8 +476,17 @@ return FALSE; break; case ARG_PARSE_STRING: - if (!managesieve_parser_read_string(parser, data, data_size)) + if ((parser->flags & MANAGESIEVE_PARSE_FLAG_STRING_STREAM) != 0) { + parser->eol = TRUE; + parser->line_size += parser->cur_pos; + i_stream_skip(parser->input, parser->cur_pos); + parser->cur_pos = 0; + parser->str_stream = quoted_string_istream_create(parser); + managesieve_parser_save_arg(parser, NULL, 0); + + } else if (!managesieve_parser_read_string(parser, data, data_size)) { return FALSE; + } break; case ARG_PARSE_LITERAL: if (!managesieve_parser_read_literal(parser, data, data_size)) @@ -623,10 +647,10 @@ return NULL; } -uoff_t _managesieve_arg_literal_size_error(const struct managesieve_arg *arg) +struct istream *_managesieve_arg_str_stream_error(const struct managesieve_arg *arg) { - i_panic("Tried to access managesieve_arg type %d as literal size", arg->type); - return 0; + i_panic("Tried to access managesieve_arg type %d as string stream", arg->type); + return NULL; } struct managesieve_arg_list *_managesieve_arg_list_error(const struct managesieve_arg *arg) @@ -634,3 +658,147 @@ i_panic("Tried to access managesieve_arg type %d as list", arg->type); return NULL; } + +/* + * Quoted string stream + */ + +struct quoted_string_istream { + struct istream_private istream; + + struct stat statbuf; + + struct managesieve_parser *parser; + + unsigned int pending_slash:1; + unsigned int last_slash:1; + unsigned int finished:1; +}; + +static ssize_t quoted_string_istream_read(struct istream_private *stream) +{ + struct quoted_string_istream *qsstream = + (struct quoted_string_istream *)stream; + const unsigned char *data; + size_t i, dest, size; + ssize_t ret = 0; + bool slash; + + if ( qsstream->finished ) { + stream->istream.eof = TRUE; + return -1; + } + + /* Read from parent */ + data = i_stream_get_data(stream->parent, &size); + if (size == 0) { + ret = i_stream_read(stream->parent); + if (ret <= 0 && (ret != -2 || stream->skip == 0)) { + if ( stream->istream.eof && stream->istream.stream_errno == 0 ) { + stream->istream.eof = 0; + stream->istream.stream_errno = EPROTO; + } else { + stream->istream.stream_errno = stream->parent->stream_errno; + stream->istream.eof = stream->parent->eof; + } + return ret; + } + data = i_stream_get_data(stream->parent, &size); + i_assert(size != 0); + } + + /* Allocate buffer space */ + if (!i_stream_get_buffer_space(stream, size, NULL)) + return -2; + + /* Parse quoted string content */ + dest = stream->pos; + slash = qsstream->pending_slash; + ret = 0; + for (i = 0; i < size && dest < stream->buffer_size; i++) { + if ( data[i] == '"' ) { + if ( !slash ) { + qsstream->finished = TRUE; + i++; + break; + } + slash = FALSE; + } else if ( data[i] == '\\' ) { + if ( !slash ) { + slash = TRUE; + continue; + } + slash = FALSE; + } else if ( slash ) { + if ( !IS_QUOTED_SPECIAL(data[i]) ) { + qsstream->parser->error = + "Escaped quoted-string character is not a QUOTED-SPECIAL."; + stream->istream.stream_errno = EPROTO; + ret = -1; + break; + } + slash = FALSE; + } + + if ( (data[i] & 0x80) == 0 && ( data[i] == '\r' || data[i] == '\n' ) ) { + qsstream->parser->error = "String contains invalid character."; + stream->istream.stream_errno = EPROTO; + ret = -1; + break; + } + + stream->w_buffer[dest++] = data[i]; + } + + i_stream_skip(stream->parent, i); + qsstream->pending_slash = slash; + + if ( ret < 0 ) { From pigeonhole at rename-it.nl Mon Jan 23 01:43:42 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 23 Jan 2012 00:43:42 +0100 Subject: dovecot-2.1-pigeonhole: ManageSieve: fixed quota problem in prev... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/bc5acd9e957e changeset: 1597:bc5acd9e957e user: Stephan Bosch date: Mon Jan 23 00:43:37 2012 +0100 description: ManageSieve: fixed quota problem in previous change. diffstat: src/managesieve/cmd-putscript.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r ae857042882b -r bc5acd9e957e src/managesieve/cmd-putscript.c --- a/src/managesieve/cmd-putscript.c Sun Jan 22 21:57:45 2012 +0100 +++ b/src/managesieve/cmd-putscript.c Mon Jan 23 00:43:37 2012 +0100 @@ -311,7 +311,6 @@ return cmd_putscript_cancel(ctx, TRUE); } - ctx->max_script_size = ctx->script_size; } else { ctx->max_script_size = managesieve_quota_max_script_size(client); } @@ -343,7 +342,8 @@ if (ctx->save_ctx != NULL) { while (ctx->script_size == 0 || ctx->input->v_offset != ctx->script_size) { - if ( ctx->input->v_offset > ctx->max_script_size ) { + if ( ctx->max_script_size > 0 && + ctx->input->v_offset > ctx->max_script_size ) { (void)managesieve_quota_check_validsize(client, ctx->input->v_offset); cmd_putscript_finish(ctx); return TRUE; From dovecot at dovecot.org Tue Jan 24 03:52:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 03:52:41 +0200 Subject: dovecot-2.1: istream-concat: If looking up stream's size fails, ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5c1471ae3005 changeset: 13983:5c1471ae3005 user: Timo Sirainen date: Tue Jan 24 03:49:03 2012 +0200 description: istream-concat: If looking up stream's size fails, log an error and handle it as error, not EOF. diffstat: src/lib/istream-concat.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diffs (32 lines): diff -r 83a2e1ba3ab6 -r 5c1471ae3005 src/lib/istream-concat.c --- a/src/lib/istream-concat.c Sun Jan 22 21:38:48 2012 +0200 +++ b/src/lib/istream-concat.c Tue Jan 24 03:49:03 2012 +0200 @@ -92,7 +92,7 @@ bool last_stream; if (cstream->cur_input == NULL) { - stream->istream.eof = TRUE; + stream->istream.stream_errno = EINVAL; return -1; } @@ -188,6 +188,9 @@ /* we'll need to figure out this stream's size */ st = i_stream_stat(cstream->input[i], TRUE); if (st == NULL) { + i_error("istream-concat: " + "Failed to get size of stream %s", + i_stream_get_name(cstream->input[i])); cstream->istream.istream.stream_errno = cstream->input[i]->stream_errno; return (unsigned int)-1; @@ -217,7 +220,9 @@ cstream->cur_idx = find_v_offset(cstream, &v_offset); if (cstream->cur_idx == (unsigned int)-1) { + /* failed */ cstream->cur_input = NULL; + stream->istream.stream_errno = EINVAL; return; } cstream->cur_input = cstream->input[cstream->cur_idx]; From dovecot at dovecot.org Tue Jan 24 03:52:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 03:52:41 +0200 Subject: dovecot-2.1: istream-mail: Skip checking if cached message size ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/4e3f2ee77b37 changeset: 13984:4e3f2ee77b37 user: Timo Sirainen date: Tue Jan 24 03:50:36 2012 +0200 description: istream-mail: Skip checking if cached message size is wrong if parent stream returns error. An error is not the same as EOF. diffstat: src/lib-storage/index/istream-mail.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 5c1471ae3005 -r 4e3f2ee77b37 src/lib-storage/index/istream-mail.c --- a/src/lib-storage/index/istream-mail.c Tue Jan 24 03:49:03 2012 +0200 +++ b/src/lib-storage/index/istream-mail.c Tue Jan 24 03:50:36 2012 +0200 @@ -82,6 +82,8 @@ doesn't have the body */ return -1; } + if (stream->istream.stream_errno != 0) + return -1; if (i_stream_mail_try_get_cached_size(mstream) && mstream->expected_size > stream->istream.v_offset + size) { i_stream_mail_set_size_corrupted(mstream, size); From dovecot at dovecot.org Tue Jan 24 03:52:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 03:52:41 +0200 Subject: dovecot-2.1: dbox: Minor code correctness fix. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/096c12e69fd6 changeset: 13985:096c12e69fd6 user: Timo Sirainen date: Tue Jan 24 03:51:20 2012 +0200 description: dbox: Minor code correctness fix. diffstat: src/lib-storage/index/dbox-common/dbox-attachment.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 4e3f2ee77b37 -r 096c12e69fd6 src/lib-storage/index/dbox-common/dbox-attachment.c --- a/src/lib-storage/index/dbox-common/dbox-attachment.c Tue Jan 24 03:50:36 2012 +0200 +++ b/src/lib-storage/index/dbox-common/dbox-attachment.c Tue Jan 24 03:51:20 2012 +0200 @@ -208,7 +208,7 @@ (*stream)->v_offset, psize); ret = 0; } else { - uoff_t trailer_size = psize - (*stream)->v_offset; + uoff_t trailer_size = psize - last_voffset; input = i_stream_create_limit(*stream, trailer_size); array_append(&streams, &input, 1); From dovecot at dovecot.org Tue Jan 24 03:52:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 03:52:41 +0200 Subject: dovecot-2.1: zlib: Getting stream's size failed in some situations. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c464072d05e0 changeset: 13986:c464072d05e0 user: Timo Sirainen date: Tue Jan 24 03:52:28 2012 +0200 description: zlib: Getting stream's size failed in some situations. This could have caused other trouble, such as with dbox + mail_attachment_dir. diffstat: src/plugins/zlib/istream-bzlib.c | 10 ++++++---- src/plugins/zlib/istream-zlib.c | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diffs (108 lines): diff -r 096c12e69fd6 -r c464072d05e0 src/plugins/zlib/istream-bzlib.c --- a/src/plugins/zlib/istream-bzlib.c Tue Jan 24 03:51:20 2012 +0200 +++ b/src/plugins/zlib/istream-bzlib.c Tue Jan 24 03:52:28 2012 +0200 @@ -14,7 +14,7 @@ struct istream_private istream; bz_stream zs; - uoff_t eof_offset; + uoff_t eof_offset, stream_size; size_t prev_size, high_pos; struct stat last_parent_statbuf; @@ -155,6 +155,7 @@ case BZ_STREAM_END: zstream->eof_offset = stream->istream.v_offset + (stream->pos - stream->skip); + zstream->stream_size = zstream->eof_offset; if (size == 0) { stream->istream.eof = TRUE; return -1; @@ -282,7 +283,7 @@ return st; stream->statbuf = *st; - if (zstream->eof_offset == (uoff_t)-1) { + if (zstream->stream_size == (uoff_t)-1) { uoff_t old_offset = stream->istream.v_offset; do { @@ -291,10 +292,10 @@ } while (i_stream_read(&stream->istream) > 0); i_stream_seek(&stream->istream, old_offset); - if (zstream->eof_offset == (uoff_t)-1) + if (zstream->stream_size == (uoff_t)-1) return NULL; } - stream->statbuf.st_size = zstream->eof_offset; + stream->statbuf.st_size = zstream->stream_size; return &stream->statbuf; } @@ -322,6 +323,7 @@ zstream = i_new(struct bzlib_istream, 1); zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->log_errors = log_errors; i_stream_bzlib_init(zstream); diff -r 096c12e69fd6 -r c464072d05e0 src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Tue Jan 24 03:51:20 2012 +0200 +++ b/src/plugins/zlib/istream-zlib.c Tue Jan 24 03:52:28 2012 +0200 @@ -25,7 +25,7 @@ struct istream_private istream; z_stream zs; - uoff_t eof_offset; + uoff_t eof_offset, stream_size; size_t prev_size, high_pos; uint32_t crc32; struct stat last_parent_statbuf; @@ -189,6 +189,7 @@ } /* gzip file with concatenated content */ zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->header_read = FALSE; zstream->trailer_read = FALSE; zstream->crc32 = 0; @@ -302,6 +303,7 @@ case Z_STREAM_END: 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; @@ -440,7 +442,7 @@ return st; stream->statbuf = *st; - if (zstream->eof_offset == (uoff_t)-1) { + if (zstream->stream_size == (uoff_t)-1) { uoff_t old_offset = stream->istream.v_offset; do { @@ -449,10 +451,10 @@ } while (i_stream_read(&stream->istream) > 0); i_stream_seek(&stream->istream, old_offset); - if (zstream->eof_offset == (uoff_t)-1) + if (zstream->stream_size == (uoff_t)-1) return NULL; } - stream->statbuf.st_size = zstream->eof_offset; + stream->statbuf.st_size = zstream->stream_size; return &stream->statbuf; } @@ -481,6 +483,7 @@ zstream = i_new(struct zlib_istream, 1); zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->gz = gz; zstream->log_errors = log_errors; From dovecot at dovecot.org Tue Jan 24 03:53:04 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 03:53:04 +0200 Subject: dovecot-2.0: zlib: Getting stream's size failed in some situations. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/9b2931607063 changeset: 13023:9b2931607063 user: Timo Sirainen date: Tue Jan 24 03:52:28 2012 +0200 description: zlib: Getting stream's size failed in some situations. This could have caused other trouble, such as with dbox + mail_attachment_dir. diffstat: src/plugins/zlib/istream-bzlib.c | 10 ++++++---- src/plugins/zlib/istream-zlib.c | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diffs (108 lines): diff -r 759e879c4c42 -r 9b2931607063 src/plugins/zlib/istream-bzlib.c --- a/src/plugins/zlib/istream-bzlib.c Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/zlib/istream-bzlib.c Tue Jan 24 03:52:28 2012 +0200 @@ -14,7 +14,7 @@ struct istream_private istream; bz_stream zs; - uoff_t eof_offset; + uoff_t eof_offset, stream_size; size_t prev_size, high_pos; struct stat last_parent_statbuf; @@ -155,6 +155,7 @@ case BZ_STREAM_END: zstream->eof_offset = stream->istream.v_offset + (stream->pos - stream->skip); + zstream->stream_size = zstream->eof_offset; if (size == 0) { stream->istream.eof = TRUE; return -1; @@ -282,7 +283,7 @@ return st; stream->statbuf = *st; - if (zstream->eof_offset == (uoff_t)-1) { + if (zstream->stream_size == (uoff_t)-1) { uoff_t old_offset = stream->istream.v_offset; do { @@ -291,10 +292,10 @@ } while (i_stream_read(&stream->istream) > 0); i_stream_seek(&stream->istream, old_offset); - if (zstream->eof_offset == (uoff_t)-1) + if (zstream->stream_size == (uoff_t)-1) return NULL; } - stream->statbuf.st_size = zstream->eof_offset; + stream->statbuf.st_size = zstream->stream_size; return &stream->statbuf; } @@ -322,6 +323,7 @@ zstream = i_new(struct bzlib_istream, 1); zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->log_errors = log_errors; i_stream_bzlib_init(zstream); diff -r 759e879c4c42 -r 9b2931607063 src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Fri Jan 20 18:59:16 2012 +0200 +++ b/src/plugins/zlib/istream-zlib.c Tue Jan 24 03:52:28 2012 +0200 @@ -25,7 +25,7 @@ struct istream_private istream; z_stream zs; - uoff_t eof_offset; + uoff_t eof_offset, stream_size; size_t prev_size, high_pos; uint32_t crc32; struct stat last_parent_statbuf; @@ -189,6 +189,7 @@ } /* gzip file with concatenated content */ zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->header_read = FALSE; zstream->trailer_read = FALSE; zstream->crc32 = 0; @@ -302,6 +303,7 @@ case Z_STREAM_END: 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; @@ -440,7 +442,7 @@ return st; stream->statbuf = *st; - if (zstream->eof_offset == (uoff_t)-1) { + if (zstream->stream_size == (uoff_t)-1) { uoff_t old_offset = stream->istream.v_offset; do { @@ -449,10 +451,10 @@ } while (i_stream_read(&stream->istream) > 0); i_stream_seek(&stream->istream, old_offset); - if (zstream->eof_offset == (uoff_t)-1) + if (zstream->stream_size == (uoff_t)-1) return NULL; } - stream->statbuf.st_size = zstream->eof_offset; + stream->statbuf.st_size = zstream->stream_size; return &stream->statbuf; } @@ -481,6 +483,7 @@ zstream = i_new(struct zlib_istream, 1); zstream->eof_offset = (uoff_t)-1; + zstream->stream_size = (uoff_t)-1; zstream->gz = gz; zstream->log_errors = log_errors; From dovecot at dovecot.org Tue Jan 24 15:30:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 15:30:52 +0200 Subject: dovecot-2.1: lib-index: Handle broken ext-header updates without... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b4d8e950eb9d changeset: 13987:b4d8e950eb9d user: Timo Sirainen date: Tue Jan 24 15:30:47 2012 +0200 description: lib-index: Handle broken ext-header updates without crashing. diffstat: src/lib-index/mail-index-sync-ext.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c464072d05e0 -r b4d8e950eb9d src/lib-index/mail-index-sync-ext.c --- a/src/lib-index/mail-index-sync-ext.c Tue Jan 24 03:52:28 2012 +0200 +++ b/src/lib-index/mail-index-sync-ext.c Tue Jan 24 15:30:47 2012 +0200 @@ -623,7 +623,7 @@ return 1; ext = array_idx(&map->extensions, ctx->cur_ext_map_idx); - if (ext->hdr_offset + offset + size > map->hdr.header_size) { + if (offset + size > ext->hdr_size) { mail_index_sync_set_corrupted(ctx, "Extension header update points outside header size"); return -1; From dovecot at dovecot.org Tue Jan 24 16:37:29 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 Jan 2012 16:37:29 +0200 Subject: dovecot-2.1: Dead code removal. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/077b09204860 changeset: 13988:077b09204860 user: Timo Sirainen date: Tue Jan 24 16:37:24 2012 +0200 description: Dead code removal. diffstat: src/lib-storage/list/mailbox-list-index.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diffs (21 lines): diff -r b4d8e950eb9d -r 077b09204860 src/lib-storage/list/mailbox-list-index.c --- a/src/lib-storage/list/mailbox-list-index.c Tue Jan 24 15:30:47 2012 +0200 +++ b/src/lib-storage/list/mailbox-list-index.c Tue Jan 24 16:37:24 2012 +0200 @@ -79,7 +79,6 @@ static int mailbox_list_index_parse_header(struct mailbox_list_index *ilist, struct mail_index_view *view) { - const struct mailbox_list_index_header *hdr; const void *data, *p; size_t i, len, size; uint32_t id, prev_id = 0; @@ -89,8 +88,7 @@ if (size == 0) return 0; - hdr = data; - for (i = sizeof(*hdr); i < size; ) { + for (i = sizeof(struct mailbox_list_index_header); i < size; ) { /* get id */ if (i + sizeof(id) > size) return -1; From dovecot at dovecot.org Wed Jan 25 23:45:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:45:16 +0200 Subject: dovecot-1.2: lib-storage: Message size lookups from cache was br... Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/9ab1c8a10944 changeset: 9651:9ab1c8a10944 user: Timo Sirainen date: Wed Jan 25 23:45:02 2012 +0200 description: lib-storage: Message size lookups from cache was broken if fields weren't in "normal" order in file. diffstat: src/lib-storage/index/index-mail.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r da3c7253b18c -r 9ab1c8a10944 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Tue Jan 17 17:17:24 2012 +0200 +++ b/src/lib-storage/index/index-mail.c Wed Jan 25 23:45:02 2012 +0200 @@ -125,8 +125,7 @@ bool index_mail_get_cached_uoff_t(struct index_mail *mail, enum index_cache_field field, uoff_t *size_r) { - return index_mail_get_fixed_field(mail, - mail->ibox->cache_fields[field].idx, + return index_mail_get_fixed_field(mail, field, size_r, sizeof(*size_r)); } From dovecot at dovecot.org Wed Jan 25 23:45:59 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:45:59 +0200 Subject: dovecot-2.0: lib-storage: Message size lookups from cache was br... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/cf3687721d02 changeset: 13024:cf3687721d02 user: Timo Sirainen date: Wed Jan 25 23:45:02 2012 +0200 description: lib-storage: Message size lookups from cache was broken if fields weren't in "normal" order in file. diffstat: src/lib-storage/index/index-mail.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r 9b2931607063 -r cf3687721d02 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Tue Jan 24 03:52:28 2012 +0200 +++ b/src/lib-storage/index/index-mail.c Wed Jan 25 23:45:02 2012 +0200 @@ -119,8 +119,7 @@ bool index_mail_get_cached_uoff_t(struct index_mail *mail, enum index_cache_field field, uoff_t *size_r) { - return index_mail_get_fixed_field(mail, - mail->ibox->cache_fields[field].idx, + return index_mail_get_fixed_field(mail, field, size_r, sizeof(*size_r)); } From dovecot at dovecot.org Wed Jan 25 23:46:18 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:46:18 +0200 Subject: dovecot-2.1: Added tag 2.1.rc4 for changeset a20a99b8815d Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/844294bc4b32 changeset: 13990:844294bc4b32 user: Timo Sirainen date: Tue Jan 24 17:28:10 2012 +0200 description: Added tag 2.1.rc4 for changeset a20a99b8815d diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r a20a99b8815d -r 844294bc4b32 .hgtags --- a/.hgtags Tue Jan 24 17:28:10 2012 +0200 +++ b/.hgtags Tue Jan 24 17:28:10 2012 +0200 @@ -72,3 +72,4 @@ 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 2.1.rc1 a14b7333ae458eb669ebbe5ec85488b81e223267 2.1.rc2 5398bdb8613fbe05f24a2c655e0408e6fa4d764f 2.1.rc3 +a20a99b8815d4d0ddd176e529a8928d00473fd7f 2.1.rc4 From dovecot at dovecot.org Wed Jan 25 23:46:18 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:46:18 +0200 Subject: dovecot-2.1: Released v2.1.rc4. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a20a99b8815d changeset: 13989:a20a99b8815d user: Timo Sirainen date: Tue Jan 24 17:28:10 2012 +0200 description: Released v2.1.rc4. diffstat: NEWS | 16 ++++++++++++++++ TODO | 3 +++ configure.in | 2 +- 3 files changed, 20 insertions(+), 1 deletions(-) diffs (43 lines): diff -r 077b09204860 -r a20a99b8815d NEWS --- a/NEWS Tue Jan 24 16:37:24 2012 +0200 +++ b/NEWS Tue Jan 24 17:28:10 2012 +0200 @@ -1,3 +1,19 @@ +v2.1.rc4 2012-01-24 Timo Sirainen + + * Temporary authentication failures sent to IMAP/POP3 clients + now includes the server's hostname and timestamp. This makes it + easier to find the error message from logs. + + + auth: Implemented support for Postfix's "TCP map" sockets for + user existence lookups. + + auth: Idling auth worker processes are now stopped. This reduces + error messages about MySQL disconnections. + - director: With >2 directors ring syncing might have stalled during + director connect/disconnect, causing logins to fail. + - LMTP client/proxy: Fixed potential hanging when sending (big) mails + - Compressed mails with external attachments (dbox + SIS + zlib) failed + sometimes with bogus "cached message size wrong" errors. + v2.1.rc3 2012-01-06 Timo Sirainen - Added missing file that prevented v2.1.rc2 from compiling.. diff -r 077b09204860 -r a20a99b8815d TODO --- a/TODO Tue Jan 24 16:37:24 2012 +0200 +++ b/TODO Tue Jan 24 17:28:10 2012 +0200 @@ -1,3 +1,6 @@ + - expire plugin should probably ignore users not in iterate_query + - message-id normalization + - mdbox index rebuild: don't lose save dates - add message/mime limits - stephan's message-parser patch - imapc: diff -r 077b09204860 -r a20a99b8815d configure.in --- a/configure.in Tue Jan 24 16:37:24 2012 +0200 +++ b/configure.in Tue Jan 24 17:28:10 2012 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.rc3],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.rc4],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Wed Jan 25 23:46:18 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:46:18 +0200 Subject: dovecot-2.1: Added signature for changeset a20a99b8815d Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d01c46b6b5bb changeset: 13991:d01c46b6b5bb user: Timo Sirainen date: Tue Jan 24 17:28:14 2012 +0200 description: Added signature for changeset a20a99b8815d diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 844294bc4b32 -r d01c46b6b5bb .hgsigs --- a/.hgsigs Tue Jan 24 17:28:10 2012 +0200 +++ b/.hgsigs Tue Jan 24 17:28:14 2012 +0200 @@ -35,3 +35,4 @@ 18f32bf70fac3c022065d4bfcd1f3e1a74b06b10 0 iEUEABECAAYFAk7NkY0ACgkQyUhSUUBVisl8xgCfSg6EA1Bz+7vShYM1YzRQCXNJx7UAlRBpHQmMenUfxRi/98DUsQs0uN0= a14b7333ae458eb669ebbe5ec85488b81e223267 0 iEYEABECAAYFAk8G/vkACgkQyUhSUUBVisnObQCePLKBz9KeNrU2YadqtlzDe65V7zwAn1+M0om2SFMlzTG251xszcN4g4gn 5398bdb8613fbe05f24a2c655e0408e6fa4d764f 0 iEYEABECAAYFAk8HTMkACgkQyUhSUUBVisknigCgkg1AEAFgPq0xdyBYYDdm55+De1UAoKDSnvoGetcQRB4j86B5c968PjxV +a20a99b8815d4d0ddd176e529a8928d00473fd7f 0 iEYEABECAAYFAk8ezgsACgkQyUhSUUBVismeJQCfVq1NwEBD/U0GTy6Bk5mdBBy6CAEAn1/s2UzStxTUIxy0bmBJg8d+91Jv From dovecot at dovecot.org Wed Jan 25 23:46:18 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 25 Jan 2012 23:46:18 +0200 Subject: dovecot-2.1: lib-storage: Message size lookups from cache was br... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/cfc395ee6be1 changeset: 13992:cfc395ee6be1 user: Timo Sirainen date: Wed Jan 25 23:45:02 2012 +0200 description: lib-storage: Message size lookups from cache was broken if fields weren't in "normal" order in file. diffstat: src/lib-storage/index/index-mail.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r d01c46b6b5bb -r cfc395ee6be1 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Tue Jan 24 17:28:14 2012 +0200 +++ b/src/lib-storage/index/index-mail.c Wed Jan 25 23:45:02 2012 +0200 @@ -134,8 +134,7 @@ bool index_mail_get_cached_uoff_t(struct index_mail *mail, enum index_cache_field field, uoff_t *size_r) { - return index_mail_get_fixed_field(mail, - mail->ibox->cache_fields[field].idx, + return index_mail_get_fixed_field(mail, field, size_r, sizeof(*size_r)); } From dovecot at dovecot.org Thu Jan 26 00:04:32 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 00:04:32 +0200 Subject: dovecot-1.1: lib-storage: Message size lookups from cache was br... Message-ID: details: http://hg.dovecot.org/dovecot-1.1/rev/eadc6ecd92a8 changeset: 8374:eadc6ecd92a8 user: Timo Sirainen date: Wed Jan 25 23:45:02 2012 +0200 description: lib-storage: Message size lookups from cache was broken if fields weren't in "normal" order in file. diffstat: src/lib-storage/index/index-mail.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r eb03f8c375fa -r eadc6ecd92a8 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Mon Aug 29 06:46:53 2011 +0300 +++ b/src/lib-storage/index/index-mail.c Wed Jan 25 23:45:02 2012 +0200 @@ -112,8 +112,7 @@ bool index_mail_get_cached_uoff_t(struct index_mail *mail, enum index_cache_field field, uoff_t *size_r) { - return index_mail_get_fixed_field(mail, - mail->ibox->cache_fields[field].idx, + return index_mail_get_fixed_field(mail, field, size_r, sizeof(*size_r)); } From dovecot at dovecot.org Thu Jan 26 00:37:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 00:37:52 +0200 Subject: dovecot-2.1: maildir: When saving mails compressed, make sure ,S... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/8f25ff7e0e78 changeset: 13993:8f25ff7e0e78 user: Timo Sirainen date: Thu Jan 26 00:37:42 2012 +0200 description: maildir: When saving mails compressed, make sure ,S=size gets added to the filename. diffstat: src/lib-storage/index/maildir/maildir-save.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diffs (27 lines): diff -r cfc395ee6be1 -r 8f25ff7e0e78 src/lib-storage/index/maildir/maildir-save.c --- a/src/lib-storage/index/maildir/maildir-save.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/lib-storage/index/maildir/maildir-save.c Thu Jan 26 00:37:42 2012 +0200 @@ -515,6 +515,7 @@ struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx; struct mail_storage *storage = &ctx->mbox->storage->storage; const char *path; + off_t real_size; int output_errno; ctx->last_save_finished = TRUE; @@ -570,6 +571,15 @@ ctx->failed = TRUE; } } + real_size = lseek(ctx->fd, 0, SEEK_END); + if (real_size == (off_t)-1) { + mail_storage_set_critical(storage, + "lseek(%s) failed: %m", path); + } else if (real_size != (off_t)ctx->file_last->size) { + /* e.g. zlib plugin was used. the "physical size" must be in + the maildir filename, since stat() will return wrong size */ + ctx->file_last->preserve_filename = FALSE; + } if (close(ctx->fd) < 0) { if (!mail_storage_set_error_from_errno(storage)) { mail_storage_set_critical(storage, From dovecot at dovecot.org Thu Jan 26 01:04:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 01:04:40 +0200 Subject: dovecot-2.1: Released v2.1.rc5. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/0f10b3ed5c18 changeset: 13994:0f10b3ed5c18 user: Timo Sirainen date: Thu Jan 26 00:44:04 2012 +0200 description: Released v2.1.rc5. diffstat: NEWS | 4 +++- configure.in | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diffs (28 lines): diff -r 8f25ff7e0e78 -r 0f10b3ed5c18 NEWS --- a/NEWS Thu Jan 26 00:37:42 2012 +0200 +++ b/NEWS Thu Jan 26 00:44:04 2012 +0200 @@ -1,4 +1,4 @@ -v2.1.rc4 2012-01-24 Timo Sirainen +v2.1.rc5 2012-01-26 Timo Sirainen * Temporary authentication failures sent to IMAP/POP3 clients now includes the server's hostname and timestamp. This makes it @@ -14,6 +14,8 @@ - Compressed mails with external attachments (dbox + SIS + zlib) failed sometimes with bogus "cached message size wrong" errors. +v2.1.rc4 was never actually released, but was accidentally tagged in hg. + v2.1.rc3 2012-01-06 Timo Sirainen - Added missing file that prevented v2.1.rc2 from compiling.. diff -r 8f25ff7e0e78 -r 0f10b3ed5c18 configure.in --- a/configure.in Thu Jan 26 00:37:42 2012 +0200 +++ b/configure.in Thu Jan 26 00:44:04 2012 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.rc4],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.1.rc5],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Thu Jan 26 01:04:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 01:04:40 +0200 Subject: dovecot-2.1: Added tag 2.1.rc5 for changeset 0f10b3ed5c18 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/67f12146691c changeset: 13995:67f12146691c user: Timo Sirainen date: Thu Jan 26 00:44:04 2012 +0200 description: Added tag 2.1.rc5 for changeset 0f10b3ed5c18 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 0f10b3ed5c18 -r 67f12146691c .hgtags --- a/.hgtags Thu Jan 26 00:44:04 2012 +0200 +++ b/.hgtags Thu Jan 26 00:44:04 2012 +0200 @@ -73,3 +73,4 @@ a14b7333ae458eb669ebbe5ec85488b81e223267 2.1.rc2 5398bdb8613fbe05f24a2c655e0408e6fa4d764f 2.1.rc3 a20a99b8815d4d0ddd176e529a8928d00473fd7f 2.1.rc4 +0f10b3ed5c18eefb752d8b76a0071b10a969fdf1 2.1.rc5 From dovecot at dovecot.org Thu Jan 26 01:04:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 01:04:40 +0200 Subject: dovecot-2.1: Added signature for changeset 0f10b3ed5c18 Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/de09157961d6 changeset: 13996:de09157961d6 user: Timo Sirainen date: Thu Jan 26 00:44:41 2012 +0200 description: Added signature for changeset 0f10b3ed5c18 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 67f12146691c -r de09157961d6 .hgsigs --- a/.hgsigs Thu Jan 26 00:44:04 2012 +0200 +++ b/.hgsigs Thu Jan 26 00:44:41 2012 +0200 @@ -36,3 +36,4 @@ a14b7333ae458eb669ebbe5ec85488b81e223267 0 iEYEABECAAYFAk8G/vkACgkQyUhSUUBVisnObQCePLKBz9KeNrU2YadqtlzDe65V7zwAn1+M0om2SFMlzTG251xszcN4g4gn 5398bdb8613fbe05f24a2c655e0408e6fa4d764f 0 iEYEABECAAYFAk8HTMkACgkQyUhSUUBVisknigCgkg1AEAFgPq0xdyBYYDdm55+De1UAoKDSnvoGetcQRB4j86B5c968PjxV a20a99b8815d4d0ddd176e529a8928d00473fd7f 0 iEYEABECAAYFAk8ezgsACgkQyUhSUUBVismeJQCfVq1NwEBD/U0GTy6Bk5mdBBy6CAEAn1/s2UzStxTUIxy0bmBJg8d+91Jv +0f10b3ed5c18eefb752d8b76a0071b10a969fdf1 0 iEYEABECAAYFAk8ghdYACgkQyUhSUUBVism4swCdGiTY9/6R8vZmxsg7gyrMhFAutZ4AnRwLbjzBreqPbmWvbP1CYrGHQzT6 From dovecot at dovecot.org Thu Jan 26 16:37:54 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 16:37:54 +0200 Subject: dovecot-2.1: Makefile: Added UnicodeData.txt dependency to unico... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/b2a2036bad3a changeset: 13997:b2a2036bad3a user: Timo Sirainen date: Thu Jan 26 15:41:23 2012 +0200 description: Makefile: Added UnicodeData.txt dependency to unicodemap.c. diffstat: src/lib/Makefile.am | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (15 lines): diff -r de09157961d6 -r b2a2036bad3a src/lib/Makefile.am --- a/src/lib/Makefile.am Thu Jan 26 00:44:41 2012 +0200 +++ b/src/lib/Makefile.am Thu Jan 26 15:41:23 2012 +0200 @@ -4,8 +4,10 @@ EXTRA_DIST = unicodemap.c unicodemap.pl UnicodeData.txt -$(srcdir)/unicodemap.c: unicodemap.pl +UnicodeData.txt: test -f UnicodeData.txt || wget http://www.unicode.org/Public/UNIDATA/UnicodeData.txt + +$(srcdir)/unicodemap.c: unicodemap.pl UnicodeData.txt perl $(srcdir)/unicodemap.pl < UnicodeData.txt > $@ liblib_la_SOURCES = \ From dovecot at dovecot.org Thu Jan 26 16:37:54 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 16:37:54 +0200 Subject: dovecot-2.1: auth: Added PLAIN-TRUNC password schmee. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3235e903dc97 changeset: 13998:3235e903dc97 user: Timo Sirainen date: Thu Jan 26 16:37:40 2012 +0200 description: auth: Added PLAIN-TRUNC password schmee. The idea is to allow successful authentication when the original plaintext password was stored truncated in the database. So e.g. user gave 123456789 as password, but database truncated it to 12345678. To make this authentication work, {PLAIN-TRUNC}8-12345678 password allows successful authentication with any password that begins with 12345678. With the "8-" prefix this prefix matching is done only when the password after it is exactly 8 characters. diffstat: src/auth/password-scheme.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diffs (48 lines): diff -r b2a2036bad3a -r 3235e903dc97 src/auth/password-scheme.c --- a/src/auth/password-scheme.c Thu Jan 26 15:41:23 2012 +0200 +++ b/src/auth/password-scheme.c Thu Jan 26 16:37:40 2012 +0200 @@ -615,6 +615,36 @@ *size_r = strlen(plaintext); } +static int +plain_trunc_verify(const char *plaintext, const char *user ATTR_UNUSED, + const unsigned char *raw_password, size_t size, + const char **error_r) +{ + unsigned int i, plaintext_len, trunc_len = 0; + + /* format: - */ + for (i = 0; i < size; i++) { + if (raw_password[i] >= '0' && raw_password[i] <= '9') + trunc_len = trunc_len*10 + raw_password[i]-'0'; + else + break; + } + if (i == size || raw_password[i] != '-') { + *error_r = "PLAIN-TRUNC missing length: prefix"; + return -1; + } + i++; + + plaintext_len = strlen(plaintext); + if (size-i == trunc_len && plaintext_len >= trunc_len) { + /* possibly truncated password. allow the given password as + long as the prefix matches. */ + return memcmp(raw_password+i, plaintext, trunc_len) == 0 ? 1 : 0; + } + return plaintext_len == size-i && + memcmp(raw_password+i, plaintext, plaintext_len) == 0 ? 1 : 0; +} + static void cram_md5_generate(const char *plaintext, const char *user ATTR_UNUSED, const unsigned char **raw_password_r, size_t *size_r) @@ -782,6 +812,7 @@ { "SSHA512", PW_ENCODING_BASE64, 0, ssha512_verify, ssha512_generate }, { "PLAIN", PW_ENCODING_NONE, 0, NULL, plain_generate }, { "CLEARTEXT", PW_ENCODING_NONE, 0, NULL, plain_generate }, + { "PLAIN-TRUNC", PW_ENCODING_NONE, 0, plain_trunc_verify, plain_generate }, { "CRAM-MD5", PW_ENCODING_HEX, CRAM_MD5_CONTEXTLEN, NULL, cram_md5_generate }, { "HMAC-MD5", PW_ENCODING_HEX, CRAM_MD5_CONTEXTLEN, From dovecot at dovecot.org Thu Jan 26 20:20:50 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 20:20:50 +0200 Subject: dovecot-2.1: doveadm fetch: Added text.utf8 field, which transla... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/89a637820edd changeset: 13999:89a637820edd user: Timo Sirainen date: Thu Jan 26 20:19:32 2012 +0200 description: doveadm fetch: Added text.utf8 field, which translates headers/body to UTF-8. diffstat: src/doveadm/doveadm-mail-fetch.c | 55 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diffs (79 lines): diff -r 3235e903dc97 -r 89a637820edd src/doveadm/doveadm-mail-fetch.c --- a/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 16:37:40 2012 +0200 +++ b/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 20:19:32 2012 +0200 @@ -6,6 +6,8 @@ #include "ostream.h" #include "str.h" #include "message-size.h" +#include "message-parser.h" +#include "message-decoder.h" #include "imap-util.h" #include "mail-user.h" #include "mail-storage.h" @@ -199,6 +201,57 @@ return ret; } +static int fetch_text_utf8(struct fetch_cmd_context *ctx) +{ + struct istream *input; + struct message_parser_ctx *parser; + struct message_decoder_context *decoder; + struct message_block raw_block, block; + struct message_part *parts; + int ret = 0; + + if (mail_get_stream(ctx->mail, NULL, NULL, &input) < 0) + return -1; + + parser = message_parser_init(pool_datastack_create(), input, + MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE, + 0); + decoder = message_decoder_init(0); + + while ((ret = message_parser_parse_next_block(parser, &raw_block)) > 0) { + if (!message_decoder_decode_next_block(decoder, &raw_block, + &block)) + continue; + + if (block.hdr == NULL) { + if (block.size > 0) + doveadm_print_stream(block.data, block.size); + } else if (block.hdr->eoh) + doveadm_print_stream("\n", 1); + else { + i_assert(block.hdr->name_len > 0); + doveadm_print_stream(block.hdr->name, + block.hdr->name_len); + doveadm_print_stream(": ", 2); + if (block.hdr->full_value_len > 0) { + doveadm_print_stream(block.hdr->full_value, + block.hdr->full_value_len); + } + doveadm_print_stream("\n", 1); + } + } + i_assert(ret != 0); + message_decoder_deinit(&decoder); + (void)message_parser_deinit(&parser, &parts); + + if (input->stream_errno != 0) { + i_error("read() failed: %m"); + ret = -1; + } + doveadm_print_stream(NULL, 0); + return ret; +} + static int fetch_size_physical(struct fetch_cmd_context *ctx) { uoff_t size; @@ -306,6 +359,8 @@ { "body", MAIL_FETCH_STREAM_BODY, fetch_body }, { "text", MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY, fetch_text }, + { "text.utf8", MAIL_FETCH_STREAM_HEADER | + MAIL_FETCH_STREAM_BODY, fetch_text_utf8 }, { "size.physical", MAIL_FETCH_PHYSICAL_SIZE, fetch_size_physical }, { "size.virtual", MAIL_FETCH_VIRTUAL_SIZE, fetch_size_virtual }, { "date.received", MAIL_FETCH_RECEIVED_DATE, fetch_date_received }, From dovecot at dovecot.org Thu Jan 26 20:46:55 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 20:46:55 +0200 Subject: dovecot-2.1: doveadm fetch text.utf8: Don't return failure on su... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/2418871d09f5 changeset: 14000:2418871d09f5 user: Timo Sirainen date: Thu Jan 26 20:46:44 2012 +0200 description: doveadm fetch text.utf8: Don't return failure on success. diffstat: src/doveadm/doveadm-mail-fetch.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (19 lines): diff -r 89a637820edd -r 2418871d09f5 src/doveadm/doveadm-mail-fetch.c --- a/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 20:19:32 2012 +0200 +++ b/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 20:46:44 2012 +0200 @@ -244,12 +244,12 @@ message_decoder_deinit(&decoder); (void)message_parser_deinit(&parser, &parts); + doveadm_print_stream(NULL, 0); if (input->stream_errno != 0) { i_error("read() failed: %m"); - ret = -1; + return -1; } - doveadm_print_stream(NULL, 0); - return ret; + return 0; } static int fetch_size_physical(struct fetch_cmd_context *ctx) From dovecot at dovecot.org Thu Jan 26 21:26:26 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 21:26:26 +0200 Subject: dovecot-2.1: doveadm fetch: hdr.*.address and hdr.*.address_name... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/a6a787f0aba1 changeset: 14001:a6a787f0aba1 user: Timo Sirainen date: Thu Jan 26 21:25:39 2012 +0200 description: doveadm fetch: hdr.*.address and hdr.*.address_name expand to parsed mail addresses. diffstat: src/doveadm/doveadm-mail-fetch.c | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-) diffs (70 lines): diff -r 2418871d09f5 -r a6a787f0aba1 src/doveadm/doveadm-mail-fetch.c --- a/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 20:46:44 2012 +0200 +++ b/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 21:25:39 2012 +0200 @@ -5,6 +5,7 @@ #include "istream.h" #include "ostream.h" #include "str.h" +#include "message-address.h" #include "message-size.h" #include "message-parser.h" #include "message-decoder.h" @@ -130,11 +131,15 @@ static int fetch_hdr_field(struct fetch_cmd_context *ctx) { - const char *const *value; + const char *const *value, *filter, *name = ctx->cur_field->name; string_t *str = t_str_new(256); bool add_lf = FALSE; - if (mail_get_headers(ctx->mail, ctx->cur_field->name, &value) < 0) + filter = strchr(name, '.'); + if (filter != NULL) + name = t_strdup_until(name, filter++); + + if (mail_get_headers(ctx->mail, name, &value) < 0) return -1; for (; *value != NULL; value++) { @@ -143,6 +148,32 @@ str_append(str, *value); add_lf = TRUE; } + + if (filter == NULL) { + /* print the header as-is */ + } else if (strcmp(filter, "address") == 0 || + strcmp(filter, "address_name") == 0) { + struct message_address *addr; + + addr = message_address_parse(pool_datastack_create(), + str_data(str), str_len(str), -1U, + FALSE); + str_truncate(str, 0); + add_lf = FALSE; + for (; addr != NULL; addr = addr->next) { + if (add_lf) + str_append_c(str, '\n'); + if (strcmp(filter, "address") == 0) { + str_printfa(str, "%s@%s", + addr->mailbox, addr->domain); + } else { + str_append(str, addr->name); + } + add_lf = TRUE; + } + } else { + i_fatal("Unknown header filter: %s", filter); + } doveadm_print(str_c(str)); return 0; } @@ -413,6 +444,7 @@ name += 4; hdr_field.name = name; array_append(&ctx->fields, &hdr_field, 1); + name = t_strcut(name, '.'); array_append(&ctx->header_fields, &name, 1); } else { field = fetch_field_find(name); From dovecot at dovecot.org Thu Jan 26 21:43:38 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 26 Jan 2012 21:43:38 +0200 Subject: dovecot-2.1: doveadm fetch hdr.*.adddress*: Don't crash when pri... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/afeabe28a499 changeset: 14002:afeabe28a499 user: Timo Sirainen date: Thu Jan 26 21:43:27 2012 +0200 description: doveadm fetch hdr.*.adddress*: Don't crash when printing groups. diffstat: src/doveadm/doveadm-mail-fetch.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diffs (22 lines): diff -r a6a787f0aba1 -r afeabe28a499 src/doveadm/doveadm-mail-fetch.c --- a/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 21:25:39 2012 +0200 +++ b/src/doveadm/doveadm-mail-fetch.c Thu Jan 26 21:43:27 2012 +0200 @@ -164,10 +164,15 @@ if (add_lf) str_append_c(str, '\n'); if (strcmp(filter, "address") == 0) { - str_printfa(str, "%s@%s", - addr->mailbox, addr->domain); + if (addr->mailbox != NULL) + str_append(str, addr->mailbox); + if (addr->domain != NULL) { + str_append_c(str, '@'); + str_append(str, addr->domain); + } } else { - str_append(str, addr->name); + if (addr->name != NULL) + str_append(str, addr->name); } add_lf = TRUE; } From dovecot at dovecot.org Fri Jan 27 02:43:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 02:43:06 +0200 Subject: dovecot-2.1: imapc: If server doesn't support GUIDs, return empt... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/f3e000992f61 changeset: 14003:f3e000992f61 user: Timo Sirainen date: Fri Jan 27 02:42:50 2012 +0200 description: imapc: If server doesn't support GUIDs, return empty GUID rather than fail. This is how other backends do it as well. diffstat: src/lib-storage/index/imapc/imapc-mail.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (18 lines): diff -r afeabe28a499 -r f3e000992f61 src/lib-storage/index/imapc/imapc-mail.c --- a/src/lib-storage/index/imapc/imapc-mail.c Thu Jan 26 21:43:27 2012 +0200 +++ b/src/lib-storage/index/imapc/imapc-mail.c Fri Jan 27 02:42:50 2012 +0200 @@ -322,8 +322,14 @@ imapc_mail_get_special(struct mail *_mail, enum mail_fetch_field field, const char **value_r) { + struct imapc_mailbox *mbox = (struct imapc_mailbox *)_mail->box; + switch (field) { case MAIL_FETCH_GUID: + if (mbox->guid_fetch_field_name == NULL) { + /* GUIDs not supported by server */ + break; + } *value_r = ""; return imapc_mail_get_guid(_mail, value_r); default: From dovecot at dovecot.org Fri Jan 27 14:16:14 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:16:14 +0200 Subject: dovecot-2.0: login: If auth_debug_passwords=yes, assume auth_deb... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/95fc6d9525ce changeset: 13026:95fc6d9525ce user: Timo Sirainen date: Fri Jan 27 14:15:30 2012 +0200 description: login: If auth_debug_passwords=yes, assume auth_debug/auth_verbose=yes diffstat: src/login-common/login-settings.c | 2 ++ src/login-common/login-settings.h | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diffs (23 lines): diff -r f320e8e760e1 -r 95fc6d9525ce src/login-common/login-settings.c --- a/src/login-common/login-settings.c Fri Jan 27 14:15:06 2012 +0200 +++ b/src/login-common/login-settings.c Fri Jan 27 14:15:30 2012 +0200 @@ -139,6 +139,8 @@ set->ssl_verify_client_cert = TRUE; } + if (set->auth_debug_passwords) + set->auth_debug = TRUE; if (set->auth_debug) set->auth_verbose = TRUE; diff -r f320e8e760e1 -r 95fc6d9525ce src/login-common/login-settings.h --- a/src/login-common/login-settings.h Fri Jan 27 14:15:06 2012 +0200 +++ b/src/login-common/login-settings.h Fri Jan 27 14:15:30 2012 +0200 @@ -24,6 +24,7 @@ bool disable_plaintext_auth; bool auth_verbose; bool auth_debug; + bool auth_debug_passwords; bool verbose_proctitle; unsigned int mail_max_userip_connections; From dovecot at dovecot.org Fri Jan 27 14:16:14 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:16:14 +0200 Subject: dovecot-2.0: login process wasn't logging all intended messages ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/f320e8e760e1 changeset: 13025:f320e8e760e1 user: Timo Sirainen date: Fri Jan 27 14:15:06 2012 +0200 description: login process wasn't logging all intended messages with auth_verbose=yes It was named verbose_auth setting accidentally. diffstat: src/login-common/client-common-auth.c | 4 ++-- src/login-common/login-settings.c | 7 +++++-- src/login-common/login-settings.h | 2 +- src/login-common/sasl-server.c | 2 +- src/login-common/ssl-proxy-openssl.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diffs (88 lines): diff -r cf3687721d02 -r f320e8e760e1 src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/login-common/client-common-auth.c Fri Jan 27 14:15:06 2012 +0200 @@ -485,7 +485,7 @@ const char *init_resp) { if (!client->secured && strcmp(client->set->ssl, "required") == 0) { - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "Login failed: " "SSL required for authentication"); } @@ -519,7 +519,7 @@ if (client->secured || !client->set->disable_plaintext_auth) return TRUE; - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "Login failed: " "Plaintext authentication disabled"); } diff -r cf3687721d02 -r f320e8e760e1 src/login-common/login-settings.c --- a/src/login-common/login-settings.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/login-common/login-settings.c Fri Jan 27 14:15:06 2012 +0200 @@ -40,7 +40,7 @@ DEF(SET_BOOL, verbose_ssl), DEF(SET_BOOL, disable_plaintext_auth), - DEF(SET_BOOL, verbose_auth), + DEF(SET_BOOL, auth_verbose), DEF(SET_BOOL, auth_debug), DEF(SET_BOOL, verbose_proctitle), @@ -71,7 +71,7 @@ .verbose_ssl = FALSE, .disable_plaintext_auth = TRUE, - .verbose_auth = FALSE, + .auth_verbose = FALSE, .auth_debug = FALSE, .verbose_proctitle = FALSE, @@ -139,6 +139,9 @@ set->ssl_verify_client_cert = TRUE; } + if (set->auth_debug) + set->auth_verbose = TRUE; + if (strcmp(set->ssl, "no") == 0) { /* disabled */ } else if (strcmp(set->ssl, "yes") == 0) { diff -r cf3687721d02 -r f320e8e760e1 src/login-common/login-settings.h --- a/src/login-common/login-settings.h Wed Jan 25 23:45:02 2012 +0200 +++ b/src/login-common/login-settings.h Fri Jan 27 14:15:06 2012 +0200 @@ -22,7 +22,7 @@ bool verbose_ssl; bool disable_plaintext_auth; - bool verbose_auth; + bool auth_verbose; bool auth_debug; bool verbose_proctitle; diff -r cf3687721d02 -r f320e8e760e1 src/login-common/sasl-server.c --- a/src/login-common/sasl-server.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/login-common/sasl-server.c Fri Jan 27 14:15:06 2012 +0200 @@ -318,7 +318,7 @@ { i_assert(client->authenticating); - if (client->set->verbose_auth && reason != NULL) { + if (client->set->auth_verbose && reason != NULL) { const char *auth_name = str_sanitize(client->auth_mech_name, MAX_MECH_NAME); client_log(client, t_strdup_printf( diff -r cf3687721d02 -r f320e8e760e1 src/login-common/ssl-proxy-openssl.c --- a/src/login-common/ssl-proxy-openssl.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/login-common/ssl-proxy-openssl.c Fri Jan 27 14:15:06 2012 +0200 @@ -918,7 +918,7 @@ proxy->cert_received = TRUE; if (proxy->set->verbose_ssl || - (proxy->set->verbose_auth && !preverify_ok)) { + (proxy->set->auth_verbose && !preverify_ok)) { char buf[1024]; X509_NAME *subject; From dovecot at dovecot.org Fri Jan 27 14:16:21 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:16:21 +0200 Subject: dovecot-2.1: login process wasn't logging all intended messages ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/581aaea8569c changeset: 14004:581aaea8569c user: Timo Sirainen date: Fri Jan 27 14:15:06 2012 +0200 description: login process wasn't logging all intended messages with auth_verbose=yes It was named verbose_auth setting accidentally. diffstat: src/login-common/client-common-auth.c | 4 ++-- src/login-common/login-settings.c | 7 +++++-- src/login-common/login-settings.h | 2 +- src/login-common/sasl-server.c | 2 +- src/login-common/ssl-proxy-openssl.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diffs (88 lines): diff -r f3e000992f61 -r 581aaea8569c src/login-common/client-common-auth.c --- a/src/login-common/client-common-auth.c Fri Jan 27 02:42:50 2012 +0200 +++ b/src/login-common/client-common-auth.c Fri Jan 27 14:15:06 2012 +0200 @@ -500,7 +500,7 @@ const char *init_resp) { if (!client->secured && strcmp(client->set->ssl, "required") == 0) { - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "Login failed: " "SSL required for authentication"); } @@ -531,7 +531,7 @@ if (client->secured || !client->set->disable_plaintext_auth) return TRUE; - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "Login failed: " "Plaintext authentication disabled"); } diff -r f3e000992f61 -r 581aaea8569c src/login-common/login-settings.c --- a/src/login-common/login-settings.c Fri Jan 27 02:42:50 2012 +0200 +++ b/src/login-common/login-settings.c Fri Jan 27 14:15:06 2012 +0200 @@ -42,7 +42,7 @@ DEF(SET_BOOL, verbose_ssl), DEF(SET_BOOL, disable_plaintext_auth), - DEF(SET_BOOL, verbose_auth), + DEF(SET_BOOL, auth_verbose), DEF(SET_BOOL, auth_debug), DEF(SET_BOOL, verbose_proctitle), @@ -75,7 +75,7 @@ .verbose_ssl = FALSE, .disable_plaintext_auth = TRUE, - .verbose_auth = FALSE, + .auth_verbose = FALSE, .auth_debug = FALSE, .verbose_proctitle = FALSE, @@ -143,6 +143,9 @@ set->ssl_verify_client_cert = TRUE; } + if (set->auth_debug) + set->auth_verbose = TRUE; + if (strcmp(set->ssl, "no") == 0) { /* disabled */ } else if (strcmp(set->ssl, "yes") == 0) { diff -r f3e000992f61 -r 581aaea8569c src/login-common/login-settings.h --- a/src/login-common/login-settings.h Fri Jan 27 02:42:50 2012 +0200 +++ b/src/login-common/login-settings.h Fri Jan 27 14:15:06 2012 +0200 @@ -24,7 +24,7 @@ bool verbose_ssl; bool disable_plaintext_auth; - bool verbose_auth; + bool auth_verbose; bool auth_debug; bool verbose_proctitle; diff -r f3e000992f61 -r 581aaea8569c src/login-common/sasl-server.c --- a/src/login-common/sasl-server.c Fri Jan 27 02:42:50 2012 +0200 +++ b/src/login-common/sasl-server.c Fri Jan 27 14:15:06 2012 +0200 @@ -332,7 +332,7 @@ { i_assert(client->authenticating); - if (client->set->verbose_auth && reason != NULL) { + if (client->set->auth_verbose && reason != NULL) { const char *auth_name = str_sanitize(client->auth_mech_name, MAX_MECH_NAME); client_log(client, t_strdup_printf( diff -r f3e000992f61 -r 581aaea8569c src/login-common/ssl-proxy-openssl.c --- a/src/login-common/ssl-proxy-openssl.c Fri Jan 27 02:42:50 2012 +0200 +++ b/src/login-common/ssl-proxy-openssl.c Fri Jan 27 14:15:06 2012 +0200 @@ -848,7 +848,7 @@ proxy->cert_received = TRUE; if (proxy->set->verbose_ssl || - (proxy->set->verbose_auth && !preverify_ok)) { + (proxy->set->auth_verbose && !preverify_ok)) { char buf[1024]; X509_NAME *subject; From dovecot at dovecot.org Fri Jan 27 14:16:21 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:16:21 +0200 Subject: dovecot-2.1: login: If auth_debug_passwords=yes, assume auth_deb... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/520fcb49c939 changeset: 14005:520fcb49c939 user: Timo Sirainen date: Fri Jan 27 14:15:30 2012 +0200 description: login: If auth_debug_passwords=yes, assume auth_debug/auth_verbose=yes diffstat: src/login-common/login-settings.c | 2 ++ src/login-common/login-settings.h | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diffs (23 lines): diff -r 581aaea8569c -r 520fcb49c939 src/login-common/login-settings.c --- a/src/login-common/login-settings.c Fri Jan 27 14:15:06 2012 +0200 +++ b/src/login-common/login-settings.c Fri Jan 27 14:15:30 2012 +0200 @@ -143,6 +143,8 @@ set->ssl_verify_client_cert = TRUE; } + if (set->auth_debug_passwords) + set->auth_debug = TRUE; if (set->auth_debug) set->auth_verbose = TRUE; diff -r 581aaea8569c -r 520fcb49c939 src/login-common/login-settings.h --- a/src/login-common/login-settings.h Fri Jan 27 14:15:06 2012 +0200 +++ b/src/login-common/login-settings.h Fri Jan 27 14:15:30 2012 +0200 @@ -26,6 +26,7 @@ bool disable_plaintext_auth; bool auth_verbose; bool auth_debug; + bool auth_debug_passwords; bool verbose_proctitle; unsigned int mail_max_userip_connections; From dovecot at dovecot.org Fri Jan 27 14:17:41 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:17:41 +0200 Subject: dovecot-2.1: login: More verbose_auth -> auth_verbose changes. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/d88f58c6fd21 changeset: 14006:d88f58c6fd21 user: Timo Sirainen date: Fri Jan 27 14:17:32 2012 +0200 description: login: More verbose_auth -> auth_verbose changes. diffstat: src/imap-login/imap-proxy.c | 2 +- src/pop3-login/client-authenticate.c | 6 +++--- src/pop3-login/pop3-proxy.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diffs (54 lines): diff -r 520fcb49c939 -r d88f58c6fd21 src/imap-login/imap-proxy.c --- a/src/imap-login/imap-proxy.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/imap-login/imap-proxy.c Fri Jan 27 14:17:32 2012 +0200 @@ -231,7 +231,7 @@ return 1; } else if (strncmp(line, "L ", 2) == 0) { line += 2; - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { const char *log_line = line; if (strncasecmp(log_line, "NO ", 3) == 0) diff -r 520fcb49c939 -r d88f58c6fd21 src/pop3-login/client-authenticate.c --- a/src/pop3-login/client-authenticate.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/pop3-login/client-authenticate.c Fri Jan 27 14:17:32 2012 +0200 @@ -164,7 +164,7 @@ unsigned int server_pid, connect_uid; if (pop3_client->apop_challenge == NULL) { - if (client->set->verbose_auth) + if (client->set->auth_verbose) client_log(client, "APOP failed: APOP not enabled"); client_send_line(client, CLIENT_CMD_REPLY_BAD, "APOP not enabled."); @@ -174,7 +174,7 @@ /* */ p = strchr(args, ' '); if (p == NULL || strlen(p+1) != 32) { - if (client->set->verbose_auth) + if (client->set->auth_verbose) client_log(client, "APOP failed: Invalid parameters"); client_send_line(client, CLIENT_CMD_REPLY_BAD, "Invalid parameters."); @@ -189,7 +189,7 @@ buffer_append_c(apop_data, '\0'); if (hex_to_binary(p+1, apop_data) < 0) { - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "APOP failed: " "Invalid characters in MD5 response"); } diff -r 520fcb49c939 -r d88f58c6fd21 src/pop3-login/pop3-proxy.c --- a/src/pop3-login/pop3-proxy.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/pop3-login/pop3-proxy.c Fri Jan 27 14:17:32 2012 +0200 @@ -151,7 +151,7 @@ client_send_raw(client, t_strconcat(line, "\r\n", NULL)); } - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { if (strncmp(line, "-ERR ", 5) == 0) line += 5; client_proxy_log_failure(client, line); From dovecot at dovecot.org Fri Jan 27 14:17:50 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:17:50 +0200 Subject: dovecot-2.0: login: More verbose_auth -> auth_verbose changes. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/0873e08cc65c changeset: 13027:0873e08cc65c user: Timo Sirainen date: Fri Jan 27 14:17:32 2012 +0200 description: login: More verbose_auth -> auth_verbose changes. diffstat: src/imap-login/imap-proxy.c | 2 +- src/pop3-login/client-authenticate.c | 6 +++--- src/pop3-login/pop3-proxy.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diffs (54 lines): diff -r 95fc6d9525ce -r 0873e08cc65c src/imap-login/imap-proxy.c --- a/src/imap-login/imap-proxy.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/imap-login/imap-proxy.c Fri Jan 27 14:17:32 2012 +0200 @@ -231,7 +231,7 @@ return 1; } else if (strncmp(line, "L ", 2) == 0) { line += 2; - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { const char *log_line = line; if (strncasecmp(log_line, "NO ", 3) == 0) diff -r 95fc6d9525ce -r 0873e08cc65c src/pop3-login/client-authenticate.c --- a/src/pop3-login/client-authenticate.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/pop3-login/client-authenticate.c Fri Jan 27 14:17:32 2012 +0200 @@ -158,7 +158,7 @@ unsigned int server_pid, connect_uid; if (pop3_client->apop_challenge == NULL) { - if (client->set->verbose_auth) + if (client->set->auth_verbose) client_log(client, "APOP failed: APOP not enabled"); client_send_line(client, CLIENT_CMD_REPLY_BAD, "APOP not enabled."); @@ -168,7 +168,7 @@ /* */ p = strchr(args, ' '); if (p == NULL || strlen(p+1) != 32) { - if (client->set->verbose_auth) + if (client->set->auth_verbose) client_log(client, "APOP failed: Invalid parameters"); client_send_line(client, CLIENT_CMD_REPLY_BAD, "Invalid parameters."); @@ -183,7 +183,7 @@ buffer_append_c(apop_data, '\0'); if (hex_to_binary(p+1, apop_data) < 0) { - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { client_log(client, "APOP failed: " "Invalid characters in MD5 response"); } diff -r 95fc6d9525ce -r 0873e08cc65c src/pop3-login/pop3-proxy.c --- a/src/pop3-login/pop3-proxy.c Fri Jan 27 14:15:30 2012 +0200 +++ b/src/pop3-login/pop3-proxy.c Fri Jan 27 14:17:32 2012 +0200 @@ -151,7 +151,7 @@ client_send_raw(client, t_strconcat(line, "\r\n", NULL)); } - if (client->set->verbose_auth) { + if (client->set->auth_verbose) { if (strncmp(line, "-ERR ", 5) == 0) line += 5; client_proxy_log_failure(client, line); From dovecot at dovecot.org Fri Jan 27 14:35:52 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:35:52 +0200 Subject: dovecot-2.1: example-config: mdbox_rotate_interval default was w... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c330960e6bcb changeset: 14007:c330960e6bcb user: Timo Sirainen date: Fri Jan 27 14:35:38 2012 +0200 description: example-config: mdbox_rotate_interval default was wrong. diffstat: doc/example-config/conf.d/10-mail.conf | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r d88f58c6fd21 -r c330960e6bcb doc/example-config/conf.d/10-mail.conf --- a/doc/example-config/conf.d/10-mail.conf Fri Jan 27 14:17:32 2012 +0200 +++ b/doc/example-config/conf.d/10-mail.conf Fri Jan 27 14:35:38 2012 +0200 @@ -314,7 +314,7 @@ # Maximum dbox file age until it's rotated. Typically in days. Day begins # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled. -#mdbox_rotate_interval = 1d +#mdbox_rotate_interval = 0 # When creating new mdbox files, immediately preallocate their size to # mdbox_rotate_size. This setting currently works only in Linux with some From dovecot at dovecot.org Fri Jan 27 14:36:00 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:36:00 +0200 Subject: dovecot-2.0: example-config: mdbox_rotate_interval default was w... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/ac8b3da5dd07 changeset: 13028:ac8b3da5dd07 user: Timo Sirainen date: Fri Jan 27 14:35:38 2012 +0200 description: example-config: mdbox_rotate_interval default was wrong. diffstat: doc/example-config/conf.d/10-mail.conf | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 0873e08cc65c -r ac8b3da5dd07 doc/example-config/conf.d/10-mail.conf --- a/doc/example-config/conf.d/10-mail.conf Fri Jan 27 14:17:32 2012 +0200 +++ b/doc/example-config/conf.d/10-mail.conf Fri Jan 27 14:35:38 2012 +0200 @@ -309,7 +309,7 @@ # Maximum dbox file age until it's rotated. Typically in days. Day begins # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled. -#mdbox_rotate_interval = 1d +#mdbox_rotate_interval = 0 # When creating new mdbox files, immediately preallocate their size to # mdbox_rotate_size. This setting currently works only in Linux with some From dovecot at dovecot.org Fri Jan 27 14:46:46 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 14:46:46 +0200 Subject: dovecot-2.1: imapc: If imapc_host is IP, don't look it up via dn... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/6e6c20ab1ed1 changeset: 14008:6e6c20ab1ed1 user: Timo Sirainen date: Fri Jan 27 14:46:38 2012 +0200 description: imapc: If imapc_host is IP, don't look it up via dns-client service. diffstat: src/lib-imap-client/imapc-connection.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diffs (25 lines): diff -r c330960e6bcb -r 6e6c20ab1ed1 src/lib-imap-client/imapc-connection.c --- a/src/lib-imap-client/imapc-connection.c Fri Jan 27 14:35:38 2012 +0200 +++ b/src/lib-imap-client/imapc-connection.c Fri Jan 27 14:46:38 2012 +0200 @@ -1340,6 +1340,7 @@ void *login_context) { struct dns_lookup_settings dns_set; + struct ip_addr ip; if (conn->fd != -1) { i_assert(login_callback == NULL); @@ -1360,6 +1361,13 @@ dns_set.timeout_msecs = IMAPC_DNS_LOOKUP_TIMEOUT_MSECS; imapc_connection_set_state(conn, IMAPC_CONNECTION_STATE_CONNECTING); + if (conn->ips_count == 0 && + net_addr2ip(conn->client->set.host, &ip) == 0) { + conn->ips_count = 1; + conn->ips = i_new(struct ip_addr, conn->ips_count); + conn->ips[0] = ip; + } + if (conn->ips_count == 0) { (void)dns_lookup(conn->client->set.host, &dns_set, imapc_connection_dns_callback, conn); From dovecot at dovecot.org Fri Jan 27 15:44:11 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 15:44:11 +0200 Subject: dovecot-2.1: sdbox: Preserve file's atime/mtime when moving it t... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/10320252b521 changeset: 14009:10320252b521 user: Timo Sirainen date: Fri Jan 27 15:44:06 2012 +0200 description: sdbox: Preserve file's atime/mtime when moving it to alt storage. diffstat: src/lib-storage/index/dbox-single/sdbox-file.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diffs (34 lines): diff -r 6e6c20ab1ed1 -r 10320252b521 src/lib-storage/index/dbox-single/sdbox-file.c --- a/src/lib-storage/index/dbox-single/sdbox-file.c Fri Jan 27 14:46:38 2012 +0200 +++ b/src/lib-storage/index/dbox-single/sdbox-file.c Fri Jan 27 15:44:06 2012 +0200 @@ -13,6 +13,7 @@ #include "sdbox-file.h" #include +#include static void sdbox_file_init_paths(struct sdbox_file *file, const char *fname) { @@ -271,6 +272,7 @@ struct ostream *output; const char *dest_dir, *temp_path, *dest_path, *p; struct stat st; + struct utimbuf ut; bool deleted; int out_fd, ret = 0; @@ -335,6 +337,14 @@ (void)unlink(temp_path); return -1; } + /* preserve the original atime/mtime. this isn't necessary for Dovecot, + but could be useful for external reasons. */ + ut.actime = st.st_atime; + ut.modtime = st.st_mtime; + if (utime(temp_path, &ut) < 0) { + mail_storage_set_critical(storage, + "utime(%s) failed: %m", temp_path); + } /* the temp file was successfully written. rename it now to the destination file. the destination shouldn't exist, but if it does From dovecot at dovecot.org Fri Jan 27 15:44:30 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 15:44:30 +0200 Subject: dovecot-2.0: sdbox: Preserve file's atime/mtime when moving it t... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5eb5c9b9d88b changeset: 13029:5eb5c9b9d88b user: Timo Sirainen date: Fri Jan 27 15:44:06 2012 +0200 description: sdbox: Preserve file's atime/mtime when moving it to alt storage. diffstat: src/lib-storage/index/dbox-single/sdbox-file.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diffs (34 lines): diff -r ac8b3da5dd07 -r 5eb5c9b9d88b src/lib-storage/index/dbox-single/sdbox-file.c --- a/src/lib-storage/index/dbox-single/sdbox-file.c Fri Jan 27 14:35:38 2012 +0200 +++ b/src/lib-storage/index/dbox-single/sdbox-file.c Fri Jan 27 15:44:06 2012 +0200 @@ -13,6 +13,7 @@ #include "sdbox-file.h" #include +#include static void sdbox_file_init_paths(struct sdbox_file *file, const char *fname) { @@ -270,6 +271,7 @@ struct ostream *output; const char *dest_dir, *temp_path, *dest_path, *p; struct stat st; + struct utimbuf ut; bool deleted; int out_fd, ret = 0; @@ -334,6 +336,14 @@ (void)unlink(temp_path); return -1; } + /* preserve the original atime/mtime. this isn't necessary for Dovecot, + but could be useful for external reasons. */ + ut.actime = st.st_atime; + ut.modtime = st.st_mtime; + if (utime(temp_path, &ut) < 0) { + mail_storage_set_critical(storage, + "utime(%s) failed: %m", temp_path); + } /* the temp file was successfully written. rename it now to the destination file. the destination shouldn't exist, but if it does From dovecot at dovecot.org Fri Jan 27 17:16:53 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 17:16:53 +0200 Subject: dovecot-2.1: dovecot-config: Added missing lib-dns and lib-fs to... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7767d168c994 changeset: 14010:7767d168c994 user: Timo Sirainen date: Fri Jan 27 17:16:46 2012 +0200 description: dovecot-config: Added missing lib-dns and lib-fs to LIBDOVECOT_INCLUDE diffstat: dovecot-config.in.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 10320252b521 -r 7767d168c994 dovecot-config.in.in --- a/dovecot-config.in.in Fri Jan 27 15:44:06 2012 +0200 +++ b/dovecot-config.in.in Fri Jan 27 17:16:46 2012 +0200 @@ -15,7 +15,7 @@ LIBDOVECOT_LDA_DEPS="@LIBDOVECOT_LDA@" LIBDOVECOT_STORAGE_DEPS="@LIBDOVECOT_STORAGE@" -LIBDOVECOT_INCLUDE="-I$(incdir) -I$(incdir)/src/lib -I$(incdir)/src/lib-dict -I$(incdir)/src/lib-mail -I$(incdir)/src/lib-imap -I$(incdir)/src/lib-charset" +LIBDOVECOT_INCLUDE="-I$(incdir) -I$(incdir)/src/lib -I$(incdir)/src/lib-dict -I$(incdir)/src/lib-dns -I$(incdir)/src/lib-mail -I$(incdir)/src/lib-imap -I$(incdir)/src/lib-fs -I$(incdir)/src/lib-charset" LIBDOVECOT_LDA_INCLUDE="-I$(incdir)/src/lib-lda -I$(incdir)/src/lda" LIBDOVECOT_SERVICE_INCLUDE="-I$(incdir)/src/lib-master -I$(incdir)/src/lib-settings" LIBDOVECOT_STORAGE_INCLUDE="-I$(incdir)/src/lib-index -I$(incdir)/src/lib-storage -I$(incdir)/src/lib-storage/index -I$(incdir)/src/lib-storage/index/raw" From dovecot at dovecot.org Fri Jan 27 17:17:07 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 17:17:07 +0200 Subject: dovecot-2.0: dovecot-config: Added missing lib-dns and lib-fs to... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/352bc0c6e0c9 changeset: 13030:352bc0c6e0c9 user: Timo Sirainen date: Fri Jan 27 17:16:46 2012 +0200 description: dovecot-config: Added missing lib-dns and lib-fs to LIBDOVECOT_INCLUDE diffstat: dovecot-config.in.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 5eb5c9b9d88b -r 352bc0c6e0c9 dovecot-config.in.in --- a/dovecot-config.in.in Fri Jan 27 15:44:06 2012 +0200 +++ b/dovecot-config.in.in Fri Jan 27 17:16:46 2012 +0200 @@ -15,7 +15,7 @@ LIBDOVECOT_LDA_DEPS="@LIBDOVECOT_LDA@" LIBDOVECOT_STORAGE_DEPS="@LIBDOVECOT_STORAGE@" -LIBDOVECOT_INCLUDE="-I$(incdir) -I$(incdir)/src/lib -I$(incdir)/src/lib-dict -I$(incdir)/src/lib-mail -I$(incdir)/src/lib-imap -I$(incdir)/src/lib-charset" +LIBDOVECOT_INCLUDE="-I$(incdir) -I$(incdir)/src/lib -I$(incdir)/src/lib-dict -I$(incdir)/src/lib-dns -I$(incdir)/src/lib-mail -I$(incdir)/src/lib-imap -I$(incdir)/src/lib-fs -I$(incdir)/src/lib-charset" LIBDOVECOT_LDA_INCLUDE="-I$(incdir)/src/lib-lda -I$(incdir)/src/lda" LIBDOVECOT_SERVICE_INCLUDE="-I$(incdir)/src/lib-master -I$(incdir)/src/lib-settings" LIBDOVECOT_STORAGE_INCLUDE="-I$(incdir)/src/lib-index -I$(incdir)/src/lib-storage -I$(incdir)/src/lib-storage/index -I$(incdir)/src/lib-storage/index/raw" From pigeonhole at rename-it.nl Fri Jan 27 18:22:23 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 27 Jan 2012 17:22:23 +0100 Subject: dovecot-2.1-pigeonhole: testsuite: fixed compile warning. Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/a130a50f82e1 changeset: 1598:a130a50f82e1 user: Stephan Bosch date: Fri Jan 27 17:22:17 2012 +0100 description: testsuite: fixed compile warning. diffstat: src/testsuite/cmd-test-message.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diffs (25 lines): diff -r bc5acd9e957e -r a130a50f82e1 src/testsuite/cmd-test-message.c --- a/src/testsuite/cmd-test-message.c Mon Jan 23 00:43:37 2012 +0100 +++ b/src/testsuite/cmd-test-message.c Fri Jan 27 17:22:17 2012 +0100 @@ -495,14 +495,17 @@ } printf("\n--MESSAGE: \n"); - + /* Pipe the message to the outgoing SMTP transport */ while ((ret=i_stream_read_data(input, &data, &size, 0)) > 0) { - write(1, data, size); - i_stream_skip(input, size); + ssize_t wret; + + if ( (wret=write(1, data, size)) <= 0 ) + break; + i_stream_skip(input, wret); } printf("\n--MESSAGE--\n"); - + return SIEVE_EXEC_OK; } From dovecot at dovecot.org Fri Jan 27 19:32:48 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 19:32:48 +0200 Subject: dovecot-2.1: login proxy: If remote auth fails, say so in discon... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/cb344eb79daa changeset: 14011:cb344eb79daa user: Timo Sirainen date: Fri Jan 27 19:31:58 2012 +0200 description: login proxy: If remote auth fails, say so in disconnect message instead of "internal failure". diffstat: src/imap-login/imap-proxy.c | 1 + src/login-common/client-common.c | 2 ++ src/login-common/client-common.h | 1 + src/pop3-login/pop3-proxy.c | 1 + 4 files changed, 5 insertions(+), 0 deletions(-) diffs (45 lines): diff -r 7767d168c994 -r cb344eb79daa src/imap-login/imap-proxy.c --- a/src/imap-login/imap-proxy.c Fri Jan 27 17:16:46 2012 +0200 +++ b/src/imap-login/imap-proxy.c Fri Jan 27 19:31:58 2012 +0200 @@ -264,6 +264,7 @@ AUTH_FAILED_MSG); } + client->proxy_auth_failed = TRUE; client_proxy_failed(client, FALSE); return -1; } else if (strncasecmp(line, "* CAPABILITY ", 13) == 0) { diff -r 7767d168c994 -r cb344eb79daa src/login-common/client-common.c --- a/src/login-common/client-common.c Fri Jan 27 17:16:46 2012 +0200 +++ b/src/login-common/client-common.c Fri Jan 27 19:31:58 2012 +0200 @@ -562,6 +562,8 @@ if (client->auth_process_comm_fail) return "(auth process communication failure)"; + if (client->proxy_auth_failed) + return "(proxy dest auth failed)"; if (client->auth_successes > 0) { return t_strdup_printf("(internal failure, %u succesful auths)", client->auth_successes); diff -r 7767d168c994 -r cb344eb79daa src/login-common/client-common.h --- a/src/login-common/client-common.h Fri Jan 27 17:16:46 2012 +0200 +++ b/src/login-common/client-common.h Fri Jan 27 19:31:58 2012 +0200 @@ -134,6 +134,7 @@ unsigned int auth_try_aborted:1; unsigned int auth_initializing:1; unsigned int auth_process_comm_fail:1; + unsigned int proxy_auth_failed:1; unsigned int auth_waiting:1; /* ... */ }; diff -r 7767d168c994 -r cb344eb79daa src/pop3-login/pop3-proxy.c --- a/src/pop3-login/pop3-proxy.c Fri Jan 27 17:16:46 2012 +0200 +++ b/src/pop3-login/pop3-proxy.c Fri Jan 27 19:31:58 2012 +0200 @@ -156,6 +156,7 @@ line += 5; client_proxy_log_failure(client, line); } + client->proxy_auth_failed = TRUE; client_proxy_failed(client, FALSE); return -1; } From pigeonhole at rename-it.nl Fri Jan 27 19:59:13 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Fri, 27 Jan 2012 18:59:13 +0100 Subject: dovecot-2.1-pigeonhole: managesieve-login: matched proxy and aut... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/968410a02493 changeset: 1599:968410a02493 user: Stephan Bosch date: Fri Jan 27 18:57:42 2012 +0100 description: managesieve-login: matched proxy and auth_verbose changes in Dovecot. diffstat: src/managesieve-login/managesieve-proxy.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (29 lines): diff -r a130a50f82e1 -r 968410a02493 src/managesieve-login/managesieve-proxy.c --- a/src/managesieve-login/managesieve-proxy.c Fri Jan 27 17:22:17 2012 +0100 +++ b/src/managesieve-login/managesieve-proxy.c Fri Jan 27 18:57:42 2012 +0100 @@ -325,13 +325,13 @@ (void)client_skip_line(msieve_client); client_proxy_finish_destroy_client(client); - + return 1; - } - + } + /* Login failed */ - if ( client->set->verbose_auth ) { + if ( client->set->auth_verbose ) { const char *log_line = line; if (strncasecmp(log_line, "NO ", 3) == 0) @@ -347,6 +347,7 @@ */ client_send_no(client, AUTH_FAILED_MSG); + client->proxy_auth_failed = TRUE; client_proxy_failed(client, FALSE); return -1; From dovecot at dovecot.org Fri Jan 27 21:52:42 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 21:52:42 +0200 Subject: dovecot-2.1: auth: If parsing passwd-file takes a long time, log... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/e9a816eaa0e2 changeset: 14012:e9a816eaa0e2 user: Timo Sirainen date: Fri Jan 27 21:52:30 2012 +0200 description: auth: If parsing passwd-file takes a long time, log a warning. diffstat: src/auth/db-passwd-file.c | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) diffs (78 lines): diff -r cb344eb79daa -r e9a816eaa0e2 src/auth/db-passwd-file.c --- a/src/auth/db-passwd-file.c Fri Jan 27 19:31:58 2012 +0200 +++ b/src/auth/db-passwd-file.c Fri Jan 27 21:52:30 2012 +0200 @@ -17,8 +17,12 @@ #include #include #include +#include #include +#define PARSE_TIME_STARTUP_WARN_SECS 60 +#define PARSE_TIME_RELOAD_WARN_SECS 10 + static struct db_passwd_file *passwd_files; static void passwd_file_add(struct passwd_file *pw, const char *username, @@ -155,12 +159,14 @@ return pw; } -static bool passwd_file_open(struct passwd_file *pw) +static bool passwd_file_open(struct passwd_file *pw, bool startup) { const char *no_args = NULL; struct istream *input; const char *line; struct stat st; + time_t start_time, end_time; + unsigned int time_secs; int fd; fd = open(pw->path, O_RDONLY); @@ -189,6 +195,7 @@ pw->users = hash_table_create(default_pool, pw->pool, 100, str_hash, (hash_cmp_callback_t *)strcmp); + start_time = time(NULL); input = i_stream_create_fd(pw->fd, 4096, FALSE); i_stream_set_return_partial_line(input, TRUE); while ((line = i_stream_read_next_line(input)) != NULL) { @@ -207,10 +214,16 @@ } T_END; } i_stream_destroy(&input); + end_time = time(NULL); + time_secs = end_time - start_time; - if (pw->db->debug) { - i_debug("passwd-file %s: Read %u users", - pw->path, hash_table_count(pw->users)); + if ((time_secs > PARSE_TIME_STARTUP_WARN_SECS && startup) || + (time_secs > PARSE_TIME_RELOAD_WARN_SECS && !startup)) { + i_warning("passwd-file %s: Reading %u users took %u secs", + pw->path, hash_table_count(pw->users), time_secs); + } else if (pw->db->debug) { + i_debug("passwd-file %s: Read %u users in %u secs", + pw->path, hash_table_count(pw->users), time_secs); } return TRUE; } @@ -260,7 +273,7 @@ if (st.st_mtime != pw->stamp || st.st_size != pw->size) { passwd_file_close(pw); - return passwd_file_open(pw); + return passwd_file_open(pw, FALSE); } return TRUE; } @@ -334,7 +347,7 @@ { if (db->default_file != NULL && db->default_file->stamp == 0) { /* no variables, open the file immediately */ - (void)passwd_file_open(db->default_file); + (void)passwd_file_open(db->default_file, TRUE); } } From dovecot at dovecot.org Fri Jan 27 22:15:46 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 22:15:46 +0200 Subject: dovecot-2.1: auth: Monitor how fast userdb passwd lookups are. I... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c9b5ea1b9709 changeset: 14013:c9b5ea1b9709 user: Timo Sirainen date: Fri Jan 27 22:15:29 2012 +0200 description: auth: Monitor how fast userdb passwd lookups are. If they're too slow, suggest blocking=yes diffstat: src/auth/userdb-passwd.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 1 deletions(-) diffs (96 lines): diff -r e9a816eaa0e2 -r c9b5ea1b9709 src/auth/userdb-passwd.c --- a/src/auth/userdb-passwd.c Fri Jan 27 21:52:30 2012 +0200 +++ b/src/auth/userdb-passwd.c Fri Jan 27 22:15:29 2012 +0200 @@ -7,13 +7,21 @@ #include "ioloop.h" #include "ipwd.h" +#include "time-util.h" #include "userdb-template.h" #define USER_CACHE_KEY "%u" +#define PASSWD_SLOW_WARN_MSECS (10*1000) +#define PASSWD_SLOW_MASTER_WARN_MSECS 50 +#define PASSDB_SLOW_MASTER_WARN_COUNT_INTERVAL 100 +#define PASSDB_SLOW_MASTER_WARN_MIN_PERCENTAGE 5 struct passwd_userdb_module { struct userdb_module module; struct userdb_template *tmpl; + + unsigned int fast_count, slow_count; + unsigned int slow_warned:1; }; struct passwd_userdb_iterate_context { @@ -24,6 +32,50 @@ static struct passwd_userdb_iterate_context *cur_userdb_iter = NULL; static struct timeout *cur_userdb_iter_to = NULL; +static void +passwd_check_warnings(struct auth_request *auth_request, + struct passwd_userdb_module *module, + const struct timeval *start_tv) +{ + struct timeval end_tv; + unsigned int msecs, percentage; + + if (gettimeofday(&end_tv, NULL) < 0) + return; + + msecs = timeval_diff_msecs(&end_tv, start_tv); + if (msecs >= PASSWD_SLOW_WARN_MSECS) { + i_warning("passwd: Lookup for %s took %u secs", + auth_request->user, msecs/1000); + return; + } + if (worker || module->slow_warned) + return; + + if (msecs < PASSWD_SLOW_MASTER_WARN_MSECS) { + module->fast_count++; + return; + } + module->slow_count++; + if (module->fast_count + module->slow_count < + PASSDB_SLOW_MASTER_WARN_COUNT_INTERVAL) + return; + + percentage = module->slow_count * 100 / + (module->slow_count + module->fast_count); + if (percentage < PASSDB_SLOW_MASTER_WARN_MIN_PERCENTAGE) { + /* start from beginning */ + module->slow_count = module->fast_count = 0; + } else { + i_warning("passwd: %u%% of last %u lookups took over " + "%u milliseconds, " + "you may want to set blocking=yes for userdb", + percentage, PASSDB_SLOW_MASTER_WARN_COUNT_INTERVAL, + PASSWD_SLOW_MASTER_WARN_MSECS); + module->slow_warned = TRUE; + } +} + static void passwd_lookup(struct auth_request *auth_request, userdb_callback_t *callback) { @@ -31,10 +83,18 @@ struct passwd_userdb_module *module = (struct passwd_userdb_module *)_module; struct passwd pw; + struct timeval start_tv; + int ret; auth_request_log_debug(auth_request, "passwd", "lookup"); - switch (i_getpwnam(auth_request->user, &pw)) { + if (gettimeofday(&start_tv, NULL) < 0) + start_tv.tv_sec = 0; + ret = i_getpwnam(auth_request->user, &pw); + if (start_tv.tv_sec != 0) + passwd_check_warnings(auth_request, module, &start_tv); + + switch (ret) { case -1: auth_request_log_error(auth_request, "passwd", "getpwnam() failed: %m"); From dovecot at dovecot.org Fri Jan 27 23:33:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 23:33:16 +0200 Subject: dovecot-2.1: master: Make service throttling seconds incremental... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/c553725d57bb changeset: 14015:c553725d57bb user: Timo Sirainen date: Fri Jan 27 23:26:42 2012 +0200 description: master: Make service throttling seconds incremental, starting from 2 secs. diffstat: src/master/service-monitor.c | 13 ++++++++++--- src/master/service.c | 1 + src/master/service.h | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diffs (69 lines): diff -r 300736775b89 -r c553725d57bb src/master/service-monitor.c --- a/src/master/service-monitor.c Fri Jan 27 23:22:22 2012 +0200 +++ b/src/master/service-monitor.c Fri Jan 27 23:26:42 2012 +0200 @@ -20,7 +20,6 @@ #include #include -#define SERVICE_STARTUP_FAILURE_THROTTLE_SECS 60 #define SERVICE_DROP_WARN_INTERVAL_SECS 60 #define SERVICE_DROP_TIMEOUT_MSECS (10*1000) #define MAX_DIE_WAIT_SECS 5 @@ -197,8 +196,14 @@ if (service->to_throttle != NULL) return; - service_error(service, "command startup failed, throttling"); - service_throttle(service, SERVICE_STARTUP_FAILURE_THROTTLE_SECS); + i_assert(service->throttle_secs > 0); + + service_error(service, "command startup failed, throttling for %u secs", + service->throttle_secs); + service_throttle(service, service->throttle_secs); + service->throttle_secs *= 2; + if (service->throttle_secs > SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS) + service->throttle_secs = SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS; } static void service_drop_timeout(struct service *service) @@ -564,6 +569,8 @@ service_monitor_listen_start(service); /* one success resets all failures */ service->exit_failures_in_sec = 0; + service->throttle_secs = + SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS; throttle = FALSE; } else { throttle = service_process_failure(process, status); diff -r 300736775b89 -r c553725d57bb src/master/service.c --- a/src/master/service.c Fri Jan 27 23:22:22 2012 +0200 +++ b/src/master/service.c Fri Jan 27 23:26:42 2012 +0200 @@ -218,6 +218,7 @@ service = p_new(pool, struct service, 1); service->list = service_list; service->set = set; + service->throttle_secs = SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS; service->client_limit = set->client_limit != 0 ? set->client_limit : set->master_set->default_client_limit; diff -r 300736775b89 -r c553725d57bb src/master/service.h --- a/src/master/service.h Fri Jan 27 23:22:22 2012 +0200 +++ b/src/master/service.h Fri Jan 27 23:26:42 2012 +0200 @@ -8,6 +8,9 @@ this many seconds, kill the process */ #define SERVICE_FIRST_STATUS_TIMEOUT_SECS 30 +#define SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS 2 +#define SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS 60 + enum service_listener_type { SERVICE_LISTENER_UNIX, SERVICE_LISTENER_FIFO, @@ -80,6 +83,7 @@ int status_fd[2]; struct io *io_status; + unsigned int throttle_secs; time_t exit_failure_last; unsigned int exit_failures_in_sec; From dovecot at dovecot.org Fri Jan 27 23:33:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 23:33:16 +0200 Subject: dovecot-2.1: master: If 10 service processes die within a second... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/300736775b89 changeset: 14014:300736775b89 user: Timo Sirainen date: Fri Jan 27 23:22:22 2012 +0200 description: master: If 10 service processes die within a second with no successes inbetween, throttle the service. diffstat: src/master/service-monitor.c | 10 ++++++++++ src/master/service.h | 3 +++ 2 files changed, 13 insertions(+), 0 deletions(-) diffs (51 lines): diff -r c9b5ea1b9709 -r 300736775b89 src/master/service-monitor.c --- a/src/master/service-monitor.c Fri Jan 27 22:15:29 2012 +0200 +++ b/src/master/service-monitor.c Fri Jan 27 23:22:22 2012 +0200 @@ -24,6 +24,7 @@ #define SERVICE_DROP_WARN_INTERVAL_SECS 60 #define SERVICE_DROP_TIMEOUT_MSECS (10*1000) #define MAX_DIE_WAIT_SECS 5 +#define SERVICE_MAX_EXIT_FAILURES_IN_SEC 10 static void service_monitor_start_extra_avail(struct service *service); static void service_status_more(struct service_process *process, @@ -524,10 +525,17 @@ static bool service_process_failure(struct service_process *process, int status) { + struct service *service = process->service; bool throttle; service_process_log_status_error(process, status); throttle = process->to_status != NULL; + if (service->exit_failure_last != ioloop_time) { + service->exit_failure_last = ioloop_time; + service->exit_failures_in_sec = 0; + } + if (++service->exit_failures_in_sec > SERVICE_MAX_EXIT_FAILURES_IN_SEC) + throttle = TRUE; service_process_notify_add(service_anvil_global->kills, process); return throttle; } @@ -554,6 +562,8 @@ if (service->listen_pending && !service->list->destroying) service_monitor_listen_start(service); + /* one success resets all failures */ + service->exit_failures_in_sec = 0; throttle = FALSE; } else { throttle = service_process_failure(process, status); diff -r c9b5ea1b9709 -r 300736775b89 src/master/service.h --- a/src/master/service.h Fri Jan 27 22:15:29 2012 +0200 +++ b/src/master/service.h Fri Jan 27 23:22:22 2012 +0200 @@ -80,6 +80,9 @@ int status_fd[2]; struct io *io_status; + time_t exit_failure_last; + unsigned int exit_failures_in_sec; + /* Login process's notify fd. We change its seek position to communicate state to login processes. */ int login_notify_fd; From dovecot at dovecot.org Fri Jan 27 23:33:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 27 Jan 2012 23:33:16 +0200 Subject: dovecot-2.1: master: Throttle rapid exit failures only if there ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/85a9b5236b6c changeset: 14016:85a9b5236b6c user: Timo Sirainen date: Fri Jan 27 23:33:00 2012 +0200 description: master: Throttle rapid exit failures only if there have never been any exit successes. This should still catch buggy services without allowing intentional DoSing. diffstat: src/master/service-monitor.c | 18 +++++++++++++----- src/master/service.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diffs (48 lines): diff -r c553725d57bb -r 85a9b5236b6c src/master/service-monitor.c --- a/src/master/service-monitor.c Fri Jan 27 23:26:42 2012 +0200 +++ b/src/master/service-monitor.c Fri Jan 27 23:33:00 2012 +0200 @@ -535,12 +535,19 @@ service_process_log_status_error(process, status); throttle = process->to_status != NULL; - if (service->exit_failure_last != ioloop_time) { - service->exit_failure_last = ioloop_time; - service->exit_failures_in_sec = 0; + if (!throttle && !service->have_successful_exits) { + /* this service has seen no successful exits yet. + try to avoid failure storms by throttling the service if it + only keeps failing rapidly. this is no longer done after + one success to avoid intentional DoSing, in case attacker + finds a way to quickly crash his own session. */ + if (service->exit_failure_last != ioloop_time) { + service->exit_failure_last = ioloop_time; + service->exit_failures_in_sec = 0; + } + if (++service->exit_failures_in_sec > SERVICE_MAX_EXIT_FAILURES_IN_SEC) + throttle = TRUE; } - if (++service->exit_failures_in_sec > SERVICE_MAX_EXIT_FAILURES_IN_SEC) - throttle = TRUE; service_process_notify_add(service_anvil_global->kills, process); return throttle; } @@ -568,6 +575,7 @@ !service->list->destroying) service_monitor_listen_start(service); /* one success resets all failures */ + service->have_successful_exits = TRUE; service->exit_failures_in_sec = 0; service->throttle_secs = SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS; diff -r c553725d57bb -r 85a9b5236b6c src/master/service.h --- a/src/master/service.h Fri Jan 27 23:26:42 2012 +0200 +++ b/src/master/service.h Fri Jan 27 23:33:00 2012 +0200 @@ -111,6 +111,8 @@ unsigned int have_inet_listeners:1; /* service_login_notify()'s last notification state */ unsigned int last_login_full_notify:1; + /* service has exited at least once with exit code 0 */ + unsigned int have_successful_exits:1; }; struct service_list { From pigeonhole at rename-it.nl Sat Jan 28 15:32:35 2012 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 28 Jan 2012 14:32:35 +0100 Subject: dovecot-2.1-pigeonhole: ManageSieve: cleaned up parser and updat... Message-ID: details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/b2a456e15ed5 changeset: 1600:b2a456e15ed5 user: Stephan Bosch date: Sat Jan 28 14:25:41 2012 +0100 description: ManageSieve: cleaned up parser and updated it to match newer structure of imap parser. diffstat: src/lib-managesieve/Makefile.am | 2 + src/lib-managesieve/managesieve-arg.c | 129 +++++++++++++++++++++ src/lib-managesieve/managesieve-arg.h | 111 ++++++++++++++++++ src/lib-managesieve/managesieve-parser.c | 172 +++++++++------------------- src/lib-managesieve/managesieve-parser.h | 91 +-------------- src/managesieve-login/client-authenticate.c | 17 +- src/managesieve-login/client-authenticate.h | 4 +- src/managesieve-login/client.c | 23 ++- src/managesieve-login/managesieve-proxy.c | 23 ++- src/managesieve/cmd-havespace.c | 6 +- src/managesieve/cmd-noop.c | 8 +- src/managesieve/cmd-putscript.c | 9 +- src/managesieve/managesieve-client.c | 15 +- src/managesieve/managesieve-client.h | 9 +- 14 files changed, 358 insertions(+), 261 deletions(-) diffs (truncated from 1089 to 300 lines): diff -r 968410a02493 -r b2a456e15ed5 src/lib-managesieve/Makefile.am --- a/src/lib-managesieve/Makefile.am Fri Jan 27 18:57:42 2012 +0100 +++ b/src/lib-managesieve/Makefile.am Sat Jan 28 14:25:41 2012 +0100 @@ -5,9 +5,11 @@ -I$(top_srcdir) libmanagesieve_a_SOURCES = \ + managesieve-arg.c \ managesieve-quote.c \ managesieve-parser.c noinst_HEADERS = \ + managesieve-arg.h \ managesieve-quote.h \ managesieve-parser.h diff -r 968410a02493 -r b2a456e15ed5 src/lib-managesieve/managesieve-arg.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-managesieve/managesieve-arg.c Sat Jan 28 14:25:41 2012 +0100 @@ -0,0 +1,129 @@ +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file + */ + +#include "lib.h" +#include "managesieve-arg.h" + +bool managesieve_arg_get_atom +(const struct managesieve_arg *arg, const char **str_r) +{ + if (arg->type != MANAGESIEVE_ARG_ATOM) + return FALSE; + + *str_r = arg->_data.str; + return TRUE; +} + +bool managesieve_arg_get_number +(const struct managesieve_arg *arg, uoff_t *number_r) +{ + const char *data; + uoff_t num = 0; + size_t i; + + if ( arg->type != MANAGESIEVE_ARG_ATOM ) + return FALSE; + + data = arg->_data.str; + for ( i = 0; i < arg->str_len; i++ ) { + uoff_t newnum; + + if (data[i] < '0' || data[i] > '9') + return FALSE; + + newnum = num*10 + (data[i] -'0'); + if ( newnum < num ) + return FALSE; + + num = newnum; + } + + *number_r = num; + return TRUE; +} + +bool managesieve_arg_get_quoted +(const struct managesieve_arg *arg, const char **str_r) +{ + if (arg->type != MANAGESIEVE_ARG_STRING) + return FALSE; + + *str_r = arg->_data.str; + return TRUE; +} + +bool managesieve_arg_get_string +(const struct managesieve_arg *arg, const char **str_r) +{ + if (arg->type != MANAGESIEVE_ARG_STRING + && arg->type != MANAGESIEVE_ARG_LITERAL) + return FALSE; + + *str_r = arg->_data.str; + return TRUE; +} + +bool managesieve_arg_get_string_stream +(const struct managesieve_arg *arg, struct istream **stream_r) +{ + if ( arg->type != MANAGESIEVE_ARG_STRING_STREAM ) + return FALSE; + + *stream_r = arg->_data.str_stream; + return TRUE; +} + +bool managesieve_arg_get_list +(const struct managesieve_arg *arg, const struct managesieve_arg **list_r) +{ + unsigned int count; + + return managesieve_arg_get_list_full(arg, list_r, &count); +} + +bool managesieve_arg_get_list_full +(const struct managesieve_arg *arg, const struct managesieve_arg **list_r, + unsigned int *list_count_r) +{ + unsigned int count; + + if (arg->type != MANAGESIEVE_ARG_LIST) + return FALSE; + + *list_r = array_get(&arg->_data.list, &count); + + /* drop MANAGESIEVE_ARG_EOL from list size */ + i_assert(count > 0); + *list_count_r = count - 1; + return TRUE; +} + +struct istream *managesieve_arg_as_string_stream +(const struct managesieve_arg *arg) +{ + struct istream *stream; + + if (!managesieve_arg_get_string_stream(arg, &stream)) + i_unreached(); + return stream; +} + +const struct managesieve_arg * +managesieve_arg_as_list(const struct managesieve_arg *arg) +{ + const struct managesieve_arg *ret; + + if (!managesieve_arg_get_list(arg, &ret)) + i_unreached(); + return ret; +} + +bool managesieve_arg_atom_equals +(const struct managesieve_arg *arg, const char *str) +{ + const char *value; + + if (!managesieve_arg_get_atom(arg, &value)) + return FALSE; + return strcasecmp(value, str) == 0; +} diff -r 968410a02493 -r b2a456e15ed5 src/lib-managesieve/managesieve-arg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-managesieve/managesieve-arg.h Sat Jan 28 14:25:41 2012 +0100 @@ -0,0 +1,111 @@ +/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file + */ + +#ifndef __MANAGESIEVE_ARG_H +#define __MANAGESIEVE_ARG_H + +#include "array.h" + +/* + * QUOTED-SPECIALS = <"> / "\" + */ +#define IS_QUOTED_SPECIAL(c) \ + ((c) == '"' || (c) == '\\') + +/* + * ATOM-SPECIALS = "(" / ")" / "{" / SP / CTL / QUOTED-SPECIALS + */ +#define IS_ATOM_SPECIAL(c) \ + ((c) == '(' || (c) == ')' || (c) == '{' || \ + (c) <= 32 || (c) == 0x7f || \ + IS_QUOTED_SPECIAL(c)) + +/* + * CHAR = %x01-7F + */ +#define IS_CHAR(c) \ + (((c) & 0x80) == 0) + +/* + * TEXT-CHAR = %x01-09 / %x0B-0C / %x0E-7F + * ;; any CHAR except CR and LF + */ +#define IS_TEXT_CHAR(c) \ + (IS_CHAR(c) && (c) != '\r' && (c) != '\n') + +/* + * SAFE-CHAR = %x01-09 / %x0B-0C / %x0E-21 / + * %x23-5B / %x5D-7F + * ;; any TEXT-CHAR except QUOTED-SPECIALS + */ +#define IS_SAFE_CHAR(c) \ + (IS_TEXT_CHAR(c) && !IS_QUOTED_SPECIAL(c)) + +enum managesieve_arg_type { + MANAGESIEVE_ARG_NONE = 0, + MANAGESIEVE_ARG_ATOM, + MANAGESIEVE_ARG_STRING, + MANAGESIEVE_ARG_STRING_STREAM, + + MANAGESIEVE_ARG_LIST, + + /* literals are returned as MANAGESIEVE_ARG_STRING by default */ + MANAGESIEVE_ARG_LITERAL, + + MANAGESIEVE_ARG_EOL /* end of argument list */ +}; + +ARRAY_DEFINE_TYPE(managesieve_arg_list, struct managesieve_arg); +struct managesieve_arg { + enum managesieve_arg_type type; + struct managesieve_arg *parent; /* always of type MANAGESIEVE_ARG_LIST */ + + /* Set when _data.str is set */ + size_t str_len; + + union { + const char *str; + struct istream *str_stream; + ARRAY_TYPE(managesieve_arg_list) list; + } _data; +}; + +#define MANAGESIEVE_ARG_IS_EOL(arg) \ + ((arg)->type == MANAGESIEVE_ARG_EOL) + +bool managesieve_arg_get_atom + (const struct managesieve_arg *arg, const char **str_r) + ATTR_WARN_UNUSED_RESULT; +bool managesieve_arg_get_number + (const struct managesieve_arg *arg, uoff_t *number_r) + ATTR_WARN_UNUSED_RESULT; +bool managesieve_arg_get_quoted + (const struct managesieve_arg *arg, const char **str_r) + ATTR_WARN_UNUSED_RESULT; +bool managesieve_arg_get_string + (const struct managesieve_arg *arg, const char **str_r) + ATTR_WARN_UNUSED_RESULT; + +bool managesieve_arg_get_string_stream + (const struct managesieve_arg *arg, struct istream **stream_r) + ATTR_WARN_UNUSED_RESULT; + +bool managesieve_arg_get_list + (const struct managesieve_arg *arg, const struct managesieve_arg **list_r) + ATTR_WARN_UNUSED_RESULT; +bool managesieve_arg_get_list_full + (const struct managesieve_arg *arg, const struct managesieve_arg **list_r, + unsigned int *list_count_r) + ATTR_WARN_UNUSED_RESULT; + +/* Similar to above, but assumes that arg is already of correct type. */ +struct istream *managesieve_arg_as_string_stream + (const struct managesieve_arg *arg); +const struct managesieve_arg *managesieve_arg_as_list + (const struct managesieve_arg *arg); + +/* Returns TRUE if arg is atom and case-insensitively matches str */ +bool managesieve_arg_atom_equals + (const struct managesieve_arg *arg, const char *str); + +#endif diff -r 968410a02493 -r b2a456e15ed5 src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Fri Jan 27 18:57:42 2012 +0100 +++ b/src/lib-managesieve/managesieve-parser.c Sat Jan 28 14:25:41 2012 +0100 @@ -11,7 +11,7 @@ #define is_linebreak(c) \ ((c) == '\r' || (c) == '\n') -#define LIST_ALLOC_SIZE 7 +#define LIST_INIT_COUNT 7 enum arg_parse_type { ARG_PARSE_NONE = 0, @@ -30,8 +30,9 @@ /* reset by managesieve_parser_reset(): */ size_t line_size; - struct managesieve_arg_list *root_list; - struct managesieve_arg_list *cur_list; + ARRAY_TYPE(managesieve_arg_list) root_list; + ARRAY_TYPE(managesieve_arg_list) *cur_list; + struct managesieve_arg *list_arg; enum arg_parse_type cur_type; size_t cur_pos; /* parser position in input buffer */ @@ -52,22 +53,6 @@ static struct istream *quoted_string_istream_create (struct managesieve_parser *parser); -/* @UNSAFE */ -#define LIST_REALLOC(parser, old_list, new_size) \ - p_realloc((parser)->pool, old_list, \ - sizeof(struct managesieve_arg_list) + \ - (old_list == NULL ? 0 : \ - sizeof(struct managesieve_arg_list) * (old_list)->alloc), \ - sizeof(struct managesieve_arg_list) * (new_size)) - -static void managesieve_args_realloc(struct managesieve_parser *parser, size_t size) From dovecot at dovecot.org Sat Jan 28 19:01:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 19:01:06 +0200 Subject: dovecot-2.1: fs layout: Handle properly returning path when ther... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/5a14f5ddd1a2 changeset: 14017:5a14f5ddd1a2 user: Timo Sirainen date: Sat Jan 28 19:00:56 2012 +0200 description: fs layout: Handle properly returning path when there is no root dir. diffstat: src/lib-storage/list/mailbox-list-fs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 85a9b5236b6c -r 5a14f5ddd1a2 src/lib-storage/list/mailbox-list-fs.c --- a/src/lib-storage/list/mailbox-list-fs.c Fri Jan 27 23:33:00 2012 +0200 +++ b/src/lib-storage/list/mailbox-list-fs.c Sat Jan 28 19:00:56 2012 +0200 @@ -207,6 +207,8 @@ return set->inbox_path; } + if (root_dir == NULL) + return type == MAILBOX_LIST_PATH_TYPE_INDEX ? "" : NULL; if (*set->maildir_name == '\0') { return t_strdup_printf("%s/%s%s", root_dir, set->mailbox_dir_name, name); From dovecot at dovecot.org Sat Jan 28 19:25:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 19:25:40 +0200 Subject: dovecot-2.1: smtp client: Do DNS blocking lookups. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/32318f1588d4 changeset: 14019:32318f1588d4 user: Timo Sirainen date: Sat Jan 28 19:25:32 2012 +0200 description: smtp client: Do DNS blocking lookups. We don't currently have access to base_dir, so we can't know what the path to dns-client is. Also smtp client is a blocking operation anyway, so doing a blocking DNS lookup isn't a problem. diffstat: src/lib-lda/smtp-client.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diffs (11 lines): diff -r bc2eea348f55 -r 32318f1588d4 src/lib-lda/smtp-client.c --- a/src/lib-lda/smtp-client.c Sat Jan 28 19:24:17 2012 +0200 +++ b/src/lib-lda/smtp-client.c Sat Jan 28 19:25:32 2012 +0200 @@ -261,7 +261,6 @@ client_set.mail_from = smtp_client->return_path == NULL ? "<>" : t_strconcat("<", smtp_client->return_path, ">", NULL); client_set.my_hostname = smtp_client->set->hostname; - client_set.dns_client_socket_path = "dns-client"; ioloop = io_loop_create(); client = lmtp_client_init(&client_set, smtp_client_send_finished, From dovecot at dovecot.org Sat Jan 28 19:25:40 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 19:25:40 +0200 Subject: dovecot-2.1: smtp/lmtp client: If dns-client socket path isn't g... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/bc2eea348f55 changeset: 14018:bc2eea348f55 user: Timo Sirainen date: Sat Jan 28 19:24:17 2012 +0200 description: smtp/lmtp client: If dns-client socket path isn't given, use blocking lookup. diffstat: src/lib-lda/lmtp-client.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diffs (44 lines): diff -r 5a14f5ddd1a2 -r bc2eea348f55 src/lib-lda/lmtp-client.c --- a/src/lib-lda/lmtp-client.c Sat Jan 28 19:00:56 2012 +0200 +++ b/src/lib-lda/lmtp-client.c Sat Jan 28 19:24:17 2012 +0200 @@ -538,6 +538,9 @@ const char *host, unsigned int port) { struct dns_lookup_settings dns_lookup_set; + struct ip_addr *ips; + unsigned int ips_count; + int ret; client->input_state = LMTP_INPUT_STATE_GREET; client->host = p_strdup(client->pool, host); @@ -554,14 +557,26 @@ client->set.dns_client_socket_path; dns_lookup_set.timeout_msecs = LMTP_CLIENT_DNS_LOOKUP_TIMEOUT_MSECS; - if (net_addr2ip(host, &client->ip) < 0) { + if (net_addr2ip(host, &client->ip) == 0) { + /* IP address */ + } else if (dns_lookup_set.dns_client_socket_path == NULL) { + /* no dns-client, use blocking lookup */ + ret = net_gethostbyname(host, &ips, &ips_count); + if (ret != 0) { + i_error("lmtp client: DNS lookup of %s failed: %s", + client->host, net_gethosterror(ret)); + return -1; + } + client->ip = ips[0]; + } else { if (dns_lookup(host, &dns_lookup_set, lmtp_client_dns_done, client) < 0) return -1; - } else { - if (lmtp_client_connect(client) < 0) - return -1; + return 0; } + + if (lmtp_client_connect(client) < 0) + return -1; return 0; } From dovecot at dovecot.org Sat Jan 28 19:44:30 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 19:44:30 +0200 Subject: dovecot-2.1: dsync: Don't crash if one source has indexes disabled. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7b94d1c8a6e7 changeset: 14020:7b94d1c8a6e7 user: Timo Sirainen date: Sat Jan 28 19:44:24 2012 +0200 description: dsync: Don't crash if one source has indexes disabled. diffstat: src/doveadm/dsync/dsync-worker-local.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 32318f1588d4 -r 7b94d1c8a6e7 src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Sat Jan 28 19:25:32 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Sat Jan 28 19:44:24 2012 +0200 @@ -313,6 +313,8 @@ const struct mailbox_log_record *rec; log = mailbox_list_get_changelog(list); + if (log == NULL) + return 0; iter = mailbox_log_iter_init(log); while ((rec = mailbox_log_iter_next(iter)) != NULL) { switch (rec->type) { From dovecot at dovecot.org Sat Jan 28 19:48:53 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 19:48:53 +0200 Subject: dovecot-2.1: dsync: If brain fails but workers don't, exit witho... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/2a4b425b05dc changeset: 14021:2a4b425b05dc user: Timo Sirainen date: Sat Jan 28 19:48:48 2012 +0200 description: dsync: If brain fails but workers don't, exit without assert-crashing. diffstat: src/doveadm/dsync/dsync-brain.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r 7b94d1c8a6e7 -r 2a4b425b05dc src/doveadm/dsync/dsync-brain.c --- a/src/doveadm/dsync/dsync-brain.c Sat Jan 28 19:44:24 2012 +0200 +++ b/src/doveadm/dsync/dsync-brain.c Sat Jan 28 19:48:48 2012 +0200 @@ -894,8 +894,7 @@ old_state = brain->state; dsync_brain_sync(brain); - if (dsync_worker_has_failed(brain->src_worker) || - dsync_worker_has_failed(brain->dest_worker)) + if (dsync_brain_has_failed(brain)) break; i_assert(brain->state != old_state); From dovecot at dovecot.org Sat Jan 28 20:09:06 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 20:09:06 +0200 Subject: dovecot-2.1: restrict_access(): If privileged and primary GIDs a... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/9b8657a98e2e changeset: 14022:9b8657a98e2e user: Timo Sirainen date: Sat Jan 28 20:08:40 2012 +0200 description: restrict_access(): If privileged and primary GIDs are the same, ignore privileged GID. diffstat: src/lib/restrict-access.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diffs (14 lines): diff -r 2a4b425b05dc -r 9b8657a98e2e src/lib/restrict-access.c --- a/src/lib/restrict-access.c Sat Jan 28 19:48:48 2012 +0200 +++ b/src/lib/restrict-access.c Sat Jan 28 20:08:40 2012 +0200 @@ -267,6 +267,10 @@ /* set the primary/privileged group */ process_primary_gid = set->gid; process_privileged_gid = set->privileged_gid; + if (process_privileged_gid == process_primary_gid) { + /* a pointless configuration, ignore it */ + process_privileged_gid = (gid_t)-1; + } have_root_group = process_primary_gid == 0; if (process_primary_gid != (gid_t)-1 || From dovecot at dovecot.org Sat Jan 28 20:21:16 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 20:21:16 +0200 Subject: dovecot-2.1: lib-storage: Thread iteration no longer returns dum... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/67972d72b55c changeset: 14023:67972d72b55c user: Timo Sirainen date: Sat Jan 28 20:21:10 2012 +0200 description: lib-storage: Thread iteration no longer returns dummy nodes without children. This fixes returning (0) nodes to IMAP client. diffstat: src/lib-storage/index/index-thread-finish.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (15 lines): diff -r 9b8657a98e2e -r 67972d72b55c src/lib-storage/index/index-thread-finish.c --- a/src/lib-storage/index/index-thread-finish.c Sat Jan 28 20:08:40 2012 +0200 +++ b/src/lib-storage/index/index-thread-finish.c Sat Jan 28 20:21:10 2012 +0200 @@ -655,6 +655,11 @@ *child_iter_r = shadow->first_child_idx == 0 ? NULL : mail_thread_iterate_children(iter, child->idx); } + if (child->uid == 0 && *child_iter_r == NULL) { + /* this is a dummy node without children, + there's no point in returning it */ + return mail_thread_iterate_next(iter, child_iter_r); + } return child; } From dovecot at dovecot.org Sat Jan 28 20:21:39 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 20:21:39 +0200 Subject: dovecot-2.0: lib-storage: Thread iteration no longer returns dum... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/57498cad6ab9 changeset: 13031:57498cad6ab9 user: Timo Sirainen date: Sat Jan 28 20:21:10 2012 +0200 description: lib-storage: Thread iteration no longer returns dummy nodes without children. This fixes returning (0) nodes to IMAP client. diffstat: src/lib-storage/index/index-thread-finish.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (15 lines): diff -r 352bc0c6e0c9 -r 57498cad6ab9 src/lib-storage/index/index-thread-finish.c --- a/src/lib-storage/index/index-thread-finish.c Fri Jan 27 17:16:46 2012 +0200 +++ b/src/lib-storage/index/index-thread-finish.c Sat Jan 28 20:21:10 2012 +0200 @@ -655,6 +655,11 @@ *child_iter_r = shadow->first_child_idx == 0 ? NULL : mail_thread_iterate_children(iter, child->idx); } + if (child->uid == 0 && *child_iter_r == NULL) { + /* this is a dummy node without children, + there's no point in returning it */ + return mail_thread_iterate_next(iter, child_iter_r); + } return child; } From dovecot at dovecot.org Sat Jan 28 22:06:13 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 22:06:13 +0200 Subject: dovecot-2.1: sql: Fixed retrying query when multiple hosts were ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/6b902f2be944 changeset: 14024:6b902f2be944 user: Timo Sirainen date: Sat Jan 28 22:05:52 2012 +0200 description: sql: Fixed retrying query when multiple hosts were specified and all of them got disconnected. diffstat: src/lib-sql/driver-sqlpool.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (30 lines): diff -r 67972d72b55c -r 6b902f2be944 src/lib-sql/driver-sqlpool.c --- a/src/lib-sql/driver-sqlpool.c Sat Jan 28 20:21:10 2012 +0200 +++ b/src/lib-sql/driver-sqlpool.c Sat Jan 28 22:05:52 2012 +0200 @@ -47,7 +47,7 @@ time_t created; unsigned int host_idx; - unsigned int retried:1; + unsigned int retry_count; /* requests are a) queries */ char *query; @@ -609,13 +609,14 @@ struct sqlpool_request *request) { struct sqlpool_db *db = request->db; - const struct sqlpool_connection *conn; + const struct sqlpool_connection *conn = NULL; struct sql_db *conndb; - if (result->failed_try_retry && !request->retried) { + if (result->failed_try_retry && + request->retry_count < array_count(&db->hosts)) { i_error("%s: Query failed, retrying: %s", db->driver->name, sql_result_get_error(result)); - request->retried = TRUE; + request->retry_count++; driver_sqlpool_prepend_request(db, request); if (driver_sqlpool_get_connection(request->db, From dovecot at dovecot.org Sat Jan 28 22:06:47 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 22:06:47 +0200 Subject: dovecot-2.0: sql: Fixed retrying query when multiple hosts were ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/4e7676b890f1 changeset: 13032:4e7676b890f1 user: Timo Sirainen date: Sat Jan 28 22:05:52 2012 +0200 description: sql: Fixed retrying query when multiple hosts were specified and all of them got disconnected. diffstat: src/lib-sql/driver-sqlpool.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diffs (30 lines): diff -r 57498cad6ab9 -r 4e7676b890f1 src/lib-sql/driver-sqlpool.c --- a/src/lib-sql/driver-sqlpool.c Sat Jan 28 20:21:10 2012 +0200 +++ b/src/lib-sql/driver-sqlpool.c Sat Jan 28 22:05:52 2012 +0200 @@ -47,7 +47,7 @@ time_t created; unsigned int host_idx; - unsigned int retried:1; + unsigned int retry_count; /* requests are a) queries */ char *query; @@ -609,13 +609,14 @@ struct sqlpool_request *request) { struct sqlpool_db *db = request->db; - const struct sqlpool_connection *conn; + const struct sqlpool_connection *conn = NULL; struct sql_db *conndb; - if (result->failed_try_retry && !request->retried) { + if (result->failed_try_retry && + request->retry_count < array_count(&db->hosts)) { i_error("%s: Query failed, retrying: %s", db->driver->name, sql_result_get_error(result)); - request->retried = TRUE; + request->retry_count++; driver_sqlpool_prepend_request(db, request); if (driver_sqlpool_get_connection(request->db, From dovecot at dovecot.org Sat Jan 28 22:24:37 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 22:24:37 +0200 Subject: dovecot-2.1: doveconf: Added -d parameter for dumping default se... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/41cb0217b7c3 changeset: 14025:41cb0217b7c3 user: Timo Sirainen date: Sat Jan 28 22:24:26 2012 +0200 description: doveconf: Added -d parameter for dumping default settings. diffstat: src/config/config-parser-private.h | 1 + src/config/config-parser.c | 22 ++++++++++++++++------ src/config/doveconf.c | 9 +++++++-- 3 files changed, 24 insertions(+), 8 deletions(-) diffs (102 lines): diff -r 6b902f2be944 -r 41cb0217b7c3 src/config/config-parser-private.h --- a/src/config/config-parser-private.h Sat Jan 28 22:05:52 2012 +0200 +++ b/src/config/config-parser-private.h Sat Jan 28 22:24:26 2012 +0200 @@ -55,6 +55,7 @@ struct config_filter_context *filter; unsigned int expand_values:1; + unsigned int hide_errors:1; }; extern void (*hook_config_parser_begin)(struct config_parser_context *ctx); diff -r 6b902f2be944 -r 41cb0217b7c3 src/config/config-parser.c --- a/src/config/config-parser.c Sat Jan 28 22:05:52 2012 +0200 +++ b/src/config/config-parser.c Sat Jan 28 22:24:26 2012 +0200 @@ -684,7 +684,9 @@ (void)array_append_space(&ctx->all_parsers); config_filter_add_all(new_filter, array_idx(&ctx->all_parsers, 0)); - if ((ret = config_all_parsers_check(ctx, new_filter, &error)) < 0) { + if (ctx->hide_errors) + ret = 0; + else if ((ret = config_all_parsers_check(ctx, new_filter, &error)) < 0) { *error_r = t_strdup_printf("Error in configuration file %s: %s", ctx->path, error); } @@ -886,15 +888,21 @@ int fd, ret = 0; bool handled; - fd = open(path, O_RDONLY); - if (fd < 0) { - *error_r = t_strdup_printf("open(%s) failed: %m", path); - return 0; + if (path == NULL) { + path = ""; + fd = -1; + } else { + fd = open(path, O_RDONLY); + if (fd < 0) { + *error_r = t_strdup_printf("open(%s) failed: %m", path); + return 0; + } } memset(&ctx, 0, sizeof(ctx)); ctx.pool = pool_alloconly_create("config file parser", 1024*256); ctx.path = path; + ctx.hide_errors = fd == -1; for (count = 0; all_roots[count] != NULL; count++) ; ctx.root_parsers = @@ -918,7 +926,9 @@ ctx.str = str_new(ctx.pool, 256); full_line = str_new(default_pool, 512); - ctx.cur_input->input = i_stream_create_fd(fd, (size_t)-1, TRUE); + ctx.cur_input->input = fd != -1 ? + i_stream_create_fd(fd, (size_t)-1, TRUE) : + i_stream_create_from_data("", 0); i_stream_set_return_partial_line(ctx.cur_input->input, TRUE); old_settings_init(&ctx); if (hook_config_parser_begin != NULL) diff -r 6b902f2be944 -r 41cb0217b7c3 src/config/doveconf.c --- a/src/config/doveconf.c Sat Jan 28 22:05:52 2012 +0200 +++ b/src/config/doveconf.c Sat Jan 28 22:24:26 2012 +0200 @@ -596,6 +596,7 @@ int c, ret, ret2; bool config_path_specified, expand_vars = FALSE, hide_key = FALSE; bool parse_full_config = FALSE, simple_output = FALSE; + bool dump_defaults = FALSE; if (getenv("USE_SYSEXITS") != NULL) { /* we're coming from (e.g.) LDA */ @@ -605,7 +606,7 @@ memset(&filter, 0, sizeof(filter)); master_service = master_service_init("config", MASTER_SERVICE_FLAG_STANDALONE, - &argc, &argv, "af:hm:nNpexS"); + &argc, &argv, "adf:hm:nNpexS"); orig_config_path = master_service_get_config_path(master_service); i_set_failure_prefix("doveconf: "); @@ -617,6 +618,9 @@ switch (c) { case 'a': break; + case 'd': + dump_defaults = TRUE; + break; case 'f': filter_parse_arg(&filter, optarg); break; @@ -666,7 +670,8 @@ master_service_init_finish(master_service); config_parse_load_modules(); - if ((ret = config_parse_file(config_path, expand_vars, + if ((ret = config_parse_file(dump_defaults ? NULL : config_path, + expand_vars, parse_full_config ? "" : module, &error)) == 0 && access(EXAMPLE_CONFIG_DIR, X_OK) == 0) { From dovecot at dovecot.org Sat Jan 28 22:40:09 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 22:40:09 +0200 Subject: dovecot-2.1: dsync: Fixed handling non-ASCII characters in mailb... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/ef6f3b7f6038 changeset: 14026:ef6f3b7f6038 user: Timo Sirainen date: Sat Jan 28 22:39:58 2012 +0200 description: dsync: Fixed handling non-ASCII characters in mailbox names. diffstat: src/doveadm/dsync/dsync-worker-local.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diffs (52 lines): diff -r 41cb0217b7c3 -r ef6f3b7f6038 src/doveadm/dsync/dsync-worker-local.c --- a/src/doveadm/dsync/dsync-worker-local.c Sat Jan 28 22:24:26 2012 +0200 +++ b/src/doveadm/dsync/dsync-worker-local.c Sat Jan 28 22:39:58 2012 +0200 @@ -1052,10 +1052,11 @@ static const char * local_worker_convert_mailbox_name(struct local_dsync_worker *worker, - const char *name, struct mail_namespace *ns, + const char *vname, struct mail_namespace *ns, const struct dsync_mailbox *dsync_box, bool creating) { + const char *name = vname; char list_sep, ns_sep = mail_namespace_get_sep(ns); if (dsync_box->name_sep != ns_sep) { @@ -1063,6 +1064,8 @@ name = mailbox_name_convert(worker, name, dsync_box->name_sep, ns_sep); } + name = mailbox_list_get_storage_name(ns->list, name); + if (creating) { list_sep = mailbox_list_get_hierarchy_sep(ns->list); if (!mailbox_list_is_valid_create_name(ns->list, name)) { @@ -1091,7 +1094,7 @@ } i_assert(mailbox_list_is_valid_create_name(ns->list, name)); } - return name; + return mailbox_list_get_vname(ns->list, name); } static struct mailbox * @@ -1185,7 +1188,7 @@ local_dsync_worker_add_mailbox(worker, mailbox_get_namespace(box), - mailbox_get_name(box), + mailbox_get_vname(box), &dsync_box->mailbox_guid); return 1; } @@ -1215,7 +1218,7 @@ /* mailbox name already exists. add mailbox guid to the name, that shouldn't exist. */ - new_name = t_strconcat(mailbox_get_name(box), "_", + new_name = t_strconcat(mailbox_get_vname(box), "_", dsync_guid_to_str(&dsync_box->mailbox_guid), NULL); ns = mailbox_get_namespace(box); From dovecot at dovecot.org Sat Jan 28 23:47:00 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 23:47:00 +0200 Subject: dovecot-2.1: mdbox: Check that m.X file doesn't have garbage at ... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/bde005e302e0 changeset: 14027:bde005e302e0 user: Timo Sirainen date: Sat Jan 28 23:46:49 2012 +0200 description: mdbox: Check that m.X file doesn't have garbage at end of file when saving new data to it. diffstat: src/lib-storage/index/dbox-multi/mdbox-map.c | 28 ++++++++++++++- src/lib-storage/index/dbox-multi/mdbox-save.c | 7 ++- src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 1 - src/lib-storage/index/dbox-multi/mdbox-sync.c | 8 ++- src/lib-storage/index/dbox-multi/mdbox-sync.h | 3 +- 5 files changed, 37 insertions(+), 10 deletions(-) diffs (130 lines): diff -r ef6f3b7f6038 -r bde005e302e0 src/lib-storage/index/dbox-multi/mdbox-map.c --- a/src/lib-storage/index/dbox-multi/mdbox-map.c Sat Jan 28 22:39:58 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-map.c Sat Jan 28 23:46:49 2012 +0200 @@ -796,10 +796,25 @@ return TRUE; } +static bool dbox_file_is_ok_at(struct dbox_file *file, uoff_t offset) +{ + bool last; + int ret; + + if (dbox_file_seek(file, offset) == 0) + return FALSE; + + while ((ret = dbox_file_seek_next(file, &offset, &last)) > 0); + if (ret == 0 && !last) + return FALSE; + return TRUE; +} + static bool mdbox_map_file_try_append(struct mdbox_map_append_context *ctx, bool want_altpath, - uint32_t file_id, time_t stamp, uoff_t mail_size, + const struct mdbox_map_mail_index_record *rec, + time_t stamp, uoff_t mail_size, struct dbox_file_append_context **file_append_r, struct ostream **output_r, bool *retry_later_r) { @@ -815,7 +830,7 @@ *output_r = NULL; *retry_later_r = FALSE; - file = mdbox_file_init(storage, file_id); + file = mdbox_file_init(storage, rec->file_id); if (!dbox_try_open(file, want_altpath)) { dbox_file_unref(&file); return TRUE; @@ -830,6 +845,13 @@ if (errno != ENOENT) i_error("stat(%s) failed: %m", file->cur_path); /* the file was unlinked between opening and locking it. */ + } else if (st.st_size != rec->offset + rec->size && + /* check if there's any garbage at the end of file. + note that there may be valid messages added by another + session before we locked it (but after we refreshed + map index). */ + !dbox_file_is_ok_at(file, rec->offset + rec->size)) { + /* error message was already logged */ } else { file_append = dbox_file_append_init(file); if (dbox_file_get_append_stream(file_append, output_r) <= 0) { @@ -1037,7 +1059,7 @@ } mail_index_lookup_uid(map->view, seq, &uid); - if (!mdbox_map_file_try_append(ctx, want_altpath, rec->file_id, + if (!mdbox_map_file_try_append(ctx, want_altpath, rec, stamp, mail_size, file_append_r, output_r, &retry_later)) { /* file is too old. the rest of the files are too. */ diff -r ef6f3b7f6038 -r bde005e302e0 src/lib-storage/index/dbox-multi/mdbox-save.c --- a/src/lib-storage/index/dbox-multi/mdbox-save.c Sat Jan 28 22:39:58 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c Sat Jan 28 23:46:49 2012 +0200 @@ -301,10 +301,13 @@ return -1; } - /* lock the mailbox after map to avoid deadlocks. */ + /* lock the mailbox after map to avoid deadlocks. if we've noticed + any corruption, deal with it later, otherwise we won't have + up-to-date atomic->sync_view */ if (mdbox_sync_begin(ctx->mbox, MDBOX_SYNC_FLAG_NO_PURGE | MDBOX_SYNC_FLAG_FORCE | - MDBOX_SYNC_FLAG_FSYNC, ctx->atomic, + MDBOX_SYNC_FLAG_FSYNC | + MDBOX_SYNC_FLAG_NO_REBUILD, ctx->atomic, &ctx->sync_ctx) < 0) { mdbox_transaction_save_rollback(_ctx); return -1; diff -r ef6f3b7f6038 -r bde005e302e0 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sat Jan 28 22:39:58 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sat Jan 28 23:46:49 2012 +0200 @@ -50,7 +50,6 @@ ARRAY_TYPE(seq_range) seen_file_ids; uint32_t rebuild_count; - uint32_t highest_seen_map_uid; uint32_t highest_file_id; struct mailbox_list *default_list; diff -r ef6f3b7f6038 -r bde005e302e0 src/lib-storage/index/dbox-multi/mdbox-sync.c --- a/src/lib-storage/index/dbox-multi/mdbox-sync.c Sat Jan 28 22:39:58 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-sync.c Sat Jan 28 23:46:49 2012 +0200 @@ -229,7 +229,7 @@ headers until syncing has locked the mailbox */ rebuild = mbox->storage->corrupted || (flags & MDBOX_SYNC_FLAG_FORCE_REBUILD) != 0; - if (rebuild) { + if (rebuild && (flags & MDBOX_SYNC_FLAG_NO_REBUILD) == 0) { if (mdbox_storage_rebuild_in_context(mbox->storage, atomic) < 0) return -1; index_mailbox_reset_uidvalidity(&mbox->box); @@ -330,8 +330,10 @@ ret = -1; } - if (mail_index_reset_fscked(box->index)) - mdbox_storage_set_corrupted(mbox->storage); + if (box->opened) { + if (mail_index_reset_fscked(box->index)) + mdbox_storage_set_corrupted(mbox->storage); + } if (ret == 0 && (index_mailbox_want_full_sync(&mbox->box, flags) || mbox->storage->corrupted)) { if ((flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0) diff -r ef6f3b7f6038 -r bde005e302e0 src/lib-storage/index/dbox-multi/mdbox-sync.h --- a/src/lib-storage/index/dbox-multi/mdbox-sync.h Sat Jan 28 22:39:58 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-sync.h Sat Jan 28 23:46:49 2012 +0200 @@ -8,7 +8,8 @@ MDBOX_SYNC_FLAG_FORCE = 0x01, MDBOX_SYNC_FLAG_FSYNC = 0x02, MDBOX_SYNC_FLAG_FORCE_REBUILD = 0x04, - MDBOX_SYNC_FLAG_NO_PURGE = 0x08 + MDBOX_SYNC_FLAG_NO_PURGE = 0x08, + MDBOX_SYNC_FLAG_NO_REBUILD = 0x10 }; struct mdbox_sync_context { From dovecot at dovecot.org Sat Jan 28 23:58:56 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 23:58:56 +0200 Subject: dovecot-2.1: imap: CONTEXT search return option wasn't handled a... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/7a1e2cb5c13c changeset: 14028:7a1e2cb5c13c user: Timo Sirainen date: Sat Jan 28 23:58:50 2012 +0200 description: imap: CONTEXT search return option wasn't handled at all. diffstat: src/imap/imap-search.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r bde005e302e0 -r 7a1e2cb5c13c src/imap/imap-search.c --- a/src/imap/imap-search.c Sat Jan 28 23:46:49 2012 +0200 +++ b/src/imap/imap-search.c Sat Jan 28 23:58:50 2012 +0200 @@ -67,7 +67,9 @@ ctx->return_options |= SEARCH_RETURN_COUNT; else if (strcmp(name, "SAVE") == 0) ctx->return_options |= SEARCH_RETURN_SAVE; - else if (strcmp(name, "UPDATE") == 0) + else if (strcmp(name, "CONTEXT") == 0) { + /* no-op */ + } else if (strcmp(name, "UPDATE") == 0) ctx->return_options |= SEARCH_RETURN_UPDATE; else if (strcmp(name, "RELEVANCY") == 0) ctx->return_options |= SEARCH_RETURN_RELEVANCY; From dovecot at dovecot.org Sat Jan 28 23:59:25 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sat, 28 Jan 2012 23:59:25 +0200 Subject: dovecot-2.0: imap: CONTEXT search return option wasn't handled a... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/fd16e200f0f7 changeset: 13033:fd16e200f0f7 user: Timo Sirainen date: Sat Jan 28 23:58:50 2012 +0200 description: imap: CONTEXT search return option wasn't handled at all. diffstat: src/imap/imap-search.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 4e7676b890f1 -r fd16e200f0f7 src/imap/imap-search.c --- a/src/imap/imap-search.c Sat Jan 28 22:05:52 2012 +0200 +++ b/src/imap/imap-search.c Sat Jan 28 23:58:50 2012 +0200 @@ -65,7 +65,9 @@ ctx->return_options |= SEARCH_RETURN_COUNT; else if (strcmp(name, "SAVE") == 0) ctx->return_options |= SEARCH_RETURN_SAVE; - else if (strcmp(name, "UPDATE") == 0) + else if (strcmp(name, "CONTEXT") == 0) { + /* no-op */ + } else if (strcmp(name, "UPDATE") == 0) ctx->return_options |= SEARCH_RETURN_UPDATE; else if (strcmp(name, "PARTIAL") == 0) { if (ctx->partial1 != 0) { From dovecot at dovecot.org Sun Jan 29 00:01:38 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 00:01:38 +0200 Subject: dovecot-1.2: imap: CONTEXT search return option wasn't handled a... Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/031a4c2fabea changeset: 9652:031a4c2fabea user: Timo Sirainen date: Sat Jan 28 23:58:50 2012 +0200 description: imap: CONTEXT search return option wasn't handled at all. diffstat: src/imap/imap-search.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 9ab1c8a10944 -r 031a4c2fabea src/imap/imap-search.c --- a/src/imap/imap-search.c Wed Jan 25 23:45:02 2012 +0200 +++ b/src/imap/imap-search.c Sat Jan 28 23:58:50 2012 +0200 @@ -65,7 +65,9 @@ ctx->return_options |= SEARCH_RETURN_COUNT; else if (strcmp(name, "SAVE") == 0) ctx->return_options |= SEARCH_RETURN_SAVE; - else if (strcmp(name, "UPDATE") == 0) + else if (strcmp(name, "CONTEXT") == 0) { + /* no-op */ + } else if (strcmp(name, "UPDATE") == 0) ctx->return_options |= SEARCH_RETURN_UPDATE; else if (strcmp(name, "PARTIAL") == 0) { if (ctx->partial1 != 0) { From dovecot at dovecot.org Sun Jan 29 00:30:30 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 00:30:30 +0200 Subject: dovecot-2.1: zlib+mbox: Fixed error handling when opening nonexi... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/dd2f85009ba0 changeset: 14029:dd2f85009ba0 user: Timo Sirainen date: Sun Jan 29 00:30:23 2012 +0200 description: zlib+mbox: Fixed error handling when opening nonexistent/directory mailbox. diffstat: src/plugins/zlib/zlib-plugin.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diffs (28 lines): diff -r 7a1e2cb5c13c -r dd2f85009ba0 src/plugins/zlib/zlib-plugin.c --- a/src/plugins/zlib/zlib-plugin.c Sat Jan 28 23:58:50 2012 +0200 +++ b/src/plugins/zlib/zlib-plugin.c Sun Jan 29 00:30:23 2012 +0200 @@ -301,6 +301,7 @@ { const struct zlib_handler *handler; struct istream *input; + struct stat st; int fd; handler = zlib_get_zlib_handler_ext(box->name); @@ -314,9 +315,13 @@ fd = open(box_path, O_RDONLY); if (fd == -1) { - mail_storage_set_critical(box->storage, - "open(%s) failed: %m", box_path); - return -1; + /* let the standard handler figure out what to do + with the failure */ + return 0; + } + if (fstat(fd, &st) == 0 && S_ISDIR(st.st_mode)) { + (void)close(fd); + return 0; } input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE); i_stream_set_name(input, box_path); From dovecot at dovecot.org Sun Jan 29 00:35:51 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 00:35:51 +0200 Subject: dovecot-2.1: mdbox: Don't lose save_dates when rebuilding indexes. Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/47018c625680 changeset: 14030:47018c625680 user: Timo Sirainen date: Sun Jan 29 00:35:40 2012 +0200 description: mdbox: Don't lose save_dates when rebuilding indexes. diffstat: src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (17 lines): diff -r dd2f85009ba0 -r 47018c625680 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sun Jan 29 00:30:23 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sun Jan 29 00:35:40 2012 +0200 @@ -364,12 +364,12 @@ bool expunged; uint32_t seq, uid, new_seq, map_uid; - memset(&new_dbox_rec, 0, sizeof(new_dbox_rec)); hdr = mail_index_get_header(view); for (seq = 1; seq <= hdr->messages_count; seq++) { mail_index_lookup_ext(view, seq, mbox->ext_id, &data, &expunged); dbox_rec = data; + new_dbox_rec = *dbox_rec; map_uid = dbox_rec == NULL ? 0 : dbox_rec->map_uid; mail_index_lookup_ext(view, seq, mbox->guid_ext_id, From dovecot at dovecot.org Sun Jan 29 00:36:15 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 00:36:15 +0200 Subject: dovecot-2.0: mdbox: Don't lose save_dates when rebuilding indexes. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c30ea8aec902 changeset: 13034:c30ea8aec902 user: Timo Sirainen date: Sun Jan 29 00:35:40 2012 +0200 description: mdbox: Don't lose save_dates when rebuilding indexes. diffstat: src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (17 lines): diff -r fd16e200f0f7 -r c30ea8aec902 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sat Jan 28 23:58:50 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Sun Jan 29 00:35:40 2012 +0200 @@ -385,12 +385,12 @@ bool expunged; uint32_t seq, uid, new_seq, map_uid; - memset(&new_dbox_rec, 0, sizeof(new_dbox_rec)); hdr = mail_index_get_header(view); for (seq = 1; seq <= hdr->messages_count; seq++) { mail_index_lookup_ext(view, seq, mbox->ext_id, &data, &expunged); dbox_rec = data; + new_dbox_rec = *dbox_rec; map_uid = dbox_rec == NULL ? 0 : dbox_rec->map_uid; mail_index_lookup_ext(view, seq, mbox->guid_ext_id, From dovecot at dovecot.org Sun Jan 29 00:49:01 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 00:49:01 +0200 Subject: dovecot-2.1: pop3c: mail.istream_opened() method wasn't being ca... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/397224940894 changeset: 14031:397224940894 user: Timo Sirainen date: Sun Jan 29 00:48:43 2012 +0200 description: pop3c: mail.istream_opened() method wasn't being called. diffstat: src/lib-storage/index/pop3c/pop3c-mail.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r 47018c625680 -r 397224940894 src/lib-storage/index/pop3c/pop3c-mail.c --- a/src/lib-storage/index/pop3c/pop3c-mail.c Sun Jan 29 00:35:40 2012 +0200 +++ b/src/lib-storage/index/pop3c/pop3c-mail.c Sun Jan 29 00:48:43 2012 +0200 @@ -123,6 +123,13 @@ } i_stream_set_name(input, t_strcut(cmd, '\r')); mail->data.stream = input; + if (mail->mail.v.istream_opened != NULL) { + if (mail->mail.v.istream_opened(_mail, + &mail->data.stream) < 0) { + index_mail_close_streams(mail); + return -1; + } + } pop3c_mail_cache_size(mail); } return index_mail_init_stream(mail, hdr_size, body_size, stream_r); From dovecot at dovecot.org Sun Jan 29 01:37:50 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 01:37:50 +0200 Subject: dovecot-2.1: zlib: zlib/bzlib ostreams no longer assert-crash if... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/3c0bd1fd035b changeset: 14032:3c0bd1fd035b user: Timo Sirainen date: Sun Jan 29 01:37:44 2012 +0200 description: zlib: zlib/bzlib ostreams no longer assert-crash if parent stream becomes full. This fixes assert-crashes with IMAP COMPRESS extension. diffstat: src/plugins/zlib/ostream-bzlib.c | 84 +++++++++++++++++++++++++++++--------- src/plugins/zlib/ostream-zlib.c | 86 ++++++++++++++++++++++++++++++--------- 2 files changed, 129 insertions(+), 41 deletions(-) diffs (truncated from 306 to 300 lines): diff -r 397224940894 -r 3c0bd1fd035b src/plugins/zlib/ostream-bzlib.c --- a/src/plugins/zlib/ostream-bzlib.c Sun Jan 29 00:48:43 2012 +0200 +++ b/src/plugins/zlib/ostream-bzlib.c Sun Jan 29 01:37:44 2012 +0200 @@ -15,7 +15,7 @@ bz_stream zs; char outbuf[CHUNK_SIZE]; - struct ostream *output; + unsigned int outbuf_offset, outbuf_used; unsigned int flushed:1; }; @@ -28,26 +28,55 @@ (void)BZ2_bzCompressEnd(&zstream->zs); } +static int o_stream_zlib_send_outbuf(struct bzlib_ostream *zstream) +{ + ssize_t ret; + size_t size; + + if (zstream->outbuf_used == 0) + return 1; + + size = zstream->outbuf_used - zstream->outbuf_offset; + i_assert(size > 0); + ret = o_stream_send(zstream->ostream.parent, + zstream->outbuf + zstream->outbuf_offset, size); + if (ret < 0) { + o_stream_copy_error_from_parent(&zstream->ostream); + return -1; + } + if ((size_t)ret != size) { + zstream->outbuf_offset += ret; + return 0; + } + zstream->outbuf_offset = 0; + zstream->outbuf_used = 0; + return 1; +} + static ssize_t o_stream_bzlib_send_chunk(struct bzlib_ostream *zstream, const void *data, size_t size) { bz_stream *zs = &zstream->zs; - ssize_t ret; + int ret; + + i_assert(zstream->outbuf_used == 0); zs->next_in = (void *)data; zs->avail_in = size; while (zs->avail_in > 0) { if (zs->avail_out == 0) { + /* previous block was compressed. send it and start + compression for a new block. */ zs->next_out = zstream->outbuf; zs->avail_out = sizeof(zstream->outbuf); - ret = o_stream_send(zstream->ostream.parent, - zstream->outbuf, - sizeof(zstream->outbuf)); - if (ret != (ssize_t)sizeof(zstream->outbuf)) { - o_stream_copy_error_from_parent(&zstream->ostream); + zstream->outbuf_used = sizeof(zstream->outbuf); + if ((ret = o_stream_zlib_send_outbuf(zstream)) < 0) return -1; + if (ret == 0) { + /* parent stream's buffer full */ + break; } } @@ -58,8 +87,10 @@ i_unreached(); } } + size -= zs->avail_in; + zstream->flushed = FALSE; - return 0; + return size; } static int o_stream_bzlib_send_flush(struct bzlib_ostream *zstream) @@ -79,18 +110,19 @@ if (zstream->flushed) return 0; + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) + return ret; + + i_assert(zstream->outbuf_used == 0); do { len = sizeof(zstream->outbuf) - zs->avail_out; if (len != 0) { zs->next_out = zstream->outbuf; zs->avail_out = sizeof(zstream->outbuf); - ret = o_stream_send(zstream->ostream.parent, - zstream->outbuf, len); - if (ret != (int)len) { - o_stream_copy_error_from_parent(&zstream->ostream); - return -1; - } + zstream->outbuf_used = len; + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) + return ret; if (done) break; } @@ -130,17 +162,29 @@ const struct const_iovec *iov, unsigned int iov_count) { struct bzlib_ostream *zstream = (struct bzlib_ostream *)stream; - ssize_t bytes = 0; + ssize_t ret, bytes = 0; unsigned int i; - for (i = 0; i < iov_count; i++) { - if (o_stream_bzlib_send_chunk(zstream, iov[i].iov_base, - iov[i].iov_len) < 0) - return -1; - bytes += iov[i].iov_len; + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) { + /* error / we still couldn't flush existing data to + parent stream. */ + return ret; } + for (i = 0; i < iov_count; i++) { + ret = o_stream_bzlib_send_chunk(zstream, iov[i].iov_base, + iov[i].iov_len); + if (ret < 0) + return -1; + bytes += ret; + if ((size_t)ret != iov[i].iov_len) + break; + } stream->ostream.offset += bytes; + + /* avail_in!=0 check is used to detect errors. if it's non-zero here + it simply means we didn't send all the data */ + zstream->zs.avail_in = 0; return bytes; } diff -r 397224940894 -r 3c0bd1fd035b src/plugins/zlib/ostream-zlib.c --- a/src/plugins/zlib/ostream-zlib.c Sun Jan 29 00:48:43 2012 +0200 +++ b/src/plugins/zlib/ostream-zlib.c Sun Jan 29 01:37:44 2012 +0200 @@ -18,6 +18,7 @@ unsigned char gz_header[10]; unsigned char outbuf[CHUNK_SIZE]; + unsigned int outbuf_offset, outbuf_used; uint32_t crc, bytes32; @@ -77,13 +78,39 @@ return 0; } -static int +static int o_stream_zlib_send_outbuf(struct zlib_ostream *zstream) +{ + ssize_t ret; + size_t size; + + if (zstream->outbuf_used == 0) + return 1; + + size = zstream->outbuf_used - zstream->outbuf_offset; + i_assert(size > 0); + ret = o_stream_send(zstream->ostream.parent, + zstream->outbuf + zstream->outbuf_offset, size); + if (ret < 0) { + o_stream_copy_error_from_parent(&zstream->ostream); + return -1; + } + if ((size_t)ret != size) { + zstream->outbuf_offset += ret; + return 0; + } + zstream->outbuf_offset = 0; + zstream->outbuf_used = 0; + return 1; +} + +static ssize_t o_stream_zlib_send_chunk(struct zlib_ostream *zstream, const void *data, size_t size) { z_stream *zs = &zstream->zs; - ssize_t ret; - int flush; + int ret, flush; + + i_assert(zstream->outbuf_used == 0); flush = zstream->ostream.corked || zstream->gz ? Z_NO_FLUSH : Z_SYNC_FLUSH; @@ -95,15 +122,17 @@ zs->avail_in = size; while (zs->avail_in > 0) { if (zs->avail_out == 0) { + /* previous block was compressed. send it and start + compression for a new block. */ zs->next_out = zstream->outbuf; zs->avail_out = sizeof(zstream->outbuf); - ret = o_stream_send(zstream->ostream.parent, - zstream->outbuf, - sizeof(zstream->outbuf)); - if (ret != (ssize_t)sizeof(zstream->outbuf)) { - o_stream_copy_error_from_parent(&zstream->ostream); + zstream->outbuf_used = sizeof(zstream->outbuf); + if ((ret = o_stream_zlib_send_outbuf(zstream)) < 0) return -1; + if (ret == 0) { + /* parent stream's buffer full */ + break; } } @@ -115,11 +144,13 @@ i_unreached(); } } + size -= zs->avail_in; + zstream->crc = crc32_data_more(zstream->crc, data, size); zstream->bytes32 += size; - zstream->flushed = flush == Z_SYNC_FLUSH && + zstream->flushed = flush == Z_SYNC_FLUSH && zs->avail_in == 0 && zs->avail_out == sizeof(zstream->outbuf); - return 0; + return size; } static int o_stream_zlib_send_flush(struct zlib_ostream *zstream) @@ -141,18 +172,19 @@ if (!zstream->header_sent) o_stream_zlib_send_gz_header(zstream); + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) + return ret; + + i_assert(zstream->outbuf_used == 0); do { len = sizeof(zstream->outbuf) - zs->avail_out; if (len != 0) { zs->next_out = zstream->outbuf; zs->avail_out = sizeof(zstream->outbuf); - ret = o_stream_send(zstream->ostream.parent, - zstream->outbuf, len); - if (ret != (int)len) { - o_stream_copy_error_from_parent(&zstream->ostream); - return -1; - } + zstream->outbuf_used = len; + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) + return ret; if (done) break; } @@ -194,21 +226,33 @@ const struct const_iovec *iov, unsigned int iov_count) { struct zlib_ostream *zstream = (struct zlib_ostream *)stream; - ssize_t bytes = 0; + ssize_t ret, bytes = 0; unsigned int i; + if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) { + /* error / we still couldn't flush existing data to + parent stream. */ + return ret; + } + for (i = 0; i < iov_count; i++) { - if (o_stream_zlib_send_chunk(zstream, iov[i].iov_base, - iov[i].iov_len) < 0) + ret = o_stream_zlib_send_chunk(zstream, iov[i].iov_base, + iov[i].iov_len); + if (ret < 0) return -1; - bytes += iov[i].iov_len; + bytes += ret; + if ((size_t)ret != iov[i].iov_len) + break; } stream->ostream.offset += bytes; - if (!zstream->ostream.corked) { + if (!zstream->ostream.corked && i == iov_count) { if (o_stream_zlib_send_flush(zstream) < 0) return -1; } From dovecot at dovecot.org Sun Jan 29 01:48:27 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Sun, 29 Jan 2012 01:48:27 +0200 Subject: dovecot-2.1: istream-concat: If EOF is already reached, use that... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/15bcb5616717 changeset: 14033:15bcb5616717 user: Timo Sirainen date: Sun Jan 29 01:48:16 2012 +0200 description: istream-concat: If EOF is already reached, use that size for stat().st_size diffstat: src/lib/istream-seekable.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diffs (40 lines): diff -r 3c0bd1fd035b -r 15bcb5616717 src/lib/istream-seekable.c --- a/src/lib/istream-seekable.c Sun Jan 29 01:37:44 2012 +0200 +++ b/src/lib/istream-seekable.c Sun Jan 29 01:48:16 2012 +0200 @@ -18,6 +18,7 @@ char *temp_path; uoff_t write_peak; + uoff_t size; int (*fd_callback)(const char **path_r, void *context); void *context; @@ -140,6 +141,7 @@ sstream->cur_input = sstream->input[sstream->cur_idx++]; if (sstream->cur_input == NULL) { /* last one, EOF */ + sstream->size = sstream->istream.istream.v_offset; sstream->istream.istream.eof = TRUE; return -1; } @@ -302,6 +304,12 @@ uoff_t old_offset; ssize_t ret; + if (sstream->size != (uoff_t)-1) { + /* we've already reached EOF and know the size */ + stream->statbuf.st_size = sstream->size; + return &stream->statbuf; + } + if (sstream->buffer != NULL) { /* we want to know the full size of the file, so read until we're finished */ @@ -365,6 +373,7 @@ sstream->buffer = buffer_create_dynamic(default_pool, BUF_INITIAL_SIZE); sstream->istream.max_buffer_size = max_buffer_size; sstream->fd = -1; + sstream->size = (uoff_t)-1; sstream->input = i_new(struct istream *, count + 1); memcpy(sstream->input, input, sizeof(*input) * count); From dovecot at dovecot.org Mon Jan 30 21:03:28 2012 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 30 Jan 2012 21:03:28 +0200 Subject: dovecot-2.1: man: Added descriptions of -d and -S options to dov... Message-ID: details: http://hg.dovecot.org/dovecot-2.1/rev/cc533cbd77b0 changeset: 14034:cc533cbd77b0 user: Pascal Volk date: Sun Jan 29 20:33:34 2012 +0000 description: man: Added descriptions of -d and -S options to doveconf.1. diffstat: doc/man/doveconf.1.in | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diffs (48 lines): diff -r 15bcb5616717 -r cc533cbd77b0 doc/man/doveconf.1.in --- a/doc/man/doveconf.1.in Sun Jan 29 01:48:16 2012 +0200 +++ b/doc/man/doveconf.1.in Sun Jan 29 20:33:34 2012 +0000 @@ -1,11 +1,11 @@ -.\" Copyright (c) 2010 Dovecot authors, see the included COPYING file -.TH DOVECONF 1 "2011-05-11" "Dovecot v2.1" "Dovecot" +.\" Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file +.TH DOVECONF 1 "2012-01-29" "Dovecot v2.1" "Dovecot" .SH NAME doveconf \- Dovecot\(aqs configuration dumping utility .\"------------------------------------------------------------------------ .SH SYNOPSIS .B doveconf -.RB [ \-anNx ] +.RB [ \-adnNSx ] [\fB\-c\fP \fIconfig\-file\fP] [\fB\-f\fP \fIfilter\fP] [\fB\-m\fP \fImodule\fP] @@ -52,6 +52,11 @@ will be used. .\"--------------------------------- .TP +.B \-d +Show the setting\(aqs default value instead of the one currently +configured. +.\"--------------------------------- +.TP .BI \-f \ filter Show the matching configuration for the specified .I filter @@ -115,6 +120,10 @@ Show settings with non\-default values and explicitly set default values. .\"--------------------------------- .TP +.B \-S +Dump settings in simplified machine parsable/readable format. +.\"--------------------------------- +.TP .B \-x Expand configuration variables (e.g. \(Domail_plugins \(rA quota) and show file contents (from e.g. ssl_cert = details: http://hg.dovecot.org/dovecot-2.1/rev/8be75a2ea2dd changeset: 14035:8be75a2ea2dd user: Timo Sirainen date: Mon Jan 30 20:09:04 2012 +0200 description: Added mountpoint_iter_*() for iterating mounted filesystems. diffstat: src/lib/mountpoint.c | 317 +++++++++++++++++++++++++++++++++----------------- src/lib/mountpoint.h | 10 +- 2 files changed, 220 insertions(+), 107 deletions(-) diffs (truncated from 421 to 300 lines): diff -r cc533cbd77b0 -r 8be75a2ea2dd src/lib/mountpoint.c --- a/src/lib/mountpoint.c Sun Jan 29 20:33:34 2012 +0000 +++ b/src/lib/mountpoint.c Mon Jan 30 20:09:04 2012 +0200 @@ -8,26 +8,31 @@ #ifdef HAVE_SYS_VMOUNT_H # include # include /* AIX */ +# define MOUNTPOINT_AIX_MNTCTL #elif defined(HAVE_STATVFS_MNTFROMNAME) # include /* NetBSD 3.0+, FreeBSD 5.0+ */ # define STATVFS_STR "statvfs" +# define MOUNTPOINT_STATVFS #elif defined(HAVE_STATFS_MNTFROMNAME) # include /* Older BSDs */ # include # define statvfs statfs # define STATVFS_STR "statfs" +# define MOUNTPOINT_STATVFS #elif defined(HAVE_MNTENT_H) # include # include /* Linux */ +# define MOUNTPOINT_LINUX #elif defined(HAVE_SYS_MNTTAB_H) # include # include /* Solaris */ # include +# define MOUNTPOINT_SOLARIS #else # define MOUNTPOINT_UNKNOWN #endif -#ifdef HAVE_SYS_MNTTAB_H +#ifdef MOUNTPOINT_SOLARIS # define MTAB_PATH MNTTAB /* Solaris */ #else # define MTAB_PATH "/etc/mtab" /* Linux */ @@ -53,14 +58,11 @@ # define MNTTYPE_ROOTFS "rootfs" #endif -int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r) +#ifdef MOUNTPOINT_STATVFS +static int +mountpoint_get_statvfs(const char *path, pool_t pool, + struct mountpoint *point_r) { -#ifdef MOUNTPOINT_UNKNOWN - memset(point_r, 0, sizeof(*point_r)); - errno = ENOSYS; - return -1; -#elif defined (HAVE_STATFS_MNTFROMNAME) || defined(HAVE_STATVFS_MNTFROMNAME) - /* BSDs */ struct statvfs buf; memset(point_r, 0, sizeof(*point_r)); @@ -81,21 +83,23 @@ #endif point_r->block_size = buf.f_bsize; return 1; +} +#endif + +int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r) +{ +#ifdef MOUNTPOINT_UNKNOWN + memset(point_r, 0, sizeof(*point_r)); + errno = ENOSYS; + return -1; +#elif defined (MOUNTPOINT_STATVFS) + /* BSDs, Tru64 */ + return mountpoint_get_statvfs(path, pool, point_r); #else - /* Linux, Solaris: /etc/mtab reading */ -#ifdef HAVE_SYS_MNTTAB_H - union { - struct mnttab ent; - struct extmnttab ext; - } ent; -#else - struct mntent *ent; - struct stat st2; -#endif + /* find via mount iteration */ + struct mountpoint_iter *iter; + const struct mountpoint *mnt; struct stat st; - const char *device_path = NULL, *mount_path = NULL, *type = NULL; - unsigned int block_size; - FILE *f; memset(point_r, 0, sizeof(*point_r)); if (stat(path, &st) < 0) { @@ -105,72 +109,143 @@ i_error("stat(%s) failed: %m", path); return -1; } - block_size = st.st_blksize; -#ifdef HAVE_SYS_VMOUNT_H + iter = mountpoint_iter_init(); + while ((mnt = mountpoint_iter_next(iter)) != NULL) { + if (minor(st.st_dev) == minor(mnt->dev) && + major(st.st_dev) == major(mnt->dev)) + break; + } + if (mnt != NULL) { + point_r->device_path = p_strdup(pool, mnt->device_path); + point_r->mount_path = p_strdup(pool, mnt->mount_path); + point_r->type = p_strdup(pool, mnt->type); + point_r->dev = mnt->dev; + point_r->block_size = st.st_blksize; + } + mountpoint_iter_deinit(&iter); + return mnt != NULL ? 1 : 0; +#endif +} + +struct mountpoint_iter { +#ifdef MOUNTPOINT_AIX_MNTCTL + char *mtab; + struct vmount *vmt; + int count; +#elif defined(MOUNTPOINT_SOLARIS) || defined(MOUNTPOINT_LINUX) + FILE *f; +#elif defined(HAVE_GETMNTINFO) /* BSDs */ + struct statfs *fs; + int count; +#endif + struct mountpoint mnt; + bool failed; +}; + +struct mountpoint_iter *mountpoint_iter_init(void) { - char static_mtab[STATIC_MTAB_SIZE], *mtab = static_mtab; - int i, count; - const struct vmount *vmt; + struct mountpoint_iter *iter = i_new(struct mountpoint_iter, 1); +#ifdef MOUNTPOINT_AIX_MNTCTL + unsigned int size = STATIC_MTAB_SIZE; + char *mtab; + int count; - count = mntctl(MCTL_QUERY, sizeof(static_mtab), mtab); - while (count == 0) { - unsigned int size = *(unsigned int *)mtab; - - mtab = t_malloc(size); - count = mntctl(MCTL_QUERY, size, mtab); + mtab = t_buffer_get(size); + while ((count = mntctl(MCTL_QUERY, size, mtab)) == 0) { + size = *(unsigned int *)mtab; + mtab = t_buffer_get(size); } if (count < 0) { i_error("mntctl(MCTL_QUERY) failed: %m"); - return -1; + iter->failed = TRUE; + return iter; } - vmt = (struct vmount *)mtab; - for (i = 0; i < count && device_path == NULL; i++) { - struct stat vst; - const char *vmt_base = (const char *)vmt; - const char *vmt_object, *vmt_stub, *vmt_hostname; + iter->count = count; + iter->mtab = i_malloc(size); + memcpy(iter->mtab, mtab, size); + iter->vmt = (void *)iter->mtab; +#elif defined(MOUNTPOINT_SOLARIS) + iter->f = fopen(MTAB_PATH, "r"); + if (iter->f == NULL) { + i_error("fopen(%s) failed: %m", MTAB_PATH); + iter->failed = TRUE; + return iter; + } + resetmnttab(iter->f); +#elif defined(MOUNTPOINT_LINUX) + iter->f = setmntent(MTAB_PATH, "r"); + if (iter->f == NULL) { + i_error("setmntent(%s) failed: %m", MTAB_PATH); + iter->failed = TRUE; + } +#elif defined(HAVE_GETMNTINFO) /* BSDs */ + iter->count = getmntinfo(&iter->fs, MNT_NOWAIT); + if (iter->count < 0) { + i_error("getmntinfo() failed: %m"); + iter->failed = TRUE; + } +#else + iter->failed = TRUE; +#endif + return iter; +} - vmt_hostname = vmt_base + vmt->vmt_data[VMT_HOSTNAME].vmt_off; - vmt_object = vmt_base + vmt->vmt_data[VMT_OBJECT].vmt_off; - vmt_stub = vmt_base + vmt->vmt_data[VMT_STUB].vmt_off; +const struct mountpoint *mountpoint_iter_next(struct mountpoint_iter *iter) +{ +#ifdef MOUNTPOINT_AIX_MNTCTL + struct vmount *vmt = iter->vmt; + char *vmt_base = (char *)vmt; + char *vmt_object, *vmt_stub, *vmt_hostname; + struct stat vst; - switch (vmt->vmt_gfstype) { - case MNT_NFS: - case MNT_NFS3: - case MNT_NFS4: - case MNT_RFS4: - if (stat(vmt_stub, &vst) == 0 && - st.st_dev == vst.st_dev) { - device_path = t_strconcat(vmt_hostname, ":", - vmt_object, NULL); - mount_path = vmt_stub; - type = MNTTYPE_NFS; - } - break; + if (iter->count == 0) + return NULL; + iter->count--; - case MNT_J2: - case MNT_JFS: - if (stat(vmt_stub, &vst) == 0 && - st.st_dev == vst.st_dev) { - device_path = vmt_object; - mount_path = vmt_stub; - type = MNTTYPE_JFS; - } - break; - } - vmt = CONST_PTR_OFFSET(vmt, vmt->vmt_length); + iter->vmt = PTR_OFFSET(vmt, vmt->vmt_length); + vmt_hostname = vmt_base + vmt->vmt_data[VMT_HOSTNAME].vmt_off; + vmt_object = vmt_base + vmt->vmt_data[VMT_OBJECT].vmt_off; + vmt_stub = vmt_base + vmt->vmt_data[VMT_STUB].vmt_off; + + memset(&iter->mnt, 0, sizeof(iter->mnt)); + switch (vmt->vmt_gfstype) { + case MNT_NFS: + case MNT_NFS3: + case MNT_NFS4: + case MNT_RFS4: + iter->mnt.device_path = + t_strconcat(vmt_hostname, ":", vmt_object, NULL); + iter->mnt.mount_path = vmt_stub; + iter->mnt.type = MNTTYPE_NFS; + break; + + case MNT_J2: + case MNT_JFS: + iter->mnt.device_path = vmt_object; + iter->mnt.mount_path = vmt_stub; + iter->mnt.type = MNTTYPE_JFS; + break; + default: + /* unwanted filesystem */ + return mountpoint_iter_next(iter); } -} -#elif defined(HAVE_SYS_MNTTAB_H) + if (stat(iter->mnt.mount_path, &vst) == 0) { + iter->mnt.dev = vst.st_dev; + iter->mnt.block_size = vst.st_blksize; + } + return &iter->mnt; +#elif defined (MOUNTPOINT_SOLARIS) + union { + struct mnttab ent; + struct extmnttab ext; + } ent; - /* Solaris */ - f = fopen(MTAB_PATH, "r"); - if (f == NULL) { - i_error("fopen(%s) failed: %m", MTAB_PATH); - return -1; - } - resetmnttab(f); - while ((getextmntent(f, &ent.ext, sizeof(ent.ext))) == 0) { + if (iter->f == NULL) + return NULL; + + memset(&iter->mnt, 0, sizeof(iter->mnt)); + while ((getextmntent(iter->f, &ent.ext, sizeof(ent.ext))) == 0) { if (hasmntopt(&ent.ent, MNTOPT_IGNORE) != NULL) continue; @@ -178,45 +253,75 @@ if (strcmp(ent.ent.mnt_special, MNTTYPE_SWAP) == 0) continue; - if (major(st.st_dev) == ent.ext.mnt_major && - minor(st.st_dev) == ent.ext.mnt_minor) { - device_path = ent.ent.mnt_special; - mount_path = ent.ent.mnt_mountp; - type = ent.ent.mnt_fstype; - break;