From dovecot at dovecot.org Mon Dec 1 20:12:19 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 01 Dec 2014 20:12:19 +0000 Subject: dovecot-2.2: quota: Added "hidden" option to hide the quota root... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/831f7e40546d changeset: 18119:831f7e40546d user: Timo Sirainen date: Mon Dec 01 12:11:54 2014 -0800 description: quota: Added "hidden" option to hide the quota root from IMAP GETQUOTAROOT command. diffstat: src/plugins/imap-quota/imap-quota-plugin.c | 2 ++ src/plugins/quota/quota-dict.c | 5 +++++ src/plugins/quota/quota-fs.c | 2 ++ src/plugins/quota/quota-maildir.c | 2 ++ src/plugins/quota/quota-private.h | 2 ++ src/plugins/quota/quota.c | 7 +++++++ src/plugins/quota/quota.h | 3 +++ 7 files changed, 23 insertions(+), 0 deletions(-) diffs (100 lines): diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/imap-quota/imap-quota-plugin.c --- a/src/plugins/imap-quota/imap-quota-plugin.c Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/imap-quota/imap-quota-plugin.c Mon Dec 01 12:11:54 2014 -0800 @@ -105,6 +105,8 @@ iter = quota_root_iter_init(box); while ((root = quota_root_iter_next(iter)) != NULL) { + if (quota_root_is_hidden(root)) + continue; str_append_c(quotaroot_reply, ' '); name = imap_quota_root_get_name(client->user, ns->owner, root); imap_append_astring(quotaroot_reply, name); diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota-dict.c --- a/src/plugins/quota/quota-dict.c Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota-dict.c Mon Dec 01 12:11:54 2014 -0800 @@ -52,6 +52,11 @@ args += 12; continue; } + if (strncmp(args, "hidden:", 7) == 0) { + _root->hidden = TRUE; + args += 7; + continue; + } if (strncmp(args, "ignoreunlimited:", 16) == 0) { _root->disable_unlimited_tracking = TRUE; args += 16; diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota-fs.c --- a/src/plugins/quota/quota-fs.c Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota-fs.c Mon Dec 01 12:11:54 2014 -0800 @@ -113,6 +113,8 @@ root->inode_per_mail = TRUE; else if (strcmp(*tmp, "noenforcing") == 0) _root->no_enforcing = TRUE; + else if (strcmp(*tmp, "hidden") == 0) + _root->hidden = TRUE; else if (strncmp(*tmp, "mount=", 6) == 0) { i_free(root->storage_mount_path); root->storage_mount_path = i_strdup(*tmp + 6); diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota-maildir.c --- a/src/plugins/quota/quota-maildir.c Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota-maildir.c Mon Dec 01 12:11:54 2014 -0800 @@ -772,6 +772,8 @@ for (tmp = t_strsplit(args, ":"); *tmp != NULL; tmp++) { if (strcmp(*tmp, "noenforcing") == 0) _root->no_enforcing = TRUE; + else if (strcmp(*tmp, "hidden") == 0) + _root->hidden = TRUE; else if (strcmp(*tmp, "ignoreunlimited") == 0) _root->disable_unlimited_tracking = TRUE; else if (strncmp(*tmp, "ns=", 3) == 0) diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota-private.h --- a/src/plugins/quota/quota-private.h Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota-private.h Mon Dec 01 12:11:54 2014 -0800 @@ -134,6 +134,8 @@ unsigned int disable_unlimited_tracking:1; /* Set while quota is being recalculated to avoid recursion. */ unsigned int recounting:1; + /* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */ + unsigned int hidden:1; }; struct quota_transaction_context { diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota.c --- a/src/plugins/quota/quota.c Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota.c Mon Dec 01 12:11:54 2014 -0800 @@ -305,6 +305,8 @@ for (; *tmp != NULL; tmp++) { if (strcmp(*tmp, "noenforcing") == 0) root->no_enforcing = TRUE; + else if (strcmp(*tmp, "hidden") == 0) + root->hidden = TRUE; else if (strcmp(*tmp, "ignoreunlimited") == 0) root->disable_unlimited_tracking = TRUE; else @@ -635,6 +637,11 @@ return root->backend.v.get_resources(root); } +bool quota_root_is_hidden(struct quota_root *root) +{ + return root->hidden; +} + int quota_get_resource(struct quota_root *root, const char *mailbox_name, const char *name, uint64_t *value_r, uint64_t *limit_r) { diff -r 67b46a7f4ed2 -r 831f7e40546d src/plugins/quota/quota.h --- a/src/plugins/quota/quota.h Fri Nov 28 10:57:43 2014 +0200 +++ b/src/plugins/quota/quota.h Mon Dec 01 12:11:54 2014 -0800 @@ -49,6 +49,9 @@ const char *quota_root_get_name(struct quota_root *root); /* Return a list of all resources set for the quota root. */ const char *const *quota_root_get_resources(struct quota_root *root); +/* Returns TRUE if quota root is marked as hidden (so it shouldn't be visible + to users via IMAP GETQUOTAROOT command). */ +bool quota_root_is_hidden(struct quota_root *root); /* Returns 1 if quota value was found, 0 if not, -1 if error. */ int quota_get_resource(struct quota_root *root, const char *mailbox_name, From dovecot at dovecot.org Mon Dec 1 20:44:02 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 01 Dec 2014 20:44:02 +0000 Subject: dovecot-2.2: lib: test-array - really really really stop gcc opt... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/096d233acb7d changeset: 18120:096d233acb7d user: Phil Carmody date: Mon Dec 01 22:43:33 2014 +0200 description: lib: test-array - really really really stop gcc optimising away fatal tests Gcc 4.6 also was determined to optimise away the calls that should crash. We therefore have to do *something*, no matter how stupid, with the return values. This should do it. (please, oh please, oh please, ...) Signed-off-by: Phil Carmody diffstat: src/lib/test-array.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diffs (45 lines): diff -r 831f7e40546d -r 096d233acb7d src/lib/test-array.c --- a/src/lib/test-array.c Mon Dec 01 12:11:54 2014 -0800 +++ b/src/lib/test-array.c Mon Dec 01 22:43:33 2014 +0200 @@ -181,6 +181,7 @@ { double tmpd[2] = { 42., -42. }; short tmps[8] = {1,2,3,4,5,6,7,8}; + static const void *useless_ptr; /* persuade gcc to not optimise the tests */ switch(stage) { case 0: { @@ -188,8 +189,7 @@ test_begin("fatal_array"); t_array_init(&ad, 3); /* allocation big enough, but memory not initialised */ - if (array_idx(&ad, 0) == NULL) - return FATAL_TEST_FAILURE; + useless_ptr = array_idx(&ad, 0); return FATAL_TEST_FAILURE; } break; @@ -198,8 +198,7 @@ t_array_init(&ad, 2); array_append(&ad, tmpd, 2); /* actual out of range address requested */ - if (array_idx(&ad, 2) == NULL) - return FATAL_TEST_FAILURE; + useless_ptr = array_idx(&ad, 2); return FATAL_TEST_FAILURE; } break; @@ -212,8 +211,11 @@ array_copy(&ad.arr, 1, &as.arr, 0, 4); return FATAL_TEST_FAILURE; } break; - } test_end(); - return FATAL_TEST_FINISHED; + /* Forces the compiler to check the value of useless_ptr, so that it + must call array_idx (which is marked as pure, and gcc was desperate + to optimise out. Of course, gcc is unaware stage is never -1.*/ + return (useless_ptr != NULL && stage == -1) + ? FATAL_TEST_FAILURE : FATAL_TEST_FINISHED; } From dovecot at dovecot.org Tue Dec 2 08:26:48 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Dec 2014 08:26:48 +0000 Subject: dovecot-2.2: dict-redis: Use EXPIRE also after INCRBY commands. Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/668068a45447 changeset: 18121:668068a45447 user: Timo Sirainen date: Tue Dec 02 00:26:24 2014 -0800 description: dict-redis: Use EXPIRE also after INCRBY commands. diffstat: src/lib-dict/dict-redis.c | 41 +++++++++++++++++++++++++++-------------- 1 files changed, 27 insertions(+), 14 deletions(-) diffs (73 lines): diff -r 096d233acb7d -r 668068a45447 src/lib-dict/dict-redis.c --- a/src/lib-dict/dict-redis.c Mon Dec 01 22:43:33 2014 +0200 +++ b/src/lib-dict/dict-redis.c Tue Dec 02 00:26:24 2014 -0800 @@ -635,6 +635,23 @@ return 0; } +static void +redis_append_expire(struct redis_dict_transaction_context *ctx, + string_t *cmd, const char *key) +{ + struct redis_dict *dict = (struct redis_dict *)ctx->ctx.dict; + + if (dict->expire_value == NULL) + return; + + str_printfa(cmd, "*3\r\n$6\r\nEXPIRE\r\n$%u\r\n%s\r\n$%u\r\n%s\r\n", + (unsigned int)strlen(key), key, + (unsigned int)strlen(dict->expire_value), + dict->expire_value); + redis_input_state_add(dict, REDIS_INPUT_STATE_MULTI); + ctx->cmd_count++; +} + static void redis_set(struct dict_transaction_context *_ctx, const char *key, const char *value) { @@ -653,14 +670,7 @@ (unsigned int)strlen(value), value); redis_input_state_add(dict, REDIS_INPUT_STATE_MULTI); ctx->cmd_count++; - if (dict->expire_value != NULL) { - str_printfa(cmd, "*3\r\n$6\r\nEXPIRE\r\n$%u\r\n%s\r\n$%u\r\n%s\r\n", - (unsigned int)strlen(key), key, - (unsigned int)strlen(dict->expire_value), - dict->expire_value); - redis_input_state_add(dict, REDIS_INPUT_STATE_MULTI); - ctx->cmd_count++; - } + redis_append_expire(ctx, cmd, key); if (o_stream_send(dict->conn.conn.output, str_data(cmd), str_len(cmd)) < 0) ctx->failed = TRUE; } @@ -712,20 +722,23 @@ struct redis_dict_transaction_context *ctx = (struct redis_dict_transaction_context *)_ctx; struct redis_dict *dict = (struct redis_dict *)_ctx->dict; - const char *cmd, *diffstr; + const char *diffstr; + string_t *cmd; if (redis_check_transaction(ctx) < 0) return; key = redis_dict_get_full_key(dict, key); diffstr = t_strdup_printf("%lld", diff); - cmd = t_strdup_printf("*3\r\n$6\r\nINCRBY\r\n$%u\r\n%s\r\n$%u\r\n%s\r\n", - (unsigned int)strlen(key), key, - (unsigned int)strlen(diffstr), diffstr); - if (o_stream_send_str(dict->conn.conn.output, cmd) < 0) - ctx->failed = TRUE; + cmd = t_str_new(128); + str_printfa(cmd, "*3\r\n$6\r\nINCRBY\r\n$%u\r\n%s\r\n$%u\r\n%s\r\n", + (unsigned int)strlen(key), key, + (unsigned int)strlen(diffstr), diffstr); redis_input_state_add(dict, REDIS_INPUT_STATE_MULTI); ctx->cmd_count++; + redis_append_expire(ctx, cmd, key); + if (o_stream_send(dict->conn.conn.output, str_data(cmd), str_len(cmd)) < 0) + ctx->failed = TRUE; } struct dict dict_driver_redis = { From dovecot at dovecot.org Tue Dec 2 08:29:40 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 02 Dec 2014 08:29:40 +0000 Subject: dovecot-2.2: dict-redis: Use timeout_msecs parameter also for tr... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/61b789a5e2c7 changeset: 18122:61b789a5e2c7 user: Timo Sirainen date: Tue Dec 02 00:29:13 2014 -0800 description: dict-redis: Use timeout_msecs parameter also for transaction commit waits. diffstat: src/lib-dict/dict-redis.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (33 lines): diff -r 668068a45447 -r 61b789a5e2c7 src/lib-dict/dict-redis.c --- a/src/lib-dict/dict-redis.c Tue Dec 02 00:26:24 2014 -0800 +++ b/src/lib-dict/dict-redis.c Tue Dec 02 00:29:13 2014 -0800 @@ -108,18 +108,29 @@ io_loop_stop(conn->dict->ioloop); } +static void redis_dict_wait_timeout(struct redis_dict *dict) +{ + i_error("redis: Commit timed out in %u.%03u secs", + dict->timeout_msecs/1000, dict->timeout_msecs%1000); + io_loop_stop(dict->ioloop); +} + static void redis_wait(struct redis_dict *dict) { + struct timeout *to; + i_assert(dict->ioloop == NULL); dict->prev_ioloop = current_ioloop; dict->ioloop = io_loop_create(); + to = timeout_add(dict->timeout_msecs, redis_dict_wait_timeout, dict); connection_switch_ioloop(&dict->conn.conn); do { io_loop_run(dict->ioloop); } while (array_count(&dict->input_states) > 0); + timeout_remove(&to); io_loop_set_current(dict->prev_ioloop); connection_switch_ioloop(&dict->conn.conn); io_loop_set_current(dict->ioloop); From dovecot at dovecot.org Fri Dec 5 01:11:45 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 01:11:45 +0000 Subject: dovecot-2.2: fts: Compiler warning fix when using fts-indexer.h ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/94c8db49fe59 changeset: 18123:94c8db49fe59 user: Timo Sirainen date: Fri Dec 05 03:10:32 2014 +0200 description: fts: Compiler warning fix when using fts-indexer.h directly diffstat: src/plugins/fts/fts-indexer.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 61b789a5e2c7 -r 94c8db49fe59 src/plugins/fts/fts-indexer.h --- a/src/plugins/fts/fts-indexer.h Tue Dec 02 00:29:13 2014 -0800 +++ b/src/plugins/fts/fts-indexer.h Fri Dec 05 03:10:32 2014 +0200 @@ -1,6 +1,7 @@ #ifndef FTS_BUILD_H #define FTS_BUILD_H +struct fts_backend; struct fts_indexer_context; /* Initialize indexing the given mailbox via indexer service. Returns 1 if From dovecot at dovecot.org Fri Dec 5 01:11:45 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 01:11:45 +0000 Subject: dovecot-2.2: fts: Install some of the header files that other ex... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/9b7fdacccf99 changeset: 18124:9b7fdacccf99 user: Timo Sirainen date: Fri Dec 05 03:11:14 2014 +0200 description: fts: Install some of the header files that other external plugins might want to use. diffstat: src/plugins/fts/Makefile.am | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diffs (27 lines): diff -r 94c8db49fe59 -r 9b7fdacccf99 src/plugins/fts/Makefile.am --- a/src/plugins/fts/Makefile.am Fri Dec 05 03:10:32 2014 +0200 +++ b/src/plugins/fts/Makefile.am Fri Dec 05 03:11:14 2014 +0200 @@ -32,15 +32,18 @@ fts-search-serialize.c \ fts-storage.c +pkginc_libdir=$(pkgincludedir) +pkginc_lib_HEADERS = \ + fts-api.h \ + fts-api-private.h \ + fts-expunge-log.h \ + fts-indexer.h \ + fts-parser.h + noinst_HEADERS = \ doveadm-fts.h \ html-entities.h \ - fts-api.h \ - fts-api-private.h \ fts-build-mail.h \ - fts-expunge-log.h \ - fts-indexer.h \ - fts-parser.h \ fts-plugin.h \ fts-search-serialize.h \ fts-storage.h From dovecot at dovecot.org Fri Dec 5 01:38:35 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 01:38:35 +0000 Subject: dovecot-2.2: auth: Don't allow changing username to an empty str... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/a3ac6d5e5915 changeset: 18125:a3ac6d5e5915 user: Timo Sirainen date: Fri Dec 05 03:38:08 2014 +0200 description: auth: Don't allow changing username to an empty string. This is most likely always accidental and Dovecot in general hasn't been designed to support empty usernames. diffstat: src/auth/auth-request.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diffs (16 lines): diff -r 9b7fdacccf99 -r a3ac6d5e5915 src/auth/auth-request.c --- a/src/auth/auth-request.c Fri Dec 05 03:11:14 2014 +0200 +++ b/src/auth/auth-request.c Fri Dec 05 03:38:08 2014 +0200 @@ -1378,6 +1378,12 @@ new_value = get_updated_username(request->user, name, value); if (new_value == NULL) return FALSE; + if (new_value[0] == '\0') { + auth_request_log_error(request, AUTH_SUBSYS_DB, + "username attempted to be changed to empty"); + request->failed = TRUE; + return TRUE; + } if (strcmp(request->user, new_value) != 0) { auth_request_log_debug(request, AUTH_SUBSYS_DB, From dovecot at dovecot.org Fri Dec 5 02:39:46 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 02:39:46 +0000 Subject: dovecot-2.2: doveadm: Support changing proxy destination usernam... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/7c834633922c changeset: 18126:7c834633922c user: Timo Sirainen date: Fri Dec 05 03:53:02 2014 +0200 description: doveadm: Support changing proxy destination username with "user" and "destuser" passdb field. diffstat: src/doveadm/doveadm-mail-server.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diffs (71 lines): diff -r a3ac6d5e5915 -r 7c834633922c src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Fri Dec 05 03:38:08 2014 +0200 +++ b/src/doveadm/doveadm-mail-server.c Fri Dec 05 03:53:02 2014 +0200 @@ -173,7 +173,8 @@ static int doveadm_mail_server_user_get_host(struct doveadm_mail_cmd_context *ctx, const struct mail_storage_service_input *input, - const char **host_r, const char **error_r) + const char **user_r, const char **host_r, + const char **error_r) { struct auth_master_connection *auth_conn; struct auth_user_info info; @@ -183,6 +184,7 @@ bool proxying; int ret; + *user_r = input->username; *host_r = ctx->set->doveadm_socket_path; if (ctx->set->doveadm_port == 0) @@ -221,6 +223,10 @@ proxying = TRUE; else if (strncmp(fields[i], "host=", 5) == 0) proxy_host = fields[i]+5; + else if (strncmp(fields[i], "user=", 5) == 0) + *user_r = t_strdup(fields[i]+5); + else if (strncmp(fields[i], "destuser=", 9) == 0) + *user_r = t_strdup(fields[i]+9); else if (strncmp(fields[i], "port=", 5) == 0) { if (str_to_uint(fields[i]+5, &proxy_port) < 0) proxy_port = 0; @@ -251,14 +257,14 @@ { struct doveadm_server *server; struct server_connection *conn; - const char *host; + const char *user, *host; char *username_dup; int ret; i_assert(cmd_ctx == ctx || cmd_ctx == NULL); cmd_ctx = ctx; - ret = doveadm_mail_server_user_get_host(ctx, input, &host, error_r); + ret = doveadm_mail_server_user_get_host(ctx, input, &user, &host, error_r); if (ret < 0) return -1; if (ret == 0 && @@ -274,18 +280,18 @@ server = doveadm_server_get(ctx, host); conn = doveadm_server_find_unused_conn(server); if (conn != NULL) - doveadm_mail_server_handle(conn, input->username); + doveadm_mail_server_handle(conn, user); else if (array_count(&server->connections) < I_MAX(ctx->set->doveadm_worker_count, 1)) { if (server_connection_create(server, &conn) < 0) internal_failure = TRUE; else - doveadm_mail_server_handle(conn, input->username); + doveadm_mail_server_handle(conn, user); } else { if (array_count(&server->queue) >= DOVEADM_SERVER_QUEUE_MAX) doveadm_server_flush_one(server); - username_dup = i_strdup(input->username); + username_dup = i_strdup(user); array_append(&server->queue, &username_dup, 1); } *error_r = "doveadm server failure"; From dovecot at dovecot.org Fri Dec 5 02:39:46 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 02:39:46 +0000 Subject: dovecot-2.2: doveadm: Avoid calling init() in doveadm binary if ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/3b89f2f4ffb3 changeset: 18127:3b89f2f4ffb3 user: Timo Sirainen date: Fri Dec 05 04:39:11 2014 +0200 description: doveadm: Avoid calling init() in doveadm binary if the command is sent to doveadm-server. The init() is still always called when -A or -u *wildcards* are used though. I'm not sure if that can be delayed. At least all commands should be verified that they don't rely on the current init() location. diffstat: src/doveadm/doveadm-mail.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diffs (49 lines): diff -r 7c834633922c -r 3b89f2f4ffb3 src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Fri Dec 05 03:53:02 2014 +0200 +++ b/src/doveadm/doveadm-mail.c Fri Dec 05 04:39:11 2014 +0200 @@ -266,7 +266,7 @@ } static int -doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx, +doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx, bool init_user, const struct mail_storage_service_input *input, const char **error_r) { @@ -285,6 +285,14 @@ if (ret != 0) return ret; + if (init_user) { + /* call init() after we've checked whether we want to do this + via doveadm-server or not */ + ctx->v.init(ctx, ctx->args); + if (hook_doveadm_mail_init != NULL) + hook_doveadm_mail_init(ctx); + } + ret = mail_storage_service_lookup(ctx->storage_service, input, &ctx->cur_service_user, &error); if (ret <= 0) { @@ -330,11 +338,7 @@ ctx->storage_service_input = *input; ctx->storage_service = mail_storage_service_init(master_service, NULL, ctx->service_flags); - ctx->v.init(ctx, ctx->args); - if (hook_doveadm_mail_init != NULL) - hook_doveadm_mail_init(ctx); - - return doveadm_mail_next_user(ctx, input, error_r); + return doveadm_mail_next_user(ctx, TRUE, input, error_r); } static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED) @@ -379,7 +383,7 @@ ctx->cur_username = user; doveadm_print_sticky("username", user); T_BEGIN { - ret = doveadm_mail_next_user(ctx, &input, &error); + ret = doveadm_mail_next_user(ctx, FALSE, &input, &error); if (ret < 0) i_error("%s", error); else if (ret == 0) From dovecot at dovecot.org Fri Dec 5 03:51:02 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 05 Dec 2014 03:51:02 +0000 Subject: dovecot-2.2: lib-storage: Mail prefetching was still not working... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6dd190bd6dcb changeset: 18128:6dd190bd6dcb user: Timo Sirainen date: Fri Dec 05 05:50:19 2014 +0200 description: lib-storage: Mail prefetching was still not working right. I wonder if it ever actually worked (except for SEARCH TEXT). diffstat: src/lib-storage/index/index-mail.c | 41 ++++++++++++++++++++++++----------- src/lib-storage/index/index-mail.h | 3 +- src/lib-storage/index/index-search.c | 8 ++++-- 3 files changed, 35 insertions(+), 17 deletions(-) diffs (138 lines): diff -r 3b89f2f4ffb3 -r 6dd190bd6dcb src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Fri Dec 05 04:39:11 2014 +0200 +++ b/src/lib-storage/index/index-mail.c Fri Dec 05 05:50:19 2014 +0200 @@ -1435,14 +1435,12 @@ mail->data.save_envelope = TRUE; } -void index_mail_update_access_parts(struct mail *_mail) +void index_mail_update_access_parts_pre(struct mail *_mail) { struct index_mail *mail = (struct index_mail *)_mail; struct index_mail_data *data = &mail->data; const struct mail_cache_field *cache_fields = mail->ibox->cache_fields; struct mail_cache_view *cache_view = _mail->transaction->cache_view; - const struct mail_index_header *hdr; - struct istream *input; if ((data->wanted_fields & (MAIL_FETCH_NUL_STATE | MAIL_FETCH_IMAP_BODY | @@ -1522,21 +1520,35 @@ data->save_sent_date = TRUE; } } - if ((data->wanted_fields & (MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY)) != 0) { - /* open stream immediately to set expunged flag if - it's already lost */ if ((data->wanted_fields & MAIL_FETCH_STREAM_HEADER) != 0) data->access_part |= READ_HDR; if ((data->wanted_fields & MAIL_FETCH_STREAM_BODY) != 0) data->access_part |= READ_BODY; + } +} + +void index_mail_update_access_parts_post(struct mail *_mail) +{ + struct index_mail *mail = (struct index_mail *)_mail; + struct index_mail_data *data = &mail->data; + const struct mail_index_header *hdr; + struct istream *input; + + /* when mail_prefetch_count>1, at this point we've started the + prefetching to all the mails and we're now starting to access the + first mail. */ + + if (data->access_part != 0) { + /* open stream immediately to set expunged flag if + it's already lost */ /* open the stream only if we didn't get here from mailbox_save_init() */ hdr = mail_index_get_header(_mail->transaction->view); if (!_mail->saving && _mail->uid < hdr->next_uid) { - if ((data->access_part & READ_BODY) != 0) + if ((data->access_part & (READ_BODY | PARSE_BODY)) != 0) (void)mail_get_stream(_mail, NULL, NULL, &input); else (void)mail_get_hdr_stream(_mail, NULL, &input); @@ -1569,11 +1581,13 @@ return; } - if (!mail->search_mail) - index_mail_update_access_parts(_mail); - else { - /* searching code will call the index_mail_update_access_parts() - after we know the mail is actually wanted to be fetched. */ + if (!mail->search_mail) { + index_mail_update_access_parts_pre(_mail); + index_mail_update_access_parts_post(_mail); + } else { + /* searching code will call the + index_mail_update_access_parts_*() after we know the mail is + actually wanted to be fetched. */ } mail->data.initialized = TRUE; } @@ -1665,7 +1679,8 @@ mailbox_header_lookup_init(_mail->box, array_idx(&names, 0)); } - index_mail_update_access_parts(_mail); + index_mail_update_access_parts_pre(_mail); + index_mail_update_access_parts_post(_mail); } void index_mail_set_uid_cache_updates(struct mail *_mail, bool set) diff -r 3b89f2f4ffb3 -r 6dd190bd6dcb src/lib-storage/index/index-mail.h --- a/src/lib-storage/index/index-mail.h Fri Dec 05 04:39:11 2014 +0200 +++ b/src/lib-storage/index/index-mail.h Fri Dec 05 05:50:19 2014 +0200 @@ -171,7 +171,8 @@ void index_mail_add_temp_wanted_fields(struct mail *mail, enum mail_fetch_field fields, struct mailbox_header_lookup_ctx *headers); -void index_mail_update_access_parts(struct mail *mail); +void index_mail_update_access_parts_pre(struct mail *mail); +void index_mail_update_access_parts_post(struct mail *_mail); void index_mail_close(struct mail *mail); void index_mail_close_streams(struct index_mail *mail); void index_mail_free(struct mail *mail); diff -r 3b89f2f4ffb3 -r 6dd190bd6dcb src/lib-storage/index/index-search.c --- a/src/lib-storage/index/index-search.c Fri Dec 05 04:39:11 2014 +0200 +++ b/src/lib-storage/index/index-search.c Fri Dec 05 05:50:19 2014 +0200 @@ -1556,7 +1556,7 @@ if searching would want fewer access_parts than the fetching part, but that's probably not a big problem usually. */ - index_mail_update_access_parts(mail); + index_mail_update_access_parts_pre(mail); ret = 1; break; } @@ -1651,6 +1651,7 @@ array_delete(&ctx->mails, 0, 1); array_append(&ctx->mails, mail_r, 1); } + index_mail_update_access_parts_post(*mail_r); return 1; } @@ -1731,13 +1732,14 @@ } /* everything searched at this point already. just returning - matches from sort list */ + matches from sort list. FIXME: we could do prefetching here also. */ if (!index_sort_list_next(_ctx->sort_program, &seq)) return FALSE; mailp = array_idx(&ctx->mails, 0); mail_set_seq(*mailp, seq); - index_mail_update_access_parts(*mailp); + index_mail_update_access_parts_pre(*mailp); + index_mail_update_access_parts_post(*mailp); *mail_r = *mailp; return TRUE; } From pigeonhole at rename-it.nl Wed Dec 17 00:12:56 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 17 Dec 2014 01:12:56 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: Fixed printing of hybrid comm... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/590407d97ecb changeset: 1974:590407d97ecb user: Stephan Bosch date: Wed Dec 17 00:35:47 2014 +0100 description: lib-sieve: Fixed printing of hybrid command type. diffstat: src/lib-sieve/sieve-commands.c | 18 ++++++++++++++++++ src/lib-sieve/sieve-commands.h | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diffs (49 lines): diff -r e7979b6a9d4b -r 590407d97ecb src/lib-sieve/sieve-commands.c --- a/src/lib-sieve/sieve-commands.c Sat Nov 22 00:17:13 2014 +0100 +++ b/src/lib-sieve/sieve-commands.c Wed Dec 17 00:35:47 2014 +0100 @@ -296,6 +296,24 @@ case SCT_NONE: return "command of unspecified type (bug)"; case SCT_TEST: return "test"; case SCT_COMMAND: return "command"; + case SCT_HYBRID: return "command or test"; + default: + break; + } + return "??COMMAND-TYPE??"; +} + +const char *sieve_command_type_name + (const struct sieve_command *cmd) +{ + switch ( cmd->def->type ) { + case SCT_NONE: return "command of unspecified type (bug)"; + case SCT_TEST: return "test"; + case SCT_COMMAND: return "command"; + case SCT_HYBRID: + if ( cmd->ast_node->type == SAT_TEST ) + return "test"; + return "command"; default: break; } diff -r e7979b6a9d4b -r 590407d97ecb src/lib-sieve/sieve-commands.h --- a/src/lib-sieve/sieve-commands.h Sat Nov 22 00:17:13 2014 +0100 +++ b/src/lib-sieve/sieve-commands.h Wed Dec 17 00:35:47 2014 +0100 @@ -164,8 +164,6 @@ ( (cmd)->def == &(definition) ) #define sieve_command_identifier(cmd) \ ( (cmd)->def->identifier ) -#define sieve_command_type_name(cmd) \ - ( sieve_command_def_type_name((cmd)->def) ) #define sieve_commands_equal(cmd1, cmd2) \ ( (cmd1) != NULL && (cmd2) != NULL && (cmd1)->def == (cmd2)->def ) @@ -179,6 +177,8 @@ const char *sieve_command_def_type_name (const struct sieve_command_def *cmd_def); +const char *sieve_command_type_name + (const struct sieve_command *cmd); struct sieve_command *sieve_command_prev (struct sieve_command *cmd); From pigeonhole at rename-it.nl Wed Dec 17 00:12:57 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 17 Dec 2014 01:12:57 +0100 Subject: dovecot-2.2-pigeonhole: tests: Fixed extprograms test suite. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/dbce56ea72cb changeset: 1975:dbce56ea72cb user: Stephan Bosch date: Wed Dec 17 00:58:58 2014 +0100 description: tests: Fixed extprograms test suite. Recent changes in handling of unknown tags caused `make test-plugins' to fail. diffstat: tests/plugins/extprograms/execute/errors/syntax.sieve | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 590407d97ecb -r dbce56ea72cb tests/plugins/extprograms/execute/errors/syntax.sieve --- a/tests/plugins/extprograms/execute/errors/syntax.sieve Wed Dec 17 00:35:47 2014 +0100 +++ b/tests/plugins/extprograms/execute/errors/syntax.sieve Wed Dec 17 00:58:58 2014 +0100 @@ -31,7 +31,7 @@ execute :input ["23423","21342"] "frop"; # 11: error: invalid :input argument; invalid parameter -execute :input :frop "frop"; +execute :input :friep "frop"; # 12: error: :output not allowed without variables extension execute :output "${frop}" "frop"; From pigeonhole at rename-it.nl Wed Dec 17 00:12:57 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 17 Dec 2014 01:12:57 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: program client: Made sure sup... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/e6087ee9a301 changeset: 1976:e6087ee9a301 user: Stephan Bosch date: Wed Dec 17 01:12:43 2014 +0100 description: lib-sieve: program client: Made sure supplemental group privileges are also dropped. diffstat: src/lib-sieve/util/program-client-local.c | 35 ++++++++++++++---------------- 1 files changed, 16 insertions(+), 19 deletions(-) diffs (61 lines): diff -r dbce56ea72cb -r e6087ee9a301 src/lib-sieve/util/program-client-local.c --- a/src/lib-sieve/util/program-client-local.c Wed Dec 17 00:58:58 2014 +0100 +++ b/src/lib-sieve/util/program-client-local.c Wed Dec 17 01:12:43 2014 +0100 @@ -18,7 +18,7 @@ #include #include #include - +#include struct program_client_local { struct program_client client; @@ -186,33 +186,30 @@ if (seteuid(0) < 0) i_fatal("seteuid(0) failed: %m"); - /* drop gid first */ + /* drop gids first */ gid = getgid(); if ( gid == 0 || gid != pclient->set.gid ) { - if ( pclient->set.gid != 0 ) { - if ( setgid(pclient->set.gid) < 0 ) - i_fatal("setgid(%d) failed: %m", pclient->set.gid); - } else { + if ( pclient->set.gid != 0 ) + gid = pclient->set.gid; + else gid = getegid(); - if (gid != 0 && setgid(gid) < 0) { - i_fatal("setgid(%d) failed: %m", gid); - } - } } + if ( setgroups(1, &gid) < 0 ) + i_fatal("setgroups(%d) failed: %m", gid); + if ( gid != 0 && setgid(gid) < 0 ) + i_fatal("setgid(%d) failed: %m", gid); /* drop uid */ - if ( pclient->set.uid != 0 ) { - if ( setuid(pclient->set.uid) ) - i_fatal("setuid(%d) failed: %m", pclient->set.uid); - } else { + if ( pclient->set.uid != 0 ) + uid = pclient->set.uid; + else uid = geteuid(); - if ( uid != 0 && setuid(uid) < 0 ) - i_fatal("setuid(%d) failed: %m", uid); - } + if ( uid != 0 && setuid(uid) < 0 ) + i_fatal("setuid(%d) failed: %m", uid); } - i_assert(getuid() != 0); - i_assert(getgid() != 0); + i_assert(pclient->set.uid == 0 || getuid() != 0); + i_assert(pclient->set.gid == 0 || getgid() != 0); if ( array_is_created(&pclient->envs) ) envs = array_get(&pclient->envs, &count); From pigeonhole at rename-it.nl Wed Dec 17 00:15:11 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 17 Dec 2014 01:15:11 +0100 Subject: dovecot-2.2-pigeonhole: Updated LGPL license. Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/e8882cfd73af changeset: 1977:e8882cfd73af user: Stephan Bosch date: Wed Dec 17 01:15:04 2014 +0100 description: Updated LGPL license. diffstat: COPYING.LGPL | 84 +++++++++++++++++++++++++++-------------------------------- 1 files changed, 38 insertions(+), 46 deletions(-) diffs (213 lines): diff -r e6087ee9a301 -r e8882cfd73af COPYING.LGPL --- a/COPYING.LGPL Wed Dec 17 01:12:43 2014 +0100 +++ b/COPYING.LGPL Wed Dec 17 01:15:04 2014 +0100 @@ -1,9 +1,8 @@ - GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -23,8 +22,7 @@ Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. +strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that @@ -57,7 +55,7 @@ that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. -^L + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -89,9 +87,9 @@ special circumstances. For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes a de-facto standard. To achieve this, non-free programs must -be allowed to use the library. A more frequent case is that a free +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. @@ -113,7 +111,7 @@ "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. -^L + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -138,8 +136,8 @@ "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation and installation of the library. +interface definition files, plus the scripts used to control compilation +and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of @@ -218,7 +216,7 @@ ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. -^L + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -269,7 +267,7 @@ distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. -^L + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -305,10 +303,10 @@ the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. - c) Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above @@ -331,7 +329,7 @@ accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. -^L + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -372,7 +370,7 @@ restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. -^L + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -386,10 +384,9 @@ the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any @@ -407,11 +404,11 @@ 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. @@ -425,7 +422,7 @@ the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. -^L + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -459,21 +456,19 @@ DAMAGES. END OF TERMS AND CONDITIONS -^L + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. Copyright (C) @@ -490,21 +485,18 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. -You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, -if necessary. Here is a sample; alter the names: +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James - Random Hacker. + library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! - - From dovecot at dovecot.org Wed Dec 17 12:40:39 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Dec 2014 12:40:39 +0000 Subject: dovecot-2.2: lib: Small optimization / unnecessary code removal ... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/0d870753d9ab changeset: 18129:0d870753d9ab user: Timo Sirainen date: Wed Dec 17 13:39:57 2014 +0100 description: lib: Small optimization / unnecessary code removal from array_*() functions. diffstat: src/lib/array.c | 33 ++++++--------------------------- 1 files changed, 6 insertions(+), 27 deletions(-) diffs (51 lines): diff -r 6dd190bd6dcb -r 0d870753d9ab src/lib/array.c --- a/src/lib/array.c Fri Dec 05 05:50:19 2014 +0200 +++ b/src/lib/array.c Wed Dec 17 13:39:57 2014 +0100 @@ -7,41 +7,20 @@ void *array_idx_modifiable_i(struct array *array, unsigned int idx) { - size_t pos; - - pos = idx * array->element_size; - if (pos >= array->buffer->used) { - /* index doesn't exist yet, initialize with zero */ - buffer_append_zero(array->buffer, pos + array->element_size - - array->buffer->used); - } - return buffer_get_space_unsafe(array->buffer, pos, array->element_size); + return buffer_get_space_unsafe(array->buffer, idx * array->element_size, + array->element_size); } void array_idx_set_i(struct array *array, unsigned int idx, const void *data) { - size_t pos; - - pos = idx * array->element_size; - if (pos > array->buffer->used) { - /* index doesn't exist yet, initialize with zero */ - buffer_append_zero(array->buffer, pos - array->buffer->used); - } - buffer_write(array->buffer, pos, data, array->element_size); + buffer_write(array->buffer, idx * array->element_size, + data, array->element_size); } void array_idx_clear_i(struct array *array, unsigned int idx) { - size_t pos; - - pos = idx * array->element_size; - if (pos > array->buffer->used) { - /* index doesn't exist yet, initialize with zero */ - buffer_append_zero(array->buffer, pos - array->buffer->used + - array->element_size); - } else { - buffer_write_zero(array->buffer, pos, array->element_size); - } + buffer_write_zero(array->buffer, idx * array->element_size, + array->element_size); } void *array_insert_space_i(struct array *array, unsigned int idx) From dovecot at dovecot.org Wed Dec 17 13:44:07 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 17 Dec 2014 13:44:07 +0000 Subject: dovecot-2.2: auth: Don't crash if master user login is attempted... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/dd2eebe35a3a changeset: 18130:dd2eebe35a3a user: Timo Sirainen date: Wed Dec 17 14:43:30 2014 +0100 description: auth: Don't crash if master user login is attempted without master=yes passdbs diffstat: src/auth/auth-request.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (26 lines): diff -r 0d870753d9ab -r dd2eebe35a3a src/auth/auth-request.c --- a/src/auth/auth-request.c Wed Dec 17 13:39:57 2014 +0100 +++ b/src/auth/auth-request.c Wed Dec 17 14:43:30 2014 +0100 @@ -1249,6 +1249,8 @@ const char *username, const char **error_r) { + struct auth_passdb *master_passdb; + i_assert(*username != '\0'); if (strcmp(username, request->user) == 0) { @@ -1258,7 +1260,12 @@ } /* lookup request->user from masterdb first */ - request->passdb = auth_request_get_auth(request)->masterdbs; + master_passdb = auth_request_get_auth(request)->masterdbs; + if (master_passdb == NULL) { + *error_r = "Master user login attempted without master passdbs"; + return FALSE; + } + request->passdb = master_passdb; request->requested_login_user = auth_request_fix_username(request, username, error_r); From pigeonhole at rename-it.nl Sat Dec 20 15:45:42 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 20 Dec 2014 16:45:42 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: Accept non-standard domain na... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/0a412dd2c168 changeset: 1978:0a412dd2c168 user: Stephan Bosch date: Sat Dec 20 16:45:32 2014 +0100 description: lib-sieve: Accept non-standard domain names, e.g. containing '_'. diffstat: src/lib-sieve/sieve-address.c | 16 ++++++++++------ tests/extensions/envelope.svtest | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) diffs (83 lines): diff -r e8882cfd73af -r 0a412dd2c168 src/lib-sieve/sieve-address.c --- a/src/lib-sieve/sieve-address.c Wed Dec 17 01:15:04 2014 +0100 +++ b/src/lib-sieve/sieve-address.c Sat Dec 20 16:45:32 2014 +0100 @@ -696,6 +696,10 @@ * sub-domain = Let-dig [Ldh-str] * Let-dig = ALPHA / DIGIT * Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig + * + * NOTE: A more generic syntax is accepted to be lenient towards + * systems that don't adhere to the standards. It allows + * '-' and '_' to occur anywhere in a sub-domain. */ str_truncate(parser->str, 0); @@ -705,27 +709,27 @@ if ( ret < 0 ) return ret; } else { for (;;) { - if ( !i_isalnum(*parser->data) ) + if ( parser->data >= parser->end || + (!i_isalnum(*parser->data) && *parser->data != '-' && + *parser->data != '_') ) return -1; str_append_c(parser->str, *parser->data); parser->data++; while ( parser->data < parser->end ) { - if ( !i_isalnum(*parser->data) && *parser->data != '-' ) + if ( !i_isalnum(*parser->data) && *parser->data != '-' && + *parser->data != '_' ) break; str_append_c(parser->str, *parser->data); parser->data++; } - if ( !i_isalnum(*(parser->data-1)) ) - return -1; - if ( (ret=path_skip_white_space(parser)) < 0 ) return ret; - if ( *parser->data != '.' ) + if ( parser->data >= parser->end || *parser->data != '.' ) break; str_append_c(parser->str, *parser->data); diff -r e8882cfd73af -r 0a412dd2c168 tests/extensions/envelope.svtest --- a/tests/extensions/envelope.svtest Wed Dec 17 01:15:04 2014 +0100 +++ b/tests/extensions/envelope.svtest Sat Dec 20 16:45:32 2014 +0100 @@ -265,5 +265,31 @@ if not envelope :localpart :is "to" "..japanese...localpart.." { test_fail "failed to parse japanese local_part (4)"; } +} +test "Envelope - Non-standard hostnames" { + test_set "envelope.to" "japanese at _example.com"; + if not envelope :domain :is "to" "_example.com" { + test_fail "failed to parse non-standard domain (1)"; + } + + test_set "envelope.to" "japanese at ex_ample.com"; + if not envelope :domain :is "to" "ex_ample.com" { + test_fail "failed to parse non-standard domain (2)"; + } + + test_set "envelope.to" "japanese at example_.com"; + if not envelope :domain :is "to" "example_.com" { + test_fail "failed to parse non-standard domain (3)"; + } + + test_set "envelope.to" "japanese at -example.com"; + if not envelope :domain :is "to" "-example.com" { + test_fail "failed to parse non-standard domain (4)"; + } + + test_set "envelope.to" "japanese at example-.com"; + if not envelope :domain :is "to" "example-.com" { + test_fail "failed to parse non-standard domain (5)"; + } } From pigeonhole at rename-it.nl Sat Dec 20 17:18:23 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Sat, 20 Dec 2014 18:18:23 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: Turned message envelope addre... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/921fd15296c2 changeset: 1979:921fd15296c2 user: Stephan Bosch date: Sat Dec 20 18:18:16 2014 +0100 description: lib-sieve: Turned message envelope address parse errors into warnings. diffstat: src/lib-sieve/sieve-message.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (42 lines): diff -r 0a412dd2c168 -r 921fd15296c2 src/lib-sieve/sieve-message.c --- a/src/lib-sieve/sieve-message.c Sat Dec 20 16:45:32 2014 +0100 +++ b/src/lib-sieve/sieve-message.c Sat Dec 20 18:18:16 2014 +0100 @@ -255,11 +255,11 @@ (msgctx->pool, msgdata->orig_envelope_to); if ( msgctx->envelope_orig_recipient == NULL ) { - sieve_sys_error(svinst, + sieve_sys_warning(svinst, "original envelope recipient address '%s' is unparsable", msgdata->orig_envelope_to); } else if ( msgctx->envelope_orig_recipient->local_part == NULL ) { - sieve_sys_error(svinst, + sieve_sys_warning(svinst, "original envelope recipient address '%s' is a null path", msgdata->orig_envelope_to); } @@ -269,13 +269,13 @@ if ( msgctx->envelope_final_recipient == NULL ) { if ( msgctx->envelope_orig_recipient != NULL ) { - sieve_sys_error(svinst, + sieve_sys_warning(svinst, "final envelope recipient address '%s' is unparsable", msgdata->final_envelope_to); } } else if ( msgctx->envelope_final_recipient->local_part == NULL ) { if ( strcmp(msgdata->orig_envelope_to, msgdata->final_envelope_to) != 0 ) { - sieve_sys_error(svinst, + sieve_sys_warning(svinst, "final envelope recipient address '%s' is a null path", msgdata->final_envelope_to); } @@ -285,7 +285,7 @@ (msgctx->pool, msgdata->return_path); if ( msgctx->envelope_sender == NULL ) { - sieve_sys_error(svinst, + sieve_sys_warning(svinst, "envelope sender address '%s' is unparsable", msgdata->return_path); } From dovecot at dovecot.org Fri Dec 26 15:29:20 2014 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 26 Dec 2014 15:29:20 +0000 Subject: dovecot-2.2: configure: Don't break when using --without-shared-... Message-ID: details: http://hg.dovecot.org/dovecot-2.2/rev/6078354e6238 changeset: 18131:6078354e6238 user: Timo Sirainen date: Fri Dec 26 17:28:30 2014 +0200 description: configure: Don't break when using --without-shared-libs and CC with '/' chars. diffstat: configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r dd2eebe35a3a -r 6078354e6238 configure.ac --- a/configure.ac Wed Dec 17 14:43:30 2014 +0100 +++ b/configure.ac Fri Dec 26 17:28:30 2014 +0200 @@ -2805,7 +2805,7 @@ # libtool can't handle using whole-archive flags, so we need to do this # with a CC wrapper.. shouldn't be much of a problem, since most people # are building with shared libs. - sed "s/@CC@/$CC/" < $srcdir/cc-wrapper.sh.in > cc-wrapper.sh + sed "s:@CC@:$CC:" < $srcdir/cc-wrapper.sh.in > cc-wrapper.sh chmod +x cc-wrapper.sh CC=`pwd`/cc-wrapper.sh fi From pigeonhole at rename-it.nl Tue Dec 30 22:01:17 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 30 Dec 2014 23:01:17 +0100 Subject: dovecot-2.2-pigeonhole: testsuite: Added syntax checks for body ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/c9698bc1751a changeset: 1981:c9698bc1751a user: Stephan Bosch date: Tue Dec 30 22:57:07 2014 +0100 description: testsuite: Added syntax checks for body test. diffstat: Makefile.am | 1 + tests/extensions/body/errors.svtest | 19 +++++++++++++++ tests/extensions/body/errors/syntax.sieve | 38 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 0 deletions(-) diffs (76 lines): diff -r d7fb503ac03e -r c9698bc1751a Makefile.am --- a/Makefile.am Tue Dec 30 22:56:11 2014 +0100 +++ b/Makefile.am Tue Dec 30 22:57:07 2014 +0100 @@ -106,6 +106,7 @@ tests/extensions/imap4flags/flagstring.svtest \ tests/extensions/imap4flags/flagstore.svtest \ tests/extensions/body/basic.svtest \ + tests/extensions/body/errors.svtest \ tests/extensions/body/raw.svtest \ tests/extensions/body/content.svtest \ tests/extensions/body/match-values.svtest \ diff -r d7fb503ac03e -r c9698bc1751a tests/extensions/body/errors.svtest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/extensions/body/errors.svtest Tue Dec 30 22:57:07 2014 +0100 @@ -0,0 +1,19 @@ +require "vnd.dovecot.testsuite"; + +require "relational"; +require "comparator-i;ascii-numeric"; + +/* + * Invalid syntax + */ + +test "Invalid Syntax" { + if test_script_compile "errors/syntax.sieve" { + test_fail "compile should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "12" { + test_fail "wrong number of errors reported"; + } +} + diff -r d7fb503ac03e -r c9698bc1751a tests/extensions/body/errors/syntax.sieve --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/extensions/body/errors/syntax.sieve Tue Dec 30 22:57:07 2014 +0100 @@ -0,0 +1,38 @@ +require "body"; + +# 1: No key list +if body { } + +# 2: Number +if body 3 { } + +# OK: String +if body "frop" { } + +# 3: To many arguments +if body "frop" "friep" { } + +# 4: Unknown tag +if body :frop { } + +# 5: Unknown tag with valid key +if body :friep "frop" { } + +# 6: Content without argument +if body :content { } + +# 7: Content without key argument +if body :content "frop" { } + +# 8: Content with number argument +if body :content 3 "frop" { } + +# 9: Content with unknown tag +if body :content :frml "frop" { } + +# 10: Content with known tag +if body :content :contains "frop" { } + +# 11: Duplicate transform +if body :content "frop" :raw "frop" { } + From pigeonhole at rename-it.nl Tue Dec 30 22:01:17 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 30 Dec 2014 23:01:17 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: Fixed parameter validation er... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/d7fb503ac03e changeset: 1980:d7fb503ac03e user: Stephan Bosch date: Tue Dec 30 22:56:11 2014 +0100 description: lib-sieve: Fixed parameter validation error message for tagged argument. It had a whitespace where it didn't belong. diffstat: src/lib-sieve/sieve-validator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 921fd15296c2 -r d7fb503ac03e src/lib-sieve/sieve-validator.c --- a/src/lib-sieve/sieve-validator.c Sat Dec 20 18:18:16 2014 +0100 +++ b/src/lib-sieve/sieve-validator.c Tue Dec 30 22:56:11 2014 +0100 @@ -847,7 +847,7 @@ t_strdup_printf(" %d (%s)", arg_pos, arg_name) ); sieve_argument_validate_error(valdtr, tag, - "the :%s tag for the %s %s requires %s as parameter %s, " + "the :%s tag for the %s %s requires %s as parameter%s, " "but no parameters were found", sieve_ast_argument_tag(tag), sieve_command_identifier(cmd), sieve_command_type_name(cmd), sieve_ast_argument_type_name(req_type), position); From pigeonhole at rename-it.nl Tue Dec 30 22:01:17 2014 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 30 Dec 2014 23:01:17 +0100 Subject: dovecot-2.2-pigeonhole: lib-sieve: Fixed crash in validation of ... Message-ID: details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/b6c55ac6460d changeset: 1982:b6c55ac6460d user: Stephan Bosch date: Tue Dec 30 23:01:04 2014 +0100 description: lib-sieve: Fixed crash in validation of the string parameter of the comparator tag. It couldn't handle a missing parameter (which also means missing arguments of the test itself in most cases). This is fixed by using the sieve_validate_tag_parameter() utility function. Testsuite is also extended. diffstat: src/lib-sieve/sieve-comparators.c | 9 ++------- tests/compile/errors.svtest | 14 ++++++++++++++ tests/compile/errors/comparator.sieve | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) diffs (71 lines): diff -r c9698bc1751a -r b6c55ac6460d src/lib-sieve/sieve-comparators.c --- a/src/lib-sieve/sieve-comparators.c Tue Dec 30 22:57:07 2014 +0100 +++ b/src/lib-sieve/sieve-comparators.c Tue Dec 30 23:01:04 2014 +0100 @@ -140,16 +140,11 @@ /* Check syntax: * ":comparator" */ - if ( (*arg)->type != SAAT_STRING ) { - sieve_argument_validate_error(valdtr, *arg, - ":comparator tag requires one string argument, but %s was found", - sieve_ast_argument_name(*arg) ); + if ( !sieve_validate_tag_parameter + (valdtr, cmd, tag, *arg, NULL, 0, SAAT_STRING, FALSE) ) { return FALSE; } - if ( !sieve_validator_argument_activate(valdtr, cmd, *arg, FALSE) ) - return FALSE; - /* FIXME: We can currently only handle string literal argument, so * variables are not allowed. */ diff -r c9698bc1751a -r b6c55ac6460d tests/compile/errors.svtest --- a/tests/compile/errors.svtest Tue Dec 30 22:57:07 2014 +0100 +++ b/tests/compile/errors.svtest Tue Dec 30 23:01:04 2014 +0100 @@ -243,6 +243,20 @@ } /* + * COMPARATOR errors + */ + +test "COMPARATOR errors (FIXME: count only)" { + if test_script_compile "errors/comparator.sieve" { + test_fail "compile should have failed."; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "6" { + test_fail "wrong number of errors reported"; + } +} + +/* * ADDRESS-PART errors */ diff -r c9698bc1751a -r b6c55ac6460d tests/compile/errors/comparator.sieve --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/compile/errors/comparator.sieve Tue Dec 30 23:01:04 2014 +0100 @@ -0,0 +1,21 @@ +/* + * Address part errors + * + * Total errors: 5 (+1 = 6) + */ + +# 1: No argument +if address :comparator { } + +# 2: Number argument +if address :comparator 1 "from" "frop" { } + +# 3: String list argument +if address :comparator ["a", "b"] "from" "frop" { } + +# 4: Unknown tag +if address :comparator :frop "from" "frop" { } + +# 5: Known tag +if address :comparator :all "from" "frop" { } +