From dovecot at dovecot.org Tue May 3 10:46:04 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 May 2011 10:46:04 +0300 Subject: dovecot-2.0: lib-storage: Remove invalid subscription file entri... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/490a81fe688f changeset: 12762:490a81fe688f user: Timo Sirainen date: Tue May 03 09:43:41 2011 +0200 description: lib-storage: Remove invalid subscription file entries instead of only ignoring them. diffstat: src/lib-storage/list/mailbox-list-subscriptions.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diffs (17 lines): diff -r 663528c5c799 -r 490a81fe688f src/lib-storage/list/mailbox-list-subscriptions.c --- a/src/lib-storage/list/mailbox-list-subscriptions.c Sat Apr 30 15:55:08 2011 +0300 +++ b/src/lib-storage/list/mailbox-list-subscriptions.c Tue May 03 09:43:41 2011 +0200 @@ -61,8 +61,12 @@ if (!mailbox_list_is_valid_existing_name(ns->list, name)) { /* we'll only get into trouble if we show this */ i_warning("Subscriptions file %s: " - "Ignoring invalid entry: %s", + "Removing invalid entry: %s", path, orig_name); + (void)subsfile_set_subscribed(ns->list, path, + mailbox_list_get_temp_prefix(ns->list), + orig_name, FALSE); + } else { name = mail_namespace_get_vname(ns, vname, name); mailbox_list_iter_update(&update_ctx, name); From dovecot at dovecot.org Tue May 3 10:58:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 May 2011 10:58:24 +0300 Subject: dovecot-2.0: lib-index: Try to avoid duplicate "duplicate transa... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/036260ae0261 changeset: 12763:036260ae0261 user: Timo Sirainen date: Tue May 03 09:58:11 2011 +0200 description: lib-index: Try to avoid duplicate "duplicate transaction log sequence" errors. diffstat: src/lib-index/mail-transaction-log-file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 490a81fe688f -r 036260ae0261 src/lib-index/mail-transaction-log-file.c --- a/src/lib-index/mail-transaction-log-file.c Tue May 03 09:43:41 2011 +0200 +++ b/src/lib-index/mail-transaction-log-file.c Tue May 03 09:58:11 2011 +0200 @@ -527,7 +527,7 @@ opened. it shouldn't happen unless the old log file was corrupted. */ for (f = file->log->files; f != NULL; f = f->next) { - if (f->hdr.file_seq == file->hdr.file_seq) { + if (f->hdr.file_seq == file->hdr.file_seq && !f->corrupted) { /* mark the old file corrupted. we can't safely remove it from the list however, so return failure. */ f->corrupted = TRUE; From dovecot at dovecot.org Tue May 3 19:41:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 03 May 2011 19:41:24 +0300 Subject: dovecot-2.0: doveadm: Added "director dump" command. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c838d40bd38e changeset: 12764:c838d40bd38e user: Timo Sirainen date: Tue May 03 18:41:10 2011 +0200 description: doveadm: Added "director dump" command. It outputs doveadm director commands to add/remove the current host configuration, so if all directors are stopped, their state can be easily restored by running the commands. diffstat: src/director/doveadm-connection.c | 40 +++++++++++++++++++++++++++++++ src/doveadm/doveadm-director.c | 50 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 1 deletions(-) diffs (138 lines): diff -r 036260ae0261 -r c838d40bd38e src/director/doveadm-connection.c --- a/src/director/doveadm-connection.c Tue May 03 09:58:11 2011 +0200 +++ b/src/director/doveadm-connection.c Tue May 03 18:41:10 2011 +0200 @@ -53,6 +53,44 @@ o_stream_send(conn->output, str_data(str), str_len(str)); } +static void doveadm_cmd_host_list_removed(struct doveadm_connection *conn) +{ + struct mail_host_list *orig_hosts_list; + struct mail_host *const *orig_hosts, *const *cur_hosts; + unsigned int i, j, orig_hosts_count, cur_hosts_count; + string_t *str = t_str_new(1024); + int ret; + + orig_hosts_list = mail_hosts_init(); + (void)mail_hosts_parse_and_add(orig_hosts_list, + conn->dir->set->director_mail_servers); + + orig_hosts = array_get(mail_hosts_get(orig_hosts_list), + &orig_hosts_count); + cur_hosts = array_get(mail_hosts_get(conn->dir->mail_hosts), + &cur_hosts_count); + + /* the hosts are sorted by IP */ + for (i = j = 0; i < orig_hosts_count && j < cur_hosts_count; ) { + ret = net_ip_cmp(&orig_hosts[i]->ip, &cur_hosts[j]->ip); + if (ret == 0) + i++, j++; + else if (ret > 0) + j++; + else { + str_printfa(str, "%s\n", + net_ip2addr(&orig_hosts[i]->ip)); + i++; + } + } + for (; i < orig_hosts_count; i++) + str_printfa(str, "%s\n", net_ip2addr(&orig_hosts[i]->ip)); + str_append_c(str, '\n'); + o_stream_send(conn->output, str_data(str), str_len(str)); + + mail_hosts_deinit(&orig_hosts_list); +} + static void doveadm_cmd_director_list(struct doveadm_connection *conn) { struct director_host *const *hostp; @@ -263,6 +301,8 @@ if (strcmp(cmd, "HOST-LIST") == 0) doveadm_cmd_host_list(conn); + else if (strcmp(cmd, "HOST-LIST-REMOVED") == 0) + doveadm_cmd_host_list_removed(conn); else if (strcmp(cmd, "DIRECTOR-LIST") == 0) doveadm_cmd_director_list(conn); else if (strcmp(cmd, "HOST-SET") == 0) diff -r 036260ae0261 -r c838d40bd38e src/doveadm/doveadm-director.c --- a/src/doveadm/doveadm-director.c Tue May 03 09:58:11 2011 +0200 +++ b/src/doveadm/doveadm-director.c Tue May 03 18:41:10 2011 +0200 @@ -20,6 +20,7 @@ const char *socket_path; const char *users_path; struct istream *input; + bool explicit_socket_path; }; struct user_list { @@ -91,6 +92,7 @@ switch (c) { case 'a': ctx->socket_path = optarg; + ctx->explicit_socket_path = TRUE; break; case 'f': ctx->users_path = optarg; @@ -465,6 +467,50 @@ director_disconnect(ctx); } +static void ATTR_FORMAT(3, 4) +director_dump_cmd(struct director_context *ctx, + const char *cmd, const char *args, ...) +{ + va_list va; + + va_start(va, args); + printf("doveadm director %s ", cmd); + if (ctx->explicit_socket_path) + printf("-a %s ", ctx->socket_path); + vprintf(args, va); + putchar('\n'); + va_end(va); +} + +static void cmd_director_dump(int argc, char *argv[]) +{ + struct director_context *ctx; + const char *line, *const *args; + + ctx = cmd_director_init(argc, argv, "a:", cmd_director_dump); + + director_send(ctx, "HOST-LIST\n"); + while ((line = i_stream_read_next_line(ctx->input)) != NULL) { + if (*line == '\0') + break; + T_BEGIN { + args = t_strsplit(line, "\t"); + if (str_array_length(args) >= 2) { + director_dump_cmd(ctx, "add", "%s %s", + args[0], args[1]); + } + } T_END; + } + + director_send(ctx, "HOST-LIST-REMOVED\n"); + while ((line = i_stream_read_next_line(ctx->input)) != NULL) { + if (*line == '\0') + break; + director_dump_cmd(ctx, "remove", "%s", line); + } + director_disconnect(ctx); +} + struct doveadm_cmd doveadm_cmd_director[] = { { cmd_director_status, "director status", "[-a ] []" }, @@ -475,7 +521,9 @@ { cmd_director_remove, "director remove", "[-a ] " }, { cmd_director_flush, "director flush", - "[-a ] |all" } + "[-a ] |all" }, + { cmd_director_dump, "director dump", + "[-a ]" } }; static void director_cmd_help(doveadm_command_t *cmd) From dovecot at dovecot.org Wed May 4 12:44:27 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 12:44:27 +0300 Subject: dovecot-2.0: pop3: Small code cleanup. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/869795a295b5 changeset: 12765:869795a295b5 user: Timo Sirainen date: Wed May 04 10:17:27 2011 +0200 description: pop3: Small code cleanup. diffstat: src/pop3/pop3-client.h | 3 --- src/pop3/pop3-commands.c | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diffs (82 lines): diff -r c838d40bd38e -r 869795a295b5 src/pop3/pop3-client.h --- a/src/pop3/pop3-client.h Tue May 03 18:41:10 2011 +0200 +++ b/src/pop3/pop3-client.h Wed May 04 10:17:27 2011 +0200 @@ -45,9 +45,6 @@ unsigned int top_count; unsigned int retr_count; - uoff_t *byte_counter; - uoff_t byte_counter_offset; - unsigned char *deleted_bitmask; unsigned char *seen_bitmask; diff -r c838d40bd38e -r 869795a295b5 src/pop3/pop3-commands.c --- a/src/pop3/pop3-commands.c Tue May 03 18:41:10 2011 +0200 +++ b/src/pop3/pop3-commands.c Wed May 04 10:17:27 2011 +0200 @@ -265,6 +265,9 @@ struct istream *stream; uoff_t body_lines; + uoff_t *byte_counter; + uoff_t byte_counter_offset; + unsigned char last; bool cr_skipped, in_body; }; @@ -365,9 +368,8 @@ (void)o_stream_send(client->output, "\r\n", 2); } - *client->byte_counter += - client->output->offset - client->byte_counter_offset; - client->byte_counter = NULL; + *ctx->byte_counter += + client->output->offset - ctx->byte_counter_offset; client_send_line(client, "."); fetch_deinit(ctx); @@ -387,7 +389,8 @@ return 1; } -static int fetch(struct client *client, unsigned int msgnum, uoff_t body_lines) +static int fetch(struct client *client, unsigned int msgnum, uoff_t body_lines, + uoff_t *byte_counter) { struct fetch_context *ctx; struct mail_search_args *search_args; @@ -399,6 +402,9 @@ ctx->search_ctx = mailbox_search_init(client->trans, search_args, NULL); mail_search_args_unref(&search_args); + ctx->byte_counter = byte_counter; + ctx->byte_counter_offset = client->output->offset; + ctx->mail = mail_alloc(client->trans, MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY, NULL); @@ -445,10 +451,7 @@ client->last_seen = msgnum+1; client->retr_count++; - client->byte_counter = &client->retr_bytes; - client->byte_counter_offset = client->output->offset; - - return fetch(client, msgnum, (uoff_t)-1); + return fetch(client, msgnum, (uoff_t)-1, &client->retr_bytes); } static int cmd_rset(struct client *client, const char *args ATTR_UNUSED) @@ -511,10 +514,7 @@ return -1; client->top_count++; - client->byte_counter = &client->top_bytes; - client->byte_counter_offset = client->output->offset; - - return fetch(client, msgnum, max_lines); + return fetch(client, msgnum, max_lines, &client->top_bytes); } struct cmd_uidl_context { From dovecot at dovecot.org Wed May 4 12:44:27 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 12:44:27 +0300 Subject: dovecot-2.0: lib-storage: Added MAIL_FETCH_POP3_ORDER special fi... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/bf0a80c91536 changeset: 12766:bf0a80c91536 user: Timo Sirainen date: Wed May 04 11:42:17 2011 +0200 description: lib-storage: Added MAIL_FETCH_POP3_ORDER special field and implemented for Maildir. The idea is that this specifies the order of messages when accessing via POP3. This is useful when migrating both POP3 and IMAP users from servers where their message ordering differes and they still want to be preserved. diffstat: src/lib-storage/index/index-mail.c | 1 + src/lib-storage/index/maildir/maildir-mail.c | 11 ++++++++++- src/lib-storage/index/maildir/maildir-uidlist.h | 5 +++++ src/lib-storage/mail-storage.h | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) diffs (67 lines): diff -r 869795a295b5 -r bf0a80c91536 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Wed May 04 10:17:27 2011 +0200 +++ b/src/lib-storage/index/index-mail.c Wed May 04 11:42:17 2011 +0200 @@ -1076,6 +1076,7 @@ case MAIL_FETCH_SEARCH_SCORE: case MAIL_FETCH_GUID: case MAIL_FETCH_HEADER_MD5: + case MAIL_FETCH_POP3_ORDER: *value_r = ""; return 0; case MAIL_FETCH_MAILBOX_NAME: diff -r 869795a295b5 -r bf0a80c91536 src/lib-storage/index/maildir/maildir-mail.c --- a/src/lib-storage/index/maildir/maildir-mail.c Wed May 04 10:17:27 2011 +0200 +++ b/src/lib-storage/index/maildir/maildir-mail.c Wed May 04 11:42:17 2011 +0200 @@ -471,7 +471,7 @@ { struct index_mail *mail = (struct index_mail *)_mail; struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box; - const char *path, *fname = NULL, *end, *guid, *uidl; + const char *path, *fname = NULL, *end, *guid, *uidl, *order; switch (field) { case MAIL_FETCH_GUID: @@ -536,6 +536,15 @@ *value_r = p_strdup(mail->data_pool, uidl); } return 0; + case MAIL_FETCH_POP3_ORDER: + order = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, + MAILDIR_UIDLIST_REC_EXT_POP3_ORDER); + if (order == NULL) { + *value_r = ""; + } else { + *value_r = p_strdup(mail->data_pool, order); + } + return 0; default: return index_mail_get_special(_mail, field, value_r); } diff -r 869795a295b5 -r bf0a80c91536 src/lib-storage/index/maildir/maildir-uidlist.h --- a/src/lib-storage/index/maildir/maildir-uidlist.h Wed May 04 10:17:27 2011 +0200 +++ b/src/lib-storage/index/maildir/maildir-uidlist.h Wed May 04 11:42:17 2011 +0200 @@ -48,6 +48,11 @@ MAILDIR_UIDLIST_REC_EXT_VSIZE = 'W', /* POP3 UIDL overriding the default format */ MAILDIR_UIDLIST_REC_EXT_POP3_UIDL = 'P', + /* POP3 message ordering number. Lower numbered messages are listed + first. Messages without ordering number are listed after them. + The idea is to be able to preserve POP3 UIDL list and IMAP UIDs + perfectly when migrating from other servers. */ + MAILDIR_UIDLIST_REC_EXT_POP3_ORDER = 'O', /* Message GUID (default is the base filename) */ MAILDIR_UIDLIST_REC_EXT_GUID = 'G' }; diff -r 869795a295b5 -r bf0a80c91536 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Wed May 04 10:17:27 2011 +0200 +++ b/src/lib-storage/mail-storage.h Wed May 04 11:42:17 2011 +0200 @@ -125,7 +125,8 @@ MAIL_FETCH_UIDL_BACKEND = 0x00040000, MAIL_FETCH_MAILBOX_NAME = 0x00080000, MAIL_FETCH_SEARCH_SCORE = 0x00100000, - MAIL_FETCH_GUID = 0x00200000 + MAIL_FETCH_GUID = 0x00200000, + MAIL_FETCH_POP3_ORDER = 0x00400000 }; enum mailbox_transaction_flags { From dovecot at dovecot.org Wed May 4 12:44:27 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 12:44:27 +0300 Subject: dovecot-2.0: lib-storage: Added MAIL_SORT_POP3_ORDER Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/fac2d4fe86b1 changeset: 12767:fac2d4fe86b1 user: Timo Sirainen date: Wed May 04 11:43:16 2011 +0200 description: lib-storage: Added MAIL_SORT_POP3_ORDER diffstat: src/lib-storage/index/index-sort.c | 45 ++++++++++++++++++++++++++++++++++++++ src/lib-storage/mail-storage.h | 1 + 2 files changed, 46 insertions(+), 0 deletions(-) diffs (80 lines): diff -r bf0a80c91536 -r fac2d4fe86b1 src/lib-storage/index/index-sort.c --- a/src/lib-storage/index/index-sort.c Wed May 04 11:42:17 2011 +0200 +++ b/src/lib-storage/index/index-sort.c Wed May 04 11:43:16 2011 +0200 @@ -81,6 +81,30 @@ node->size = 0; } +static uoff_t index_sort_get_pop3_order(struct mail *mail) +{ + const char *str; + uoff_t size; + + if (mail_get_special(mail, MAIL_FETCH_POP3_ORDER, &str) < 0 || + str_to_uoff(str, &size) < 0) + return (uint32_t)-1; + else + return size; +} + +static void +index_sort_list_add_pop3_order(struct mail_search_sort_program *program, + struct mail *mail) +{ + ARRAY_TYPE(mail_sort_node_size) *nodes = program->context; + struct mail_sort_node_size *node; + + node = array_append_space(nodes); + node->seq = mail->seq; + node->size = index_sort_get_pop3_order(mail); +} + static float index_sort_get_score(struct mail *mail) { const char *str; @@ -283,6 +307,16 @@ program->context = nodes; break; } + case MAIL_SORT_POP3_ORDER: { + ARRAY_TYPE(mail_sort_node_size) *nodes; + + nodes = i_malloc(sizeof(*nodes)); + i_array_init(nodes, 128); + program->sort_list_add = index_sort_list_add_pop3_order; + program->sort_list_finish = index_sort_list_finish_size; + program->context = nodes; + break; + } default: i_unreached(); } @@ -486,6 +520,17 @@ ret = float1 < float2 ? -1 : (float1 > float2 ? 1 : 0); break; + case MAIL_SORT_POP3_ORDER: + /* 32bit numbers would be enough, but since there is already + existing code for uoff_t in sizes, just use them. */ + mail_set_seq(mail, seq1); + size1 = index_sort_get_pop3_order(mail); + mail_set_seq(mail, seq2); + size2 = index_sort_get_pop3_order(mail); + + ret = size1 < size2 ? -1 : + (size1 > size2 ? 1 : 0); + break; case MAIL_SORT_END: return seq1 < seq2 ? -1 : (seq1 > seq2 ? 1 : 0); diff -r bf0a80c91536 -r fac2d4fe86b1 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Wed May 04 11:42:17 2011 +0200 +++ b/src/lib-storage/mail-storage.h Wed May 04 11:43:16 2011 +0200 @@ -92,6 +92,7 @@ MAIL_SORT_SEARCH_SCORE = 0x0080, MAIL_SORT_DISPLAYFROM = 0x0100, MAIL_SORT_DISPLAYTO = 0x0200, + MAIL_SORT_POP3_ORDER = 0x0400, MAIL_SORT_MASK = 0x0fff, MAIL_SORT_FLAG_REVERSE = 0x1000, /* reverse this mask type */ From dovecot at dovecot.org Wed May 4 12:44:27 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 12:44:27 +0300 Subject: dovecot-2.0: pop3: Added support for showing messages in "pop3 o... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c9b7e829c6a9 changeset: 12768:c9b7e829c6a9 user: Timo Sirainen date: Wed May 04 11:43:59 2011 +0200 description: pop3: Added support for showing messages in "pop3 order". diffstat: src/pop3/pop3-client.c | 64 ++++++++++++++++++++---- src/pop3/pop3-client.h | 18 +++++- src/pop3/pop3-commands.c | 124 ++++++++++++++++++++++++++++++---------------- 3 files changed, 148 insertions(+), 58 deletions(-) diffs (truncated from 502 to 300 lines): diff -r fac2d4fe86b1 -r c9b7e829c6a9 src/pop3/pop3-client.c --- a/src/pop3/pop3-client.c Wed May 04 11:43:16 2011 +0200 +++ b/src/pop3/pop3-client.c Wed May 04 11:43:59 2011 +0200 @@ -39,6 +39,11 @@ struct client *pop3_clients; unsigned int pop3_client_count; +static enum mail_sort_type pop3_sort_program[] = { + MAIL_SORT_POP3_ORDER, + MAIL_SORT_END +}; + static void client_input(struct client *client); static int client_output(struct client *client); @@ -103,6 +108,28 @@ return mail_get_virtual_size(mail, size_r); } +static void +msgnum_to_seq_map_add(ARRAY_TYPE(uint32_t) *msgnum_to_seq_map, + struct client *client, struct mail *mail, + unsigned int msgnum) +{ + uint32_t seq; + + if (mail->seq == msgnum+1) + return; + + if (!array_is_created(msgnum_to_seq_map)) + i_array_init(msgnum_to_seq_map, client->messages_count); + else { + /* add any messages between this and the previous one that had + a POP3 order defined */ + seq = array_count(msgnum_to_seq_map) + 1; + for (; seq <= msgnum; seq++) + array_append(msgnum_to_seq_map, &seq, 1); + } + array_append(msgnum_to_seq_map, &mail->seq, 1); +} + static int read_mailbox(struct client *client, uint32_t *failed_uid_r) { struct mailbox_status status; @@ -112,6 +139,8 @@ struct mail *mail; uoff_t size; ARRAY_DEFINE(message_sizes, uoff_t); + ARRAY_TYPE(uint32_t) msgnum_to_seq_map = ARRAY_INIT; + unsigned int msgnum; int ret = 1; *failed_uid_r = 0; @@ -124,13 +153,14 @@ search_args = mail_search_build_init(); mail_search_build_add_all(search_args); - ctx = mailbox_search_init(t, search_args, NULL); + ctx = mailbox_search_init(t, search_args, pop3_sort_program); mail_search_args_unref(&search_args); - client->last_seen = 0; + client->last_seen_pop3_msn = 0; client->total_size = 0; i_array_init(&message_sizes, client->messages_count); + msgnum = 0; mail = mail_alloc(t, MAIL_FETCH_VIRTUAL_SIZE, NULL); while (mailbox_search_next(ctx, mail)) { if (pop3_mail_get_size(client, mail, &size) < 0) { @@ -138,29 +168,40 @@ *failed_uid_r = mail->uid; break; } + msgnum_to_seq_map_add(&msgnum_to_seq_map, client, mail, msgnum); if ((mail_get_flags(mail) & MAIL_SEEN) != 0) - client->last_seen = mail->seq; + client->last_seen_pop3_msn = msgnum + 1; client->total_size += size; array_append(&message_sizes, &size, 1); + msgnum++; } mail_free(&mail); if (mailbox_search_deinit(&ctx) < 0) ret = -1; - if (ret > 0) { - client->trans = t; - client->message_sizes = - buffer_free_without_data(&message_sizes.arr.buffer); - } else { + if (ret <= 0) { /* commit the transaction instead of rollbacking to make sure we don't lose data (virtual sizes) added to cache file */ (void)mailbox_transaction_commit(&t); array_free(&message_sizes); + if (array_is_created(&msgnum_to_seq_map)) + array_free(&msgnum_to_seq_map); + return ret; } - return ret; + + client->trans = t; + client->message_sizes = + buffer_free_without_data(&message_sizes.arr.buffer); + if (array_is_created(&msgnum_to_seq_map)) { + client->msgnum_to_seq_map_count = + array_count(&msgnum_to_seq_map); + client->msgnum_to_seq_map = + buffer_free_without_data(&msgnum_to_seq_map.arr.buffer); + } + return 1; } static int init_mailbox(struct client *client, const char **error_r) @@ -349,8 +390,8 @@ } /* 1..new-1 were probably left to mailbox by previous POP3 session */ - old_msg_count = client->lowest_retr > 0 ? - client->lowest_retr - 1 : client->messages_count; + old_msg_count = client->lowest_retr_pop3_msn > 0 ? + client->lowest_retr_pop3_msn - 1 : client->messages_count; for (i = 0, old_hash = 0; i < old_msg_count; i++) old_hash ^= client->message_uidl_hashes[i]; @@ -464,6 +505,7 @@ i_free(client->message_uidl_hashes); i_free(client->deleted_bitmask); i_free(client->seen_bitmask); + i_free(client->msgnum_to_seq_map); if (client->io != NULL) io_remove(&client->io); diff -r fac2d4fe86b1 -r c9b7e829c6a9 src/pop3/pop3-client.h --- a/src/pop3/pop3-client.h Wed May 04 11:43:16 2011 +0200 +++ b/src/pop3/pop3-client.h Wed May 04 11:43:59 2011 +0200 @@ -9,6 +9,12 @@ #define MSGS_BITMASK_SIZE(client) \ (((client)->messages_count + (CHAR_BIT-1)) / CHAR_BIT) +/* + pop3_msn = 1..n in the POP3 protocol + msgnum = 0..n-1 = pop3_msn-1 + seq = 1..n = mail's sequence number in lib-storage. when pop3 sort ordering + is used, msgnum_to_seq_map[] can be used for translation. +*/ struct client { struct client *prev, *next; @@ -34,17 +40,23 @@ unsigned int uid_validity; unsigned int messages_count; unsigned int deleted_count, expunged_count, seen_change_count; - uint32_t *message_uidl_hashes; - uoff_t *message_sizes; uoff_t total_size; uoff_t deleted_size; - uint32_t last_seen, lowest_retr; + uint32_t last_seen_pop3_msn, lowest_retr_pop3_msn; + + /* [msgnum] contains mail seq. anything after it has seq = msgnum+1 */ + uint32_t *msgnum_to_seq_map; + uint32_t msgnum_to_seq_map_count; uoff_t top_bytes; uoff_t retr_bytes; unsigned int top_count; unsigned int retr_count; + /* [msgnum] */ + uint32_t *message_uidl_hashes; + uoff_t *message_sizes; + /* [msgnum/8] & msgnum%8 */ unsigned char *deleted_bitmask; unsigned char *seen_bitmask; diff -r fac2d4fe86b1 -r c9b7e829c6a9 src/pop3/pop3-commands.c --- a/src/pop3/pop3-commands.c Wed May 04 11:43:16 2011 +0200 +++ b/src/pop3/pop3-commands.c Wed May 04 11:43:59 2011 +0200 @@ -14,6 +14,17 @@ #include "pop3-capability.h" #include "pop3-commands.h" +static enum mail_sort_type pop3_sort_program[] = { + MAIL_SORT_POP3_ORDER, + MAIL_SORT_END +}; + +static uint32_t msgnum_to_seq(struct client *client, uint32_t msgnum) +{ + return msgnum < client->msgnum_to_seq_map_count ? + client->msgnum_to_seq_map[msgnum] : msgnum+1; +} + static const char *get_msgnum(struct client *client, const char *args, unsigned int *msgnum) { @@ -132,8 +143,8 @@ (1 << (ctx->msgnum % CHAR_BIT))) continue; } - ret = client_send_line(client, "%u %"PRIuUOFF_T, - ctx->msgnum+1, + + ret = client_send_line(client, "%u %"PRIuUOFF_T, ctx->msgnum+1, client->message_sizes[ctx->msgnum]); if (ret < 0) break; @@ -172,7 +183,7 @@ static int cmd_last(struct client *client, const char *args ATTR_UNUSED) { - client_send_line(client, "+OK %u", client->last_seen); + client_send_line(client, "+OK %u", client->last_seen_pop3_msn); return 1; } @@ -197,12 +208,28 @@ return search_args; } +static int client_verify_ordering(struct client *client, + struct mail *mail, uint32_t msgnum) +{ + uint32_t seq; + + seq = msgnum_to_seq(client, msgnum); + if (seq != mail->seq) { + i_error("Message ordering changed unexpectedly " + "(msg #%u: storage seq %u -> %u)", + msgnum+1, seq, mail->seq); + return -1; + } + return 0; +} + bool client_update_mails(struct client *client) { struct mail_search_args *search_args; struct mail_search_context *ctx; struct mail *mail; - uint32_t idx, bit; + uint32_t msgnum, bit; + bool ret = TRUE; if (mailbox_is_readonly(client->mailbox)) { /* silently ignore */ @@ -210,26 +237,35 @@ } search_args = pop3_search_build(client, 0); - ctx = mailbox_search_init(client->trans, search_args, NULL); + ctx = mailbox_search_init(client->trans, search_args, + pop3_sort_program); mail_search_args_unref(&search_args); + msgnum = 0; mail = mail_alloc(client->trans, 0, NULL); while (mailbox_search_next(ctx, mail)) { - idx = mail->seq - 1; - bit = 1 << (idx % CHAR_BIT); + if (client_verify_ordering(client, mail, msgnum) < 0) { + ret = FALSE; + break; + } + + bit = 1 << (msgnum % CHAR_BIT); if (client->deleted_bitmask != NULL && - (client->deleted_bitmask[idx / CHAR_BIT] & bit) != 0) { + (client->deleted_bitmask[msgnum / CHAR_BIT] & bit) != 0) { mail_expunge(mail); client->expunged_count++; } else if (client->seen_bitmask != NULL && - (client->seen_bitmask[idx / CHAR_BIT] & bit) != 0) { + (client->seen_bitmask[msgnum / CHAR_BIT] & bit) != 0) { mail_update_flags(mail, MODIFY_ADD, MAIL_SEEN); } + msgnum++; } mail_free(&mail); client->seen_change_count = 0; - return mailbox_search_deinit(&ctx) == 0; + if (mailbox_search_deinit(&ctx) < 0) + ret = FALSE; + return ret; } static int cmd_quit(struct client *client, const char *args ATTR_UNUSED) @@ -260,7 +296,6 @@ } struct fetch_context { - struct mail_search_context *search_ctx; struct mail *mail; struct istream *stream; From dovecot at dovecot.org Wed May 4 16:04:13 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 16:04:13 +0300 Subject: dovecot-2.0: doveadm cleanup: Don't try to keep auth/user comand... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d0f54521bb3b changeset: 12769:d0f54521bb3b user: Timo Sirainen date: Wed May 04 14:58:03 2011 +0200 description: doveadm cleanup: Don't try to keep auth/user comand handlers in same function. diffstat: src/doveadm/doveadm-auth.c | 67 ++++++++++++++++++++++++++++----------------- 1 files changed, 41 insertions(+), 26 deletions(-) diffs (103 lines): diff -r c9b7e829c6a9 -r d0f54521bb3b src/doveadm/doveadm-auth.c --- a/src/doveadm/doveadm-auth.c Wed May 04 11:43:59 2011 +0200 +++ b/src/doveadm/doveadm-auth.c Wed May 04 14:58:03 2011 +0200 @@ -199,8 +199,43 @@ auth_master_deinit(&conn); } -static void -auth_cmd_common(const struct doveadm_cmd *cmd, int argc, char *argv[]) +static void cmd_auth(int argc, char *argv[]) +{ + const char *auth_socket_path = NULL; + struct authtest_input input; + int c; + + memset(&input, 0, sizeof(input)); + input.info.service = "doveadm"; + + while ((c = getopt(argc, argv, "a:x:")) > 0) { + switch (c) { + case 'a': + auth_socket_path = optarg; + break; + case 'x': + auth_user_info_parse(&input.info, optarg); + break; + default: + help(&doveadm_cmd_auth); + } + } + + if (optind == argc) + help(&doveadm_cmd_auth); + + input.username = argv[optind++]; + input.password = argv[optind] != NULL ? argv[optind++] : + t_askpass("Password: "); + if (argv[optind] != NULL) + i_fatal("Unexpected parameter: %s", argv[optind]); + if (cmd_auth_input(auth_socket_path, &input) < 0) + exit(FATAL_DEFAULT); + if (!input.success) + exit(1); +} + +static void cmd_user(int argc, char *argv[]) { const char *auth_socket_path = NULL; struct authtest_input input; @@ -220,12 +255,12 @@ auth_user_info_parse(&input.info, optarg); break; default: - help(cmd); + help(&doveadm_cmd_user); } } if (optind == argc) - help(cmd); + help(&doveadm_cmd_user); have_wildcards = FALSE; for (i = optind; argv[i] != NULL; i++) { @@ -236,19 +271,9 @@ } } - if (cmd == &doveadm_cmd_auth) { - input.username = argv[optind++]; - input.password = argv[optind] != NULL ? argv[optind++] : - t_askpass("Password: "); - if (argv[optind] != NULL) - i_fatal("Unexpected parameter: %s", argv[optind]); - if (cmd_auth_input(auth_socket_path, &input) < 0) - exit(FATAL_DEFAULT); - if (!input.success) - exit(1); - } else if (have_wildcards) { + if (have_wildcards) cmd_user_list(auth_socket_path, argv + optind); - } else { + else { bool first = TRUE; bool notfound = FALSE; @@ -270,16 +295,6 @@ } } -static void cmd_auth(int argc, char *argv[]) -{ - auth_cmd_common(&doveadm_cmd_auth, argc, argv); -} - -static void cmd_user(int argc, char *argv[]) -{ - auth_cmd_common(&doveadm_cmd_user, argc, argv); -} - struct doveadm_cmd doveadm_cmd_auth = { cmd_auth, "auth", "[-a ] [-x ] []" From dovecot at dovecot.org Wed May 4 16:04:13 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 04 May 2011 16:04:13 +0300 Subject: dovecot-2.0: doveadm user: Added -f parameter to show only the s... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/23b6234ce0ae changeset: 12770:23b6234ce0ae user: Timo Sirainen date: Wed May 04 15:03:14 2011 +0200 description: doveadm user: Added -f parameter to show only the specified extra field's value. diffstat: src/doveadm/doveadm-auth.c | 27 +++++++++++++++++++++------ 1 files changed, 21 insertions(+), 6 deletions(-) diffs (74 lines): diff -r d0f54521bb3b -r 23b6234ce0ae src/doveadm/doveadm-auth.c --- a/src/doveadm/doveadm-auth.c Wed May 04 14:58:03 2011 +0200 +++ b/src/doveadm/doveadm-auth.c Wed May 04 15:03:14 2011 +0200 @@ -24,7 +24,8 @@ }; static int -cmd_user_input(const char *auth_socket_path, const struct authtest_input *input) +cmd_user_input(const char *auth_socket_path, const struct authtest_input *input, + const char *show_field) { struct auth_master_connection *conn; pool_t pool; @@ -49,8 +50,17 @@ input->username, fields[0]); } } else if (ret == 0) { - printf("userdb lookup: user %s doesn't exist\n", - input->username); + fprintf(show_field == NULL ? stdout : stderr, + "userdb lookup: user %s doesn't exist\n", + input->username); + } else if (show_field != NULL) { + unsigned int show_field_len = strlen(show_field); + + for (; *fields; fields++) { + if (strncmp(*fields, show_field, show_field_len) == 0 && + (*fields)[show_field_len] == '=') + printf("%s\n", *fields + show_field_len + 1); + } } else { printf("userdb: %s\n", input->username); @@ -239,6 +249,7 @@ { const char *auth_socket_path = NULL; struct authtest_input input; + const char *show_field = NULL; unsigned int i; bool have_wildcards; int c; @@ -246,11 +257,14 @@ memset(&input, 0, sizeof(input)); input.info.service = "doveadm"; - while ((c = getopt(argc, argv, "a:x:")) > 0) { + while ((c = getopt(argc, argv, "a:f:x:")) > 0) { switch (c) { case 'a': auth_socket_path = optarg; break; + case 'f': + show_field = optarg; + break; case 'x': auth_user_info_parse(&input.info, optarg); break; @@ -282,7 +296,8 @@ first = FALSE; else putchar('\n'); - switch (cmd_user_input(auth_socket_path, &input)) { + switch (cmd_user_input(auth_socket_path, &input, + show_field)) { case -1: exit(1); case 0: @@ -302,5 +317,5 @@ struct doveadm_cmd doveadm_cmd_user = { cmd_user, "user", - "[-a ] [-x ] [...]" + "[-a ] [-x ] [-f field] [...]" }; From dovecot at dovecot.org Thu May 5 19:14:20 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 05 May 2011 19:14:20 +0300 Subject: dovecot-2.0: lib-index: Added mail_cache_field_exists_any() Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/45f6d523b1a1 changeset: 12771:45f6d523b1a1 user: Timo Sirainen date: Thu May 05 17:47:58 2011 +0200 description: lib-index: Added mail_cache_field_exists_any() diffstat: src/lib-index/mail-cache-lookup.c | 7 +++++++ src/lib-index/mail-cache.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletions(-) diffs (33 lines): diff -r 23b6234ce0ae -r 45f6d523b1a1 src/lib-index/mail-cache-lookup.c --- a/src/lib-index/mail-cache-lookup.c Wed May 04 15:03:14 2011 +0200 +++ b/src/lib-index/mail-cache-lookup.c Thu May 05 17:47:58 2011 +0200 @@ -328,6 +328,13 @@ data[field] == view->cached_exists_value) ? 1 : 0; } +bool mail_cache_field_exists_any(struct mail_cache_view *view, uint32_t seq) +{ + uint32_t reset_id; + + return mail_cache_lookup_cur_offset(view->view, seq, &reset_id) != 0; +} + enum mail_cache_decision_type mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx) { diff -r 23b6234ce0ae -r 45f6d523b1a1 src/lib-index/mail-cache.h --- a/src/lib-index/mail-cache.h Wed May 04 15:03:14 2011 +0200 +++ b/src/lib-index/mail-cache.h Thu May 05 17:47:58 2011 +0200 @@ -94,9 +94,11 @@ bool mail_cache_field_can_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq, unsigned int field_idx); -/* Retursn 1 if field exists, 0 if not, -1 if error. */ +/* Returns 1 if field exists, 0 if not, -1 if error. */ int mail_cache_field_exists(struct mail_cache_view *view, uint32_t seq, unsigned int field_idx); +/* Returns TRUE if something is cached for the message, FALSE if not. */ +bool mail_cache_field_exists_any(struct mail_cache_view *view, uint32_t seq); /* Returns current caching decision for given field. */ enum mail_cache_decision_type mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx); From dovecot at dovecot.org Thu May 5 19:14:20 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 05 May 2011 19:14:20 +0300 Subject: dovecot-2.0: lib-storage: Added mail_is_cached() Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/55ff92050bd7 changeset: 12772:55ff92050bd7 user: Timo Sirainen date: Thu May 05 17:48:55 2011 +0200 description: lib-storage: Added mail_is_cached() diffstat: src/lib-storage/index/index-transaction.c | 3 +++ src/lib-storage/mail-storage-private.h | 3 +++ src/lib-storage/mail-storage.h | 3 +++ src/lib-storage/mail.c | 7 +++++++ 4 files changed, 16 insertions(+), 0 deletions(-) diffs (63 lines): diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/index/index-transaction.c --- a/src/lib-storage/index/index-transaction.c Thu May 05 17:47:58 2011 +0200 +++ b/src/lib-storage/index/index-transaction.c Thu May 05 17:48:55 2011 +0200 @@ -88,6 +88,9 @@ it->cache_view = mail_cache_view_open(box->cache, t->view); it->cache_trans = mail_cache_get_transaction(it->cache_view, t->itrans); + t->cache_view = it->cache_view; + t->cache_trans = it->cache_trans; + /* set up after mail_cache_get_transaction(), so that we'll still have the cache_trans available in _index_commit() */ it->super = t->itrans->v; diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail-storage-private.h --- a/src/lib-storage/mail-storage-private.h Thu May 05 17:47:58 2011 +0200 +++ b/src/lib-storage/mail-storage-private.h Thu May 05 17:48:55 2011 +0200 @@ -390,6 +390,9 @@ /* view contains all changes done within this transaction */ struct mail_index_view *view; + struct mail_cache_view *cache_view; + struct mail_cache_transaction_ctx *cache_trans; + struct mail_transaction_commit_changes *changes; ARRAY_DEFINE(module_contexts, union mailbox_transaction_module_context *); diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Thu May 05 17:47:58 2011 +0200 +++ b/src/lib-storage/mail-storage.h Thu May 05 17:48:55 2011 +0200 @@ -701,6 +701,9 @@ void mail_update_pop3_uidl(struct mail *mail, const char *uidl); /* Expunge this message. Sequence numbers don't change until commit. */ void mail_expunge(struct mail *mail); + +/* Returns TRUE if anything is cached for the mail, FALSE if not. */ +bool mail_is_cached(struct mail *mail); /* Mark a cached field corrupted and have it recalculated. */ void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field); diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail.c --- a/src/lib-storage/mail.c Thu May 05 17:47:58 2011 +0200 +++ b/src/lib-storage/mail.c Thu May 05 17:48:55 2011 +0200 @@ -7,6 +7,7 @@ #include "crc32.h" #include "sha1.h" #include "hostpid.h" +#include "mail-cache.h" #include "mail-storage-private.h" #include @@ -239,6 +240,12 @@ mail->expunged = TRUE; } +bool mail_is_cached(struct mail *mail) +{ + return mail_cache_field_exists_any(mail->transaction->cache_view, + mail->seq); +} + void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field) { struct mail_private *p = (struct mail_private *)mail; From dovecot at dovecot.org Thu May 5 19:14:20 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 05 May 2011 19:14:20 +0300 Subject: dovecot-2.0: lib-storage: Added mail_parse(). Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/e9918fd289f3 changeset: 12773:e9918fd289f3 user: Timo Sirainen date: Thu May 05 17:49:45 2011 +0200 description: lib-storage: Added mail_parse(). diffstat: src/lib-storage/index/cydir/cydir-mail.c | 1 + src/lib-storage/index/dbox-multi/mdbox-mail.c | 1 + src/lib-storage/index/dbox-single/sdbox-mail.c | 1 + src/lib-storage/index/index-mail.c | 13 +++++++++++++ src/lib-storage/index/index-mail.h | 1 + src/lib-storage/index/maildir/maildir-mail.c | 1 + src/lib-storage/index/mbox/mbox-mail.c | 1 + src/lib-storage/index/raw/raw-mail.c | 1 + src/lib-storage/mail-storage-private.h | 1 + src/lib-storage/mail-storage.h | 3 +++ src/lib-storage/mail.c | 7 +++++++ src/lib-storage/test-mail.c | 6 ++++++ src/plugins/virtual/virtual-mail.c | 10 ++++++++++ 13 files changed, 47 insertions(+), 0 deletions(-) diffs (191 lines): diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/cydir/cydir-mail.c --- a/src/lib-storage/index/cydir/cydir-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/cydir/cydir-mail.c Thu May 05 17:49:45 2011 +0200 @@ -152,6 +152,7 @@ index_mail_update_modseq, NULL, index_mail_expunge, + index_mail_parse, index_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/dbox-multi/mdbox-mail.c --- a/src/lib-storage/index/dbox-multi/mdbox-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c Thu May 05 17:49:45 2011 +0200 @@ -214,6 +214,7 @@ index_mail_update_modseq, NULL, index_mail_expunge, + index_mail_parse, index_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/dbox-single/sdbox-mail.c --- a/src/lib-storage/index/dbox-single/sdbox-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/dbox-single/sdbox-mail.c Thu May 05 17:49:45 2011 +0200 @@ -110,6 +110,7 @@ index_mail_update_modseq, NULL, index_mail_expunge, + index_mail_parse, index_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/index-mail.c Thu May 05 17:49:45 2011 +0200 @@ -1509,6 +1509,19 @@ } } +void index_mail_parse(struct mail *mail, bool parse_body) +{ + struct index_mail *imail = (struct index_mail *)mail; + + imail->data.access_part |= PARSE_HDR; + if (index_mail_parse_headers(imail, NULL) == 0) { + if (parse_body) { + imail->data.access_part |= PARSE_BODY; + (void)index_mail_parse_body(imail, 0); + } + } +} + void index_mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field) { diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/index-mail.h --- a/src/lib-storage/index/index-mail.h Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/index-mail.h Thu May 05 17:49:45 2011 +0200 @@ -202,6 +202,7 @@ struct mail_keywords *keywords); void index_mail_update_modseq(struct mail *mail, uint64_t min_modseq); void index_mail_expunge(struct mail *mail); +void index_mail_parse(struct mail *mail, bool parse_body); void index_mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field); int index_mail_opened(struct mail *mail, struct istream **stream); diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/maildir/maildir-mail.c --- a/src/lib-storage/index/maildir/maildir-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/maildir/maildir-mail.c Thu May 05 17:49:45 2011 +0200 @@ -656,6 +656,7 @@ index_mail_update_modseq, maildir_update_pop3_uidl, index_mail_expunge, + index_mail_parse, maildir_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/mbox/mbox-mail.c --- a/src/lib-storage/index/mbox/mbox-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/mbox/mbox-mail.c Thu May 05 17:49:45 2011 +0200 @@ -411,6 +411,7 @@ index_mail_update_modseq, NULL, index_mail_expunge, + index_mail_parse, index_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/index/raw/raw-mail.c --- a/src/lib-storage/index/raw/raw-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/index/raw/raw-mail.c Thu May 05 17:49:45 2011 +0200 @@ -138,6 +138,7 @@ index_mail_update_modseq, NULL, index_mail_expunge, + index_mail_parse, index_mail_set_cache_corrupted, index_mail_opened }; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/mail-storage-private.h --- a/src/lib-storage/mail-storage-private.h Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/mail-storage-private.h Thu May 05 17:49:45 2011 +0200 @@ -336,6 +336,7 @@ void (*update_modseq)(struct mail *mail, uint64_t min_modseq); void (*update_pop3_uidl)(struct mail *mail, const char *uidl); void (*expunge)(struct mail *mail); + void (*parse)(struct mail *mail, bool parse_body); void (*set_cache_corrupted)(struct mail *mail, enum mail_fetch_field field); int (*istream_opened)(struct mail *mail, struct istream **input); diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/mail-storage.h Thu May 05 17:49:45 2011 +0200 @@ -704,6 +704,9 @@ /* Returns TRUE if anything is cached for the mail, FALSE if not. */ bool mail_is_cached(struct mail *mail); +/* Parse mail's header and optionally body so that fields using them get + cached. */ +void mail_parse(struct mail *mail, bool parse_body); /* Mark a cached field corrupted and have it recalculated. */ void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field); diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/mail.c --- a/src/lib-storage/mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/mail.c Thu May 05 17:49:45 2011 +0200 @@ -246,6 +246,13 @@ mail->seq); } +void mail_parse(struct mail *mail, bool parse_body) +{ + struct mail_private *p = (struct mail_private *)mail; + + p->v.parse(mail, parse_body); +} + void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field) { struct mail_private *p = (struct mail_private *)mail; diff -r 55ff92050bd7 -r e9918fd289f3 src/lib-storage/test-mail.c --- a/src/lib-storage/test-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/lib-storage/test-mail.c Thu May 05 17:49:45 2011 +0200 @@ -195,6 +195,11 @@ { } +static void test_mail_parse(struct mail *mail ATTR_UNUSED, + bool parse_body ATTR_UNUSED) +{ +} + static void test_mail_set_cache_corrupted(struct mail *mail ATTR_UNUSED, enum mail_fetch_field field ATTR_UNUSED) @@ -229,6 +234,7 @@ test_mail_update_modseq, NULL, test_mail_expunge, + test_mail_parse, test_mail_set_cache_corrupted, NULL }; diff -r 55ff92050bd7 -r e9918fd289f3 src/plugins/virtual/virtual-mail.c --- a/src/plugins/virtual/virtual-mail.c Thu May 05 17:48:55 2011 +0200 +++ b/src/plugins/virtual/virtual-mail.c Thu May 05 17:49:45 2011 +0200 @@ -369,6 +369,15 @@ mail_expunge(vmail->backend_mail); } +static void virtual_mail_parse(struct mail *mail, bool parse_body) +{ + struct virtual_mail *vmail = (struct virtual_mail *)mail; + + if (virtual_mail_handle_lost(vmail) < 0) + return; + mail_parse(vmail->backend_mail, parse_body); +} + static void virtual_mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field) { @@ -407,6 +416,7 @@ index_mail_update_modseq, virtual_mail_update_pop3_uidl, virtual_mail_expunge, + virtual_mail_parse, virtual_mail_set_cache_corrupted, NULL }; From dovecot at dovecot.org Thu May 5 19:14:20 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 05 May 2011 19:14:20 +0300 Subject: dovecot-2.0: doveadm: Added "index" command to add unindexed mes... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/840e27a52e51 changeset: 12774:840e27a52e51 user: Timo Sirainen date: Thu May 05 18:13:55 2011 +0200 description: doveadm: Added "index" command to add unindexed messages into index/cache/fts. The caching adds only the fields that were previously added to the mailbox's caching decisions, so it won't do anything useful for mailboxes that user's client hasn't accessed yet. diffstat: src/doveadm/Makefile.am | 1 + src/doveadm/doveadm-mail-index.c | 247 +++++++++++++++++++++++++++++++++++++++ src/doveadm/doveadm-mail.c | 1 + src/doveadm/doveadm-mail.h | 1 + 4 files changed, 250 insertions(+), 0 deletions(-) diffs (284 lines): diff -r e9918fd289f3 -r 840e27a52e51 src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Thu May 05 17:49:45 2011 +0200 +++ b/src/doveadm/Makefile.am Thu May 05 18:13:55 2011 +0200 @@ -63,6 +63,7 @@ doveadm-mail-expunge.c \ doveadm-mail-fetch.c \ doveadm-mail-import.c \ + doveadm-mail-index.c \ doveadm-mail-iter.c \ doveadm-mail-mailbox.c \ doveadm-mail-mailbox-status.c \ diff -r e9918fd289f3 -r 840e27a52e51 src/doveadm/doveadm-mail-index.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/doveadm/doveadm-mail-index.c Thu May 05 18:13:55 2011 +0200 @@ -0,0 +1,247 @@ +/* Copyright (c) 2010-2011 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "mail-namespace.h" +#include "mail-storage.h" +#include "mail-search-build.h" +#include "doveadm-mail.h" + +enum cache_mask { + CACHE_HDR = 0x01, + CACHE_BODY = 0x02, + CACHE_RECEIVED_DATE = 0x04, + CACHE_SAVE_DATE = 0x08, + CACHE_VIRTUAL_SIZE = 0x10, + CACHE_PHYSICAL_SIZE = 0x20, + CACHE_POP3_UIDL = 0x40, + CACHE_GUID = 0x80 +}; + +static bool fts_is_enabled = FALSE; + +static enum cache_mask cache_fields_get(const struct mailbox_status *status) +{ + const char *const *cache_fields; + unsigned int i, count; + enum cache_mask cache = 0; + + cache_fields = array_get(status->cache_fields, &count); + for (i = 0; i < count; i++) { + if (strncmp(cache_fields[i], "hdr.", 4) == 0 || + strcmp(cache_fields[i], "date.sent") == 0 || + strcmp(cache_fields[i], "imap.envelope") == 0) + cache |= CACHE_HDR; + else if (strcmp(cache_fields[i], "mime.parts") == 0 || + strcmp(cache_fields[i], "imap.body") == 0 || + strcmp(cache_fields[i], "imap.bodystructure") == 0) + cache |= CACHE_BODY; + else if (strcmp(cache_fields[i], "date.received") == 0) + cache |= CACHE_RECEIVED_DATE; + else if (strcmp(cache_fields[i], "date.save") == 0) + cache |= CACHE_SAVE_DATE; + else if (strcmp(cache_fields[i], "size.virtual") == 0) + cache |= CACHE_VIRTUAL_SIZE; + else if (strcmp(cache_fields[i], "size.physical") == 0) + cache |= CACHE_PHYSICAL_SIZE; + else if (strcmp(cache_fields[i], "pop3.uidl") == 0) + cache |= CACHE_POP3_UIDL; + else if (strcmp(cache_fields[i], "guid") == 0) + cache |= CACHE_GUID; + else if (doveadm_debug) { + i_debug("Ignoring unknown cache field: %s", + cache_fields[i]); + } + } + return cache; +} + +static int cache_add(struct mailbox *box, const struct mailbox_status *status, + enum cache_mask cache) +{ + struct mailbox_transaction_context *trans; + struct mail *mail; + uint32_t seq; + time_t date; + uoff_t size; + const char *str; + + if (doveadm_debug) { + i_debug("%s: Nothing in mailbox cache, skipping", + mailbox_get_vname(box)); + return 0; + } + + /* find the first message we need to index */ + trans = mailbox_transaction_begin(box, 0); + mail = mail_alloc(trans, 0, NULL); + for (seq = status->messages; seq > 0; seq--) { + mail_set_seq(mail, seq); + if (mail_is_cached(mail)) + break; + } + seq++; + + if (doveadm_debug) { + if (seq > status->messages) { + i_debug("%s: Cache is already up to date", + mailbox_get_vname(box)); + } else { + i_debug("%s: Caching mails seq=%u..%u cache=0x%x", + mailbox_get_vname(box), + seq, status->messages, cache); + } + } + + for (; seq <= status->messages; seq++) { + mail_set_seq(mail, seq); + + if ((cache & (CACHE_HDR | CACHE_BODY)) != 0) + mail_parse(mail, (cache & CACHE_BODY) != 0); + if ((cache & CACHE_RECEIVED_DATE) != 0) + (void)mail_get_received_date(mail, &date); + if ((cache & CACHE_SAVE_DATE) != 0) + (void)mail_get_save_date(mail, &date); + if ((cache & CACHE_VIRTUAL_SIZE) != 0) + (void)mail_get_virtual_size(mail, &size); + if ((cache & CACHE_PHYSICAL_SIZE) != 0) + (void)mail_get_physical_size(mail, &size); + if ((cache & CACHE_POP3_UIDL) != 0) { + (void)mail_get_special(mail, MAIL_FETCH_UIDL_BACKEND, + &str); + } + if ((cache & CACHE_GUID) != 0) + (void)mail_get_special(mail, MAIL_FETCH_GUID, &str); + } + mail_free(&mail); + if (mailbox_transaction_commit(&trans) < 0) { + i_error("Commiting mailbox %s failed: %s", + mailbox_get_vname(box), + mail_storage_get_last_error(mailbox_get_storage(box), NULL)); + return -1; + } + return 0; +} + +static int fts_update(struct mailbox *box, const struct mailbox_status *status) +{ + struct mailbox_transaction_context *t; + struct mail_search_args *search_args; + struct mail_search_arg *arg; + struct mail_search_context *ctx; + struct mail *mail; + int ret; + + if (!fts_is_enabled) + return 0; + + /* a bit kludgy way to trigger the full text search update: + search for a string in the last message */ + t = mailbox_transaction_begin(box, 0); + search_args = mail_search_build_init(); + search_args->charset = "UTF-8"; + mail_search_build_add_seqset(search_args, + status->messages, status->messages); + arg = mail_search_build_add(search_args, SEARCH_BODY_FAST); + arg->value.str = "xyzzy"; + + ctx = mailbox_search_init(t, search_args, NULL); + mail_search_args_unref(&search_args); + + mail = mail_alloc(t, 0, NULL); + while (mailbox_search_next(ctx, mail)) { + } + mail_free(&mail); + + if (mailbox_search_deinit(&ctx) < 0) + ret = -1; + (void)mailbox_transaction_commit(&t); + return ret; +} + +static int +cmd_index_box(const struct mailbox_info *info) +{ + struct mailbox *box; + struct mailbox_status status; + const char *storage_name; + enum cache_mask cache; + int ret = 0; + + storage_name = mail_namespace_get_storage_name(info->ns, info->name); + box = mailbox_alloc(info->ns->list, storage_name, + MAILBOX_FLAG_KEEP_RECENT | + MAILBOX_FLAG_IGNORE_ACLS); + + if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) { + i_error("Syncing mailbox %s failed: %s", info->name, + mail_storage_get_last_error(mailbox_get_storage(box), NULL)); + mailbox_free(&box); + return -1; + } + mailbox_get_status(box, STATUS_MESSAGES | STATUS_CACHE_FIELDS, &status); + + cache = cache_fields_get(&status); + ret = cache_add(box, &status, cache); + + if (fts_update(box, &status) < 0) + ret = -1; + + mailbox_free(&box); + return ret; +} + +static void +cmd_index_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) +{ + const enum mailbox_list_iter_flags iter_flags = + MAILBOX_LIST_ITER_RAW_LIST | + MAILBOX_LIST_ITER_NO_AUTO_INBOX | + MAILBOX_LIST_ITER_RETURN_NO_FLAGS | + MAILBOX_LIST_ITER_STAR_WITHIN_NS; + const enum namespace_type ns_mask = + NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC; + struct mailbox_list_iterate_context *iter; + const struct mailbox_info *info; + + if (mail_user_plugin_getenv(user, "fts") != NULL) T_BEGIN { + const char *const *plugins; + + plugins = t_strsplit(user->set->mail_plugins, " "); + for (; *plugins != NULL; plugins++) { + if (strncmp(*plugins, "fts", 3) == 0) + fts_is_enabled = TRUE; + } + } T_END; + + iter = mailbox_list_iter_init_namespaces(user->namespaces, ctx->args, + ns_mask, iter_flags); + while ((info = mailbox_list_iter_next(iter)) != NULL) { + if ((info->flags & (MAILBOX_NOSELECT | + MAILBOX_NONEXISTENT)) == 0) T_BEGIN { + (void)cmd_index_box(info); + } T_END; + } + if (mailbox_list_iter_deinit(&iter) < 0) + i_error("Listing mailboxes failed"); +} + +static void cmd_index_init(struct doveadm_mail_cmd_context *ctx ATTR_UNUSED, + const char *const args[]) +{ + if (args[0] == NULL) + doveadm_mail_help_name("index"); +} + +static struct doveadm_mail_cmd_context *cmd_index_alloc(void) +{ + struct doveadm_mail_cmd_context *ctx; + + ctx = doveadm_mail_cmd_alloc(struct doveadm_mail_cmd_context); + ctx->v.init = cmd_index_init; + ctx->v.run = cmd_index_run; + return ctx; +} + +struct doveadm_mail_cmd cmd_index = { + cmd_index_alloc, "index", "" +}; diff -r e9918fd289f3 -r 840e27a52e51 src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Thu May 05 17:49:45 2011 +0200 +++ b/src/doveadm/doveadm-mail.c Thu May 05 18:13:55 2011 +0200 @@ -565,6 +565,7 @@ &cmd_search, &cmd_fetch, &cmd_import, + &cmd_index, &cmd_altmove, &cmd_move, &cmd_mailbox_list, diff -r e9918fd289f3 -r 840e27a52e51 src/doveadm/doveadm-mail.h --- a/src/doveadm/doveadm-mail.h Thu May 05 17:49:45 2011 +0200 +++ b/src/doveadm/doveadm-mail.h Thu May 05 18:13:55 2011 +0200 @@ -108,6 +108,7 @@ struct doveadm_mail_cmd cmd_search; struct doveadm_mail_cmd cmd_fetch; struct doveadm_mail_cmd cmd_import; +struct doveadm_mail_cmd cmd_index; struct doveadm_mail_cmd cmd_altmove; struct doveadm_mail_cmd cmd_move; struct doveadm_mail_cmd cmd_mailbox_list; From dovecot at dovecot.org Mon May 9 17:41:54 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 17:41:54 +0300 Subject: dovecot-2.0: lmtp: With lmtp_save_to_detail_mailbox=yes, save ma... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/622d42376fe0 changeset: 12775:622d42376fe0 user: Timo Sirainen date: Mon May 09 17:41:45 2011 +0300 description: lmtp: With lmtp_save_to_detail_mailbox=yes, save mail to detail. The previous behavior required using prefix="" namespace to work. diffstat: src/lmtp/commands.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diffs (30 lines): diff -r 840e27a52e51 -r 622d42376fe0 src/lmtp/commands.c --- a/src/lmtp/commands.c Thu May 05 18:13:55 2011 +0200 +++ b/src/lmtp/commands.c Mon May 09 17:41:45 2011 +0300 @@ -452,6 +452,7 @@ struct mail_deliver_context dctx; struct mail_storage *storage; const struct mail_storage_service_input *input; + struct mail_namespace *ns; void **sets; const char *error, *username; enum mail_error mail_error; @@ -485,9 +486,15 @@ if (dctx.dest_addr == NULL) dctx.dest_addr = rcpt->address; dctx.final_dest_addr = rcpt->address; - dctx.dest_mailbox_name = *rcpt->detail != '\0' && - client->lmtp_set->lmtp_save_to_detail_mailbox ? - rcpt->detail : "INBOX"; + if (rcpt->detail == '\0' || + !client->lmtp_set->lmtp_save_to_detail_mailbox) + dctx.dest_mailbox_name = "INBOX"; + else { + ns = mail_namespace_find_inbox(dctx.dest_user->namespaces); + dctx.dest_mailbox_name = + t_strconcat(ns->prefix, rcpt->detail, NULL); + } + dctx.save_dest_mail = array_count(&client->state.rcpt_to) > 1 && client->state.first_saved_mail == NULL; From dovecot at dovecot.org Mon May 9 17:58:44 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 17:58:44 +0300 Subject: dovecot-2.0: lib-storage: Fixed LIST/LSUB with LAYOUT=none. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/78286b1a0a16 changeset: 12776:78286b1a0a16 user: Timo Sirainen date: Mon May 09 17:58:37 2011 +0300 description: lib-storage: Fixed LIST/LSUB with LAYOUT=none. It shouldn't have listed INBOX if it didn't match the given patterns. diffstat: src/lib-storage/list/mailbox-list-none.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diffs (41 lines): diff -r 622d42376fe0 -r 78286b1a0a16 src/lib-storage/list/mailbox-list-none.c --- a/src/lib-storage/list/mailbox-list-none.c Mon May 09 17:41:45 2011 +0300 +++ b/src/lib-storage/list/mailbox-list-none.c Mon May 09 17:58:37 2011 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2006-2011 Dovecot authors, see the included COPYING file */ #include "lib.h" +#include "imap-match.h" #include "mailbox-list-private.h" #define MAILBOX_LIST_NAME_NONE "none" @@ -128,19 +129,25 @@ static struct mailbox_list_iterate_context * none_list_iter_init(struct mailbox_list *list, - const char *const *patterns ATTR_UNUSED, + const char *const *patterns, enum mailbox_list_iter_flags flags) { struct noop_list_iterate_context *ctx; + struct imap_match_glob *glob; ctx = i_new(struct noop_list_iterate_context, 1); ctx->ctx.list = list; ctx->ctx.flags = flags; - if ((list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) { - ctx->list_inbox = TRUE; + if ((list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) T_BEGIN { ctx->inbox_info.ns = list->ns; ctx->inbox_info.name = "INBOX"; - } + + glob = imap_match_init_multiple(pool_datastack_create(), + patterns, TRUE, + list->hierarchy_sep); + if (imap_match(glob, "INBOX") == IMAP_MATCH_YES) + ctx->list_inbox = TRUE; + } T_END; return &ctx->ctx; } From dovecot at dovecot.org Mon May 9 18:23:32 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 18:23:32 +0300 Subject: dovecot-2.0: imap: RENAME and DELETE wasn't replying with NONEXI... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/6790433a1e77 changeset: 12777:6790433a1e77 user: Timo Sirainen date: Mon May 09 18:23:23 2011 +0300 description: imap: RENAME and DELETE wasn't replying with NONEXISTENT resp code. diffstat: src/imap/cmd-delete.c | 5 ++++- src/imap/cmd-rename.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diffs (44 lines): diff -r 78286b1a0a16 -r 6790433a1e77 src/imap/cmd-delete.c --- a/src/imap/cmd-delete.c Mon May 09 17:58:37 2011 +0300 +++ b/src/imap/cmd-delete.c Mon May 09 18:23:23 2011 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */ #include "imap-common.h" +#include "imap-resp-code.h" #include "imap-commands.h" bool cmd_delete(struct client_command_context *cmd) @@ -31,7 +32,9 @@ case MAILBOX_NAME_VALID: case MAILBOX_NAME_INVALID: case MAILBOX_NAME_NOINFERIORS: - client_fail_mailbox_name_status(cmd, name, NULL, status); + client_fail_mailbox_name_status(cmd, name, + IMAP_RESP_CODE_NONEXISTENT, + status); return TRUE; } diff -r 78286b1a0a16 -r 6790433a1e77 src/imap/cmd-rename.c --- a/src/imap/cmd-rename.c Mon May 09 17:58:37 2011 +0300 +++ b/src/imap/cmd-rename.c Mon May 09 18:23:23 2011 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */ #include "imap-common.h" +#include "imap-resp-code.h" #include "mail-namespace.h" #include "imap-commands.h" @@ -26,7 +27,9 @@ case MAILBOX_NAME_VALID: case MAILBOX_NAME_INVALID: case MAILBOX_NAME_NOINFERIORS: - client_fail_mailbox_name_status(cmd, oldname, NULL, status); + client_fail_mailbox_name_status(cmd, oldname, + IMAP_RESP_CODE_NONEXISTENT, + status); return TRUE; } From dovecot at dovecot.org Mon May 9 18:43:44 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 18:43:44 +0300 Subject: dovecot-2.0: master: Warn if service's vsz_limit < 1 MB Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c3f4201f9818 changeset: 12778:c3f4201f9818 user: Timo Sirainen date: Mon May 09 18:43:35 2011 +0300 description: master: Warn if service's vsz_limit < 1 MB It's unlikely anyone wants it to be smaller, and small values give random errors/crashes. diffstat: src/master/master-settings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 6790433a1e77 -r c3f4201f9818 src/master/master-settings.c --- a/src/master/master-settings.c Mon May 09 18:23:23 2011 +0300 +++ b/src/master/master-settings.c Mon May 09 18:43:35 2011 +0300 @@ -507,7 +507,7 @@ service->name); return FALSE; } - if (service->vsz_limit < 1024 && service->vsz_limit != 0) { + if (service->vsz_limit < 1024*1024 && service->vsz_limit != 0) { *error_r = t_strdup_printf("service(%s): " "vsz_limit is too low", service->name); return FALSE; From dovecot at dovecot.org Mon May 9 19:08:50 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 19:08:50 +0300 Subject: dovecot-2.0: auth: Added assert. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/3ada82147977 changeset: 12779:3ada82147977 user: Timo Sirainen date: Mon May 09 19:08:43 2011 +0300 description: auth: Added assert. diffstat: src/auth/db-ldap.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r c3f4201f9818 -r 3ada82147977 src/auth/db-ldap.c --- a/src/auth/db-ldap.c Mon May 09 18:43:35 2011 +0300 +++ b/src/auth/db-ldap.c Mon May 09 19:08:43 2011 +0300 @@ -328,6 +328,8 @@ struct ldap_request *const *requestp, *request; int ret = -1; + i_assert(conn->pending_count <= aqueue_count(conn->request_queue)); + if (conn->pending_count == aqueue_count(conn->request_queue)) { /* no non-pending requests */ return FALSE; From dovecot at dovecot.org Mon May 9 19:26:03 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 19:26:03 +0300 Subject: dovecot-2.0: lib-settings: Crashfix for broken settings under st... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/74248914cf40 changeset: 12780:74248914cf40 user: Timo Sirainen date: Mon May 09 19:25:44 2011 +0300 description: lib-settings: Crashfix for broken settings under strlist. diffstat: src/lib-settings/settings-parser.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 3ada82147977 -r 74248914cf40 src/lib-settings/settings-parser.c --- a/src/lib-settings/settings-parser.c Mon May 09 19:08:43 2011 +0300 +++ b/src/lib-settings/settings-parser.c Mon May 09 19:25:44 2011 +0300 @@ -696,7 +696,8 @@ if (parent_def == NULL) { /* we'll get here with e.g. "plugin/a/b=val". not sure if we should ever do anything here.. */ - if (strcmp(parent_link->full_key, parent_key) != 0) + if (parent_link->full_key == NULL || + strcmp(parent_link->full_key, parent_key) != 0) return FALSE; } else { if (parent_def->type != SET_STRLIST) From dovecot at dovecot.org Mon May 9 19:28:34 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 19:28:34 +0300 Subject: dovecot-2.0: Minor typofix. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/4e99454e2c7c changeset: 12781:4e99454e2c7c user: Timo Sirainen date: Mon May 09 19:28:27 2011 +0300 description: Minor typofix. diffstat: src/plugins/lazy-expunge/lazy-expunge-plugin.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (10 lines): diff -r 74248914cf40 -r 4e99454e2c7c src/plugins/lazy-expunge/lazy-expunge-plugin.h --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.h Mon May 09 19:25:44 2011 +0300 +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.h Mon May 09 19:28:27 2011 +0300 @@ -1,5 +1,5 @@ #ifndef LAZY_EXPUNGE_PLUGIN_H -#define TLAZY_EXPUNGE_PLUGIN_H +#define LAZY_EXPUNGE_PLUGIN_H void lazy_expunge_plugin_init(struct module *module); void lazy_expunge_plugin_deinit(void); From dovecot at dovecot.org Mon May 9 19:59:32 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 19:59:32 +0300 Subject: dovecot-2.0: script-login: Changed default behavior to be to dro... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/1bbb45a97cc1 changeset: 12782:1bbb45a97cc1 user: Timo Sirainen date: Mon May 09 19:59:21 2011 +0300 description: script-login: Changed default behavior to be to drop privileges. Also since the default is to run as root, allow that. There is now "-n" parameter to avoid dropping privileges. diffstat: src/util/script-login.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (36 lines): diff -r 4e99454e2c7c -r 1bbb45a97cc1 src/util/script-login.c --- a/src/util/script-login.c Mon May 09 19:28:27 2011 +0300 +++ b/src/util/script-login.c Mon May 09 19:59:21 2011 +0300 @@ -22,7 +22,7 @@ #define SCRIPT_COMM_FD 3 static const char **exec_args; -static bool drop_privileges = FALSE; +static bool drop_privileges = TRUE; static void client_connected(struct master_service_connection *conn) { @@ -120,7 +120,7 @@ mail_storage_service_restrict_setenv(service_ctx, user); if (drop_privileges) - restrict_access_by_env(getenv("HOME"), TRUE); + restrict_access_by_env(getenv("HOME"), FALSE); if (dup2(fd, STDIN_FILENO) < 0) i_fatal("dup2() failed: %m"); @@ -186,11 +186,11 @@ flags |= MASTER_SERVICE_FLAG_STANDALONE; master_service = master_service_init("script-login", flags, - &argc, &argv, "+d"); + &argc, &argv, "+n"); while ((c = master_getopt(master_service)) > 0) { switch (c) { - case 'd': - drop_privileges = TRUE; + case 'n': + drop_privileges = FALSE; break; default: return FATAL_DEFAULT; From dovecot at dovecot.org Mon May 9 20:03:31 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 20:03:31 +0300 Subject: dovecot-2.0: script-login: Reverted last change. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/56a1b3082b4b changeset: 12783:56a1b3082b4b user: Timo Sirainen date: Mon May 09 20:03:24 2011 +0300 description: script-login: Reverted last change. diffstat: src/util/script-login.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (36 lines): diff -r 1bbb45a97cc1 -r 56a1b3082b4b src/util/script-login.c --- a/src/util/script-login.c Mon May 09 19:59:21 2011 +0300 +++ b/src/util/script-login.c Mon May 09 20:03:24 2011 +0300 @@ -22,7 +22,7 @@ #define SCRIPT_COMM_FD 3 static const char **exec_args; -static bool drop_privileges = TRUE; +static bool drop_privileges = FALSE; static void client_connected(struct master_service_connection *conn) { @@ -120,7 +120,7 @@ mail_storage_service_restrict_setenv(service_ctx, user); if (drop_privileges) - restrict_access_by_env(getenv("HOME"), FALSE); + restrict_access_by_env(getenv("HOME"), TRUE); if (dup2(fd, STDIN_FILENO) < 0) i_fatal("dup2() failed: %m"); @@ -186,11 +186,11 @@ flags |= MASTER_SERVICE_FLAG_STANDALONE; master_service = master_service_init("script-login", flags, - &argc, &argv, "+n"); + &argc, &argv, "+d"); while ((c = master_getopt(master_service)) > 0) { switch (c) { - case 'n': - drop_privileges = FALSE; + case 'd': + drop_privileges = TRUE; break; default: return FATAL_DEFAULT; From dovecot at dovecot.org Mon May 9 20:11:08 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 09 May 2011 20:11:08 +0300 Subject: dovecot-2.0: script-login: When -d isn't given, drop privileges ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/25a452227a09 changeset: 12784:25a452227a09 user: Timo Sirainen date: Mon May 09 20:11:00 2011 +0300 description: script-login: When -d isn't given, drop privileges as specified by the service settings. diffstat: src/util/script-login.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diffs (53 lines): diff -r 56a1b3082b4b -r 25a452227a09 src/util/script-login.c --- a/src/util/script-login.c Mon May 09 20:03:24 2011 +0300 +++ b/src/util/script-login.c Mon May 09 20:11:00 2011 +0300 @@ -22,7 +22,7 @@ #define SCRIPT_COMM_FD 3 static const char **exec_args; -static bool drop_privileges = FALSE; +static bool drop_to_userdb_privileges = FALSE; static void client_connected(struct master_service_connection *conn) { @@ -119,7 +119,7 @@ i_fatal("%s", error); mail_storage_service_restrict_setenv(service_ctx, user); - if (drop_privileges) + if (drop_to_userdb_privileges) restrict_access_by_env(getenv("HOME"), TRUE); if (dup2(fd, STDIN_FILENO) < 0) @@ -190,7 +190,7 @@ while ((c = master_getopt(master_service)) > 0) { switch (c) { case 'd': - drop_privileges = TRUE; + drop_to_userdb_privileges = TRUE; break; default: return FATAL_DEFAULT; @@ -200,12 +200,20 @@ argv += optind; master_service_init_log(master_service, "script-login: "); + + if (!drop_to_userdb_privileges && + (flags & MASTER_SERVICE_FLAG_STANDALONE) == 0) { + /* drop to privileges defined by service settings */ + restrict_access_by_env(NULL, FALSE); + } + master_service_init_finish(master_service); master_service_set_service_count(master_service, 1); - if ((flags & MASTER_SERVICE_FLAG_STANDALONE) != 0) + if ((flags & MASTER_SERVICE_FLAG_STANDALONE) != 0) { + /* The last post-login script is calling us to finish login */ script_execute_finish(); - else { + } else { if (argv[0] == NULL) i_fatal("Missing script path"); exec_args = i_new(const char *, argc + 2); From pigeonhole at rename-it.nl Mon May 9 21:56:53 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Mon, 09 May 2011 20:56:53 +0200 Subject: dovecot-2.0-pigeonhole: Imap4flags: prevent forcibly enabling im... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/ef58ace33b47 changeset: 1497:ef58ace33b47 user: Stephan Bosch date: Mon May 09 20:56:08 2011 +0200 description: Imap4flags: prevent forcibly enabling imap4flags when imapflags is enabled. diffstat: src/lib-sieve/plugins/imap4flags/ext-imapflags.c | 2 +- src/lib-sieve/plugins/vacation/ext-vacation-seconds.c | 2 +- src/lib-sieve/sieve-extensions.c | 20 +++++++++++--------- src/lib-sieve/sieve-extensions.h | 4 +++- 4 files changed, 16 insertions(+), 12 deletions(-) diffs (118 lines): diff -r 42497f1c37ff -r ef58ace33b47 src/lib-sieve/plugins/imap4flags/ext-imapflags.c --- a/src/lib-sieve/plugins/imap4flags/ext-imapflags.c Thu Apr 14 22:45:40 2011 +0200 +++ b/src/lib-sieve/plugins/imap4flags/ext-imapflags.c Mon May 09 20:56:08 2011 +0200 @@ -94,7 +94,7 @@ if ( *context == NULL ) { /* Make sure real extension is registered, it is needed by the binary */ *context = (void *) - sieve_extension_require(ext->svinst, &imap4flags_extension); + sieve_extension_require(ext->svinst, &imap4flags_extension, FALSE); } return TRUE; diff -r 42497f1c37ff -r ef58ace33b47 src/lib-sieve/plugins/vacation/ext-vacation-seconds.c --- a/src/lib-sieve/plugins/vacation/ext-vacation-seconds.c Thu Apr 14 22:45:40 2011 +0200 +++ b/src/lib-sieve/plugins/vacation/ext-vacation-seconds.c Mon May 09 20:56:08 2011 +0200 @@ -45,7 +45,7 @@ if ( *context == NULL ) { /* Make sure vacation extension is registered */ *context = (void *) - sieve_extension_require(ext->svinst, &vacation_extension); + sieve_extension_require(ext->svinst, &vacation_extension, TRUE); } return TRUE; diff -r 42497f1c37ff -r ef58ace33b47 src/lib-sieve/sieve-extensions.c --- a/src/lib-sieve/sieve-extensions.c Thu Apr 14 22:45:40 2011 +0200 +++ b/src/lib-sieve/sieve-extensions.c Mon May 09 20:56:08 2011 +0200 @@ -24,7 +24,7 @@ static struct sieve_extension *_sieve_extension_register (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, - bool load, bool required); + bool load, bool required, bool implied); /* * Instance global context @@ -216,7 +216,7 @@ /* Pre-load dummy extensions */ for ( i = 0; i < sieve_dummy_extensions_count; i++ ) { if ( (ext=_sieve_extension_register - (svinst, sieve_dummy_extensions[i], TRUE, FALSE)) == NULL ) + (svinst, sieve_dummy_extensions[i], TRUE, FALSE, FALSE)) == NULL ) return FALSE; ext->dummy = TRUE; @@ -346,8 +346,8 @@ } static struct sieve_extension *_sieve_extension_register -(struct sieve_instance *svinst, const struct sieve_extension_def *extdef, - bool load, bool required) +(struct sieve_instance *svinst, const struct sieve_extension_def *extdef, + bool load, bool required, bool implied) { struct sieve_extension_registry *ext_reg = svinst->ext_reg; struct sieve_extension *ext = (struct sieve_extension *) @@ -390,7 +390,8 @@ ext->loaded = TRUE; } - ext->required = (ext->required || required ); + ext->required = ( ext->required || required ); + ext->implied = ( ext->implied || implied ); return ext; } @@ -399,7 +400,7 @@ (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, bool load) { - return _sieve_extension_register(svinst, extdef, load, FALSE); + return _sieve_extension_register(svinst, extdef, load, FALSE, FALSE); } void sieve_extension_unregister(const struct sieve_extension *ext) @@ -419,9 +420,10 @@ } const struct sieve_extension *sieve_extension_require -(struct sieve_instance *svinst, const struct sieve_extension_def *extdef) +(struct sieve_instance *svinst, const struct sieve_extension_def *extdef, + bool implied) { - return _sieve_extension_register(svinst, extdef, TRUE, TRUE); + return _sieve_extension_register(svinst, extdef, TRUE, TRUE, implied); } int sieve_extensions_get_count(struct sieve_instance *svinst) @@ -627,7 +629,7 @@ if ( exts[i]->id >= 0 && exts[i]->def != NULL && *(exts[i]->def->name) != '@' ) { - if ( disabled && !exts[i]->required ) + if ( disabled && !exts[i]->implied ) sieve_extension_disable(exts[i]); else sieve_extension_enable(exts[i]); diff -r 42497f1c37ff -r ef58ace33b47 src/lib-sieve/sieve-extensions.h --- a/src/lib-sieve/sieve-extensions.h Thu Apr 14 22:45:40 2011 +0200 +++ b/src/lib-sieve/sieve-extensions.h Mon May 09 20:56:08 2011 +0200 @@ -74,6 +74,7 @@ unsigned int required:1; unsigned int loaded:1; unsigned int enabled:1; + unsigned int implied:1; unsigned int dummy:1; }; @@ -116,7 +117,8 @@ (struct sieve_instance *svinst, const struct sieve_extension_def *extension, bool load); const struct sieve_extension *sieve_extension_require - (struct sieve_instance *svinst, const struct sieve_extension_def *extension); + (struct sieve_instance *svinst, const struct sieve_extension_def *extension, + bool implied); bool sieve_extension_reload(const struct sieve_extension *ext); void sieve_extension_unregister(const struct sieve_extension *ext); From dovecot at dovecot.org Tue May 10 01:25:00 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 May 2011 01:25:00 +0300 Subject: dovecot-2.0: Removed ssl_parameters_file setting. It wasn't used... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/40a5f8f07bd2 changeset: 12785:40a5f8f07bd2 user: Timo Sirainen date: Tue May 10 01:24:34 2011 +0300 description: Removed ssl_parameters_file setting. It wasn't used by anything. diffstat: src/login-common/login-settings.c | 2 -- src/login-common/login-settings.h | 1 - 2 files changed, 0 insertions(+), 3 deletions(-) diffs (30 lines): diff -r 25a452227a09 -r 40a5f8f07bd2 src/login-common/login-settings.c --- a/src/login-common/login-settings.c Mon May 09 20:11:00 2011 +0300 +++ b/src/login-common/login-settings.c Tue May 10 01:24:34 2011 +0300 @@ -30,7 +30,6 @@ DEF(SET_STR, ssl_cert), DEF(SET_STR, ssl_key), DEF(SET_STR, ssl_key_password), - DEF(SET_STR, ssl_parameters_file), DEF(SET_STR, ssl_cipher_list), DEF(SET_STR, ssl_cert_username_field), DEF(SET_BOOL, ssl_verify_client_cert), @@ -60,7 +59,6 @@ .ssl_cert = "", .ssl_key = "", .ssl_key_password = "", - .ssl_parameters_file = "ssl-parameters.dat", .ssl_cipher_list = "ALL:!LOW:!SSLv2:!EXP:!aNULL", .ssl_cert_username_field = "commonName", .ssl_verify_client_cert = FALSE, diff -r 25a452227a09 -r 40a5f8f07bd2 src/login-common/login-settings.h --- a/src/login-common/login-settings.h Mon May 09 20:11:00 2011 +0300 +++ b/src/login-common/login-settings.h Tue May 10 01:24:34 2011 +0300 @@ -12,7 +12,6 @@ const char *ssl_cert; const char *ssl_key; const char *ssl_key_password; - const char *ssl_parameters_file; const char *ssl_cipher_list; const char *ssl_cert_username_field; bool ssl_verify_client_cert; From dovecot at dovecot.org Tue May 10 17:46:58 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 May 2011 17:46:58 +0300 Subject: dovecot-2.0: acl: Don't waste time doing ACL checks for IMAP LSU... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/a7f1980d250c changeset: 12786:a7f1980d250c user: Timo Sirainen date: Tue May 10 17:46:50 2011 +0300 description: acl: Don't waste time doing ACL checks for IMAP LSUB command. diffstat: src/plugins/acl/acl-mailbox-list.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diffs (18 lines): diff -r 40a5f8f07bd2 -r a7f1980d250c src/plugins/acl/acl-mailbox-list.c --- a/src/plugins/acl/acl-mailbox-list.c Tue May 10 01:24:34 2011 +0300 +++ b/src/plugins/acl/acl-mailbox-list.c Tue May 10 17:46:50 2011 +0300 @@ -321,6 +321,14 @@ return 1; } + if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0 && + (ctx->ctx.flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) != 0) { + /* don't waste time doing an ACL check. we're going to list + all subscriptions anyway. */ + info->flags &= MAILBOX_SUBSCRIBED | MAILBOX_CHILD_SUBSCRIBED; + return 1; + } + acl_name = acl_mailbox_list_iter_get_name(&ctx->ctx, info->name); ret = acl_mailbox_list_have_right(ctx->ctx.list, acl_name, FALSE, ACL_STORAGE_RIGHT_LOOKUP, From dovecot at dovecot.org Tue May 10 17:55:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 May 2011 17:55:45 +0300 Subject: dovecot-2.0: doveadm mailbox status: Don't assert-crash at exit ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/b74dfa49692b changeset: 12787:b74dfa49692b user: Timo Sirainen date: Tue May 10 17:55:27 2011 +0300 description: doveadm mailbox status: Don't assert-crash at exit if syncing a mailbox fails. diffstat: src/doveadm/doveadm-mail.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r a7f1980d250c -r b74dfa49692b src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Tue May 10 17:46:50 2011 +0300 +++ b/src/doveadm/doveadm-mail.c Tue May 10 17:55:27 2011 +0300 @@ -110,6 +110,7 @@ i_error("Syncing mailbox %s failed: %s", mailbox, mail_storage_get_last_error(mailbox_get_storage(*box_r), NULL)); + mailbox_free(box_r); return -1; } return 0; From dovecot at dovecot.org Tue May 10 18:19:42 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 May 2011 18:19:42 +0300 Subject: dovecot-2.0: istream-[b]zlib: stat(exact=FALSE) should always re... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/15a0687ec9d0 changeset: 12788:15a0687ec9d0 user: Timo Sirainen date: Tue May 10 18:19:35 2011 +0300 description: istream-[b]zlib: stat(exact=FALSE) should always return the same value if file hasn't changed. diffstat: src/plugins/zlib/istream-bzlib.c | 6 +++++- src/plugins/zlib/istream-zlib.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diffs (32 lines): diff -r b74dfa49692b -r 15a0687ec9d0 src/plugins/zlib/istream-bzlib.c --- a/src/plugins/zlib/istream-bzlib.c Tue May 10 17:55:27 2011 +0300 +++ b/src/plugins/zlib/istream-bzlib.c Tue May 10 18:19:35 2011 +0300 @@ -273,7 +273,11 @@ if (st == NULL) return NULL; - if (zstream->eof_offset == (uoff_t)-1 && !exact) + /* when exact=FALSE always return the parent stat's size, even if we + know the exact value. this is necessary because otherwise e.g. mbox + code can see two different values and think that a compressed mbox + file keeps changing. */ + if (!exact) return st; stream->statbuf = *st; diff -r b74dfa49692b -r 15a0687ec9d0 src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Tue May 10 17:55:27 2011 +0300 +++ b/src/plugins/zlib/istream-zlib.c Tue May 10 18:19:35 2011 +0300 @@ -419,7 +419,11 @@ if (st == NULL) return NULL; - if (zstream->eof_offset == (uoff_t)-1 && !exact) + /* when exact=FALSE always return the parent stat's size, even if we + know the exact value. this is necessary because otherwise e.g. mbox + code can see two different values and think that a compressed mbox + file keeps changing. */ + if (!exact) return st; stream->statbuf = *st; From dovecot at dovecot.org Tue May 10 18:24:38 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 10 May 2011 18:24:38 +0300 Subject: dovecot-2.0: zlib: Don't unnecessarily reset istream caches. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/66ec075a49d3 changeset: 12789:66ec075a49d3 user: Timo Sirainen date: Tue May 10 18:24:31 2011 +0300 description: zlib: Don't unnecessarily reset istream caches. diffstat: src/plugins/zlib/istream-bzlib.c | 12 ++++++++++++ src/plugins/zlib/istream-zlib.c | 12 ++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diffs (60 lines): diff -r 15a0687ec9d0 -r 66ec075a49d3 src/plugins/zlib/istream-bzlib.c --- a/src/plugins/zlib/istream-bzlib.c Tue May 10 18:19:35 2011 +0300 +++ b/src/plugins/zlib/istream-bzlib.c Tue May 10 18:24:31 2011 +0300 @@ -16,6 +16,7 @@ bz_stream zs; uoff_t eof_offset; size_t prev_size, high_pos; + struct stat last_parent_statbuf; unsigned int log_errors:1; unsigned int marked:1; @@ -300,7 +301,18 @@ static void i_stream_bzlib_sync(struct istream_private *stream) { struct bzlib_istream *zstream = (struct bzlib_istream *) stream; + const struct stat *st; + st = i_stream_stat(stream->parent, FALSE); + if (st != NULL) { + if (memcmp(&zstream->last_parent_statbuf, + st, sizeof(*st)) == 0) { + /* a compressed file doesn't change unexpectedly, + don't clear our caches unnecessarily */ + return; + } + zstream->last_parent_statbuf = *st; + } i_stream_bzlib_reset(zstream); } diff -r 15a0687ec9d0 -r 66ec075a49d3 src/plugins/zlib/istream-zlib.c --- a/src/plugins/zlib/istream-zlib.c Tue May 10 18:19:35 2011 +0300 +++ b/src/plugins/zlib/istream-zlib.c Tue May 10 18:24:31 2011 +0300 @@ -28,6 +28,7 @@ uoff_t eof_offset; size_t prev_size, high_pos; uint32_t crc32; + struct stat last_parent_statbuf; unsigned int gz:1; unsigned int log_errors:1; @@ -446,7 +447,18 @@ static void i_stream_zlib_sync(struct istream_private *stream) { struct zlib_istream *zstream = (struct zlib_istream *) stream; + const struct stat *st; + st = i_stream_stat(stream->parent, FALSE); + if (st != NULL) { + if (memcmp(&zstream->last_parent_statbuf, + st, sizeof(*st)) == 0) { + /* a compressed file doesn't change unexpectedly, + don't clear our caches unnecessarily */ + return; + } + zstream->last_parent_statbuf = *st; + } i_stream_zlib_reset(zstream); } From pigeonhole at rename-it.nl Tue May 10 22:36:55 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Tue, 10 May 2011 21:36:55 +0200 Subject: dovecot-2.0-pigeonhole: Imap4flags: previous change was inadequate. Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/cc25d9fa8183 changeset: 1498:cc25d9fa8183 user: Stephan Bosch date: Tue May 10 21:36:47 2011 +0200 description: Imap4flags: previous change was inadequate. diffstat: src/lib-sieve/sieve-extensions.c | 59 ++++++++++++++--------------- src/lib-sieve/sieve-extensions.h | 3 +- src/lib-sieve/sieve-validator.c | 10 ++-- 3 files changed, 35 insertions(+), 37 deletions(-) diffs (259 lines): diff -r ef58ace33b47 -r cc25d9fa8183 src/lib-sieve/sieve-extensions.c --- a/src/lib-sieve/sieve-extensions.c Mon May 09 20:56:08 2011 +0200 +++ b/src/lib-sieve/sieve-extensions.c Tue May 10 21:36:47 2011 +0200 @@ -24,7 +24,7 @@ static struct sieve_extension *_sieve_extension_register (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, - bool load, bool required, bool implied); + bool load, bool required); /* * Instance global context @@ -216,7 +216,7 @@ /* Pre-load dummy extensions */ for ( i = 0; i < sieve_dummy_extensions_count; i++ ) { if ( (ext=_sieve_extension_register - (svinst, sieve_dummy_extensions[i], TRUE, FALSE, FALSE)) == NULL ) + (svinst, sieve_dummy_extensions[i], TRUE, FALSE)) == NULL ) return FALSE; ext->dummy = TRUE; @@ -347,7 +347,7 @@ static struct sieve_extension *_sieve_extension_register (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, - bool load, bool required, bool implied) + bool load, bool required) { struct sieve_extension_registry *ext_reg = svinst->ext_reg; struct sieve_extension *ext = (struct sieve_extension *) @@ -378,8 +378,8 @@ } /* Enable extension */ - if ( load ) { - ext->enabled = TRUE; + if ( load || required ) { + ext->enabled = ( ext->enabled || load ); /* Call load handler if extension was not loaded already */ if ( !ext->loaded ) { @@ -391,7 +391,6 @@ } ext->required = ( ext->required || required ); - ext->implied = ( ext->implied || implied ); return ext; } @@ -400,7 +399,7 @@ (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, bool load) { - return _sieve_extension_register(svinst, extdef, load, FALSE, FALSE); + return _sieve_extension_register(svinst, extdef, load, FALSE); } void sieve_extension_unregister(const struct sieve_extension *ext) @@ -421,9 +420,9 @@ const struct sieve_extension *sieve_extension_require (struct sieve_instance *svinst, const struct sieve_extension_def *extdef, - bool implied) + bool load) { - return _sieve_extension_register(svinst, extdef, TRUE, TRUE, implied); + return _sieve_extension_register(svinst, extdef, load, TRUE); } int sieve_extensions_get_count(struct sieve_instance *svinst) @@ -438,14 +437,14 @@ { struct sieve_extension_registry *ext_reg = svinst->ext_reg; struct sieve_extension * const *ext; - + if ( ext_id < array_count(&ext_reg->extensions) ) { ext = array_idx(&ext_reg->extensions, ext_id); - if ( (*ext)->def != NULL && (*ext)->enabled ) + if ( (*ext)->def != NULL && ((*ext)->enabled || (*ext)->required) ) return *ext; } - + return NULL; } @@ -454,16 +453,16 @@ { struct sieve_extension_registry *ext_reg = svinst->ext_reg; const struct sieve_extension *ext; - + if ( *name == '@' ) - return NULL; - - ext = (const struct sieve_extension *) + return NULL; + + ext = (const struct sieve_extension *) hash_table_lookup(ext_reg->extension_index, name); - if ( ext == NULL || ext->def == NULL || !ext->enabled ) + if ( ext == NULL || ext->def == NULL || (!ext->enabled && !ext->required)) return NULL; - + return ext; } @@ -472,15 +471,15 @@ struct sieve_extension_registry *ext_reg = svinst->ext_reg; string_t *extstr = t_str_new(256); struct sieve_extension * const *exts; - unsigned int i, ext_count; + unsigned int i, ext_count; exts = array_get(&ext_reg->extensions, &ext_count); if ( ext_count > 0 ) { i = 0; - + /* Find first listable extension */ - while ( i < ext_count && + while ( i < ext_count && !( exts[i]->enabled && exts[i]->def != NULL && *(exts[i]->def->name) != '@' && !exts[i]->dummy ) ) i++; @@ -488,11 +487,11 @@ if ( i < ext_count ) { /* Add first to string */ str_append(extstr, exts[i]->def->name); - i++; + i++; /* Add others */ for ( ; i < ext_count; i++ ) { - if ( exts[i]->enabled && exts[i]->def != NULL && + if ( exts[i]->enabled && exts[i]->def != NULL && *(exts[i]->def->name) != '@' && !exts[i]->dummy ) { str_append_c(extstr, ' '); str_append(extstr, exts[i]->def->name); @@ -507,7 +506,7 @@ static void sieve_extension_enable(struct sieve_extension *ext) { ext->enabled = TRUE; - + if ( !ext->loaded ) { (void)_sieve_extension_load(ext); } @@ -536,7 +535,7 @@ if ( ext_string == NULL ) { /* Enable all */ exts = array_get_modifiable(&ext_reg->extensions, &ext_count); - + for ( i = 0; i < ext_count; i++ ) sieve_extension_enable(exts[i]); @@ -557,7 +556,7 @@ if ( *name != '\0' ) { const struct sieve_extension *ext; char op = '\0'; /* No add/remove operation */ - + if ( *name == '+' /* Add to existing config */ || *name == '-' ) { /* Remove from existing config */ op = *name++; @@ -569,7 +568,7 @@ else ext = (const struct sieve_extension *) hash_table_lookup(ext_reg->extension_index, name); - + if ( ext == NULL || ext->def == NULL ) { sieve_sys_warning(svinst, "ignored unknown extension '%s' while configuring " @@ -617,19 +616,19 @@ } /* Enable if listed with '+' or no prefix */ - + for ( j = 0; j < ena_count; j++ ) { if ( ext_enabled[j]->def == exts[i]->def ) { disabled = FALSE; break; - } + } } /* Perform actual activation/deactivation */ if ( exts[i]->id >= 0 && exts[i]->def != NULL && *(exts[i]->def->name) != '@' ) { - if ( disabled && !exts[i]->implied ) + if ( disabled ) sieve_extension_disable(exts[i]); else sieve_extension_enable(exts[i]); diff -r ef58ace33b47 -r cc25d9fa8183 src/lib-sieve/sieve-extensions.h --- a/src/lib-sieve/sieve-extensions.h Mon May 09 20:56:08 2011 +0200 +++ b/src/lib-sieve/sieve-extensions.h Tue May 10 21:36:47 2011 +0200 @@ -74,7 +74,6 @@ unsigned int required:1; unsigned int loaded:1; unsigned int enabled:1; - unsigned int implied:1; unsigned int dummy:1; }; @@ -118,7 +117,7 @@ bool load); const struct sieve_extension *sieve_extension_require (struct sieve_instance *svinst, const struct sieve_extension_def *extension, - bool implied); + bool load); bool sieve_extension_reload(const struct sieve_extension *ext); void sieve_extension_unregister(const struct sieve_extension *ext); diff -r ef58ace33b47 -r cc25d9fa8183 src/lib-sieve/sieve-validator.c --- a/src/lib-sieve/sieve-validator.c Mon May 09 20:56:08 2011 +0200 +++ b/src/lib-sieve/sieve-validator.c Tue May 10 21:36:47 2011 +0200 @@ -546,8 +546,8 @@ } ext = sieve_extension_get_by_name(valdtr->svinst, name); - - if ( ext == NULL || ext->def == NULL ) { + + if ( ext == NULL || ext->def == NULL || !ext->enabled ) { unsigned int i; bool core_test = FALSE; bool core_command = FALSE; @@ -576,7 +576,7 @@ } return NULL; } - + sieve_ast_extension_link(valdtr->ast, ext); extdef = ext->def; @@ -609,10 +609,10 @@ const struct sieve_extension_def *extdef; ext = sieve_extension_get_by_name(valdtr->svinst, ext_name); - + if ( ext == NULL || ext->def == NULL ) return NULL; - + sieve_ast_extension_link(valdtr->ast, ext); extdef = ext->def; From dovecot at dovecot.org Wed May 11 14:24:25 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 14:24:25 +0300 Subject: dovecot-2.0: example-config: Updated auth_gssapi_hostname comment. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/370bf3d2d54f changeset: 12790:370bf3d2d54f user: Timo Sirainen date: Wed May 11 14:24:18 2011 +0300 description: example-config: Updated auth_gssapi_hostname comment. diffstat: doc/example-config/conf.d/10-auth.conf | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 66ec075a49d3 -r 370bf3d2d54f doc/example-config/conf.d/10-auth.conf --- a/doc/example-config/conf.d/10-auth.conf Tue May 10 18:24:31 2011 +0300 +++ b/doc/example-config/conf.d/10-auth.conf Wed May 11 14:24:18 2011 +0300 @@ -65,7 +65,8 @@ #auth_worker_max_count = 30 # Host name to use in GSSAPI principal names. The default is to use the -# name returned by gethostname(). Use "$ALL" to allow all keytab entries. +# name returned by gethostname(). Use "$ALL" (with quotes) to allow all keytab +# entries. #auth_gssapi_hostname = # Kerberos keytab to use for the GSSAPI mechanism. Will use the system From dovecot at dovecot.org Wed May 11 14:35:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 14:35:24 +0300 Subject: dovecot-2.0: lda: Log destination address and its source with ma... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/8f605efb15ce changeset: 12791:8f605efb15ce user: Timo Sirainen date: Wed May 11 14:35:15 2011 +0300 description: lda: Log destination address and its source with mail_debug=yes diffstat: src/lda/main.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diffs (43 lines): diff -r 370bf3d2d54f -r 8f605efb15ce src/lda/main.c --- a/src/lda/main.c Wed May 11 14:24:18 2011 +0300 +++ b/src/lda/main.c Wed May 11 14:35:15 2011 +0300 @@ -221,7 +221,7 @@ struct istream *input; struct mailbox_transaction_context *t; struct mailbox_header_lookup_ctx *headers_ctx; - const char *user_source = ""; + const char *user_source = "", *destaddr_source = ""; void **sets; uid_t process_euid; bool stderr_rejection = FALSE; @@ -266,6 +266,7 @@ case 'a': /* original recipient address */ ctx.dest_addr = optarg; + destaddr_source = "-a parameter"; break; case 'd': /* destination user */ @@ -422,14 +423,22 @@ *ctx.set->lda_original_recipient_header != '\0') { ctx.dest_addr = mail_deliver_get_address(ctx.src_mail, ctx.set->lda_original_recipient_header); + destaddr_source = t_strconcat( + ctx.set->lda_original_recipient_header, " header", NULL); } if (ctx.dest_addr == NULL) { ctx.dest_addr = strchr(user, '@') != NULL ? user : t_strconcat(user, "@", ctx.set->hostname, NULL); + destaddr_source = "user at hostname"; } if (ctx.final_dest_addr == NULL) ctx.final_dest_addr = ctx.dest_addr; + if (ctx.dest_user->mail_debug) { + i_debug("Destination address: %s (source: %s)", + ctx.dest_addr, destaddr_source); + } + if (mail_deliver(&ctx, &storage) < 0) { if (storage == NULL) { /* This shouldn't happen */ From dovecot at dovecot.org Wed May 11 15:17:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:17:21 +0300 Subject: dovecot-2.0: message header parser: Fixed handling NUL character... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/cef76cf2cec9 changeset: 12792:cef76cf2cec9 user: Timo Sirainen date: Wed May 11 15:17:02 2011 +0300 description: message header parser: Fixed handling NUL characters in header names. line->name_len was too large and line->middle pointer may have pointed past allocated memory. These may have caused crashes/corruption (fts, mbox at least). diffstat: src/lib-mail/message-header-parser.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 8f605efb15ce -r cef76cf2cec9 src/lib-mail/message-header-parser.c --- a/src/lib-mail/message-header-parser.c Wed May 11 14:35:15 2011 +0300 +++ b/src/lib-mail/message-header-parser.c Wed May 11 15:17:02 2011 +0300 @@ -311,7 +311,9 @@ colon_pos--; str_truncate(ctx->name, 0); - str_append_n(ctx->name, msg, colon_pos); + /* use buffer_append() so the name won't be truncated if there + are NULs. */ + buffer_append(ctx->name, msg, colon_pos); str_append_c(ctx->name, '\0'); /* keep middle stored also in ctx->name so it's available From dovecot at dovecot.org Wed May 11 15:17:32 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:17:32 +0300 Subject: dovecot-1.2: message header parser: Fixed handling NUL character... Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/ede60b230594 changeset: 9643:ede60b230594 user: Timo Sirainen date: Wed May 11 15:17:02 2011 +0300 description: message header parser: Fixed handling NUL characters in header names. line->name_len was too large and line->middle pointer may have pointed past allocated memory. These may have caused crashes/corruption (fts, mbox at least). diffstat: src/lib-mail/message-header-parser.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r e7721f67688a -r ede60b230594 src/lib-mail/message-header-parser.c --- a/src/lib-mail/message-header-parser.c Sat Mar 12 16:05:57 2011 +0200 +++ b/src/lib-mail/message-header-parser.c Wed May 11 15:17:02 2011 +0300 @@ -311,7 +311,9 @@ colon_pos--; str_truncate(ctx->name, 0); - str_append_n(ctx->name, msg, colon_pos); + /* use buffer_append() so the name won't be truncated if there + are NULs. */ + buffer_append(ctx->name, msg, colon_pos); str_append_c(ctx->name, '\0'); /* keep middle stored also in ctx->name so it's available From dovecot at dovecot.org Wed May 11 15:17:40 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:17:40 +0300 Subject: dovecot-1.1: message header parser: Fixed handling NUL character... Message-ID: details: http://hg.dovecot.org/dovecot-1.1/rev/3698dfe0f21c changeset: 8371:3698dfe0f21c user: Timo Sirainen date: Wed May 11 15:17:02 2011 +0300 description: message header parser: Fixed handling NUL characters in header names. line->name_len was too large and line->middle pointer may have pointed past allocated memory. These may have caused crashes/corruption (fts, mbox at least). diffstat: src/lib-mail/message-header-parser.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diffs (14 lines): diff -r 9b17de31aac3 -r 3698dfe0f21c src/lib-mail/message-header-parser.c --- a/src/lib-mail/message-header-parser.c Fri Mar 04 19:28:31 2011 +0200 +++ b/src/lib-mail/message-header-parser.c Wed May 11 15:17:02 2011 +0300 @@ -310,7 +310,9 @@ colon_pos--; str_truncate(ctx->name, 0); - str_append_n(ctx->name, msg, colon_pos); + /* use buffer_append() so the name won't be truncated if there + are NULs. */ + buffer_append(ctx->name, msg, colon_pos); str_append_c(ctx->name, '\0'); /* keep middle stored also in ctx->name so it's available From dovecot at dovecot.org Wed May 11 15:20:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:20:24 +0300 Subject: dovecot-2.0: message [header] decoder: Output only valid UTF-8 d... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c392158f374d changeset: 12793:c392158f374d user: Timo Sirainen date: Wed May 11 15:19:34 2011 +0300 description: message [header] decoder: Output only valid UTF-8 data. diffstat: src/lib-mail/message-decoder.c | 6 +++++- src/lib-mail/message-header-decode.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diffs (35 lines): diff -r cef76cf2cec9 -r c392158f374d src/lib-mail/message-decoder.c --- a/src/lib-mail/message-decoder.c Wed May 11 15:17:02 2011 +0300 +++ b/src/lib-mail/message-decoder.c Wed May 11 15:19:34 2011 +0300 @@ -168,13 +168,17 @@ (void)uni_utf8_to_decomposed_titlecase(hdr->name, hdr->name_len, ctx->buf); buffer_append_c(ctx->buf, '\0'); + } else { + if (!uni_utf8_get_valid_data((const unsigned char *)hdr->name, + hdr->name_len, ctx->buf)) + buffer_append_c(ctx->buf, '\0'); } ctx->hdr = *hdr; ctx->hdr.full_value = ctx->buf->data; ctx->hdr.full_value_len = value_len; ctx->hdr.value_len = 0; - if (dtcase) { + if (ctx->buf->used != value_len) { ctx->hdr.name = CONST_PTR_OFFSET(ctx->buf->data, ctx->hdr.full_value_len); ctx->hdr.name_len = ctx->buf->used - 1 - value_len; diff -r cef76cf2cec9 -r c392158f374d src/lib-mail/message-header-decode.c --- a/src/lib-mail/message-header-decode.c Wed May 11 15:17:02 2011 +0300 +++ b/src/lib-mail/message-header-decode.c Wed May 11 15:19:34 2011 +0300 @@ -160,7 +160,8 @@ (void)uni_utf8_to_decomposed_titlecase(data, size, ctx->dest); } else { - buffer_append(ctx->dest, data, size); + if (uni_utf8_get_valid_data(data, size, ctx->dest)) + buffer_append(ctx->dest, data, size); } return TRUE; } From dovecot at dovecot.org Wed May 11 15:20:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:20:24 +0300 Subject: dovecot-2.0: fts: Added assert to make sure all header data is v... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5e5daccf1de3 changeset: 12794:5e5daccf1de3 user: Timo Sirainen date: Wed May 11 15:20:19 2011 +0300 description: fts: Added assert to make sure all header data is valid UTF-8. diffstat: src/plugins/fts/fts-storage.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (20 lines): diff -r c392158f374d -r 5e5daccf1de3 src/plugins/fts/fts-storage.c --- a/src/plugins/fts/fts-storage.c Wed May 11 15:19:34 2011 +0300 +++ b/src/plugins/fts/fts-storage.c Wed May 11 15:20:19 2011 +0300 @@ -4,6 +4,7 @@ #include "ioloop.h" #include "array.h" #include "str.h" +#include "unichar.h" #include "istream.h" #include "time-util.h" #include "rfc822-parser.h" @@ -79,6 +80,8 @@ if (str_len(ctx->headers) == 0) return 0; + i_assert(uni_utf8_data_is_valid(ctx->headers->data, ctx->headers->used)); + fts_backend_build_hdr(ctx->build, ctx->uid); if (fts_backend_build_more(ctx->build, str_data(ctx->headers), str_len(ctx->headers)) < 0) From dovecot at dovecot.org Wed May 11 15:35:31 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 15:35:31 +0300 Subject: dovecot-2.0: man: Updated doveconf. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/a6db801253c6 changeset: 12795:a6db801253c6 user: Timo Sirainen date: Wed May 11 15:35:20 2011 +0300 description: man: Updated doveconf. diffstat: doc/man/doveconf.1.in | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diffs (35 lines): diff -r 5e5daccf1de3 -r a6db801253c6 doc/man/doveconf.1.in --- a/doc/man/doveconf.1.in Wed May 11 15:20:19 2011 +0300 +++ b/doc/man/doveconf.1.in Wed May 11 15:35:20 2011 +0300 @@ -1,5 +1,5 @@ .\" Copyright (c) 2010 Dovecot authors, see the included COPYING file -.TH DOVECONF 1 "2010-06-26" "Dovecot v2.0" "Dovecot" +.TH DOVECONF 1 "2011-05-11" "Dovecot v2.0" "Dovecot" .SH NAME doveconf \- Dovecot\(aqs configuration dumping utility .\"------------------------------------------------------------------------ @@ -127,7 +127,9 @@ .I setting_name Show only the setting of one or more .IR setting_name (s) -with the currently configured value. +with the currently configured value. You can show a setting inside a +section using \(aq/\(aq as the section separator, e.g. +service/imap/executable. .\"------------------------------------------------------------------------ .SH EXAMPLE When Dovecot was configured to use different settings for some @@ -170,6 +172,13 @@ quota = pgsql:@pkgsysconfdir@/dovecot\-dict\-sql.conf.ext } .fi +.PP +Or how to dump only the quota dict: +.sp +.nf +.B doveconf dict/quota +dict/quota = pgsql:@pkgsysconfdir@/dovecot\-dict\-sql.conf.ext +.fi .\"------------------------------------------------------------------------ @INCLUDE:reporting-bugs@ .\"------------------------------------------------------------------------ From dovecot at dovecot.org Wed May 11 16:20:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 16:20:24 +0300 Subject: dovecot-2.0: director: Avoid potential problems by making sure u... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/dab7043e8263 changeset: 12796:dab7043e8263 user: Timo Sirainen date: Wed May 11 15:57:47 2011 +0300 description: director: Avoid potential problems by making sure users list is always sorted by timestamp. diffstat: src/director/user-directory.c | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diffs (37 lines): diff -r a6db801253c6 -r dab7043e8263 src/director/user-directory.c --- a/src/director/user-directory.c Wed May 11 15:35:20 2011 +0300 +++ b/src/director/user-directory.c Wed May 11 15:57:47 2011 +0300 @@ -68,14 +68,31 @@ user_directory_add(struct user_directory *dir, unsigned int username_hash, struct mail_host *host, time_t timestamp) { - struct user *user; + struct user *user, *pos; user = i_new(struct user, 1); user->username_hash = username_hash; user->host = host; user->host->user_count++; user->timestamp = timestamp; - DLLIST2_APPEND(&dir->head, &dir->tail, user); + + if (dir->tail == NULL || dir->tail->timestamp <= timestamp) + DLLIST2_APPEND(&dir->head, &dir->tail, user); + else { + /* need to insert to correct position */ + for (pos = dir->tail; pos != NULL; pos = pos->prev) { + if (pos->timestamp <= timestamp) + break; + } + if (pos == NULL) + DLLIST2_PREPEND(&dir->head, &dir->tail, user); + else { + user->prev = pos; + user->next = pos->next; + user->prev->next = user; + user->next->prev = user; + } + } hash_table_insert(dir->hash, POINTER_CAST(user->username_hash), user); return user; From dovecot at dovecot.org Wed May 11 16:20:24 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 16:20:24 +0300 Subject: dovecot-2.0: config: Updated obsolete protocol warning messages. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/7f88557102c3 changeset: 12797:7f88557102c3 user: Timo Sirainen date: Wed May 11 16:20:15 2011 +0300 description: config: Updated obsolete protocol warning messages. diffstat: src/config/old-set-parser.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diffs (27 lines): diff -r dab7043e8263 -r 7f88557102c3 src/config/old-set-parser.c --- a/src/config/old-set-parser.c Wed May 11 15:57:47 2011 +0300 +++ b/src/config/old-set-parser.c Wed May 11 16:20:15 2011 +0300 @@ -102,19 +102,19 @@ value = t_strarray_join((const char *const *)protos, " "); if (have_imaps && !have_imap) { - obsolete(ctx, "protocols=imaps is no longer supported. to disable non-ssl imap, use service imap-login { inet_listener imap { port=0 } }"); + obsolete(ctx, "'imaps' protocol is no longer supported. to disable non-ssl imap, use service imap-login { inet_listener imap { port=0 } }"); value = t_strconcat(value, " imap", NULL); config_apply_line(ctx, "port", "service/imap-login/inet_listener/imap/port=0", NULL); } else if (have_imaps) - obsolete(ctx, "protocols=imaps is no longer necessary, remove it"); + obsolete(ctx, "'imaps' protocol is no longer necessary, remove it"); if (have_pop3s && !have_pop3) { - obsolete(ctx, "protocols=pop3s is no longer supported. to disable non-ssl pop3, use service pop3-login { inet_listener pop3 { port=0 } }"); + obsolete(ctx, "'pop3s' protocol is no longer supported. to disable non-ssl pop3, use service pop3-login { inet_listener pop3 { port=0 } }"); value = t_strconcat(value, " pop3", NULL); config_apply_line(ctx, "port", "service/pop3-login/inet_listener/pop3/port=0", NULL); } else if (have_pop3s) - obsolete(ctx, "protocols=pop3s is no longer necessary, remove it"); + obsolete(ctx, "'pop3s' protocol is no longer necessary, remove it"); if (*value == ' ') value++; config_parser_apply_line(ctx, CONFIG_LINE_TYPE_KEYVALUE, From dovecot at dovecot.org Wed May 11 16:28:38 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 16:28:38 +0300 Subject: dovecot-2.0: example-config: Updated auth_krb5_keytab comment. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/b41ff254e1d6 changeset: 12798:b41ff254e1d6 user: Timo Sirainen date: Wed May 11 16:28:32 2011 +0300 description: example-config: Updated auth_krb5_keytab comment. diffstat: doc/example-config/conf.d/10-auth.conf | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (15 lines): diff -r 7f88557102c3 -r b41ff254e1d6 doc/example-config/conf.d/10-auth.conf --- a/doc/example-config/conf.d/10-auth.conf Wed May 11 16:20:15 2011 +0300 +++ b/doc/example-config/conf.d/10-auth.conf Wed May 11 16:28:32 2011 +0300 @@ -69,8 +69,9 @@ # entries. #auth_gssapi_hostname = -# Kerberos keytab to use for the GSSAPI mechanism. Will use the system -# default (usually /etc/krb5.keytab) if not specified. +# Kerberos keytab to use for the GSSAPI mechanism. Will use the system +# default (usually /etc/krb5.keytab) if not specified. You may need to change +# the auth service to run as root to be able to read this file. #auth_krb5_keytab = # Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and From dovecot at dovecot.org Wed May 11 17:00:14 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 17:00:14 +0300 Subject: dovecot-2.0: Compile fix for HP-UX Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/39389620ace4 changeset: 12799:39389620ace4 user: Timo Sirainen date: Wed May 11 16:58:07 2011 +0300 description: Compile fix for HP-UX diffstat: src/lib/compat.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r b41ff254e1d6 -r 39389620ace4 src/lib/compat.h --- a/src/lib/compat.h Wed May 11 16:28:32 2011 +0300 +++ b/src/lib/compat.h Wed May 11 16:58:07 2011 +0300 @@ -1,7 +1,7 @@ #ifndef COMPAT_H #define COMPAT_H -#if defined (HAVE_INTTYPES_H) && defined(__osf__) +#if defined (HAVE_INTTYPES_H) && (defined(__osf__) || defined(_HPUX_SOURCE)) # include #endif From dovecot at dovecot.org Wed May 11 17:00:14 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 17:00:14 +0300 Subject: dovecot-2.0: Increased highest signal number limit. HP-UX can us... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/a32debbe3496 changeset: 12800:a32debbe3496 user: Timo Sirainen date: Wed May 11 17:00:08 2011 +0300 description: Increased highest signal number limit. HP-UX can use at least 44. diffstat: src/lib/lib-signals.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 39389620ace4 -r a32debbe3496 src/lib/lib-signals.c --- a/src/lib/lib-signals.c Wed May 11 16:58:07 2011 +0300 +++ b/src/lib/lib-signals.c Wed May 11 17:00:08 2011 +0300 @@ -9,7 +9,7 @@ #include #include -#define MAX_SIGNAL_VALUE 31 +#define MAX_SIGNAL_VALUE 63 #define SIGNAL_IS_TERMINAL(signo) \ ((signo) == SIGINT || (signo) == SIGQUIT || (signo) == SIGTERM) From dovecot at dovecot.org Wed May 11 17:45:15 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 17:45:15 +0300 Subject: dovecot-2.0: man: Added doveadm director dump. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/a410f68c5fba changeset: 12801:a410f68c5fba user: Timo Sirainen date: Wed May 11 17:45:03 2011 +0300 description: man: Added doveadm director dump. diffstat: doc/man/doveadm-director.1.in | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diffs (41 lines): diff -r a32debbe3496 -r a410f68c5fba doc/man/doveadm-director.1.in --- a/doc/man/doveadm-director.1.in Wed May 11 17:00:08 2011 +0300 +++ b/doc/man/doveadm-director.1.in Wed May 11 17:45:03 2011 +0300 @@ -1,5 +1,5 @@ .\" Copyright (c) 2010 Dovecot authors, see the included COPYING file -.TH DOVEADM\-DIRECTOR 1 "2010-07-16" "Dovecot v2.0" "Dovecot" +.TH DOVEADM\-DIRECTOR 1 "2011-05-11" "Dovecot v2.0" "Dovecot" .SH NAME doveadm\-director \- Manage Dovecot directors .\"------------------------------------------------------------------------ @@ -25,6 +25,10 @@ .I host .\"------------------------------------- .br +.BR doveadm " [" \-Dv "] " "director dump" +[\fB\-a\fP \fIdirector_socket_path\fP] +.\"------------------------------------- +.br .BR doveadm " [" \-Dv "] " "director status" [\fB\-a\fP \fIdirector_socket_path\fP] .RI [ user ] @@ -138,10 +142,18 @@ [\fB\-a\fP \fIdirector_socket_path\fP] .I host .PP -Use this command in oder to remove the given +Use this command in order to remove the given .I host from the director. .\"------------------------------------- +.SS director dump +.B doveadm director dump +[\fB\-a\fP \fIdirector_socket_path\fP] +.PP +Dump the current host configuration as doveadm commands. These commands can +be easily run after a full director cluster restart to get back to the +dumped state. +.\"------------------------------------- .SS director status .B doveadm director status [\fB\-a\fP \fIdirector_socket_path\fP] From dovecot at dovecot.org Wed May 11 17:56:38 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 17:56:38 +0300 Subject: dovecot-2.0: man: Added doveadm index. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/822bd4936d46 changeset: 12802:822bd4936d46 user: Timo Sirainen date: Wed May 11 17:56:25 2011 +0300 description: man: Added doveadm index. diffstat: .hgignore | 2 +- doc/man/Makefile.am | 6 ++++ doc/man/doveadm-index.1.in | 57 ++++++++++++++++++++++++++++++++++++++++++++++ doc/man/doveadm.1.in | 7 ++++- 4 files changed, 70 insertions(+), 2 deletions(-) diffs (124 lines): diff -r a410f68c5fba -r 822bd4936d46 .hgignore --- a/.hgignore Wed May 11 17:45:03 2011 +0300 +++ b/.hgignore Wed May 11 17:56:25 2011 +0300 @@ -94,5 +94,5 @@ syntax: regexp src/.*/test-[^\.]*$ -doc/man/doveadm-(altmove|auth|director|dump|expunge|fetch|import|force-resync|help|kick|log|mailbox|penalty|purge|pw|quota|search|user|who)\.1$ +doc/man/doveadm-(altmove|auth|director|dump|expunge|fetch|import|index|force-resync|help|kick|log|mailbox|penalty|purge|pw|quota|search|user|who)\.1$ doc/man/(doveadm|doveconf|dovecot-lda|dovecot|dsync)\.1$ diff -r a410f68c5fba -r 822bd4936d46 doc/man/Makefile.am --- a/doc/man/Makefile.am Wed May 11 17:45:03 2011 +0300 +++ b/doc/man/Makefile.am Wed May 11 17:56:25 2011 +0300 @@ -18,6 +18,7 @@ doveadm-expunge.1 \ doveadm-fetch.1 \ doveadm-import.1 \ + doveadm-index.1 \ doveadm-force-resync.1 \ doveadm-help.1 \ doveadm-kick.1 \ @@ -52,6 +53,7 @@ doveadm-expunge.1.in \ doveadm-fetch.1.in \ doveadm-import.1.in \ + doveadm-index.1.in \ doveadm-force-resync.1.in \ doveadm-help.1.in \ doveadm-kick.1.in \ @@ -105,6 +107,10 @@ $(SHELL) $(srcdir)/sed.sh $(srcdir) $(rundir) $(pkgsysconfdir) \ < $(srcdir)/doveadm-import.1.in > doveadm-import.1 +doveadm-index.1: $(srcdir)/doveadm-index.1.in $(man_includefiles) Makefile + $(SHELL) $(srcdir)/sed.sh $(srcdir) $(rundir) $(pkgsysconfdir) \ + < $(srcdir)/doveadm-index.1.in > doveadm-index.1 + doveadm-force-resync.1: $(srcdir)/doveadm-force-resync.1.in $(man_includefiles) Makefile $(SHELL) $(srcdir)/sed.sh $(srcdir) $(rundir) $(pkgsysconfdir) \ < $(srcdir)/doveadm-force-resync.1.in > doveadm-force-resync.1 diff -r a410f68c5fba -r 822bd4936d46 doc/man/doveadm-index.1.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/man/doveadm-index.1.in Wed May 11 17:56:25 2011 +0300 @@ -0,0 +1,57 @@ +.\" Copyright (c) 2010 Dovecot authors, see the included COPYING file +.TH DOVEADM\-IMPORT 1 "2011-05-11" "Dovecot v2.0" "Dovecot" +.SH NAME +doveadm\-index \- Index mailboxes +.\"------------------------------------------------------------------------ +.SH SYNOPSIS +.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.IR socket_path "] " mailbox +.\"------------------------------------- +.br +.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.IR socket_path "] " +.BI \-A \ mailbox +.\"------------------------------------- +.br +.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.IR socket_path "] " +.BI \-u " user mailbox" +.\"------------------------------------------------------------------------ +.SH DESCRIPTION +Add unindexed messages in a mailbox into index/cache file. If full text +search is enabled, also add unindexed messages to the fts database. +.PP +The caching adds only the fields that were previously added to the +mailbox\(aqs caching decisions, so it won\(aqt do anything useful for +mailboxes that user\(aqs client hasn\(aqt accessed yet. You can use +.B doveadm dump +command to show a specific mailbox\(aqs current caching decisions. +.\"------------------------------------------------------------------------ + at INCLUDE:global-options@ +.\" --- command specific options --- "/. +.PP +Command specific +.IR options : +.\"------------------------------------- + at INCLUDE:option-A@ +.\"------------------------------------- + at INCLUDE:option-S-socket@ +.\"------------------------------------- + at INCLUDE:option-u-user@ +.\"------------------------------------------------------------------------ +.SH ARGUMENTS +.TP +.I mailbox +The name of the mailbox to index. +.\"------------------------------------------------------------------------ +.SH EXAMPLE +Index bob\(aqs INBOX: +.PP +.nf +.B doveadm index \-u bob INBOX +.fi +.\"------------------------------------------------------------------------ + at INCLUDE:reporting-bugs@ +.\"------------------------------------------------------------------------ +.SH SEE ALSO +.BR doveadm (1) \ No newline at end of file diff -r a410f68c5fba -r 822bd4936d46 doc/man/doveadm.1.in --- a/doc/man/doveadm.1.in Wed May 11 17:45:03 2011 +0300 +++ b/doc/man/doveadm.1.in Wed May 11 17:56:25 2011 +0300 @@ -1,5 +1,5 @@ .\" Copyright (c) 2010 Dovecot authors, see the included COPYING file -.TH DOVEADM 1 "2010-11-25" "Dovecot v2.0" "Dovecot" +.TH DOVEADM 1 "2011-05-11" "Dovecot v2.0" "Dovecot" .SH NAME doveadm \- Dovecot\(aqs administration utility .\"------------------------------------------------------------------------ @@ -112,6 +112,11 @@ Import messages matching given search query. .\"------------------------------------- .TP +.B doveadm index +.BR doveadm\-index (1), +Index messages in a given mailbox. +.\"------------------------------------- +.TP .B doveadm mailbox .BR doveadm\-mailbox (1), Various commands related to handling mailboxes. From dovecot at dovecot.org Wed May 11 18:54:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 18:54:21 +0300 Subject: dovecot-2.0: Released v2.0.13. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/aa8dfa085a99 changeset: 12803:aa8dfa085a99 user: Timo Sirainen date: Wed May 11 17:59:56 2011 +0300 description: Released v2.0.13. diffstat: NEWS | 19 +++++++++++++++++++ configure.in | 2 +- 2 files changed, 20 insertions(+), 1 deletions(-) diffs (36 lines): diff -r 822bd4936d46 -r aa8dfa085a99 NEWS --- a/NEWS Wed May 11 17:56:25 2011 +0300 +++ b/NEWS Wed May 11 17:59:56 2011 +0300 @@ -1,3 +1,22 @@ +v2.0.13 2011-05-11 Timo Sirainen + + + Added "doveadm index" command to add unindexed messages into + index/cache. If full text search is enabled, it also adds unindexed + messages to the fts database. + + added "doveadm director dump" command. + + pop3: Added support for showing messages in "POP3 order", which can + be different from IMAP message order. This can be useful for + migrations from other servers. Implemented it for Maildir as 'O' + field in dovecot-uidlist. + - doveconf: Fixed a wrong "subsection has ssl=yes" warning. + - mdbox purge: Fixed wrong warning about corrupted extrefs. + - sdbox: INBOX GUID changed when INBOX was autocreated, leading to + trouble with dsync. + - script-login binary wasn't actually dropping privileges to the + user/group/chroot specified by its service settings. + - Fixed potential crashes and other problems when parsing header names + that contained NUL characters. + v2.0.12 2011-04-12 Timo Sirainen + doveadm: Added "move" command for moving mails between mailboxes. diff -r 822bd4936d46 -r aa8dfa085a99 configure.in --- a/configure.in Wed May 11 17:56:25 2011 +0300 +++ b/configure.in Wed May 11 17:59:56 2011 +0300 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.0.12],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[2.0.13],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Wed May 11 18:54:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 18:54:21 +0300 Subject: dovecot-2.0: Added tag 2.0.13 for changeset aa8dfa085a99 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/5a9adcae1a0e changeset: 12804:5a9adcae1a0e user: Timo Sirainen date: Wed May 11 17:59:56 2011 +0300 description: Added tag 2.0.13 for changeset aa8dfa085a99 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r aa8dfa085a99 -r 5a9adcae1a0e .hgtags --- a/.hgtags Wed May 11 17:59:56 2011 +0300 +++ b/.hgtags Wed May 11 17:59:56 2011 +0300 @@ -63,3 +63,4 @@ 755c63ff089f434d18801d1864e5ce98d60f5ca9 2.0.10 3355b4bbd4acf5eb004cacbaa3bcc873ad818b80 2.0.11 606faab2b896295b7dae7941b47e9374dbf90a66 2.0.12 +aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 2.0.13 From dovecot at dovecot.org Wed May 11 18:54:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 18:54:21 +0300 Subject: dovecot-2.0: Added signature for changeset aa8dfa085a99 Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/72c2784fcbc9 changeset: 12805:72c2784fcbc9 user: Timo Sirainen date: Wed May 11 17:59:59 2011 +0300 description: Added signature for changeset aa8dfa085a99 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 5a9adcae1a0e -r 72c2784fcbc9 .hgsigs --- a/.hgsigs Wed May 11 17:59:56 2011 +0300 +++ b/.hgsigs Wed May 11 17:59:59 2011 +0300 @@ -26,3 +26,4 @@ 755c63ff089f434d18801d1864e5ce98d60f5ca9 0 iEYEABECAAYFAk1xNpAACgkQyUhSUUBVisn4HgCggcSxHEZGjRlCJQubqYquZMrnYckAoIKy+zTG+JMEez2pAtZdKse3uCjQ 3355b4bbd4acf5eb004cacbaa3bcc873ad818b80 0 iEYEABECAAYFAk10DCoACgkQyUhSUUBVislFAwCfUyZb1gwaGuSweAs1eUwIpIAAWTkAn2M2MDMIjmZduTZgcmbQPlWScNGP 606faab2b896295b7dae7941b47e9374dbf90a66 0 iEYEABECAAYFAk2kh3YACgkQyUhSUUBViskrNgCfdmuKZ1/9HDFOvBuBnTCw6lUuiaEAn207VAo55MOIb1RwAQgaP8wNC7YS +aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 0 iEYEABECAAYFAk3KpGwACgkQyUhSUUBVismbmQCfTKfNrQnIy2cIQCYUE7zFrRl6nvgAnAu5W0iAfzKwFEAGtnGj1h+D+tY0 From dovecot at dovecot.org Wed May 11 18:55:10 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Wed, 11 May 2011 18:55:10 +0300 Subject: dovecot-2.0: doveadm: Code correctness fix. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/b72d72ae9bd6 changeset: 12806:b72d72ae9bd6 user: Timo Sirainen date: Wed May 11 18:49:44 2011 +0300 description: doveadm: Code correctness fix. diffstat: src/doveadm/doveadm-mail-index.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (15 lines): diff -r 72c2784fcbc9 -r b72d72ae9bd6 src/doveadm/doveadm-mail-index.c --- a/src/doveadm/doveadm-mail-index.c Wed May 11 17:59:59 2011 +0300 +++ b/src/doveadm/doveadm-mail-index.c Wed May 11 18:49:44 2011 +0300 @@ -152,9 +152,9 @@ } mail_free(&mail); - if (mailbox_search_deinit(&ctx) < 0) + ret = mailbox_search_deinit(&ctx); + if (mailbox_transaction_commit(&t) < 0) ret = -1; - (void)mailbox_transaction_commit(&t); return ret; } From pigeonhole at rename-it.nl Wed May 11 20:26:58 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Wed, 11 May 2011 19:26:58 +0200 Subject: dovecot-2.0-pigeonhole: Sieve Storage: improved handling of unco... Message-ID: details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/560057691dac changeset: 1499:560057691dac user: Stephan Bosch date: Wed May 11 19:26:57 2011 +0200 description: Sieve Storage: improved handling of unconfigured user home directory. diffstat: src/lib-sievestorage/sieve-storage.c | 87 ++++++++++++++++++---------- src/managesieve/managesieve-client.c | 2 +- 2 files changed, 56 insertions(+), 33 deletions(-) diffs (182 lines): diff -r cc25d9fa8183 -r 560057691dac src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Tue May 10 21:36:47 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Wed May 11 19:26:57 2011 +0200 @@ -177,7 +177,7 @@ { pool_t pool; struct sieve_storage *storage; - const char *tmp_dir, *link_path; + const char *tmp_dir, *link_path, *path; const char *sieve_data, *active_path, *active_fname, *storage_dir; mode_t dir_create_mode, file_create_mode; gid_t file_create_gid; @@ -185,15 +185,11 @@ unsigned long long int uint_setting; size_t size_setting; - /* - * Read settings + /* + * Configure active script path */ active_path = sieve_setting_get(svinst, "sieve"); - sieve_data = sieve_setting_get(svinst, "sieve_dir"); - - if ( sieve_data == NULL ) - sieve_data = sieve_setting_get(svinst, "sieve_storage"); /* Get path to active Sieve script */ @@ -201,21 +197,29 @@ if ( *active_path == '\0' ) { /* disabled */ if ( debug ) - i_debug("sieve-storage: sieve is disabled (sieve = \"\")"); + i_debug("sieve-storage: sieve is disabled (sieve=\"\")"); return NULL; } } else { - - if ( home == NULL ) { - /* we must have a home directory */ - i_error("sieve-storage: userdb(%s) didn't return a home directory or " - "sieve script location", user); - return NULL; + if ( debug ) { + i_debug("sieve-storage: sieve active script path is unconfigured; " + "using default (sieve=%s)", SIEVE_DEFAULT_PATH); } active_path = SIEVE_DEFAULT_PATH; } + /* Substitute home dir if necessary */ + + path = home_expand_tilde(active_path, home); + if ( path == NULL ) { + i_error("sieve-storage: userdb(%s) didn't return a home directory " + "for substitition in active script path (sieve=%s)", user, active_path); + return NULL; + } + + active_path = path; + /* Get the filename for the active script link */ active_fname = strrchr(active_path, '/'); @@ -233,10 +237,21 @@ return NULL; } - /* Find out where to put the script storage */ + /* + * Configure script storage directory + */ storage_dir = NULL; + /* Read setting */ + + sieve_data = sieve_setting_get(svinst, "sieve_dir"); + + if ( sieve_data == NULL ) + sieve_data = sieve_setting_get(svinst, "sieve_storage"); + + /* Determine location */ + if ( sieve_data == NULL || *sieve_data == '\0' ) { /* We'll need to figure out the storage location ourself. * @@ -250,7 +265,7 @@ i_debug("sieve-storage: root exists (%s)", home); } - storage_dir = home_expand_tilde("~/sieve", home); + storage_dir = t_strconcat(home, "/sieve", NULL); } else { /* Don't have required access on the home directory */ @@ -262,26 +277,34 @@ } else { if ( debug ) i_debug("sieve-storage: HOME not set"); - } - if (access("/sieve", R_OK|W_OK|X_OK) == 0) { - storage_dir = "/sieve"; - if ( debug ) - i_debug("sieve-storage: /sieve exists, assuming chroot"); + if (access("/sieve", R_OK|W_OK|X_OK) == 0) { + storage_dir = "/sieve"; + if ( debug ) + i_debug("sieve-storage: /sieve exists, assuming chroot"); + } } } else { storage_dir = sieve_data; } if (storage_dir == NULL || *storage_dir == '\0') { - if ( debug ) - i_debug("sieve-storage: couldn't find storage dir"); + i_error("sieve-storage: couldn't find storage root directory; " + "sieve_dir was left unconfigured and autodetection failed"); return NULL; } - /* Expand home directories in path */ - active_path = home_expand_tilde(active_path, home); - storage_dir = home_expand_tilde(storage_dir, home); + /* Expand home directory in path */ + + path = home_expand_tilde(storage_dir, home); + if ( path == NULL ) { + i_error("sieve-storage: userdb(%s) didn't return a home directory " + "for substitition in storage root directory (sieve_dir=%s)", + user, storage_dir); + return NULL; + } + + storage_dir = path; if ( debug ) { i_debug("sieve-storage: " @@ -300,19 +323,19 @@ * Ensure sieve local directory structure exists (full autocreate): * This currently currently only consists of a ./tmp direcory */ - - tmp_dir = t_strconcat(storage_dir, "/tmp", NULL); + + tmp_dir = t_strconcat(storage_dir, "/tmp", NULL); /*ret = maildir_check_tmp(box->storage, box->path); if (ret < 0) return -1;*/ - if ( mkdir_verify(tmp_dir, dir_create_mode, file_create_gid, + if ( mkdir_verify(tmp_dir, dir_create_mode, file_create_gid, file_create_gid_origin, debug) < 0 ) return NULL; - - /* - * Create storage object + + /* + * Create storage object */ pool = pool_alloconly_create("sieve-storage", 512+256); diff -r cc25d9fa8183 -r 560057691dac src/managesieve/managesieve-client.c --- a/src/managesieve/managesieve-client.c Tue May 10 21:36:47 2011 +0200 +++ b/src/managesieve/managesieve-client.c Wed May 11 19:26:57 2011 +0200 @@ -84,7 +84,7 @@ const char *home; if ( mail_user_get_home(user, &home) <= 0 ) - home = NULL; + home = NULL; storage = sieve_storage_create (svinst, user->username, home, set->mail_debug); From dovecot at dovecot.org Thu May 12 00:49:26 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Thu, 12 May 2011 00:49:26 +0300 Subject: dovecot-2.0: man: Corrected cmd name in doveadm-index.1. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/e76a3313a46c changeset: 12807:e76a3313a46c user: Pascal Volk date: Wed May 11 21:46:56 2011 +0000 description: man: Corrected cmd name in doveadm-index.1. diffstat: doc/man/doveadm-index.1.in | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (28 lines): diff -r b72d72ae9bd6 -r e76a3313a46c doc/man/doveadm-index.1.in --- a/doc/man/doveadm-index.1.in Wed May 11 18:49:44 2011 +0300 +++ b/doc/man/doveadm-index.1.in Wed May 11 21:46:56 2011 +0000 @@ -1,19 +1,19 @@ -.\" Copyright (c) 2010 Dovecot authors, see the included COPYING file -.TH DOVEADM\-IMPORT 1 "2011-05-11" "Dovecot v2.0" "Dovecot" +.\" Copyright (c) 2010-2011 Dovecot authors, see the included COPYING file +.TH DOVEADM\-INDEX 1 "2011-05-11" "Dovecot v2.0" "Dovecot" .SH NAME doveadm\-index \- Index mailboxes .\"------------------------------------------------------------------------ .SH SYNOPSIS -.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.BR doveadm " [" \-Dv "] " index " [" \-S .IR socket_path "] " mailbox .\"------------------------------------- .br -.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.BR doveadm " [" \-Dv "] " index " [" \-S .IR socket_path "] " .BI \-A \ mailbox .\"------------------------------------- .br -.BR doveadm " [" \-Dv "] " force\-resync " [" \-S +.BR doveadm " [" \-Dv "] " index " [" \-S .IR socket_path "] " .BI \-u " user mailbox" .\"------------------------------------------------------------------------ From dovecot at dovecot.org Mon May 16 15:53:28 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 16 May 2011 15:53:28 +0300 Subject: dovecot-2.0: Compiler warning fix on 32bit systems. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d9d5759196ee changeset: 12808:d9d5759196ee user: Timo Sirainen date: Mon May 16 15:53:13 2011 +0300 description: Compiler warning fix on 32bit systems. Patch by Mike Abbott / Apple diffstat: src/director/user-directory.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (18 lines): diff -r e76a3313a46c -r d9d5759196ee src/director/user-directory.c --- a/src/director/user-directory.c Wed May 11 21:46:56 2011 +0000 +++ b/src/director/user-directory.c Mon May 16 15:53:13 2011 +0300 @@ -76,12 +76,12 @@ user->host->user_count++; user->timestamp = timestamp; - if (dir->tail == NULL || dir->tail->timestamp <= timestamp) + if (dir->tail == NULL || (time_t)dir->tail->timestamp <= timestamp) DLLIST2_APPEND(&dir->head, &dir->tail, user); else { /* need to insert to correct position */ for (pos = dir->tail; pos != NULL; pos = pos->prev) { - if (pos->timestamp <= timestamp) + if ((time_t)pos->timestamp <= timestamp) break; } if (pos == NULL) From dovecot at dovecot.org Mon May 16 17:03:04 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 16 May 2011 17:03:04 +0300 Subject: dovecot-2.0: imap: If client disconnects in APPEND, log more abo... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/53fed82f8013 changeset: 12809:53fed82f8013 user: Timo Sirainen date: Mon May 16 17:02:56 2011 +0300 description: imap: If client disconnects in APPEND, log more about what it did before that. diffstat: src/imap/cmd-append.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diffs (60 lines): diff -r d9d5759196ee -r 53fed82f8013 src/imap/cmd-append.c --- a/src/imap/cmd-append.c Mon May 16 15:53:13 2011 +0300 +++ b/src/imap/cmd-append.c Mon May 16 17:02:56 2011 +0300 @@ -24,6 +24,7 @@ struct mail_storage *storage; struct mailbox *box; struct mailbox_transaction_context *t; + time_t started; struct istream *input; uoff_t msg_size; @@ -40,10 +41,26 @@ static bool cmd_append_continue_message(struct client_command_context *cmd); static bool cmd_append_continue_parsing(struct client_command_context *cmd); +static const char *get_disconnect_reason(struct cmd_append_context *ctx) +{ + string_t *str = t_str_new(128); + unsigned int secs = ioloop_time - ctx->started; + + str_printfa(str, "Disconnected in APPEND (%u msgs, %u secs", + ctx->count, secs); + if (ctx->input != NULL) { + str_printfa(str, ", %"PRIuUOFF_T"/%"PRIuUOFF_T" bytes", + ctx->input->v_offset, ctx->msg_size); + } + str_append_c(str, ')'); + return str_c(str); +} + static void client_input_append(struct client_command_context *cmd) { struct cmd_append_context *ctx = cmd->context; struct client *client = cmd->client; + const char *reason; bool finished; i_assert(!client->destroyed); @@ -54,11 +71,12 @@ switch (i_stream_read(client->input)) { case -1: /* disconnected */ + reason = get_disconnect_reason(ctx); cmd_append_finish(cmd->context); /* Reset command so that client_destroy() doesn't try to call cmd_append_continue_message() anymore. */ client_command_free(&cmd); - client_destroy(client, "Disconnected in APPEND"); + client_destroy(client, reason); return; case -2: if (ctx->message_input) { @@ -510,6 +528,7 @@ ctx->cmd = cmd; ctx->client = client; ctx->box = get_mailbox(cmd, mailbox); + ctx->started = ioloop_time; if (ctx->box == NULL) ctx->failed = TRUE; else { From dovecot at dovecot.org Mon May 16 17:34:58 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 16 May 2011 17:34:58 +0300 Subject: dovecot-2.0: pop3: Add [IN-USE] to all login -ERR replies. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/f786d95dc5c0 changeset: 12810:f786d95dc5c0 user: Timo Sirainen date: Mon May 16 17:29:40 2011 +0300 description: pop3: Add [IN-USE] to all login -ERR replies. diffstat: src/pop3/pop3-client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 53fed82f8013 -r f786d95dc5c0 src/pop3/pop3-client.c --- a/src/pop3/pop3-client.c Mon May 16 17:02:56 2011 +0300 +++ b/src/pop3/pop3-client.c Mon May 16 17:29:40 2011 +0300 @@ -319,7 +319,7 @@ inbox = "INBOX"; ns = mail_namespace_find(user->namespaces, &inbox); if (ns == NULL) { - client_send_line(client, "-ERR No INBOX namespace for user."); + client_send_line(client, "-ERR [IN-USE] No INBOX namespace for user."); client_destroy(client, "No INBOX namespace for user."); return NULL; } From dovecot at dovecot.org Mon May 16 17:34:58 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 16 May 2011 17:34:58 +0300 Subject: dovecot-2.0: pop3: If mail storage couldn't be initialized, send... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/ac006833cd66 changeset: 12811:ac006833cd66 user: Timo Sirainen date: Mon May 16 17:34:42 2011 +0300 description: pop3: If mail storage couldn't be initialized, send -ERR to client before disconnecting. diffstat: src/pop3/main.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diffs (31 lines): diff -r f786d95dc5c0 -r ac006833cd66 src/pop3/main.c --- a/src/pop3/main.c Mon May 16 17:29:40 2011 +0300 +++ b/src/pop3/main.c Mon May 16 17:34:42 2011 +0300 @@ -14,6 +14,7 @@ #include "master-login.h" #include "master-interface.h" #include "var-expand.h" +#include "mail-error.h" #include "mail-user.h" #include "mail-storage-service.h" @@ -88,14 +89,18 @@ int fd_in, int fd_out, const buffer_t *input_buf, const char **error_r) { + const char *lookup_error_str = + "-ERR [IN-USE] "MAIL_ERRSTR_CRITICAL_MSG"\r\n"; struct mail_storage_service_user *user; struct mail_user *mail_user; struct client *client; const struct pop3_settings *set; if (mail_storage_service_lookup_next(storage_service, input, - &user, &mail_user, error_r) <= 0) + &user, &mail_user, error_r) <= 0) { + (void)write(fd_out, lookup_error_str, strlen(lookup_error_str)); return -1; + } restrict_access_allow_coredumps(TRUE); set = mail_storage_service_user_get_set(user)[1]; From dovecot at dovecot.org Tue May 17 13:13:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 May 2011 13:13:45 +0300 Subject: dovecot-1.2: autogen.sh updated to use wiki1-export.tar.gz Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/d8220ad46879 changeset: 9644:d8220ad46879 user: Timo Sirainen date: Wed May 11 18:03:31 2011 +0300 description: autogen.sh updated to use wiki1-export.tar.gz diffstat: autogen.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diffs (18 lines): diff -r ede60b230594 -r d8220ad46879 autogen.sh --- a/autogen.sh Wed May 11 15:17:02 2011 +0300 +++ b/autogen.sh Wed May 11 18:03:31 2011 +0300 @@ -18,10 +18,10 @@ if test ! -f doc/wiki/Authentication.txt; then cd doc - wget http://www.dovecot.org/tmp/wiki-export.tar.gz - tar xzf wiki-export.tar.gz - mv wiki-export/*.txt wiki/ - rm -rf wiki-export wiki-export.tar.gz + wget http://www.dovecot.org/tmp/wiki1-export.tar.gz + tar xzf wiki1-export.tar.gz + mv wiki1-export/*.txt wiki/ + rm -rf wiki1-export wiki1-export.tar.gz cd .. fi From dovecot at dovecot.org Tue May 17 13:13:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 May 2011 13:13:45 +0300 Subject: dovecot-1.2: Released v1.2.17. Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/2bc5e52dc51f changeset: 9645:2bc5e52dc51f user: Timo Sirainen date: Wed May 11 18:05:31 2011 +0300 description: Released v1.2.17. diffstat: NEWS | 8 ++++++++ configure.in | 2 +- 2 files changed, 9 insertions(+), 1 deletions(-) diffs (25 lines): diff -r d8220ad46879 -r 2bc5e52dc51f NEWS --- a/NEWS Wed May 11 18:03:31 2011 +0300 +++ b/NEWS Wed May 11 18:05:31 2011 +0300 @@ -1,3 +1,11 @@ +v1.2.17 2011-05-11 Timo Sirainen + + - Fixed potential crashes and other problems when parsing header names + that contained NUL characters. + - IMAP: Fixed a memory leak with ESEARCH command handling + - Quota warnings could have been executed at incorrect times with + some configs. + v1.2.16 2010-11-08 Timo Sirainen - imap: Fixed SELECT QRESYNC not to crash on mailbox close if a lot diff -r d8220ad46879 -r 2bc5e52dc51f configure.in --- a/configure.in Wed May 11 18:03:31 2011 +0300 +++ b/configure.in Wed May 11 18:05:31 2011 +0300 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[1.2.16],[dovecot at dovecot.org]) +AC_INIT([Dovecot],[1.2.17],[dovecot at dovecot.org]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) From dovecot at dovecot.org Tue May 17 13:13:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 May 2011 13:13:45 +0300 Subject: dovecot-1.2: Added tag 1.2.17 for changeset 2bc5e52dc51f Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/4dbc00c69556 changeset: 9646:4dbc00c69556 user: Timo Sirainen date: Wed May 11 18:05:31 2011 +0300 description: Added tag 1.2.17 for changeset 2bc5e52dc51f diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 2bc5e52dc51f -r 4dbc00c69556 .hgtags --- a/.hgtags Wed May 11 18:05:31 2011 +0300 +++ b/.hgtags Wed May 11 18:05:31 2011 +0300 @@ -59,3 +59,4 @@ eb04e2b13e3d929c4947ca6160962f362cd4a903 1.2.14 d0500786b046ead559f86f21c3779dc38401ace3 1.2.15 bc2972a8326565641e75d082d97e7697cb9b278f 1.2.16 +2bc5e52dc51f211ae6fd3b600916a69cc9e0475d 1.2.17 From dovecot at dovecot.org Tue May 17 13:13:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 May 2011 13:13:45 +0300 Subject: dovecot-1.2: Added signature for changeset 2bc5e52dc51f Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/f216b798c7cb changeset: 9647:f216b798c7cb user: Timo Sirainen date: Wed May 11 18:05:34 2011 +0300 description: Added signature for changeset 2bc5e52dc51f diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 4dbc00c69556 -r f216b798c7cb .hgsigs --- a/.hgsigs Wed May 11 18:05:31 2011 +0300 +++ b/.hgsigs Wed May 11 18:05:34 2011 +0300 @@ -9,3 +9,4 @@ eb04e2b13e3d929c4947ca6160962f362cd4a903 0 iEYEABECAAYFAkxz/QUACgkQyUhSUUBVislmYwCgoCkqKTPh0fPFGi6isysm06RvVW0AnA270kBN12Ge/BrJLGWcEzqhUEY1 d0500786b046ead559f86f21c3779dc38401ace3 0 iEYEABECAAYFAkymTiYACgkQyUhSUUBVismg4QCcDKWkGAk4l5FzgcLYA7pGFA/a/YsAn33YJgREt6Pgl6nzIwg9ifiTf53r bc2972a8326565641e75d082d97e7697cb9b278f 0 iEYEABECAAYFAkzYUukACgkQyUhSUUBVismnFACfacowuw+C8gaWsR4jeJ/iSJTC9oYAoIWDcjwyVfwdUbfKssMTYBj2jyur +2bc5e52dc51f211ae6fd3b600916a69cc9e0475d 0 iEYEABECAAYFAk3KpbsACgkQyUhSUUBViskf0ACfaCOmNlpk2xX/NeZ2JdctY6XPIWAAnipkrRJJjfwLpfQFzmQ4cPuf7qrr From dovecot at dovecot.org Tue May 17 13:13:45 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 17 May 2011 13:13:45 +0300 Subject: dovecot-1.2: IMAP: Fixed ID command to log the parameters properly. Message-ID: details: http://hg.dovecot.org/dovecot-1.2/rev/32fe996d3c99 changeset: 9648:32fe996d3c99 user: Timo Sirainen date: Wed Mar 09 20:22:52 2011 +0200 description: IMAP: Fixed ID command to log the parameters properly. Patch by Mike Abbott / Apple. diffstat: src/lib-imap/imap-id.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r f216b798c7cb -r 32fe996d3c99 src/lib-imap/imap-id.c --- a/src/lib-imap/imap-id.c Wed May 11 18:05:34 2011 +0300 +++ b/src/lib-imap/imap-id.c Wed Mar 09 20:22:52 2011 +0200 @@ -169,6 +169,7 @@ str_append_c(reply, '='); str_append(reply, str_sanitize(value, 80)); } + args++; } return str_len(reply) == 0 ? NULL : str_c(reply); } From pigeonhole at rename-it.nl Thu May 19 22:44:38 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 21:44:38 +0200 Subject: dovecot-1.2-sieve: Fixed various compile warnings related to spu... Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/8c2f2391c617 changeset: 1286:8c2f2391c617 user: Stephan Bosch date: Thu May 19 21:36:29 2011 +0200 description: Fixed various compile warnings related to spurious semicolons and inappropriate variable initialization. diffstat: src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 2 +- src/lib-sieve/sieve-result.c | 2 +- src/testsuite/cmd-test-message.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diffs (45 lines): diff -r 5a76887c616c -r 8c2f2391c617 src/lib-sieve/plugins/mailbox/tag-mailbox-create.c --- a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c Wed Jan 19 17:37:43 2011 +0100 +++ b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c Thu May 19 21:36:29 2011 +0200 @@ -43,7 +43,7 @@ static bool seff_mailbox_create_pre_execute (const struct sieve_side_effect *seffect, const struct sieve_action *action, const struct sieve_action_exec_env *aenv, void **se_context, - void *tr_context);; + void *tr_context); const struct sieve_side_effect_def mailbox_create_side_effect = { SIEVE_OBJECT("create", &mailbox_create_operand, 0), diff -r 5a76887c616c -r 8c2f2391c617 src/lib-sieve/sieve-result.c --- a/src/lib-sieve/sieve-result.c Wed Jan 19 17:37:43 2011 +0100 +++ b/src/lib-sieve/sieve-result.c Thu May 19 21:36:29 2011 +0200 @@ -1302,7 +1302,7 @@ list->last_effect = NULL; return list; -}; +} void sieve_side_effects_list_add (struct sieve_side_effects_list *list, const struct sieve_side_effect *seffect) diff -r 5a76887c616c -r 8c2f2391c617 src/testsuite/cmd-test-message.c --- a/src/testsuite/cmd-test-message.c Wed Jan 19 17:37:43 2011 +0100 +++ b/src/testsuite/cmd-test-message.c Thu May 19 21:36:29 2011 +0200 @@ -299,7 +299,7 @@ (const struct sieve_runtime_env *renv, sieve_size_t *address) { sieve_number_t msg_index; - unsigned int is_test = -1; + unsigned int is_test = 0; bool result; /* @@ -345,7 +345,7 @@ { string_t *folder; sieve_number_t msg_index; - unsigned int is_test = -1; + unsigned int is_test = 0; bool result; /* From pigeonhole at rename-it.nl Thu May 19 22:45:43 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 21:45:43 +0200 Subject: dovecot-1.2-managesieve: managsieve-login: Reduced the max. numb... Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/8efc4a8e4a19 changeset: 219:8efc4a8e4a19 user: Stephan Bosch date: Thu May 19 21:38:34 2011 +0200 description: managsieve-login: Reduced the max. number of allowed bad commands. diffstat: src/managesieve-login/client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c4d1791a1e5b -r 8efc4a8e4a19 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Thu Feb 17 21:18:19 2011 +0100 +++ b/src/managesieve-login/client.c Thu May 19 21:38:34 2011 +0200 @@ -33,7 +33,7 @@ #define MAX_OUTBUF_SIZE 4096 /* Disconnect client when it sends too many bad commands */ -#define CLIENT_MAX_BAD_COMMANDS 10 +#define CLIENT_MAX_BAD_COMMANDS 3 /* When max. number of simultaneous connections is reached, few of the oldest connections are disconnected. Since we have to go through all of the From pigeonhole at rename-it.nl Thu May 19 23:05:50 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 22:05:50 +0200 Subject: dovecot-1.2-sieve: Updated copyright notices to include year 2011. Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/cb7e44c2e5e9 changeset: 1287:cb7e44c2e5e9 user: Stephan Bosch date: Thu May 19 22:05:11 2011 +0200 description: Updated copyright notices to include year 2011. diffstat: 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/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/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.h | 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/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-dumper.c | 2 +- src/lib-sieve/sieve-binary-dumper.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-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-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/plugins/lda-sieve/lda-sieve-plugin.c | 2 +- src/plugins/lda-sieve/lda-sieve-plugin.h | 2 +- src/sieve-tools/debug/cmd-debug-print.c | 2 +- src/sieve-tools/debug/ext-debug-common.h | 2 +- src/sieve-tools/debug/ext-debug.c | 2 +- src/sieve-tools/debug/sieve-ext-debug.h | 2 +- src/sieve-tools/sieve-filter.c | 2 +- src/sieve-tools/sieve-test.c | 2 +- src/sieve-tools/sievec.c | 2 +- src/sieve-tools/sieved.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-print.c | 2 +- src/testsuite/cmd-test-result-reset.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-execute.c | 2 +- src/testsuite/tst-test-result.c | 2 +- src/testsuite/tst-test-script-compile.c | 2 +- src/testsuite/tst-test-script-run.c | 2 +- 230 files changed, 230 insertions(+), 230 deletions(-) diffs (truncated from 2070 to 300 lines): diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve-tool/mail-raw.c --- a/src/lib-sieve-tool/mail-raw.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve-tool/mail-raw.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* FIXME: This file was gratefully stolen from dovecot/src/deliver/deliver.c and diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve-tool/mail-raw.h --- a/src/lib-sieve-tool/mail-raw.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve-tool/mail-raw.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __MAIL_RAW_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve-tool/sieve-tool.c --- a/src/lib-sieve-tool/sieve-tool.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve-tool/sieve-tool.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve-tool/sieve-tool.h --- a/src/lib-sieve-tool/sieve-tool.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve-tool/sieve-tool.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_TOOL_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-discard.c --- a/src/lib-sieve/cmd-discard.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-discard.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-if.c --- a/src/lib-sieve/cmd-if.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-if.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "sieve-common.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-keep.c --- a/src/lib-sieve/cmd-keep.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-keep.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-redirect.c --- a/src/lib-sieve/cmd-redirect.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-redirect.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-require.c --- a/src/lib-sieve/cmd-require.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-require.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmd-stop.c --- a/src/lib-sieve/cmd-stop.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmd-stop.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "sieve-common.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmp-i-ascii-casemap.c --- a/src/lib-sieve/cmp-i-ascii-casemap.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmp-i-ascii-casemap.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Comparator 'i;ascii-casemap': diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/cmp-i-octet.c --- a/src/lib-sieve/cmp-i-octet.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/cmp-i-octet.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Comparator 'i;octet': diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/ext-encoded-character.c --- a/src/lib-sieve/ext-encoded-character.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/ext-encoded-character.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension encoded-character diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/ext-envelope.c --- a/src/lib-sieve/ext-envelope.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/ext-envelope.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension envelope diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/ext-fileinto.c --- a/src/lib-sieve/ext-fileinto.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/ext-fileinto.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension fileinto diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/ext-reject.c --- a/src/lib-sieve/ext-reject.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/ext-reject.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension reject diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/mcht-contains.c --- a/src/lib-sieve/mcht-contains.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/mcht-contains.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Match-type ':contains' diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/mcht-is.c --- a/src/lib-sieve/mcht-is.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/mcht-is.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Match-type ':is': diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/mcht-matches.c --- a/src/lib-sieve/mcht-matches.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/mcht-matches.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Match-type ':matches' diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/body/ext-body-common.c --- a/src/lib-sieve/plugins/body/ext-body-common.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/body/ext-body-common.h --- a/src/lib-sieve/plugins/body/ext-body-common.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/body/ext-body-common.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __EXT_BODY_COMMON_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/body/ext-body.c --- a/src/lib-sieve/plugins/body/ext-body.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/body/ext-body.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension body diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/body/tst-body.c --- a/src/lib-sieve/plugins/body/tst-body.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/body/tst-body.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "sieve-extensions.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 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 Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension comparator-i;ascii-numeric diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/copy/ext-copy.c --- a/src/lib-sieve/plugins/copy/ext-copy.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/copy/ext-copy.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension copy diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/date/ext-date-common.c --- a/src/lib-sieve/plugins/date/ext-date-common.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/date/ext-date-common.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/date/ext-date-common.h --- a/src/lib-sieve/plugins/date/ext-date-common.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/date/ext-date-common.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __EXT_DATE_COMMON_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/date/ext-date.c --- a/src/lib-sieve/plugins/date/ext-date.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/date/ext-date.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* Extension date diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/date/tst-date.c --- a/src/lib-sieve/plugins/date/tst-date.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/date/tst-date.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/enotify/cmd-notify.c --- a/src/lib-sieve/plugins/enotify/cmd-notify.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/enotify/cmd-notify.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/enotify/ext-enotify-common.c --- a/src/lib-sieve/plugins/enotify/ext-enotify-common.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/enotify/ext-enotify-common.c Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/enotify/ext-enotify-common.h --- a/src/lib-sieve/plugins/enotify/ext-enotify-common.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/enotify/ext-enotify-common.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __EXT_ENOTIFY_COMMON_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/enotify/ext-enotify-limits.h --- a/src/lib-sieve/plugins/enotify/ext-enotify-limits.h Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/enotify/ext-enotify-limits.h Thu May 19 22:05:11 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __EXT_ENOTIFY_LIMITS_H diff -r 8c2f2391c617 -r cb7e44c2e5e9 src/lib-sieve/plugins/enotify/ext-enotify.c --- a/src/lib-sieve/plugins/enotify/ext-enotify.c Thu May 19 21:36:29 2011 +0200 +++ b/src/lib-sieve/plugins/enotify/ext-enotify.c Thu May 19 22:05:11 2011 +0200 From pigeonhole at rename-it.nl Thu May 19 23:07:20 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 22:07:20 +0200 Subject: dovecot-1.2-managesieve: Updated copyright notices to include ye... Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/b5cbda1f5c15 changeset: 220:b5cbda1f5c15 user: Stephan Bosch date: Thu May 19 22:07:22 2011 +0200 description: Updated copyright notices to include year 2011. diffstat: src/lib-cmusieve/sieve-common.h | 2 +- src/lib-cmusieve/sieve-error-private.h | 2 +- src/lib-cmusieve/sieve-error.c | 2 +- src/lib-cmusieve/sieve-error.h | 2 +- src/lib-cmusieve/sieve-script-private.h | 2 +- src/lib-cmusieve/sieve-script.c | 2 +- src/lib-cmusieve/sieve-script.h | 2 +- src/lib-cmusieve/sieve.c | 2 +- src/lib-cmusieve/sieve.h | 2 +- src/lib-managesieve/managesieve-parser.c | 2 +- src/lib-managesieve/managesieve-parser.h | 2 +- src/lib-managesieve/managesieve-quote.c | 2 +- src/lib-managesieve/managesieve-quote.h | 2 +- src/lib-sievestorage/sieve-storage-error.h | 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/cmd-noop.c | 2 +- src/managesieve-login/commands.h | 2 +- src/managesieve-login/managesieve-capability.c | 2 +- src/managesieve-login/managesieve-capability.h | 2 +- src/managesieve-login/managesieve-proxy.c | 2 +- src/managesieve-login/managesieve-proxy.h | 2 +- src/managesieve/client.c | 2 +- src/managesieve/client.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/commands.c | 2 +- src/managesieve/commands.h | 2 +- src/managesieve/common.h | 2 +- src/managesieve/main.c | 2 +- src/managesieve/managesieve-quota.c | 2 +- src/managesieve/managesieve-quota.h | 2 +- 53 files changed, 53 insertions(+), 53 deletions(-) diffs (truncated from 477 to 300 lines): diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-common.h --- a/src/lib-cmusieve/sieve-common.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-common.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_COMMON_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-error-private.h --- a/src/lib-cmusieve/sieve-error-private.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-error-private.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_ERROR_PRIVATE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-error.c --- a/src/lib-cmusieve/sieve-error.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-error.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-error.h --- a/src/lib-cmusieve/sieve-error.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-error.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_ERROR_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-script-private.h --- a/src/lib-cmusieve/sieve-script-private.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-script-private.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_SCRIPT_PRIVATE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-script.c --- a/src/lib-cmusieve/sieve-script.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-script.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve-script.h --- a/src/lib-cmusieve/sieve-script.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve-script.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_SCRIPT_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve.c --- a/src/lib-cmusieve/sieve.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-cmusieve/sieve.h --- a/src/lib-cmusieve/sieve.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-cmusieve/sieve.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-managesieve/managesieve-parser.c --- a/src/lib-managesieve/managesieve-parser.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-managesieve/managesieve-parser.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-managesieve/managesieve-parser.h --- a/src/lib-managesieve/managesieve-parser.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-managesieve/managesieve-parser.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __MANAGESIEVE_PARSER_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-managesieve/managesieve-quote.c --- a/src/lib-managesieve/managesieve-quote.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-managesieve/managesieve-quote.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-managesieve/managesieve-quote.h --- a/src/lib-managesieve/managesieve-quote.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-managesieve/managesieve-quote.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __IMAP_QUOTE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-error.h --- a/src/lib-sievestorage/sieve-storage-error.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-error.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_ERROR_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-list.c --- a/src/lib-sievestorage/sieve-storage-list.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-list.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-list.h --- a/src/lib-sievestorage/sieve-storage-list.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-list.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_LIST_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-private.h --- a/src/lib-sievestorage/sieve-storage-private.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-private.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_PRIVATE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-quota.c --- a/src/lib-sievestorage/sieve-storage-quota.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-quota.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-quota.h --- a/src/lib-sievestorage/sieve-storage-quota.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-quota.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_QUOTA_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-save.c --- a/src/lib-sievestorage/sieve-storage-save.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-save.h --- a/src/lib-sievestorage/sieve-storage-save.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-save.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_SAVE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-script.c --- a/src/lib-sievestorage/sieve-storage-script.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage-script.h --- a/src/lib-sievestorage/sieve-storage-script.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage-script.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_SCRIPT_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage.c --- a/src/lib-sievestorage/sieve-storage.c Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/lib-sievestorage/sieve-storage.h --- a/src/lib-sievestorage/sieve-storage.h Thu May 19 21:38:34 2011 +0200 +++ b/src/lib-sievestorage/sieve-storage.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __SIEVE_STORAGE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/client-authenticate.c --- a/src/managesieve-login/client-authenticate.c Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/client-authenticate.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "common.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/client-authenticate.h --- a/src/managesieve-login/client-authenticate.h Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/client-authenticate.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __CLIENT_AUTHENTICATE_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/client.c --- a/src/managesieve-login/client.c Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/client.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "common.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/client.h --- a/src/managesieve-login/client.h Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/client.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __CLIENT_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/cmd-noop.c --- a/src/managesieve-login/cmd-noop.c Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/cmd-noop.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ /* FIXME: Duplicate! */ diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/commands.h --- a/src/managesieve-login/commands.h Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/commands.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __COMMANDS_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/managesieve-capability.c --- a/src/managesieve-login/managesieve-capability.c Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/managesieve-capability.c Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #include "lib.h" diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/managesieve-capability.h --- a/src/managesieve-login/managesieve-capability.h Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/managesieve-capability.h Thu May 19 22:07:22 2011 +0200 @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file +/* Copyright (c) 2002-2011 Dovecot Sieve authors, see the included COPYING file */ #ifndef __MANAGESIEVE_CAPABILITY_H diff -r 8efc4a8e4a19 -r b5cbda1f5c15 src/managesieve-login/managesieve-proxy.c --- a/src/managesieve-login/managesieve-proxy.c Thu May 19 21:38:34 2011 +0200 +++ b/src/managesieve-login/managesieve-proxy.c Thu May 19 22:07:22 2011 +0200 From pigeonhole at rename-it.nl Thu May 19 23:12:41 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 22:12:41 +0200 Subject: dovecot-1.2-sieve: Updated NEWS file for next release. Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/cb74912bc088 changeset: 1288:cb74912bc088 user: Stephan Bosch date: Thu May 19 22:12:44 2011 +0200 description: Updated NEWS file for next release. diffstat: NEWS | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diffs (16 lines): diff -r cb7e44c2e5e9 -r cb74912bc088 NEWS --- a/NEWS Thu May 19 22:05:11 2011 +0200 +++ b/NEWS Thu May 19 22:12:44 2011 +0200 @@ -1,3 +1,12 @@ +v0.1.19 19-05-2011 Stephan Bosch + + - Enotify extension: fixed inappropriate return type in mailto URI parse + function, also fixing ARM compiler warning. + - Vacation extension: fixed handling of sendmail errors. It produced an + additional confusing success message in case of error. + - Removed header MIME-decoding to fix erroneous address parsing. Applies to + address test and vacation command. + v0.1.18 04-10-2010 Stephan Bosch - Imap4flags: fixed segfault bug occuring in multiscript context. Occured in From pigeonhole at rename-it.nl Fri May 20 00:31:55 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:31:55 +0200 Subject: dovecot-1.2-sieve: Released v0.1.19 for Dovecot v1.2.17. Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/7ce4e9e8646f changeset: 1289:7ce4e9e8646f user: Stephan Bosch date: Thu May 19 23:31:49 2011 +0200 description: Released v0.1.19 for Dovecot v1.2.17. diffstat: configure.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (9 lines): diff -r cb74912bc088 -r 7ce4e9e8646f configure.in --- a/configure.in Thu May 19 22:12:44 2011 +0200 +++ b/configure.in Thu May 19 23:31:49 2011 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Dovecot Sieve], [0.1.18], [dovecot at dovecot.org], [dovecot-1.2-sieve]) +AC_INIT([Dovecot Sieve], [0.1.19], [dovecot at dovecot.org], [dovecot-1.2-sieve]) AC_CONFIG_SRCDIR([src]) # Autoheader is not needed and does more harm than good for this package. However, it is From pigeonhole at rename-it.nl Fri May 20 00:31:58 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:31:58 +0200 Subject: dovecot-1.2-sieve: Added tag 0.1.19 for changeset 7ce4e9e8646f Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/5c9732e204fe changeset: 1290:5c9732e204fe user: Stephan Bosch date: Thu May 19 23:32:00 2011 +0200 description: Added tag 0.1.19 for changeset 7ce4e9e8646f diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r 7ce4e9e8646f -r 5c9732e204fe .hgtags --- a/.hgtags Thu May 19 23:31:49 2011 +0200 +++ b/.hgtags Thu May 19 23:32:00 2011 +0200 @@ -17,3 +17,4 @@ a7fd1e81160cb9c285486ae30823787288324376 0.1.16 0b888fcb693dc86bfdc9b2ea819d9ce5eccb618d 0.1.17 0b2b9ffc70dc5c5b1e9313cfbe3a9482220b3df3 0.1.18 +7ce4e9e8646fefa976402178203c3f5ddcd0843f 0.1.19 From pigeonhole at rename-it.nl Fri May 20 00:33:32 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:33:32 +0200 Subject: dovecot-1.2-managesieve: Updated NEWS file for next release. Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/781697ebd323 changeset: 221:781697ebd323 user: Stephan Bosch date: Thu May 19 22:15:33 2011 +0200 description: Updated NEWS file for next release. diffstat: NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (12 lines): diff -r b5cbda1f5c15 -r 781697ebd323 NEWS --- a/NEWS Thu May 19 22:07:22 2011 +0200 +++ b/NEWS Thu May 19 22:15:33 2011 +0200 @@ -1,5 +1,8 @@ Dovecot 1.2: +v0.11.13: + - ManageSieve: fixed bug in UTF-8 checking of string values. + v0.11.12: - Fixed error handling of PUTSCRIPT commmand; save commit errors would not make the command fail. From pigeonhole at rename-it.nl Fri May 20 00:33:35 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:33:35 +0200 Subject: dovecot-1.2-managesieve: Released v0.11.13 for Dovecot v1.2.17. Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/a71f8b4a4287 changeset: 222:a71f8b4a4287 user: Stephan Bosch date: Thu May 19 23:32:51 2011 +0200 description: Released v0.11.13 for Dovecot v1.2.17. diffstat: configure.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (9 lines): diff -r 781697ebd323 -r a71f8b4a4287 configure.in --- a/configure.in Thu May 19 22:15:33 2011 +0200 +++ b/configure.in Thu May 19 23:32:51 2011 +0200 @@ -1,4 +1,4 @@ -AC_INIT([Dovecot ManageSieve], [0.11.12], [dovecot at dovecot.org], [dovecot-1.2-managesieve]) +AC_INIT([Dovecot ManageSieve], [0.11.13], [dovecot at dovecot.org], [dovecot-1.2-managesieve]) AC_CONFIG_SRCDIR([src]) AC_CONFIG_HEADERS([dummy-config.h dmanagesieve-config.h]) From pigeonhole at rename-it.nl Fri May 20 00:33:37 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:33:37 +0200 Subject: dovecot-1.2-managesieve: Added tag 0.11.13 for changeset a71f8b4... Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/a2132a8845de changeset: 223:a2132a8845de user: Stephan Bosch date: Thu May 19 23:33:34 2011 +0200 description: Added tag 0.11.13 for changeset a71f8b4a4287 diffstat: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (8 lines): diff -r a71f8b4a4287 -r a2132a8845de .hgtags --- a/.hgtags Thu May 19 23:32:51 2011 +0200 +++ b/.hgtags Thu May 19 23:33:34 2011 +0200 @@ -15,3 +15,4 @@ aaf9668856ecc5dcc50aa6ed23d9c3cd2d151400 0.11.10 539f0896e4852c1421ab6dd64ca8ef70999e20ca 0.11.11 e8216d09cebb7abd460bec079ddcfdb3da4ba9c3 0.11.12 +a71f8b4a4287e59165a5a59b5ddbeb421c8305df 0.11.13 From pigeonhole at rename-it.nl Fri May 20 00:41:40 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:41:40 +0200 Subject: dovecot-1.2-sieve: Added signature for changeset 7ce4e9e8646f Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/3adf9046ded8 changeset: 1291:3adf9046ded8 user: Stephan Bosch date: Thu May 19 23:41:02 2011 +0200 description: Added signature for changeset 7ce4e9e8646f diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (6 lines): diff -r 5c9732e204fe -r 3adf9046ded8 .hgsigs --- a/.hgsigs Thu May 19 23:32:00 2011 +0200 +++ b/.hgsigs Thu May 19 23:41:02 2011 +0200 @@ -1,1 +1,2 @@ 0b2b9ffc70dc5c5b1e9313cfbe3a9482220b3df3 0 iQEcBAABAgAGBQJMqkI/AAoJEATWKx49+7T0epMH/AgjcPThuxueE+P/0hhYhp8/oZl96Put35mUCEYYAvdktsJmj5hSfrZCudMOWOvWBBI9YD1T38eMFHB5dLlE9mLfuO39dIXvGav/vV+FYGxBAvBmjjfSSZQgZpiaY4HouPYeH8X3ALwdBjrH4wH4LeGGQpnO/6vpP/aj6xD5vS6Ax1OHMaeWfHENOnjTqTEpef/hnBf3O6Lftuyx0qpRHeuQvqqgnkM6TIDEgsUcnGw6LLeEfyZzKooLGDLjtSUCS5he8AwY/rK+BF/qAdScapOGeTes4OvdLlkY29+pPo2Fz54gjVtOHY/gz/JG2alZV8yH0a2Re2X11GlogTaYDo4= +7ce4e9e8646fefa976402178203c3f5ddcd0843f 0 iQEcBAABAgAGBQJN1Y5pAAoJEATWKx49+7T0/CwH/15SAhEAQbEL9SvoTi5RY3RbLyKhwLBumfdpKJdDOHJrX6q9rTC+VTvrhje4Ln9xxQy11Ublkr7scPRDQUD2umc1l0cP4sfELkXdNx0QumHLBDyKUj3zWycPH9CHKuURprzbQiYJtgjkyZYn+/gXwcoxqEgfvIROdI8Lockgz9VwIdyN6LN2af9c6HKYlPkbeAjxJZ86VzsvdOndAD6LUUhWjxUlwF3jXwFY9by8zdPtQ88q6ETc1Fiu/maKprpqGboAlRwWzDtNtKf6JwaAolS5jjG93l6tYlo9s8ixxjXb1roaJARD7rfbn/9KAGFT5JHBwq5gjFJsWzCevcTCqaQ= From pigeonhole at rename-it.nl Fri May 20 00:50:58 2011 From: pigeonhole at rename-it.nl (pigeonhole at rename-it.nl) Date: Thu, 19 May 2011 23:50:58 +0200 Subject: dovecot-1.2-managesieve: Added signature for changeset a71f8b4a4287 Message-ID: details: http://hg.rename-it.nl/dovecot-1.2-managesieve/rev/78d4860e22ce changeset: 224:78d4860e22ce user: Stephan Bosch date: Thu May 19 23:42:37 2011 +0200 description: Added signature for changeset a71f8b4a4287 diffstat: .hgsigs | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (6 lines): diff -r a2132a8845de -r 78d4860e22ce .hgsigs --- a/.hgsigs Thu May 19 23:33:34 2011 +0200 +++ b/.hgsigs Thu May 19 23:42:37 2011 +0200 @@ -1,1 +1,2 @@ e8216d09cebb7abd460bec079ddcfdb3da4ba9c3 0 iQEcBAABAgAGBQJMqkKNAAoJEATWKx49+7T0v8cIALS/eI3hrtBYyUMQP2Poqcv4nE65opZHWPQj8uTChTxpGdWwZyFvslzCMooeUG0A5sxNe7aoD4mIadP0ol4DEYW/TdTclZs/xfxzZwfsdPHoF1aQl1CuVyunORJ3P3qw+dYFrxKxczEDNCpnY2vcPojlugvswZK6jNBFcwsI5UuJ6iL2m5Po18dLQMOU8dXTLKLBL8EIvxc623QHYrqESWW2Kg8BluCg/X7F2Xb1N6E8y3f8zwBHuvHHVOyzqsUJugACW0Zj4f6DwAZAIiDDtcSs/r18T5h/i5WtzsPu3c/xvgNHaETgpKs3FH2lioEOtIAgN/5uAMoLowzWHBrvayo= +a71f8b4a4287e59165a5a59b5ddbeb421c8305df 0 iQEcBAABAgAGBQJN1Y7HAAoJEATWKx49+7T0SUQIANT4pD79mtBe7L5n30+d0dxLnJsq08sXWW+fzqdAs+lJxzlB9qrUwOQ4vXjPFw7uCrJLZ240XBn+T7R/G/2o1gMN64bsfozTxpkK41eb3oaMsgpu1ULKXVz+R1FeV8x3wq4BwQsY84kqAsEuI3fL78RA9j4EG+U4hzpG2+KSpM4KpqvvsIB5k+KjpPQHlkUUQvPp794v20EKu//XxAJzWlD6jOEd7b1ZQceeOIpS1XXmRfJvqiDxuENMGRjAuWxmqZpsOejm1ZP5dgOWs7Gq0ZI9oloZLkR7rfwxoVhfBfDu49VQKmykD4pucIyd+Wil26MMBCuyqCcq+do91+N2dOc= From dovecot at dovecot.org Fri May 20 13:03:42 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 13:03:42 +0300 Subject: dovecot-2.0: doveadm: Set service=doveadm for userdb lookup. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d20588657ddc changeset: 12812:d20588657ddc user: Timo Sirainen date: Fri May 20 13:03:34 2011 +0300 description: doveadm: Set service=doveadm for userdb lookup. diffstat: src/doveadm/doveadm-mail.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r ac006833cd66 -r d20588657ddc src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Mon May 16 17:34:42 2011 +0300 +++ b/src/doveadm/doveadm-mail.c Fri May 20 13:03:34 2011 +0300 @@ -236,6 +236,7 @@ i_fatal("USER environment is missing and -u option not used"); memset(&input, 0, sizeof(input)); + input.service = "doveadm"; input.username = username; ctx->storage_service = mail_storage_service_init(master_service, NULL, From dovecot at dovecot.org Fri May 20 13:30:49 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 13:30:49 +0300 Subject: dovecot-2.0: doveadm: Added simple PLAIN authentication for remo... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/6604f80abb02 changeset: 12814:6604f80abb02 user: Timo Sirainen date: Fri May 20 13:30:40 2011 +0300 description: doveadm: Added simple PLAIN authentication for remote connections. Currently clients are required to use "doveadm" as the username and the password must match doveadm_password setting. When using doveadm as a client, it automatically uses these settings when connecting to remote servers. diffstat: src/doveadm/client-connection.c | 63 +++++++++++++++++++++++++++++++++++----- src/doveadm/doveadm-settings.c | 2 + src/doveadm/doveadm-settings.h | 1 + src/doveadm/server-connection.c | 47 ++++++++++++++++++++++++++--- 4 files changed, 98 insertions(+), 15 deletions(-) diffs (225 lines): diff -r 9c9f81ad0111 -r 6604f80abb02 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Fri May 20 13:05:16 2011 +0300 +++ b/src/doveadm/client-connection.c Fri May 20 13:30:40 2011 +0300 @@ -1,6 +1,7 @@ /* Copyright (c) 2010-2011 Dovecot authors, see the included COPYING file */ #include "lib.h" +#include "base64.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" @@ -11,6 +12,7 @@ #include "doveadm-server.h" #include "doveadm-mail.h" #include "doveadm-print.h" +#include "doveadm-settings.h" #include "client-connection.h" #include @@ -147,17 +149,56 @@ return TRUE; } -static bool -client_connection_authenticate(struct client_connection *conn ATTR_UNUSED) +static int +client_connection_authenticate(struct client_connection *conn) { - i_fatal("Authentication not supported yet"); - return FALSE; + const char *line, *pass; + buffer_t *plain; + const unsigned char *data; + size_t size; + + if ((line = i_stream_read_next_line(conn->input)) == NULL) + return 0; + + if (*doveadm_settings->doveadm_password == '\0') { + i_error("doveadm_password not set, " + "remote authentication disabled"); + return -1; + } + + /* FIXME: some day we should probably let auth process do this and + support all kinds of authentication */ + if (strncmp(line, "PLAIN\t", 6) != 0) { + i_error("doveadm client attempted non-PLAIN authentication"); + return -1; + } + + plain = buffer_create_dynamic(pool_datastack_create(), 128); + if (base64_decode(line + 6, strlen(line + 6), NULL, plain) < 0) { + i_error("doveadm client sent invalid base64 auth PLAIN data"); + return -1; + } + data = plain->data; + size = plain->used; + + if (size < 10 || data[0] != '\0' || + memcmp(data+1, "doveadm", 7) != 0 || data[8] != '\0') { + i_error("doveadm client didn't authenticate as 'doveadm'"); + return -1; + } + pass = t_strndup(data + 9, size - 9); + if (strcmp(pass, doveadm_settings->doveadm_password) != 0) { + i_error("doveadm client authenticated with wrong password"); + return -1; + } + return 1; } static void client_connection_input(struct client_connection *conn) { const char *line; - bool ret = TRUE; + bool ok = TRUE; + int ret; if (!conn->handshaked) { if ((line = i_stream_read_next_line(conn->input)) == NULL) { @@ -176,19 +217,23 @@ conn->handshaked = TRUE; } if (!conn->authenticated) { - if (!client_connection_authenticate(conn)) + if ((ret = client_connection_authenticate(conn)) <= 0) { + if (ret < 0) + client_connection_destroy(&conn); return; + } + conn->authenticated = TRUE; } - while (ret && (line = i_stream_read_next_line(conn->input)) != NULL) { + while (ok && (line = i_stream_read_next_line(conn->input)) != NULL) { T_BEGIN { char **args; args = p_strsplit(pool_datastack_create(), line, "\t"); - ret = client_handle_command(conn, args); + ok = client_handle_command(conn, args); } T_END; } - if (conn->input->eof || conn->input->stream_errno != 0 || !ret) + if (conn->input->eof || conn->input->stream_errno != 0 || !ok) client_connection_destroy(&conn); } diff -r 9c9f81ad0111 -r 6604f80abb02 src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Fri May 20 13:05:16 2011 +0300 +++ b/src/doveadm/doveadm-settings.c Fri May 20 13:30:40 2011 +0300 @@ -58,6 +58,7 @@ DEF(SET_STR, doveadm_socket_path), DEF(SET_UINT, doveadm_worker_count), DEF(SET_UINT, doveadm_proxy_port), + DEF(SET_STR, doveadm_password), { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL }, @@ -71,6 +72,7 @@ .doveadm_socket_path = "doveadm-server", .doveadm_worker_count = 0, .doveadm_proxy_port = 0, + .doveadm_password = "", .plugin_envs = ARRAY_INIT }; diff -r 9c9f81ad0111 -r 6604f80abb02 src/doveadm/doveadm-settings.h --- a/src/doveadm/doveadm-settings.h Fri May 20 13:05:16 2011 +0300 +++ b/src/doveadm/doveadm-settings.h Fri May 20 13:30:40 2011 +0300 @@ -8,6 +8,7 @@ const char *doveadm_socket_path; unsigned int doveadm_worker_count; unsigned int doveadm_proxy_port; + const char *doveadm_password; ARRAY_DEFINE(plugin_envs, const char *); }; diff -r 9c9f81ad0111 -r 6604f80abb02 src/doveadm/server-connection.c --- a/src/doveadm/server-connection.c Fri May 20 13:05:16 2011 +0300 +++ b/src/doveadm/server-connection.c Fri May 20 13:30:40 2011 +0300 @@ -2,6 +2,7 @@ #include "lib.h" #include "array.h" +#include "base64.h" #include "ioloop.h" #include "network.h" #include "istream.h" @@ -11,6 +12,7 @@ #include "doveadm-print.h" #include "doveadm-util.h" #include "doveadm-server.h" +#include "doveadm-settings.h" #include "server-connection.h" #include @@ -149,10 +151,28 @@ i_stream_skip(conn->input, size); } -static void -server_connection_authenticate(struct server_connection *conn ATTR_UNUSED) +static int +server_connection_authenticate(struct server_connection *conn) { - i_fatal("Authentication not supported yet"); + string_t *plain = t_str_new(128); + string_t *cmd = t_str_new(128); + + if (*doveadm_settings->doveadm_password == '\0') { + i_error("doveadm_password not set, can't authenticate"); + return -1; + } + + str_append_c(plain, '\0'); + str_append(plain, "doveadm"); + str_append_c(plain, '\0'); + str_append(plain, doveadm_settings->doveadm_password); + + str_append(cmd, "PLAIN\t"); + base64_encode(plain->data, plain->used, cmd); + str_append_c(cmd, '\n'); + + o_stream_send(conn->output, cmd->data, cmd->used); + return 0; } static void server_connection_input(struct server_connection *conn) @@ -171,9 +191,12 @@ conn->handshaked = TRUE; if (strcmp(line, "+") == 0) conn->authenticated = TRUE; - else if (strcmp(line, "-") == 0) - server_connection_authenticate(conn); - else { + else if (strcmp(line, "-") == 0) { + if (server_connection_authenticate(conn) < 0) { + server_connection_destroy(&conn); + return; + } + } else { i_error("doveadm server sent invalid handshake: %s", line); server_connection_destroy(&conn); @@ -190,6 +213,18 @@ if (size == 0) return; + if (!conn->authenticated) { + if ((line = i_stream_next_line(conn->input)) != NULL) + return; + if (strcmp(line, "+") == 0) + conn->authenticated = TRUE; + else { + i_error("doveadm authentication failed (%s)", line+1); + server_connection_destroy(&conn); + return; + } + } + switch (conn->state) { case SERVER_REPLY_STATE_DONE: i_error("doveadm server sent unexpected input"); From dovecot at dovecot.org Fri May 20 13:30:49 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 13:30:49 +0300 Subject: dovecot-2.0: doveadm: Added doveadm_proxy_port setting to make i... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/9c9f81ad0111 changeset: 12813:9c9f81ad0111 user: Timo Sirainen date: Fri May 20 13:05:16 2011 +0300 description: doveadm: Added doveadm_proxy_port setting to make it work with proxying. diffstat: src/doveadm/Makefile.am | 8 +- src/doveadm/doveadm-mail-server.c | 96 +++++++++++++++++++++++++++----------- src/doveadm/doveadm-mail.c | 13 ++-- src/doveadm/doveadm-mail.h | 3 +- src/doveadm/doveadm-settings.c | 2 + src/doveadm/doveadm-settings.h | 1 + src/doveadm/main.c | 11 ---- 7 files changed, 82 insertions(+), 52 deletions(-) diffs (275 lines): diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/Makefile.am Fri May 20 13:05:16 2011 +0300 @@ -70,9 +70,11 @@ doveadm-mail-move.c \ doveadm-mail-list-iter.c \ doveadm-mail-search.c \ + doveadm-mail-server.c \ doveadm-print.c \ doveadm-settings.c \ - doveadm-util.c + doveadm-util.c \ + server-connection.c doveadm_SOURCES = \ $(common) \ @@ -87,7 +89,6 @@ doveadm-kick.c \ doveadm-log.c \ doveadm-master.c \ - doveadm-mail-server.c \ doveadm-mutf7.c \ doveadm-penalty.c \ doveadm-print-flow.c \ @@ -96,8 +97,7 @@ doveadm-print-table.c \ doveadm-pw.c \ doveadm-sis.c \ - doveadm-who.c \ - server-connection.c + doveadm-who.c doveadm_server_SOURCES = \ $(common) \ diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/doveadm-mail-server.c Fri May 20 13:05:16 2011 +0300 @@ -7,6 +7,7 @@ #include "strescape.h" #include "ioloop.h" #include "master-service.h" +#include "auth-master.h" #include "mail-storage.h" #include "mail-storage-service.h" #include "server-connection.h" @@ -142,33 +143,74 @@ !DOVEADM_MAIL_SERVER_FAILED()); } -static const char *userdb_field_find(const char *const *fields, const char *key) +static int +doveadm_mail_server_user_get_host(struct doveadm_mail_cmd_context *ctx, + const char *username, const char **host_r, + const char **error_r) { - unsigned int i, len = strlen(key); + struct mail_storage_service_input input; + struct auth_master_connection *auth_conn; + struct auth_user_info info; + pool_t pool; + const char *proxy_host, *const *fields; + unsigned int i; + bool proxying; + int ret; - if (fields == NULL) - return NULL; + *host_r = doveadm_settings->doveadm_socket_path; - for (i = 0; fields[i] != NULL; i++) { - if (strncmp(fields[i], key, len) == 0) { - if (fields[i][len] == '\0') - return ""; - if (fields[i][len] == '=') - return fields[i]+len+1; + if (doveadm_settings->doveadm_proxy_port == 0) + return 0; + + /* make sure we have an auth connection */ + memset(&input, 0, sizeof(input)); + input.service = "doveadm"; + mail_storage_service_init_settings(ctx->storage_service, &input); + + memset(&info, 0, sizeof(info)); + info.service = master_service_get_name(master_service); + + pool = pool_alloconly_create("auth lookup", 1024); + auth_conn = mail_storage_service_get_auth_conn(ctx->storage_service); + ret = auth_master_pass_lookup(auth_conn, username, &info, + pool, &fields); + if (ret < 0) { + *error_r = fields[0] != NULL ? + t_strdup(fields[0]) : "passdb lookup failed"; + } else if (ret == 0) { + /* user not found from passdb. it could be in userdb though, + so just continue with the default host */ + } else { + proxy_host = NULL; + for (i = 0; fields[i] != NULL; i++) { + if (strncmp(fields[i], "proxy", 5) == 0 && + (fields[i][5] == '\0' || fields[i][5] == '=')) + proxying = TRUE; + else if (strncmp(fields[i], "host=", 5) == 0) + proxy_host = fields[i]+5; + } + if (!proxying) + ret = 0; + else if (proxy_host == NULL) { + *error_r = "Proxy is missing destination host"; + ret = -1; + } else { + *host_r = t_strdup_printf("%s:%u", proxy_host, + doveadm_settings->doveadm_proxy_port); } } - return NULL; + pool_unref(&pool); + return ret; } int doveadm_mail_server_user(struct doveadm_mail_cmd_context *ctx, - struct mail_storage_service_user *user, - const char **error_r) + const char *username, const char **error_r) { - const struct mail_storage_service_input *input; struct doveadm_server *server; struct server_connection *conn; const char *host; char *username_dup; + int ret; i_assert(cmd_ctx == ctx || cmd_ctx == NULL); cmd_ctx = ctx; @@ -177,34 +219,32 @@ so undo any sticks we might have added already */ doveadm_print_unstick_headers(); - input = mail_storage_service_user_get_input(user); - if (userdb_field_find(input->userdb_fields, "proxy") != NULL) { - host = userdb_field_find(input->userdb_fields, "host"); - if (host == NULL) { - *error_r = "Proxy is missing destination host"; - return -1; - } - } else { - host = doveadm_settings->doveadm_socket_path; + ret = doveadm_mail_server_user_get_host(ctx, username, &host, error_r); + if (ret < 0) + return -1; + if (ret == 0 && + (doveadm_settings->doveadm_worker_count == 0 || doveadm_server)) { + /* run it ourself */ + return 0; } server = doveadm_server_get(host); conn = doveadm_server_find_unused_conn(server); if (conn != NULL) - doveadm_mail_server_handle(conn, input->username); + doveadm_mail_server_handle(conn, username); else if (array_count(&server->connections) < - doveadm_settings->doveadm_worker_count) { + I_MAX(doveadm_settings->doveadm_worker_count, 1)) { conn = server_connection_create(server); - doveadm_mail_server_handle(conn, input->username); + doveadm_mail_server_handle(conn, username); } 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(username); array_append(&server->queue, &username_dup, 1); } *error_r = "doveadm server failure"; - return DOVEADM_MAIL_SERVER_FAILED() ? -1 : 0; + return DOVEADM_MAIL_SERVER_FAILED() ? -1 : 1; } static struct doveadm_server *doveadm_server_find_used(void) diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/doveadm-mail.c --- a/src/doveadm/doveadm-mail.c Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/doveadm-mail.c Fri May 20 13:05:16 2011 +0300 @@ -193,6 +193,12 @@ i_set_failure_prefix(t_strdup_printf("doveadm(%s): ", input->username)); + /* see if we want to execute this command via (another) + doveadm server */ + ret = doveadm_mail_server_user(ctx, input->username, error_r); + if (ret != 0) + return ret; + ret = mail_storage_service_lookup(ctx->storage_service, input, &service_user, &error); if (ret <= 0) { @@ -203,13 +209,6 @@ return ret; } - if (doveadm_settings->doveadm_worker_count > 0 && !doveadm_server) { - /* execute this command via doveadm server */ - ret = doveadm_mail_server_user(ctx, service_user, error_r); - mail_storage_service_user_free(&service_user); - return ret < 0 ? -1 : 1; - } - ret = mail_storage_service_next(ctx->storage_service, service_user, &ctx->cur_mail_user); if (ret < 0) { diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/doveadm-mail.h --- a/src/doveadm/doveadm-mail.h Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/doveadm-mail.h Fri May 20 13:05:16 2011 +0300 @@ -85,8 +85,7 @@ char *argv[], const char *username, enum mail_storage_service_flags service_flags); int doveadm_mail_server_user(struct doveadm_mail_cmd_context *ctx, - struct mail_storage_service_user *user, - const char **error_r); + const char *username, const char **error_r); void doveadm_mail_server_flush(void); int doveadm_mailbox_find_and_sync(struct mail_user *user, const char *mailbox, diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/doveadm-settings.c Fri May 20 13:05:16 2011 +0300 @@ -57,6 +57,7 @@ DEF(SET_STR, mail_plugin_dir), DEF(SET_STR, doveadm_socket_path), DEF(SET_UINT, doveadm_worker_count), + DEF(SET_UINT, doveadm_proxy_port), { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL }, @@ -69,6 +70,7 @@ .mail_plugin_dir = MODULEDIR, .doveadm_socket_path = "doveadm-server", .doveadm_worker_count = 0, + .doveadm_proxy_port = 0, .plugin_envs = ARRAY_INIT }; diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/doveadm-settings.h --- a/src/doveadm/doveadm-settings.h Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/doveadm-settings.h Fri May 20 13:05:16 2011 +0300 @@ -7,6 +7,7 @@ const char *mail_plugin_dir; const char *doveadm_socket_path; unsigned int doveadm_worker_count; + unsigned int doveadm_proxy_port; ARRAY_DEFINE(plugin_envs, const char *); }; diff -r d20588657ddc -r 9c9f81ad0111 src/doveadm/main.c --- a/src/doveadm/main.c Fri May 20 13:03:34 2011 +0300 +++ b/src/doveadm/main.c Fri May 20 13:05:16 2011 +0300 @@ -18,17 +18,6 @@ struct client_connection *doveadm_client; -int doveadm_mail_server_user(struct doveadm_mail_cmd_context *ctx ATTR_UNUSED, - struct mail_storage_service_user *user ATTR_UNUSED, - const char **error_r ATTR_UNUSED) -{ - /* this function should be called only by doveadm client code */ - i_unreached(); -} -void doveadm_mail_server_flush(void) -{ -} - static void doveadm_die(void) { /* do nothing. doveadm connections should be over soon. */ From dovecot at dovecot.org Fri May 20 14:08:52 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 14:08:52 +0300 Subject: dovecot-2.0: doveadm: Added support for using local/remote {} se... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/b6568a36ecf9 changeset: 12815:b6568a36ecf9 user: Timo Sirainen date: Fri May 20 14:08:43 2011 +0300 description: doveadm: Added support for using local/remote {} settings. diffstat: src/doveadm/client-connection.c | 73 ++++++++++++++++++++++++++++++++------ src/doveadm/doveadm-mail-server.c | 39 ++++++++++---------- src/doveadm/doveadm-mail.c | 32 +++++++++------- src/doveadm/doveadm-mail.h | 11 +++-- 4 files changed, 105 insertions(+), 50 deletions(-) diffs (truncated from 419 to 300 lines): diff -r 6604f80abb02 -r b6568a36ecf9 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Fri May 20 13:30:40 2011 +0300 +++ b/src/doveadm/client-connection.c Fri May 20 14:08:43 2011 +0300 @@ -6,7 +6,9 @@ #include "istream.h" #include "ostream.h" #include "strescape.h" +#include "settings-parser.h" #include "master-service.h" +#include "master-service-settings.h" #include "mail-storage-service.h" #include "doveadm-util.h" #include "doveadm-server.h" @@ -20,17 +22,24 @@ #define MAX_INBUF_SIZE 1024 struct client_connection { + pool_t pool; + int fd; struct io *io; struct istream *input; struct ostream *output; + struct ip_addr local_ip, remote_ip; + const struct doveadm_settings *set; unsigned int handshaked:1; unsigned int authenticated:1; }; -static bool doveadm_mail_cmd_server(const char *cmd_name, const char *username, - int argc, char *argv[]) +static bool +doveadm_mail_cmd_server(const char *cmd_name, + const struct doveadm_settings *set, + const struct mail_storage_service_input *input, + int argc, char *argv[]) { enum mail_storage_service_flags service_flags = MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT | @@ -50,7 +59,7 @@ if (doveadm_debug) service_flags |= MAIL_STORAGE_SERVICE_FLAG_DEBUG; - ctx = doveadm_mail_cmd_init(cmd); + ctx = doveadm_mail_cmd_init(cmd, set); getopt_args = t_strconcat("Au:", ctx->getopt_args, NULL); while ((c = getopt(argc, argv, getopt_args)) > 0) { switch (c) { @@ -88,10 +97,10 @@ doveadm_print_header("username", "Username", DOVEADM_PRINT_HEADER_FLAG_STICKY | DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE); - doveadm_print_sticky("username", username); + doveadm_print_sticky("username", input->username); } - doveadm_mail_single_user(ctx, argv, username, service_flags); + doveadm_mail_single_user(ctx, argv, input, service_flags); ctx->v.deinit(ctx); doveadm_print_flush(); return !ctx->failed; @@ -99,10 +108,14 @@ static bool client_handle_command(struct client_connection *conn, char **args) { - const char *flags, *username, *cmd_name; + struct mail_storage_service_input input; + const char *flags, *cmd_name; unsigned int argc; bool ret; + memset(&input, 0, sizeof(input)); + input.service = "doveadm"; + for (argc = 0; args[argc] != NULL; argc++) args[argc] = str_tabunescape(args[argc]); @@ -111,7 +124,7 @@ return FALSE; } flags = args[0]; - username = args[1]; + input.username = args[1]; cmd_name = args[2]; args += 3; argc -= 3; @@ -135,7 +148,7 @@ } o_stream_cork(conn->output); - ret = doveadm_mail_cmd_server(cmd_name, username, argc, args); + ret = doveadm_mail_cmd_server(cmd_name, conn->set, &input, argc, args); if (ret) o_stream_send(conn->output, "\n+\n", 3); else @@ -160,7 +173,7 @@ if ((line = i_stream_read_next_line(conn->input)) == NULL) return 0; - if (*doveadm_settings->doveadm_password == '\0') { + if (*conn->set->doveadm_password == '\0') { i_error("doveadm_password not set, " "remote authentication disabled"); return -1; @@ -187,7 +200,7 @@ return -1; } pass = t_strndup(data + 9, size - 9); - if (strcmp(pass, doveadm_settings->doveadm_password) != 0) { + if (strcmp(pass, conn->set->doveadm_password) != 0) { i_error("doveadm client authenticated with wrong password"); return -1; } @@ -237,18 +250,52 @@ client_connection_destroy(&conn); } +static int client_connection_read_settings(struct client_connection *conn) +{ + const struct setting_parser_info *set_roots[] = { + &doveadm_setting_parser_info, + NULL + }; + struct master_service_settings_input input; + struct master_service_settings_output output; + const char *error; + void *set; + + memset(&input, 0, sizeof(input)); + input.roots = set_roots; + input.service = "doveadm"; + input.local_ip = conn->local_ip; + input.remote_ip = conn->remote_ip; + + if (master_service_settings_read(master_service, &input, + &output, &error) < 0) { + i_error("Error reading configuration: %s", error); + return -1; + } + set = master_service_settings_get_others(master_service)[0]; + conn->set = settings_dup(&doveadm_setting_parser_info, set, conn->pool); + return 0; +} + struct client_connection *client_connection_create(int fd, int listen_fd) { struct client_connection *conn; struct stat st; const char *listen_path; + unsigned int port; + pool_t pool; - conn = i_new(struct client_connection, 1); + pool = pool_alloconly_create("doveadm client", 1024*16); + conn = p_new(pool, struct client_connection, 1); + conn->pool = pool; conn->fd = fd; conn->io = io_add(fd, IO_READ, client_connection_input, conn); conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE); conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE); + (void)net_getsockname(fd, &conn->local_ip, &port); + (void)net_getpeername(fd, &conn->remote_ip, &port); + /* we'll have to do this with stat(), because at least in Linux fstat() always returns mode as 0777 */ if (net_getunixname(listen_fd, &listen_path) == 0 && @@ -260,6 +307,8 @@ } else { o_stream_send(conn->output, "-\n", 2); } + if (client_connection_read_settings(conn) < 0) + client_connection_destroy(&conn); return conn; } @@ -274,7 +323,7 @@ io_remove(&conn->io); if (close(conn->fd) < 0) i_error("close(client) failed: %m"); - i_free(conn); + pool_unref(&conn->pool); doveadm_client = NULL; master_service_client_connection_destroyed(master_service); diff -r 6604f80abb02 -r b6568a36ecf9 src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Fri May 20 13:30:40 2011 +0300 +++ b/src/doveadm/doveadm-mail-server.c Fri May 20 14:08:43 2011 +0300 @@ -30,7 +30,8 @@ static void doveadm_mail_server_handle(struct server_connection *conn, const char *username); -static struct doveadm_server *doveadm_server_get(const char *name) +static struct doveadm_server * +doveadm_server_get(struct doveadm_mail_cmd_context *ctx, const char *name) { struct doveadm_server *server; char *dup_name; @@ -46,7 +47,7 @@ server = p_new(server_pool, struct doveadm_server, 1); server->name = dup_name = p_strdup(server_pool, name); p_array_init(&server->connections, server_pool, - doveadm_settings->doveadm_worker_count); + ctx->set->doveadm_worker_count); p_array_init(&server->queue, server_pool, DOVEADM_SERVER_QUEUE_MAX); hash_table_insert(servers, dup_name, server); @@ -145,10 +146,9 @@ static int doveadm_mail_server_user_get_host(struct doveadm_mail_cmd_context *ctx, - const char *username, const char **host_r, - const char **error_r) + const struct mail_storage_service_input *input, + const char **host_r, const char **error_r) { - struct mail_storage_service_input input; struct auth_master_connection *auth_conn; struct auth_user_info info; pool_t pool; @@ -157,22 +157,20 @@ bool proxying; int ret; - *host_r = doveadm_settings->doveadm_socket_path; + *host_r = ctx->set->doveadm_socket_path; - if (doveadm_settings->doveadm_proxy_port == 0) + if (ctx->set->doveadm_proxy_port == 0) return 0; /* make sure we have an auth connection */ - memset(&input, 0, sizeof(input)); - input.service = "doveadm"; - mail_storage_service_init_settings(ctx->storage_service, &input); + mail_storage_service_init_settings(ctx->storage_service, input); memset(&info, 0, sizeof(info)); info.service = master_service_get_name(master_service); pool = pool_alloconly_create("auth lookup", 1024); auth_conn = mail_storage_service_get_auth_conn(ctx->storage_service); - ret = auth_master_pass_lookup(auth_conn, username, &info, + ret = auth_master_pass_lookup(auth_conn, input->username, &info, pool, &fields); if (ret < 0) { *error_r = fields[0] != NULL ? @@ -196,7 +194,7 @@ ret = -1; } else { *host_r = t_strdup_printf("%s:%u", proxy_host, - doveadm_settings->doveadm_proxy_port); + ctx->set->doveadm_proxy_port); } } pool_unref(&pool); @@ -204,7 +202,8 @@ } int doveadm_mail_server_user(struct doveadm_mail_cmd_context *ctx, - const char *username, const char **error_r) + const struct mail_storage_service_input *input, + const char **error_r) { struct doveadm_server *server; struct server_connection *conn; @@ -219,28 +218,28 @@ so undo any sticks we might have added already */ doveadm_print_unstick_headers(); - ret = doveadm_mail_server_user_get_host(ctx, username, &host, error_r); + ret = doveadm_mail_server_user_get_host(ctx, input, &host, error_r); if (ret < 0) return -1; if (ret == 0 && - (doveadm_settings->doveadm_worker_count == 0 || doveadm_server)) { + (ctx->set->doveadm_worker_count == 0 || doveadm_server)) { /* run it ourself */ return 0; } - server = doveadm_server_get(host); + server = doveadm_server_get(ctx, host); conn = doveadm_server_find_unused_conn(server); if (conn != NULL) - doveadm_mail_server_handle(conn, username); + doveadm_mail_server_handle(conn, input->username); else if (array_count(&server->connections) < - I_MAX(doveadm_settings->doveadm_worker_count, 1)) { + I_MAX(ctx->set->doveadm_worker_count, 1)) { conn = server_connection_create(server); - doveadm_mail_server_handle(conn, username); + doveadm_mail_server_handle(conn, input->username); } else { if (array_count(&server->queue) >= DOVEADM_SERVER_QUEUE_MAX) doveadm_server_flush_one(server); - username_dup = i_strdup(username); + username_dup = i_strdup(input->username); From dovecot at dovecot.org Fri May 20 14:20:53 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 14:20:53 +0300 Subject: dovecot-2.0: doveadm server: Fixed running multiple commands wit... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c46b1ce45cd1 changeset: 12816:c46b1ce45cd1 user: Timo Sirainen date: Fri May 20 14:20:46 2011 +0300 description: doveadm server: Fixed running multiple commands without crashing. diffstat: src/doveadm/client-connection.c | 9 +++++++-- src/doveadm/doveadm-mail-server.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diffs (43 lines): diff -r b6568a36ecf9 -r c46b1ce45cd1 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Fri May 20 14:08:43 2011 +0300 +++ b/src/doveadm/client-connection.c Fri May 20 14:20:46 2011 +0300 @@ -47,7 +47,7 @@ struct doveadm_mail_cmd_context *ctx; const struct doveadm_mail_cmd *cmd; const char *getopt_args; - bool add_username_header = FALSE; + bool ret, add_username_header = FALSE; int c; cmd = doveadm_mail_cmd_find(cmd_name); @@ -101,9 +101,14 @@ } doveadm_mail_single_user(ctx, argv, input, service_flags); + doveadm_mail_server_flush(); ctx->v.deinit(ctx); doveadm_print_flush(); - return !ctx->failed; + mail_storage_service_deinit(&ctx->storage_service); + ret = !ctx->failed; + pool_unref(&ctx->pool); + + return ret; } static bool client_handle_command(struct client_connection *conn, char **args) diff -r b6568a36ecf9 -r c46b1ce45cd1 src/doveadm/doveadm-mail-server.c --- a/src/doveadm/doveadm-mail-server.c Fri May 20 14:08:43 2011 +0300 +++ b/src/doveadm/doveadm-mail-server.c Fri May 20 14:20:46 2011 +0300 @@ -289,8 +289,10 @@ { struct doveadm_server *server; - if (servers == NULL) + if (servers == NULL) { + cmd_ctx = NULL; return; + } while ((server = doveadm_server_find_used()) != NULL && !DOVEADM_MAIL_SERVER_FAILED()) From dovecot at dovecot.org Fri May 20 14:21:58 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 14:21:58 +0300 Subject: dovecot-2.0: doveadm: Added doveadm_allowed_commands setting, wh... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/c67ba5bf1ba9 changeset: 12817:c67ba5bf1ba9 user: Timo Sirainen date: Fri May 20 14:21:51 2011 +0300 description: doveadm: Added doveadm_allowed_commands setting, which is used by doveadm server. diffstat: src/doveadm/client-connection.c | 27 +++++++++++++++++++++++++++ src/doveadm/doveadm-settings.c | 2 ++ src/doveadm/doveadm-settings.h | 1 + 3 files changed, 30 insertions(+), 0 deletions(-) diffs (74 lines): diff -r c46b1ce45cd1 -r c67ba5bf1ba9 src/doveadm/client-connection.c --- a/src/doveadm/client-connection.c Fri May 20 14:20:46 2011 +0300 +++ b/src/doveadm/client-connection.c Fri May 20 14:21:51 2011 +0300 @@ -111,6 +111,27 @@ return ret; } +static bool client_is_allowed_command(const struct doveadm_settings *set, + const char *cmd_name) +{ + bool ret = FALSE; + + if (*set->doveadm_allowed_commands == '\0') + return TRUE; + + T_BEGIN { + const char *const *cmds = + t_strsplit(set->doveadm_allowed_commands, ","); + for (; *cmds != NULL; cmds++) { + if (strcmp(*cmds, cmd_name) == 0) { + ret = TRUE; + break; + } + } + } T_END; + return ret; +} + static bool client_handle_command(struct client_connection *conn, char **args) { struct mail_storage_service_input input; @@ -152,6 +173,12 @@ } } + if (!client_is_allowed_command(conn->set, cmd_name)) { + i_error("doveadm client isn't allowed to use command: %s", + cmd_name); + return FALSE; + } + o_stream_cork(conn->output); ret = doveadm_mail_cmd_server(cmd_name, conn->set, &input, argc, args); if (ret) diff -r c46b1ce45cd1 -r c67ba5bf1ba9 src/doveadm/doveadm-settings.c --- a/src/doveadm/doveadm-settings.c Fri May 20 14:20:46 2011 +0300 +++ b/src/doveadm/doveadm-settings.c Fri May 20 14:21:51 2011 +0300 @@ -59,6 +59,7 @@ DEF(SET_UINT, doveadm_worker_count), DEF(SET_UINT, doveadm_proxy_port), DEF(SET_STR, doveadm_password), + DEF(SET_STR, doveadm_allowed_commands), { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL }, @@ -73,6 +74,7 @@ .doveadm_worker_count = 0, .doveadm_proxy_port = 0, .doveadm_password = "", + .doveadm_allowed_commands = "", .plugin_envs = ARRAY_INIT }; diff -r c46b1ce45cd1 -r c67ba5bf1ba9 src/doveadm/doveadm-settings.h --- a/src/doveadm/doveadm-settings.h Fri May 20 14:20:46 2011 +0300 +++ b/src/doveadm/doveadm-settings.h Fri May 20 14:21:51 2011 +0300 @@ -9,6 +9,7 @@ unsigned int doveadm_worker_count; unsigned int doveadm_proxy_port; const char *doveadm_password; + const char *doveadm_allowed_commands; ARRAY_DEFINE(plugin_envs, const char *); }; From dovecot at dovecot.org Fri May 20 18:48:19 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 18:48:19 +0300 Subject: dovecot-2.0: login proxy: Connect to IPC server and implement KI... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/e4f7fb3b5a9c changeset: 12819:e4f7fb3b5a9c user: Timo Sirainen date: Fri May 20 18:47:02 2011 +0300 description: login proxy: Connect to IPC server and implement KILL and LIST commands. diffstat: src/login-common/login-proxy.c | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diffs (155 lines): diff -r bf5c8ee58e5e -r e4f7fb3b5a9c src/login-common/login-proxy.c --- a/src/login-common/login-proxy.c Fri May 20 18:45:29 2011 +0300 +++ b/src/login-common/login-proxy.c Fri May 20 18:47:02 2011 +0300 @@ -5,9 +5,11 @@ #include "istream.h" #include "ostream.h" #include "llist.h" +#include "md5.h" #include "str-sanitize.h" #include "time-util.h" #include "master-service.h" +#include "ipc-server.h" #include "dns-lookup.h" #include "client-common.h" #include "ssl-proxy.h" @@ -18,6 +20,8 @@ #define OUTBUF_THRESHOLD 1024 #define LOGIN_PROXY_DIE_IDLE_SECS 2 #define LOGIN_PROXY_DNS_WARN_MSECS 500 +#define LOGIN_PROXY_IPC_PATH "ipc-proxy" +#define LOGIN_PROXY_IPC_NAME "proxy" struct login_proxy { struct login_proxy *prev, *next; @@ -49,6 +53,10 @@ static struct login_proxy_state *proxy_state; static struct login_proxy *login_proxies = NULL; +static struct login_proxy *login_proxies_pending = NULL; +static struct ipc_server *login_proxy_ipc_server; + +static void login_proxy_ipc_cmd(struct ipc_cmd *cmd, const char *line); static void server_input(struct login_proxy *proxy) { @@ -286,6 +294,8 @@ return -1; } + DLLIST_PREPEND(&login_proxies_pending, proxy); + proxy->callback = callback; client->login_proxy = proxy; return 0; @@ -338,6 +348,8 @@ i_assert(proxy->client_io == NULL); i_assert(proxy->client_output == NULL); + DLLIST_REMOVE(&login_proxies_pending, proxy); + if (proxy->callback != NULL) proxy->callback(proxy->client); } @@ -439,6 +451,14 @@ proxy->callback = NULL; + if (login_proxy_ipc_server == NULL) { + login_proxy_ipc_server = + ipc_server_init(LOGIN_PROXY_IPC_PATH, + LOGIN_PROXY_IPC_NAME, + login_proxy_ipc_cmd); + } + + DLLIST_REMOVE(&login_proxies_pending, proxy); DLLIST_PREPEND(&login_proxies, proxy); client->fd = -1; @@ -520,6 +540,78 @@ } } +static void +login_proxy_cmd_kill(struct ipc_cmd *cmd, const char *const *args) +{ + struct login_proxy *proxy, *next; + unsigned int count = 0; + + if (args[0] == NULL) { + ipc_cmd_fail(&cmd, "Missing parameter"); + return; + } + + for (proxy = login_proxies; proxy != NULL; proxy = next) { + next = proxy->next; + + if (strcmp(proxy->client->virtual_user, args[0]) == 0) { + login_proxy_free(&proxy); + count++; + } + } + for (proxy = login_proxies_pending; proxy != NULL; proxy = next) { + next = proxy->next; + + if (strcmp(proxy->client->virtual_user, args[0]) == 0) { + client_destroy(proxy->client, "Connection killed"); + count++; + } + } + ipc_cmd_success_reply(&cmd, t_strdup_printf("%u", count)); +} + +static void +login_proxy_cmd_list_reply(struct ipc_cmd *cmd, + struct login_proxy *proxy) +{ + T_BEGIN { + const char *reply; + + reply = t_strdup_printf("%s\t%s\t%s\t%s\t%u", + proxy->client->virtual_user, + login_binary.protocol, + net_ip2addr(&proxy->client->ip), + net_ip2addr(&proxy->ip), proxy->port); + ipc_cmd_send(cmd, reply); + } T_END; +} + +static void +login_proxy_cmd_list(struct ipc_cmd *cmd, const char *const *args ATTR_UNUSED) +{ + struct login_proxy *proxy; + + for (proxy = login_proxies; proxy != NULL; proxy = proxy->next) + login_proxy_cmd_list_reply(cmd, proxy); + for (proxy = login_proxies_pending; proxy != NULL; proxy = proxy->next) + login_proxy_cmd_list_reply(cmd, proxy); + ipc_cmd_success(&cmd); +} + +static void login_proxy_ipc_cmd(struct ipc_cmd *cmd, const char *line) +{ + const char *const *args = t_strsplit(line, "\t"); + const char *name = args[0]; + + args++; + if (strcmp(name, "KILL") == 0) + login_proxy_cmd_kill(cmd, args); + else if (strcmp(name, "LIST") == 0) + login_proxy_cmd_list(cmd, args); + else + ipc_cmd_fail(&cmd, "Unknown command"); +} + void login_proxy_init(const char *proxy_notify_pipe_path) { proxy_state = login_proxy_state_init(proxy_notify_pipe_path); @@ -533,5 +625,7 @@ proxy = login_proxies; login_proxy_free(&proxy); } + if (login_proxy_ipc_server != NULL) + ipc_server_deinit(&login_proxy_ipc_server); login_proxy_state_deinit(&proxy_state); } From dovecot at dovecot.org Fri May 20 18:48:19 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 18:48:19 +0300 Subject: dovecot-2.0: Added support for a simplified IPC infrastructure. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/bf5c8ee58e5e changeset: 12818:bf5c8ee58e5e user: Timo Sirainen date: Fri May 20 18:45:29 2011 +0300 description: Added support for a simplified IPC infrastructure. The idea is that you have one "ipc" proxy process, where all server processes connect to. IPC clients can then connect to the proxy and ask it to forward commands to either a specific server or all servers. The proxy does this, and forwards back any replies from the server. diffstat: src/Makefile.am | 1 + src/ipc/Makefile.am | 25 ++++ src/ipc/client.c | 150 +++++++++++++++++++++++++++ src/ipc/client.h | 9 + src/ipc/ipc-connection.c | 242 ++++++++++++++++++++++++++++++++++++++++++++ src/ipc/ipc-connection.h | 45 ++++++++ src/ipc/ipc-group.c | 160 +++++++++++++++++++++++++++++ src/ipc/ipc-group.h | 43 +++++++ src/ipc/ipc-settings.c | 48 ++++++++ src/ipc/main.c | 66 ++++++++++++ src/lib-master/Makefile.am | 4 + src/lib-master/ipc-client.c | 163 +++++++++++++++++++++++++++++ src/lib-master/ipc-client.h | 20 +++ src/lib-master/ipc-server.c | 197 +++++++++++++++++++++++++++++++++++ src/lib-master/ipc-server.h | 20 +++ 15 files changed, 1193 insertions(+), 0 deletions(-) diffs (truncated from 1272 to 300 lines): diff -r c67ba5bf1ba9 -r bf5c8ee58e5e src/Makefile.am --- a/src/Makefile.am Fri May 20 14:21:51 2011 +0300 +++ b/src/Makefile.am Fri May 20 18:45:29 2011 +0300 @@ -24,6 +24,7 @@ auth \ dict \ dns \ + ipc \ master \ login-common \ imap-login \ diff -r c67ba5bf1ba9 -r bf5c8ee58e5e src/ipc/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ipc/Makefile.am Fri May 20 18:45:29 2011 +0300 @@ -0,0 +1,25 @@ +pkglibexecdir = $(libexecdir)/dovecot + +pkglibexec_PROGRAMS = ipc + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/lib-settings \ + -I$(top_srcdir)/src/lib-master + +ipc_LDADD = \ + $(LIBDOVECOT) \ + $(MODULE_LIBS) +ipc_DEPENDENCIES = $(LIBDOVECOT_DEPS) + +ipc_SOURCES = \ + client.c \ + main.c \ + ipc-connection.c \ + ipc-group.c \ + ipc-settings.c + +noinst_HEADERS = \ + client.h \ + ipc-connection.h \ + ipc-group.h diff -r c67ba5bf1ba9 -r bf5c8ee58e5e src/ipc/client.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ipc/client.c Fri May 20 18:45:29 2011 +0300 @@ -0,0 +1,150 @@ +/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "llist.h" +#include "ioloop.h" +#include "istream.h" +#include "ostream.h" +#include "master-service.h" +#include "ipc-group.h" +#include "ipc-connection.h" +#include "client.h" + +#include + +struct client { + struct client *prev, *next; + + int fd; + struct io *io; + struct istream *input; + struct ostream *output; +}; + +static struct client *clients; + +static void client_input(struct client *client); + +static void +client_cmd_input(enum ipc_cmd_status status, const char *line, void *context) +{ + struct client *client = context; + char chr = '\0'; + + switch (status) { + case IPC_CMD_STATUS_REPLY: + chr = ':'; + break; + case IPC_CMD_STATUS_OK: + chr = '+'; + break; + case IPC_CMD_STATUS_ERROR: + chr = '-'; + break; + } + + T_BEGIN { + o_stream_send_str(client->output, + t_strdup_printf("%c%s\n", chr, line)); + } T_END; + + if (status != IPC_CMD_STATUS_REPLY) { + i_assert(client->io == NULL); + client->io = io_add(client->fd, IO_READ, client_input, client); + client_input(client); + } +} + +static void client_input(struct client *client) +{ + struct ipc_group *group; + struct ipc_connection *conn; + char *line, *id, *data; + unsigned int id_num; + + while ((line = i_stream_read_next_line(client->input)) != NULL) { + /* *| */ + id = strchr(line, '\t'); + if (id == NULL) + data = NULL; + else { + *id++ = '\0'; + data = strchr(id, '\t'); + } + if (data == NULL || data[1] == '\0') { + o_stream_send_str(client->output, "-Invalid input\n"); + continue; + } + *data++ = '\0'; + + group = ipc_group_lookup_name(line); + if (group == NULL) { + o_stream_send_str(client->output, + t_strdup_printf("-Unknown IPC group: %s\n", line)); + continue; + } + + if (strcmp(id, "*") == 0) { + /* send to everyone */ + ipc_group_cmd(group, data, client_cmd_input, client); + } else if (str_to_uint(id, &id_num) < 0) { + o_stream_send_str(client->output, + t_strdup_printf("-Invalid IPC connection id: %s\n", id)); + continue; + } else if ((conn = ipc_connection_lookup_id(group, id_num)) == NULL) { + o_stream_send_str(client->output, + t_strdup_printf("-Unknown IPC connection id: %u\n", id_num)); + continue; + } else { + ipc_connection_cmd(conn, data, client_cmd_input, client); + } + + /* we'll handle commands one at a time. stop reading input + until this command is finished. */ + io_remove(&client->io); + break; + } + if (client->input->eof || client->input->stream_errno != 0) + client_destroy(&client); +} + +struct client *client_create(int fd) +{ + struct client *client; + + client = i_new(struct client, 1); + client->fd = fd; + client->io = io_add(fd, IO_READ, client_input, client); + client->input = i_stream_create_fd(fd, (size_t)-1, FALSE); + client->output = o_stream_create_fd(fd, (size_t)-1, FALSE); + + DLLIST_PREPEND(&clients, client); + return client; +} + +void client_destroy(struct client **_client) +{ + struct client *client = *_client; + + *_client = NULL; + + DLLIST_REMOVE(&clients, client); + if (client->io != NULL) + io_remove(&client->io); + i_stream_destroy(&client->input); + o_stream_destroy(&client->output); + if (close(client->fd) < 0) + i_error("close(client) failed: %m"); + i_free(client); + + master_service_client_connection_destroyed(master_service); +} + +void clients_destroy_all(void) +{ + while (clients != NULL) { + struct client *client = clients; + + client_destroy(&client); + } +} diff -r c67ba5bf1ba9 -r bf5c8ee58e5e src/ipc/client.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ipc/client.h Fri May 20 18:45:29 2011 +0300 @@ -0,0 +1,9 @@ +#ifndef CLIENT_H +#define CLIENT_H + +struct client *client_create(int fd); +void client_destroy(struct client **client); + +void clients_destroy_all(void); + +#endif diff -r c67ba5bf1ba9 -r bf5c8ee58e5e src/ipc/ipc-connection.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ipc/ipc-connection.c Fri May 20 18:45:29 2011 +0300 @@ -0,0 +1,242 @@ +/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "array.h" +#include "ioloop.h" +#include "istream.h" +#include "ostream.h" +#include "llist.h" +#include "master-service.h" +#include "ipc-group.h" +#include "ipc-connection.h" + +#include + +#define IPC_SERVER_PROTOCOL_MAJOR_VERSION 1 +#define IPC_SERVER_PROTOCOL_MINOR_VERSION 0 + +#define IPC_SERVER_HANDSHAKE "VERSION\tipc-proxy\t1\t0\n" + +static unsigned int connection_id_counter; +static void ipc_connection_cmd_free(struct ipc_connection_cmd **cmd); + +static void ipc_connection_cmd_free(struct ipc_connection_cmd **_cmd) +{ + struct ipc_connection_cmd *cmd = *_cmd; + struct ipc_connection_cmd **cmds; + unsigned int i, count; + + *_cmd = NULL; + + cmds = array_get_modifiable(&cmd->conn->cmds, &count); + for (i = 0; i < count; i++) { + if (cmds[i] == cmd) { + array_delete(&cmd->conn->cmds, i, 1); + break; + } + } + if (cmd->callback != NULL) { + cmd->callback(IPC_CMD_STATUS_ERROR, + "Connection to server died", cmd->context); + } + i_free(cmd); +} + +static struct ipc_connection_cmd * +ipc_connection_cmd_find(struct ipc_connection *conn, unsigned int tag) +{ + struct ipc_connection_cmd *const *cmdp; + + array_foreach(&conn->cmds, cmdp) { + if ((*cmdp)->tag == tag) + return *cmdp; + } + return NULL; +} + +static int +ipc_connection_input_line(struct ipc_connection *conn, char *line) +{ + struct ipc_connection_cmd *cmd; + unsigned int tag; + enum ipc_cmd_status status; + char *data; + + /* [:+-] */ + data = strchr(line, '\t'); + if (data == NULL) + return -1; + + *data++ = '\0'; + if (str_to_uint(line, &tag) < 0) + return -1; + + switch (data[0]) { + case ':': + status = IPC_CMD_STATUS_REPLY; + break; + case '+': + status = IPC_CMD_STATUS_OK; + break; + case '-': + status = IPC_CMD_STATUS_ERROR; + break; + default: + return -1; + } + data++; + + cmd = ipc_connection_cmd_find(conn, tag); From dovecot at dovecot.org Fri May 20 18:48:19 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 18:48:19 +0300 Subject: dovecot-2.0: doveadm: Added "proxy list" and "proxy kill" commands. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/f2874eef6b0b changeset: 12820:f2874eef6b0b user: Timo Sirainen date: Fri May 20 18:47:26 2011 +0300 description: doveadm: Added "proxy list" and "proxy kill" commands. diffstat: src/doveadm/Makefile.am | 1 + src/doveadm/doveadm-proxy.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ src/doveadm/doveadm.c | 1 + src/doveadm/doveadm.h | 1 + 4 files changed, 143 insertions(+), 0 deletions(-) diffs (177 lines): diff -r e4f7fb3b5a9c -r f2874eef6b0b src/doveadm/Makefile.am --- a/src/doveadm/Makefile.am Fri May 20 18:47:02 2011 +0300 +++ b/src/doveadm/Makefile.am Fri May 20 18:47:26 2011 +0300 @@ -95,6 +95,7 @@ doveadm-print-pager.c \ doveadm-print-tab.c \ doveadm-print-table.c \ + doveadm-proxy.c \ doveadm-pw.c \ doveadm-sis.c \ doveadm-who.c diff -r e4f7fb3b5a9c -r f2874eef6b0b src/doveadm/doveadm-proxy.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/doveadm/doveadm-proxy.c Fri May 20 18:47:26 2011 +0300 @@ -0,0 +1,140 @@ +/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "ioloop.h" +#include "ipc-client.h" +#include "doveadm.h" +#include "doveadm-print.h" + +#include +#include + +struct proxy_context { + struct ipc_client *ipc; +}; + +extern struct doveadm_cmd doveadm_cmd_proxy[]; + +static void proxy_cmd_help(doveadm_command_t *cmd) ATTR_NORETURN; + +static struct proxy_context * +cmd_proxy_init(int argc, char *argv[], const char *getopt_args, + doveadm_command_t *cmd) +{ + struct proxy_context *ctx; + const char *socket_path; + int c; + + ctx = t_new(struct proxy_context, 1); + socket_path = t_strconcat(doveadm_settings->base_dir, "/ipc", NULL); + + while ((c = getopt(argc, argv, getopt_args)) > 0) { + switch (c) { + case 'a': + socket_path = optarg; + break; + default: + proxy_cmd_help(cmd); + } + } + ctx->ipc = ipc_client_init(socket_path); + return ctx; +} + +static void cmd_proxy_list_callback(enum ipc_client_cmd_state state, + const char *data, void *context ATTR_UNUSED) +{ + switch (state) { + case IPC_CLIENT_CMD_STATE_REPLY: + T_BEGIN { + const char *const *args = t_strsplit(data, "\t"); + for (; *args != NULL; args++) + doveadm_print(*args); + } T_END; + return; + case IPC_CLIENT_CMD_STATE_OK: + break; + case IPC_CLIENT_CMD_STATE_ERROR: + i_error("LIST failed: %s", data); + break; + } + io_loop_stop(current_ioloop); +} + +static void cmd_proxy_list(int argc, char *argv[]) +{ + struct proxy_context *ctx; + + ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_list); + + doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE); + doveadm_print_header_simple("username"); + doveadm_print_header("service", "proto", 0); + doveadm_print_header("src-ip", "src ip", 0); + doveadm_print_header("dest-ip", "dest ip", 0); + doveadm_print_header("dest-port", "port", 0); + + ipc_client_cmd(ctx->ipc, "proxy\t*\tLIST", + cmd_proxy_list_callback, NULL); + io_loop_run(current_ioloop); + ipc_client_deinit(&ctx->ipc); +} + +static void cmd_proxy_kill_callback(enum ipc_client_cmd_state state, + const char *data, void *context ATTR_UNUSED) +{ + switch (state) { + case IPC_CLIENT_CMD_STATE_REPLY: + return; + case IPC_CLIENT_CMD_STATE_OK: + printf("%s connections killed\n", data); + break; + case IPC_CLIENT_CMD_STATE_ERROR: + i_error("KILL failed: %s", data); + break; + } + io_loop_stop(current_ioloop); +} + +static void cmd_proxy_kill(int argc, char *argv[]) +{ + struct proxy_context *ctx; + + ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_kill); + + if (argv[optind] == NULL) { + proxy_cmd_help(cmd_proxy_kill); + return; + } + + ipc_client_cmd(ctx->ipc, t_strdup_printf("proxy\t*\tKILL\t%s", argv[optind]), + cmd_proxy_kill_callback, NULL); + io_loop_run(current_ioloop); + ipc_client_deinit(&ctx->ipc); +} + +struct doveadm_cmd doveadm_cmd_proxy[] = { + { cmd_proxy_list, "proxy list", + "[-a ]" }, + { cmd_proxy_kill, "proxy kill", + "[-a ] " } +}; + +static void proxy_cmd_help(doveadm_command_t *cmd) +{ + unsigned int i; + + for (i = 0; i < N_ELEMENTS(doveadm_cmd_proxy); i++) { + if (doveadm_cmd_proxy[i].cmd == cmd) + help(&doveadm_cmd_proxy[i]); + } + i_unreached(); +} + +void doveadm_register_proxy_commands(void) +{ + unsigned int i; + + for (i = 0; i < N_ELEMENTS(doveadm_cmd_proxy); i++) + doveadm_register_cmd(&doveadm_cmd_proxy[i]); +} diff -r e4f7fb3b5a9c -r f2874eef6b0b src/doveadm/doveadm.c --- a/src/doveadm/doveadm.c Fri May 20 18:47:02 2011 +0300 +++ b/src/doveadm/doveadm.c Fri May 20 18:47:26 2011 +0300 @@ -316,6 +316,7 @@ } else { quick_init = FALSE; doveadm_register_director_commands(); + doveadm_register_proxy_commands(); doveadm_register_log_commands(); doveadm_dump_init(); doveadm_mail_init(); diff -r e4f7fb3b5a9c -r f2874eef6b0b src/doveadm/doveadm.h --- a/src/doveadm/doveadm.h Fri May 20 18:47:02 2011 +0300 +++ b/src/doveadm/doveadm.h Fri May 20 18:47:26 2011 +0300 @@ -34,6 +34,7 @@ void doveadm_master_send_signal(int signo); void doveadm_register_director_commands(void); +void doveadm_register_proxy_commands(void); void doveadm_register_log_commands(void); #endif From dovecot at dovecot.org Fri May 20 19:55:03 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 19:55:03 +0300 Subject: dovecot-2.0: login proxy: Show in disconnect reason who did the ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/d1c2cc4c513d changeset: 12821:d1c2cc4c513d user: Timo Sirainen date: Fri May 20 19:54:57 2011 +0300 description: login proxy: Show in disconnect reason who did the disconnection and possible error. diffstat: src/login-common/login-proxy.c | 60 +++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 12 deletions(-) diffs (147 lines): diff -r f2874eef6b0b -r d1c2cc4c513d src/login-common/login-proxy.c --- a/src/login-common/login-proxy.c Fri May 20 18:47:26 2011 +0300 +++ b/src/login-common/login-proxy.c Fri May 20 19:54:57 2011 +0300 @@ -22,6 +22,7 @@ #define LOGIN_PROXY_DNS_WARN_MSECS 500 #define LOGIN_PROXY_IPC_PATH "ipc-proxy" #define LOGIN_PROXY_IPC_NAME "proxy" +#define KILLED_BY_ADMIN_REASON "Killed by admin" struct login_proxy { struct login_proxy *prev, *next; @@ -58,6 +59,20 @@ static void login_proxy_ipc_cmd(struct ipc_cmd *cmd, const char *line); +static void +login_proxy_free_reason(struct login_proxy **_proxy, const char *reason); + +static void login_proxy_free_errno(struct login_proxy **proxy, + int err, const char *who) +{ + const char *reason; + + reason = err == 0 || err == EPIPE ? + t_strdup_printf("Disconnected by %s", who) : + t_strdup_printf("Disconnected by %s: %s", who, strerror(errno)); + login_proxy_free_reason(proxy, reason); +} + static void server_input(struct login_proxy *proxy) { unsigned char buf[OUTBUF_THRESHOLD]; @@ -73,8 +88,13 @@ } ret = net_receive(proxy->server_fd, buf, sizeof(buf)); - if (ret < 0 || o_stream_send(proxy->client_output, buf, ret) != ret) - login_proxy_free(&proxy); + if (ret < 0) + login_proxy_free_errno(&proxy, errno, "server"); + else if (o_stream_send(proxy->client_output, buf, ret) != ret) { + login_proxy_free_errno(&proxy, + proxy->client_output->stream_errno, + "client"); + } } static void proxy_client_input(struct login_proxy *proxy) @@ -92,15 +112,22 @@ } ret = net_receive(proxy->client_fd, buf, sizeof(buf)); - if (ret < 0 || o_stream_send(proxy->server_output, buf, ret) != ret) - login_proxy_free(&proxy); + if (ret < 0) + login_proxy_free_errno(&proxy, errno, "client"); + else if (o_stream_send(proxy->server_output, buf, ret) != ret) { + login_proxy_free_errno(&proxy, + proxy->server_output->stream_errno, + "server"); + } } static int server_output(struct login_proxy *proxy) { proxy->last_io = ioloop_time; if (o_stream_flush(proxy->server_output) < 0) { - login_proxy_free(&proxy); + login_proxy_free_errno(&proxy, + proxy->server_output->stream_errno, + "server"); return 1; } @@ -119,7 +146,9 @@ { proxy->last_io = ioloop_time; if (o_stream_flush(proxy->client_output) < 0) { - login_proxy_free(&proxy); + login_proxy_free_errno(&proxy, + proxy->client_output->stream_errno, + "client"); return 1; } @@ -301,7 +330,8 @@ return 0; } -void login_proxy_free(struct login_proxy **_proxy) +static void +login_proxy_free_reason(struct login_proxy **_proxy, const char *reason) { struct login_proxy *proxy = *_proxy; struct client *client = proxy->client; @@ -335,9 +365,10 @@ DLLIST_REMOVE(&login_proxies, proxy); ipstr = net_ip2addr(&proxy->client->ip); - i_info("proxy(%s): disconnecting %s", + i_info("proxy(%s): disconnecting %s%s", proxy->client->virtual_user, - ipstr != NULL ? ipstr : ""); + ipstr != NULL ? ipstr : "", + reason == NULL ? "" : t_strdup_printf(" (%s)", reason)); if (proxy->client_io != NULL) io_remove(&proxy->client_io); @@ -366,6 +397,11 @@ client_unref(&client); } +void login_proxy_free(struct login_proxy **_proxy) +{ + login_proxy_free_reason(_proxy, NULL); +} + bool login_proxy_is_ourself(const struct client *client, const char *host, unsigned int port, const char *destuser) { @@ -516,7 +552,7 @@ static void proxy_kill_idle(struct login_proxy *proxy) { - login_proxy_free(&proxy); + login_proxy_free_reason(&proxy, KILLED_BY_ADMIN_REASON); } void login_proxy_kill_idle(void) @@ -555,7 +591,7 @@ next = proxy->next; if (strcmp(proxy->client->virtual_user, args[0]) == 0) { - login_proxy_free(&proxy); + login_proxy_free_reason(&proxy, KILLED_BY_ADMIN_REASON); count++; } } @@ -623,7 +659,7 @@ while (login_proxies != NULL) { proxy = login_proxies; - login_proxy_free(&proxy); + login_proxy_free_reason(&proxy, KILLED_BY_ADMIN_REASON); } if (login_proxy_ipc_server != NULL) ipc_server_deinit(&login_proxy_ipc_server); From dovecot at dovecot.org Fri May 20 21:46:39 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Fri, 20 May 2011 21:46:39 +0300 Subject: dovecot-2.0: message header parser: Allow NULs in header name al... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/f8c378e8b461 changeset: 12822:f8c378e8b461 user: Timo Sirainen date: Fri May 20 21:46:32 2011 +0300 description: message header parser: Allow NULs in header name also when header is missing ':'. This doesn't fix any crashes/corruption unlike the earlier fix, but it makes the code more correct. Although it might help with mbox rewriting seeing some size mismatches (or might not). diffstat: src/lib-mail/message-header-parser.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r d1c2cc4c513d -r f8c378e8b461 src/lib-mail/message-header-parser.c --- a/src/lib-mail/message-header-parser.c Fri May 20 19:54:57 2011 +0300 +++ b/src/lib-mail/message-header-parser.c Fri May 20 21:46:32 2011 +0300 @@ -268,7 +268,7 @@ line->value_len = 0; str_truncate(ctx->name, 0); - str_append_n(ctx->name, msg, size); + buffer_append(ctx->name, msg, size); line->name = str_c(ctx->name); line->name_len = str_len(ctx->name); From dovecot at dovecot.org Mon May 23 14:54:20 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 23 May 2011 14:54:20 +0300 Subject: dovecot-2.0: director: Added support for moving user to another ... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/79f9dce5d5fd changeset: 12823:79f9dce5d5fd user: Timo Sirainen date: Mon May 23 14:54:02 2011 +0300 description: director: Added support for moving user to another server with "doveadm director move". diffstat: src/director/director-connection.c | 78 +++++++++++++- src/director/director-request.c | 9 +- src/director/director-test.sh | 3 +- src/director/director.c | 214 +++++++++++++++++++++++++++++++++++++ src/director/director.h | 9 + src/director/doveadm-connection.c | 37 ++++++ src/director/user-directory.c | 2 + src/director/user-directory.h | 26 ++++ src/doveadm/doveadm-director.c | 38 ++++++ src/login-common/login-proxy.c | 45 +++++++ 10 files changed, 456 insertions(+), 5 deletions(-) diffs (truncated from 654 to 300 lines): diff -r f8c378e8b461 -r 79f9dce5d5fd src/director/director-connection.c --- a/src/director/director-connection.c Fri May 20 21:46:32 2011 +0300 +++ b/src/director/director-connection.c Mon May 23 14:54:02 2011 +0300 @@ -348,8 +348,8 @@ net_addr2ip(args[0], &ip) < 0 || str_to_uint(args[1], &port) < 0 || str_to_uint(args[2], &seq) < 0) { - i_error("director(%s): Command is missing parameters", - conn->name); + i_error("director(%s): Command is missing parameters: %s", + conn->name, t_strarray_join(args, " ")); return -1; } *_args = args + 3; @@ -475,6 +475,74 @@ return TRUE; } +static bool +director_cmd_user_move(struct director_connection *conn, + const char *const *args) +{ + struct director_host *dir_host; + struct mail_host *host; + struct ip_addr ip; + unsigned int username_hash; + int ret; + + if ((ret = director_cmd_is_seen(conn, &args, &dir_host)) != 0) + return ret > 0; + + if (str_array_length(args) != 2 || + str_to_uint(args[0], &username_hash) < 0 || + net_addr2ip(args[1], &ip) < 0) { + i_error("director(%s): Invalid USER-MOVE args", conn->name); + return FALSE; + } + + host = mail_host_lookup(conn->dir->mail_hosts, &ip); + if (host != NULL) { + director_move_user(conn->dir, conn->host, dir_host, + username_hash, host); + } + return TRUE; +} + +static bool +director_cmd_user_killed(struct director_connection *conn, + const char *const *args) +{ + struct director_host *dir_host; + unsigned int username_hash; + + if (str_array_length(args) != 1 || + str_to_uint(args[0], &username_hash) < 0) { + i_error("director(%s): Invalid USER-KILLED args", conn->name); + return FALSE; + } + + director_user_killed(conn->dir, username_hash); + return TRUE; +} + +static bool +director_cmd_user_killed_everywhere(struct director_connection *conn, + const char *const *args) +{ + struct director_host *dir_host; + unsigned int username_hash; + int ret; + + if ((ret = director_cmd_is_seen(conn, &args, &dir_host)) != 0) + return ret > 0; + + if (str_array_length(args) != 1 || + str_to_uint(args[0], &username_hash) < 0) { + i_error("director(%s): Invalid USER-KILLED-EVERYWHERE args", + conn->name); + return FALSE; + } + + director_user_killed_everywhere(conn->dir, conn->host, + dir_host, username_hash); + return TRUE; +} + static void director_handshake_cmd_done(struct director_connection *conn) { struct director *dir = conn->dir; @@ -766,6 +834,12 @@ return director_cmd_host_remove(conn, args); if (strcmp(cmd, "HOST-FLUSH") == 0) return director_cmd_host_flush(conn, args); + if (strcmp(cmd, "USER-MOVE") == 0) + return director_cmd_user_move(conn, args); + if (strcmp(cmd, "USER-KILLED") == 0) + return director_cmd_user_killed(conn, args); + if (strcmp(cmd, "USER-KILLED-EVERYWHERE") == 0) + return director_cmd_user_killed_everywhere(conn, args); if (strcmp(cmd, "DIRECTOR") == 0) return director_cmd_director(conn, args); if (strcmp(cmd, "SYNC") == 0) diff -r f8c378e8b461 -r 79f9dce5d5fd src/director/director-request.c --- a/src/director/director-request.c Fri May 20 21:46:32 2011 +0300 +++ b/src/director/director-request.c Mon May 23 14:54:02 2011 +0300 @@ -102,9 +102,14 @@ } user = user_directory_lookup(dir->users, request->username_hash); - if (user != NULL) + if (user != NULL) { + if (user->kill_state != USER_KILL_STATE_NONE) { + /* delay processing this user's connections until + its existing connections have been killed */ + return FALSE; + } user_directory_refresh(dir->users, user); - else { + } else { if (!dir->ring_synced) { /* delay adding new users until ring is again synced */ ring_log_delayed_warning(dir); diff -r f8c378e8b461 -r 79f9dce5d5fd src/director/director-test.sh --- a/src/director/director-test.sh Fri May 20 21:46:32 2011 +0300 +++ b/src/director/director-test.sh Mon May 23 14:54:02 2011 +0300 @@ -10,7 +10,7 @@ while [ $i != $director_count ]; do i=`expr $i + 1` dirs="$dirs 127.0.1.$i" - echo "director 127.0.1.$i" + echo "127.0.1.$i director" cat > dovecot-director$i.conf <host->ip))); } +struct director_user_kill_finish_ctx { + struct director *dir; + struct user *user; +}; + +static void +director_user_kill_finish_delayed_to(struct director_user_kill_finish_ctx *ctx) +{ + i_assert(ctx->user->kill_state == USER_KILL_STATE_DELAY); + + ctx->user->kill_state = USER_KILL_STATE_NONE; + timeout_remove(&ctx->user->to_move); + + ctx->dir->state_change_callback(ctx->dir); + i_free(ctx); +} + +static void +director_user_kill_finish_delayed(struct director *dir, struct user *user) +{ + struct director_user_kill_finish_ctx *ctx; + + ctx = i_new(struct director_user_kill_finish_ctx, 1); + ctx->dir = dir; + ctx->user = user; + + user->kill_state = USER_KILL_STATE_DELAY; + timeout_remove(&user->to_move); + + user->to_move = timeout_add(DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS, + director_user_kill_finish_delayed_to, ctx); +} + +struct director_kill_context { + struct director *dir; + unsigned int username_hash; + bool self; +}; + +static void +director_finish_user_kill(struct director *dir, struct user *user, bool self) +{ + if (dir->right == NULL || dir->right == dir->left) { + /* we're alone */ + director_user_kill_finish_delayed(dir, user); + } else if (self || + user->kill_state == USER_KILL_STATE_KILLING_NOTIFY_RECEIVED) { + director_connection_send(dir->right, t_strdup_printf( + "USER-KILLED\t%u\n", user->username_hash)); + user->kill_state = USER_KILL_STATE_KILLED_WAITING_FOR_EVERYONE; + } else { + i_assert(user->kill_state == USER_KILL_STATE_KILLING); + user->kill_state = USER_KILL_STATE_KILLED_WAITING_FOR_NOTIFY; + } +} + +static void director_kill_user_callback(enum ipc_client_cmd_state state, + const char *data, void *context) +{ + struct director_kill_context *ctx = context; + struct user *user; + + switch (state) { + case IPC_CLIENT_CMD_STATE_REPLY: + return; + case IPC_CLIENT_CMD_STATE_OK: + break; + case IPC_CLIENT_CMD_STATE_ERROR: + i_error("Failed to kill user %u connections: %s", + ctx->username_hash, data); + /* we can't really do anything but continue anyway */ + break; + } + + user = user_directory_lookup(ctx->dir->users, ctx->username_hash); + if (user == NULL || user->kill_state == USER_KILL_STATE_NONE) + return; + + director_finish_user_kill(ctx->dir, user, ctx->self); +} + +static void director_user_move_timeout(struct user *user) +{ + i_error("Finishing user %u move timed out, " + "its state may now be inconsistent", user->username_hash); + + user->kill_state = USER_KILL_STATE_NONE; + timeout_remove(&user->to_move); +} + +void director_move_user(struct director *dir, struct director_host *src, + struct director_host *orig_src, + unsigned int username_hash, struct mail_host *host) +{ + struct user *user; + const char *cmd; + struct director_kill_context *ctx; + + /* 1. move this user's host, and set its "killing" flag to delay all of + its future connections until all directors have killed the + connections and notified us about it. + + 2. tell the other directors about the move + + 3. once user kill callback is called, tell the other directors + with USER-KILLED that we're done killing the user. + + 4. when some director gets a duplicate USER-KILLED, it's + responsible for notifying all directors that user is completely + killed. + + 5. after receiving USER-KILLED-EVERYWHERE notification, + new connections are again allowed for the user. + */ + user = user_directory_lookup(dir->users, username_hash); + if (user == NULL) { + user = user_directory_add(dir->users, username_hash, + host, ioloop_time); + } else { + if (user->host == host) { + /* user is already in this host */ + return; + } + user->host->user_count--; + user->host = host; + user->host->user_count++; + user->timestamp = ioloop_time; + } + if (user->kill_state == USER_KILL_STATE_NONE) { + ctx = i_new(struct director_kill_context, 1); + ctx->dir = dir; From dovecot at dovecot.org Mon May 23 15:05:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 23 May 2011 15:05:21 +0300 Subject: dovecot-2.0: ipc: Fixes when sending commands to an empty group. Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/6bb200302acd changeset: 12824:6bb200302acd user: Timo Sirainen date: Mon May 23 15:04:36 2011 +0300 description: ipc: Fixes when sending commands to an empty group. diffstat: src/ipc/client.c | 32 ++++++++++++++++++++------------ src/ipc/ipc-group.c | 5 +++-- src/ipc/ipc-group.h | 5 +++-- 3 files changed, 26 insertions(+), 16 deletions(-) diffs (115 lines): diff -r 79f9dce5d5fd -r 6bb200302acd src/ipc/client.c --- a/src/ipc/client.c Mon May 23 14:54:02 2011 +0300 +++ b/src/ipc/client.c Mon May 23 15:04:36 2011 +0300 @@ -48,8 +48,7 @@ t_strdup_printf("%c%s\n", chr, line)); } T_END; - if (status != IPC_CMD_STATUS_REPLY) { - i_assert(client->io == NULL); + if (status != IPC_CMD_STATUS_REPLY && client->io == NULL) { client->io = io_add(client->fd, IO_READ, client_input, client); client_input(client); } @@ -61,6 +60,7 @@ struct ipc_connection *conn; char *line, *id, *data; unsigned int id_num; + bool ret; while ((line = i_stream_read_next_line(client->input)) != NULL) { /* *| */ @@ -78,31 +78,39 @@ *data++ = '\0'; group = ipc_group_lookup_name(line); - if (group == NULL) { - o_stream_send_str(client->output, - t_strdup_printf("-Unknown IPC group: %s\n", line)); - continue; - } + ret = FALSE; if (strcmp(id, "*") == 0) { /* send to everyone */ - ipc_group_cmd(group, data, client_cmd_input, client); + if (group == NULL) { + client_cmd_input(IPC_CMD_STATUS_OK, + NULL, client); + } else { + ret = ipc_group_cmd(group, data, + client_cmd_input, client); + } } else if (str_to_uint(id, &id_num) < 0) { o_stream_send_str(client->output, t_strdup_printf("-Invalid IPC connection id: %s\n", id)); continue; + } else if (group == NULL) { + o_stream_send_str(client->output, + t_strdup_printf("-Unknown IPC group: %s\n", line)); } else if ((conn = ipc_connection_lookup_id(group, id_num)) == NULL) { o_stream_send_str(client->output, t_strdup_printf("-Unknown IPC connection id: %u\n", id_num)); continue; } else { ipc_connection_cmd(conn, data, client_cmd_input, client); + ret = TRUE; } - /* we'll handle commands one at a time. stop reading input - until this command is finished. */ - io_remove(&client->io); - break; + if (ret) { + /* we'll handle commands one at a time. stop reading + input until this command is finished. */ + io_remove(&client->io); + break; + } } if (client->input->eof || client->input->stream_errno != 0) client_destroy(&client); diff -r 79f9dce5d5fd -r 6bb200302acd src/ipc/ipc-group.c --- a/src/ipc/ipc-group.c Mon May 23 14:54:02 2011 +0300 +++ b/src/ipc/ipc-group.c Mon May 23 15:04:36 2011 +0300 @@ -113,7 +113,7 @@ } -void ipc_group_cmd(struct ipc_group *group, const char *cmd, +bool ipc_group_cmd(struct ipc_group *group, const char *cmd, ipc_cmd_callback_t *callback, void *context) { struct ipc_connection *conn, *next; @@ -121,7 +121,7 @@ if (group->connections == NULL) { callback(IPC_CMD_STATUS_OK, NULL, context); - return; + return FALSE; } group_cmd = i_new(struct ipc_group_cmd, 1); @@ -135,6 +135,7 @@ ipc_connection_cmd(conn, cmd, ipc_group_cmd_callback, group_cmd); } + return TRUE; } void ipc_groups_init(void) diff -r 79f9dce5d5fd -r 6bb200302acd src/ipc/ipc-group.h --- a/src/ipc/ipc-group.h Mon May 23 14:54:02 2011 +0300 +++ b/src/ipc/ipc-group.h Mon May 23 15:04:36 2011 +0300 @@ -33,8 +33,9 @@ int ipc_group_update_name(struct ipc_group *group, const char *name); /* Send a command to all connections in a group. All connections are expected - to answer something. All replies are */ -void ipc_group_cmd(struct ipc_group *group, const char *cmd, + to answer something. If there are no connections, callback() is called + immediately and FALSE is returned. */ +bool ipc_group_cmd(struct ipc_group *group, const char *cmd, ipc_cmd_callback_t *callback, void *context); void ipc_groups_init(void); From dovecot at dovecot.org Mon May 23 15:05:21 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 23 May 2011 15:05:21 +0300 Subject: dovecot-2.0: director: Changed the "user killed" delay from 12 s... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/2bfdd566c149 changeset: 12825:2bfdd566c149 user: Timo Sirainen date: Mon May 23 15:05:13 2011 +0300 description: director: Changed the "user killed" delay from 12 secs to 2 secs. It was 12 secs only for testing. diffstat: src/director/director.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 6bb200302acd -r 2bfdd566c149 src/director/director.c --- a/src/director/director.c Mon May 23 15:04:36 2011 +0300 +++ b/src/director/director.c Mon May 23 15:05:13 2011 +0300 @@ -16,7 +16,7 @@ #define DIRECTOR_RECONNECT_RETRY_SECS 60 #define DIRECTOR_RECONNECT_TIMEOUT_MSECS (30*1000) #define DIRECTOR_USER_MOVE_TIMEOUT_MSECS (30*1000) -#define DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS (12*1000) +#define DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS (2*1000) static bool director_is_self_ip_set(struct director *dir) { From dovecot at dovecot.org Mon May 23 16:26:33 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Mon, 23 May 2011 16:26:33 +0300 Subject: dovecot-2.0: configure: Added missing ipc Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/9127a988acb8 changeset: 12826:9127a988acb8 user: Timo Sirainen date: Mon May 23 16:26:21 2011 +0300 description: configure: Added missing ipc diffstat: configure.in | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 2bfdd566c149 -r 9127a988acb8 configure.in --- a/configure.in Mon May 23 15:05:13 2011 +0300 +++ b/configure.in Mon May 23 16:26:21 2011 +0300 @@ -2687,6 +2687,7 @@ src/dict/Makefile src/director/Makefile src/dns/Makefile +src/ipc/Makefile src/imap/Makefile src/imap-login/Makefile src/login-common/Makefile From dovecot at dovecot.org Tue May 24 20:07:32 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 24 May 2011 20:07:32 +0300 Subject: dovecot-2.0: doveadm proxy: s/kill/kick/ and related internal co... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/936f6c2ddfdd changeset: 12827:936f6c2ddfdd user: Timo Sirainen date: Tue May 24 20:06:24 2011 +0300 description: doveadm proxy: s/kill/kick/ and related internal code changes. Mainly for consistency, because "doveadm kick" already existed. diffstat: src/director/director.c | 2 +- src/doveadm/doveadm-proxy.c | 18 +++++++++--------- src/login-common/login-proxy.c | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diffs (122 lines): diff -r 9127a988acb8 -r 936f6c2ddfdd src/director/director.c --- a/src/director/director.c Mon May 23 16:26:21 2011 +0300 +++ b/src/director/director.c Tue May 24 20:06:24 2011 +0300 @@ -488,7 +488,7 @@ user->to_move = timeout_add(DIRECTOR_USER_MOVE_TIMEOUT_MSECS, director_user_move_timeout, user); user->kill_state = USER_KILL_STATE_KILLING; - cmd = t_strdup_printf("proxy\t*\tKILL-DIRECTOR-HASH\t%u", + cmd = t_strdup_printf("proxy\t*\tKICK-DIRECTOR-HASH\t%u", username_hash); ipc_client_cmd(dir->ipc_proxy, cmd, director_kill_user_callback, ctx); diff -r 9127a988acb8 -r 936f6c2ddfdd src/doveadm/doveadm-proxy.c --- a/src/doveadm/doveadm-proxy.c Mon May 23 16:26:21 2011 +0300 +++ b/src/doveadm/doveadm-proxy.c Tue May 24 20:06:24 2011 +0300 @@ -80,35 +80,35 @@ ipc_client_deinit(&ctx->ipc); } -static void cmd_proxy_kill_callback(enum ipc_client_cmd_state state, +static void cmd_proxy_kick_callback(enum ipc_client_cmd_state state, const char *data, void *context ATTR_UNUSED) { switch (state) { case IPC_CLIENT_CMD_STATE_REPLY: return; case IPC_CLIENT_CMD_STATE_OK: - printf("%s connections killed\n", data); + printf("%s connections kicked\n", data); break; case IPC_CLIENT_CMD_STATE_ERROR: - i_error("KILL failed: %s", data); + i_error("KICK failed: %s", data); break; } io_loop_stop(current_ioloop); } -static void cmd_proxy_kill(int argc, char *argv[]) +static void cmd_proxy_kick(int argc, char *argv[]) { struct proxy_context *ctx; - ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_kill); + ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_kick); if (argv[optind] == NULL) { - proxy_cmd_help(cmd_proxy_kill); + proxy_cmd_help(cmd_proxy_kick); return; } - ipc_client_cmd(ctx->ipc, t_strdup_printf("proxy\t*\tKILL\t%s", argv[optind]), - cmd_proxy_kill_callback, NULL); + ipc_client_cmd(ctx->ipc, t_strdup_printf("proxy\t*\tKICK\t%s", argv[optind]), + cmd_proxy_kick_callback, NULL); io_loop_run(current_ioloop); ipc_client_deinit(&ctx->ipc); } @@ -116,7 +116,7 @@ struct doveadm_cmd doveadm_cmd_proxy[] = { { cmd_proxy_list, "proxy list", "[-a ]" }, - { cmd_proxy_kill, "proxy kill", + { cmd_proxy_kick, "proxy kick", "[-a ] " } }; diff -r 9127a988acb8 -r 936f6c2ddfdd src/login-common/login-proxy.c --- a/src/login-common/login-proxy.c Mon May 23 16:26:21 2011 +0300 +++ b/src/login-common/login-proxy.c Tue May 24 20:06:24 2011 +0300 @@ -577,7 +577,7 @@ } static void -login_proxy_cmd_kill(struct ipc_cmd *cmd, const char *const *args) +login_proxy_cmd_kick(struct ipc_cmd *cmd, const char *const *args) { struct login_proxy *proxy, *next; unsigned int count = 0; @@ -599,7 +599,7 @@ next = proxy->next; if (strcmp(proxy->client->virtual_user, args[0]) == 0) { - client_destroy(proxy->client, "Connection killed"); + client_destroy(proxy->client, "Connection kicked"); count++; } } @@ -620,7 +620,7 @@ } static void -login_proxy_cmd_kill_director_hash(struct ipc_cmd *cmd, const char *const *args) +login_proxy_cmd_kick_director_hash(struct ipc_cmd *cmd, const char *const *args) { struct login_proxy *proxy, *next; unsigned int hash, count = 0; @@ -642,7 +642,7 @@ next = proxy->next; if (director_username_hash(proxy->client->virtual_user) == hash) { - client_destroy(proxy->client, "Connection killed"); + client_destroy(proxy->client, "Connection kicked"); count++; } } @@ -683,10 +683,10 @@ const char *name = args[0]; args++; - if (strcmp(name, "KILL") == 0) - login_proxy_cmd_kill(cmd, args); - else if (strcmp(name, "KILL-DIRECTOR-HASH") == 0) - login_proxy_cmd_kill_director_hash(cmd, args); + if (strcmp(name, "KICK") == 0) + login_proxy_cmd_kick(cmd, args); + else if (strcmp(name, "KICK-DIRECTOR-HASH") == 0) + login_proxy_cmd_kick_director_hash(cmd, args); else if (strcmp(name, "LIST") == 0) login_proxy_cmd_list(cmd, args); else From dovecot at dovecot.org Tue May 31 15:36:32 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 31 May 2011 15:36:32 +0300 Subject: dovecot-2.0: liblib: Added uni_utf8_to_ucs4_n(). Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/7a7c22755b7a changeset: 12828:7a7c22755b7a user: Timo Sirainen date: Tue May 31 15:36:22 2011 +0300 description: liblib: Added uni_utf8_to_ucs4_n(). diffstat: src/lib/unichar.c | 20 ++++++++++++++++++++ src/lib/unichar.h | 2 ++ 2 files changed, 22 insertions(+), 0 deletions(-) diffs (42 lines): diff -r 936f6c2ddfdd -r 7a7c22755b7a src/lib/unichar.c --- a/src/lib/unichar.c Tue May 24 20:06:24 2011 +0300 +++ b/src/lib/unichar.c Tue May 31 15:36:22 2011 +0300 @@ -112,6 +112,26 @@ return 0; } +int uni_utf8_to_ucs4_n(const unsigned char *input, size_t size, + ARRAY_TYPE(unichars) *output) +{ + unichar_t chr; + unsigned int len; + + while (size > 0) { + if (uni_utf8_get_char_n(input, size, &chr) <= 0) { + /* invalid input */ + return -1; + } + len = uni_utf8_char_bytes(*input); + i_assert(len <= size); + input += len; size -= len; + + array_append(output, &chr, 1); + } + return 0; +} + void uni_ucs4_to_utf8(const unichar_t *input, size_t len, buffer_t *output) { for (; len > 0 && *input != '\0'; input++, len--) diff -r 936f6c2ddfdd -r 7a7c22755b7a src/lib/unichar.h --- a/src/lib/unichar.h Tue May 24 20:06:24 2011 +0300 +++ b/src/lib/unichar.h Tue May 31 15:36:22 2011 +0300 @@ -35,6 +35,8 @@ /* Translates UTF-8 input to UCS-4 output. Returns 0 if ok, -1 if input was invalid */ int uni_utf8_to_ucs4(const char *input, ARRAY_TYPE(unichars) *output); +int uni_utf8_to_ucs4_n(const unsigned char *input, size_t size, + ARRAY_TYPE(unichars) *output); /* Translates UCS-4 input to UTF-8 output. */ void uni_ucs4_to_utf8(const unichar_t *input, size_t len, buffer_t *output); void uni_ucs4_to_utf8_c(unichar_t chr, buffer_t *output); From dovecot at dovecot.org Tue May 31 15:38:11 2011 From: dovecot at dovecot.org (dovecot at dovecot.org) Date: Tue, 31 May 2011 15:38:11 +0300 Subject: dovecot-2.0: fts-lucene: Fixes to work with CLucene v2.3.3.4 and... Message-ID: details: http://hg.dovecot.org/dovecot-2.0/rev/9ae30e5d6935 changeset: 12829:9ae30e5d6935 user: Timo Sirainen date: Tue May 31 15:38:03 2011 +0300 description: fts-lucene: Fixes to work with CLucene v2.3.3.4 and new FTS API. It's still not recommended to actually use this. diffstat: src/plugins/fts-lucene/Makefile.am | 2 +- src/plugins/fts-lucene/fts-backend-lucene.c | 71 ++++++++++--- src/plugins/fts-lucene/lucene-wrapper.cc | 149 ++++++++++++--------------- 3 files changed, 121 insertions(+), 101 deletions(-) diffs (truncated from 397 to 300 lines): diff -r 7a7c22755b7a -r 9ae30e5d6935 src/plugins/fts-lucene/Makefile.am --- a/src/plugins/fts-lucene/Makefile.am Tue May 31 15:36:22 2011 +0300 +++ b/src/plugins/fts-lucene/Makefile.am Tue May 31 15:38:03 2011 +0300 @@ -12,7 +12,7 @@ lib21_fts_lucene_plugin.la lib21_fts_lucene_plugin_la_LIBADD = \ - -lclucene + -lclucene-shared -lclucene-core lib21_fts_lucene_plugin_la_SOURCES = \ fts-lucene-plugin.c \ diff -r 7a7c22755b7a -r 9ae30e5d6935 src/plugins/fts-lucene/fts-backend-lucene.c --- a/src/plugins/fts-lucene/fts-backend-lucene.c Tue May 31 15:36:22 2011 +0300 +++ b/src/plugins/fts-lucene/fts-backend-lucene.c Tue May 31 15:38:03 2011 +0300 @@ -24,8 +24,13 @@ struct fts_backend backend; struct lucene_mail_storage *lstorage; struct mailbox *box; +}; - uint32_t last_uid; +struct lucene_fts_backend_build_context { + struct fts_backend_build_context ctx; + + uint32_t uid; + bool hdr; }; static MODULE_CONTEXT_DEFINE_INIT(fts_lucene_storage_module, @@ -110,38 +115,69 @@ { struct lucene_fts_backend *backend = (struct lucene_fts_backend *)_backend; - struct fts_backend_build_context *ctx; + struct lucene_fts_backend_build_context *ctx; + uint32_t last_uid; fts_backend_select(backend); if (lucene_index_build_init(backend->lstorage->index, - &backend->last_uid) < 0) + &last_uid) < 0) return -1; - ctx = i_new(struct fts_backend_build_context, 1); - ctx->backend = _backend; + ctx = i_new(struct lucene_fts_backend_build_context, 1); + ctx->ctx.backend = _backend; + ctx->uid = last_uid + 1; - *last_uid_r = backend->last_uid; - *ctx_r = ctx; + *last_uid_r = last_uid; + *ctx_r = &ctx->ctx; return 0; } +static void +fts_backend_lucene_build_hdr(struct fts_backend_build_context *_ctx, + uint32_t uid) +{ + struct lucene_fts_backend_build_context *ctx = + (struct lucene_fts_backend_build_context *)_ctx; + + i_assert(uid >= ctx->uid); + + ctx->uid = uid; + ctx->hdr = TRUE; +} + +static bool +fts_backend_lucene_build_body_begin(struct fts_backend_build_context *_ctx, + uint32_t uid, const char *content_type, + const char *content_disposition ATTR_UNUSED) +{ + struct lucene_fts_backend_build_context *ctx = + (struct lucene_fts_backend_build_context *)_ctx; + + i_assert(uid >= ctx->uid); + + if (!fts_backend_default_can_index(content_type)) + return FALSE; + + ctx->uid = uid; + ctx->hdr = FALSE; + return TRUE; +} + static int -fts_backend_lucene_build_more(struct fts_backend_build_context *ctx, - uint32_t uid, const unsigned char *data, - size_t size, bool headers) +fts_backend_lucene_build_more(struct fts_backend_build_context *_ctx, + const unsigned char *data, size_t size) { + struct lucene_fts_backend_build_context *ctx = + (struct lucene_fts_backend_build_context *)_ctx; struct lucene_fts_backend *backend = - (struct lucene_fts_backend *)ctx->backend; + (struct lucene_fts_backend *)_ctx->backend; - if (ctx->failed) + if (_ctx->failed) return -1; - i_assert(uid >= backend->last_uid); - backend->last_uid = uid; - i_assert(backend->lstorage->selected_box == backend->box); return lucene_index_build_more(backend->lstorage->index, - uid, data, size, headers); + ctx->uid, data, size, ctx->hdr); } static int @@ -212,6 +248,9 @@ fts_backend_lucene_get_last_uid, NULL, fts_backend_lucene_build_init, + fts_backend_lucene_build_hdr, + fts_backend_lucene_build_body_begin, + NULL, fts_backend_lucene_build_more, fts_backend_lucene_build_deinit, fts_backend_lucene_expunge, diff -r 7a7c22755b7a -r 9ae30e5d6935 src/plugins/fts-lucene/lucene-wrapper.cc --- a/src/plugins/fts-lucene/lucene-wrapper.cc Tue May 31 15:36:22 2011 +0300 +++ b/src/plugins/fts-lucene/lucene-wrapper.cc Tue May 31 15:38:03 2011 +0300 @@ -33,8 +33,7 @@ struct lucene_index { char *path, *lock_path; - char *mailbox_name; - TCHAR *tmailbox_name; + wchar_t *mailbox_name; time_t last_stale_check; bool lock_error; @@ -48,45 +47,6 @@ uint32_t prev_uid, last_uid; }; -class RawTokenStream : public TokenStream { - CL_NS(util)::Reader *reader; - -public: - RawTokenStream(CL_NS(util)::Reader *reader) { - this->reader = reader; - }; - - bool next(Token *token) { - const TCHAR *data; - - int32_t len = this->reader->read(data); - if (len <= 0) - return false; - - token->set(data, 0, len); - return true; - } - - void close() { } -}; - -class DovecotAnalyzer : public standard::StandardAnalyzer { -public: - TokenStream *tokenStream(const TCHAR *fieldName, - CL_NS(util)::Reader *reader) { - /* Everything except body/headers should go as-is without any - modifications. Isn't there any easier way to do this than - to implement a whole new RawTokenStream?.. */ - if (fieldName != 0 && - wcscmp(fieldName, L"headers") != 0 && - wcscmp(fieldName, L"body") != 0) - return _CLNEW RawTokenStream(reader); - - return standard::StandardAnalyzer:: - tokenStream(fieldName, reader); - } -}; - static bool lucene_dir_scan(const char *dir, const char *skip_path, time_t stale_stamp, bool unlink_staled) { @@ -174,7 +134,7 @@ index = i_new(struct lucene_index, 1); index->path = i_strdup(path); index->lock_path = i_strdup(lock_path); - index->analyzer = _CLNEW DovecotAnalyzer(); + index->analyzer = _CLNEW standard::StandardAnalyzer(); lucene_delete_stale_locks(index); return index; @@ -192,24 +152,54 @@ lucene_index_close(index); _CLDELETE(index->analyzer); i_free(index->mailbox_name); - i_free(index->tmailbox_name); i_free(index->path); i_free(index->lock_path); i_free(index); } +static void +lucene_utf8_to_tchar(const char *src, wchar_t *dest, size_t destsize) +{ + ARRAY_TYPE(unichars) dest_arr; + buffer_t buf = { 0, 0 }; + + i_assert(sizeof(wchar_t) == sizeof(unichar_t)); + + buffer_create_data(&buf, dest, sizeof(wchar_t) * destsize); + array_create_from_buffer(&dest_arr, &buf, sizeof(wchar_t)); + if (uni_utf8_to_ucs4(src, &dest_arr) < 0) + i_unreached(); + i_assert(array_count(&dest_arr)+1 == destsize); + dest[destsize-1] = 0; +} + +static void +lucene_utf8_n_to_tchar(const unsigned char *src, size_t srcsize, + wchar_t *dest, size_t destsize) +{ + ARRAY_TYPE(unichars) dest_arr; + buffer_t buf = { 0, 0 }; + + i_assert(sizeof(wchar_t) == sizeof(unichar_t)); + + buffer_create_data(&buf, dest, sizeof(wchar_t) * destsize); + array_create_from_buffer(&dest_arr, &buf, sizeof(wchar_t)); + if (uni_utf8_to_ucs4_n(src, srcsize, &dest_arr) < 0) + i_unreached(); + i_assert(array_count(&dest_arr)+1 == destsize); + dest[destsize-1] = 0; +} + void lucene_index_select_mailbox(struct lucene_index *index, const char *mailbox_name) { - size_t len; + size_t size; i_free(index->mailbox_name); - i_free(index->tmailbox_name); - len = strlen(mailbox_name); - index->mailbox_name = i_strdup(mailbox_name); - index->tmailbox_name = i_new(TCHAR, len + 1); - STRCPY_AtoT(index->tmailbox_name, mailbox_name, len); + size = uni_utf8_strlen_n(mailbox_name, (size_t)-1) + 1; + index->mailbox_name = i_new(wchar_t, size); + lucene_utf8_to_tchar(mailbox_name, index->mailbox_name, size); } static void lucene_handle_error(struct lucene_index *index, CLuceneError &err, @@ -265,7 +255,7 @@ const TCHAR *field_name, uint32_t *uid_r) { Field *field = doc->getField(field_name); - TCHAR *uid = field == NULL ? NULL : field->stringValue(); + const TCHAR *uid = field == NULL ? NULL : field->stringValue(); if (uid == NULL) { i_error("lucene: Corrupted FTS index %s: No UID for document", index->path); @@ -298,7 +288,7 @@ if there are more than one, delete the smaller ones. this is normal behavior because we can't update/delete documents in writer, so we'll do it only in here.. */ - Term mailbox_term(_T("box"), index->tmailbox_name); + Term mailbox_term(_T("box"), index->mailbox_name); Term last_uid_term(_T("last_uid"), _T("*")); TermQuery mailbox_query(&mailbox_term); WildcardQuery last_uid_query(&last_uid_term); @@ -421,49 +411,43 @@ const unsigned char *data, size_t size, bool headers) { - unsigned int len; + size_t destsize; i_assert(uid > index->last_uid); i_assert(size > 0); - len = uni_utf8_strlen_n(data, size); - wchar_t dest[len+1]; - lucene_utf8towcs(dest, (const char *)data, len); - dest[len] = 0; + destsize = uni_utf8_strlen_n(data, size) + 1; + wchar_t dest[destsize]; + lucene_utf8_n_to_tchar(data, size, dest, destsize); if (uid != index->prev_uid) { - char id[MAX_INT_STRLEN]; - TCHAR tid[MAX_INT_STRLEN]; + wchar_t id[MAX_INT_STRLEN]; if (lucene_index_build_flush(index) < 0) return -1; index->prev_uid = uid;