Date: Thu, 10 Apr 2003 12:00:32 -0700 (PDT) From: Dominic Marks <dom@cus.org.uk> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/50615: PR Fix (x2): mail/dovecot Message-ID: <200304101900.h3AJ0W5H037894@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/50615; it has been noted by GNATS. From: Dominic Marks <dom@cus.org.uk> To: freebsd-gnats-submit@FreeBSD.org, dom@cus.org.uk Cc: Subject: Re: ports/50615: PR Fix (x2): mail/dovecot Date: Thu, 10 Apr 2003 19:59:14 +0100 Hey, Please add the following patch to the files/ directory. These fix a number of problems found with 0.99.8.1 which are dealt with in CVS. Index: imap/cmd-list.c =================================================================== RCS file: /home/cvs/dovecot/src/imap/cmd-list.c,v retrieving revision 1.20 retrieving revision 1.22 diff -u -r1.20 -r1.22 --- imap/cmd-list.c 27 Feb 2003 14:48:00 -0000 1.20 +++ imap/cmd-list.c 20 Mar 2003 17:38:39 -0000 1.22 @@ -24,16 +24,17 @@ const char *response_name; const char *sep; struct imap_match_glob *glob; - int listext; + int listext, no_placeholder; }; -static const char *mailbox_flags2str(enum mailbox_flags flags, int listext) +static const char *mailbox_flags2str(enum mailbox_flags flags, + int listext, int no_placeholder) { const char *str; if (flags & MAILBOX_PLACEHOLDER) { - if (flags == MAILBOX_PLACEHOLDER) { - if (!listext) + if ((flags & ~MAILBOX_CHILDREN) == MAILBOX_PLACEHOLDER) { + if (!listext || no_placeholder) flags = MAILBOX_NOSELECT; } else { /* it was at one point, but then we got better specs */ @@ -59,7 +60,6 @@ static void list_node_update(pool_t pool, struct list_node **node, const char *path, char separator, - enum mailbox_flags dir_flags, enum mailbox_flags flags) { const char *name, *parent; @@ -88,7 +88,8 @@ /* not found, create it */ *node = p_new(pool, struct list_node, 1); (*node)->name = p_strdup(pool, name); - (*node)->flags = *path == '\0' ? flags : dir_flags; + (*node)->flags = *path == '\0' ? flags : + MAILBOX_PLACEHOLDER; } else { if (*path == '\0') { if (((*node)->flags & MAILBOX_NOSELECT) != 0 && @@ -139,16 +140,24 @@ buf = str_unescape(t_strdup_noconst(name)); match = imap_match(ctx->glob, buf); - if (match == IMAP_MATCH_CHILDREN) { + /* FIXME: IMAP spec says this should be done, but + a) this is broken, we shouldn't give \NoSelect for + this folder if it actually works. + b) at least mozilla's subscriptions list breaks if + this is sent + c) cyrus and courier doesn't do this either.. + + if (match == IMAP_MATCH_CHILDREN) { send_name = t_strconcat(name, ctx->sep, NULL); buf = str_unescape(t_strdup_noconst(send_name)); match = imap_match(ctx->glob, buf); - } + }*/ } if (match == IMAP_MATCH_YES) { /* node->name should already be escaped */ - flagstr = mailbox_flags2str(node->flags, ctx->listext); + flagstr = mailbox_flags2str(node->flags, ctx->listext, + ctx->no_placeholder); str = t_strdup_printf("* %s (%s) \"%s\" \"%s\"", ctx->response_name, flagstr, ctx->sep, send_name); @@ -171,19 +180,15 @@ struct mailbox_list *list; struct list_node *nodes; struct list_send_context send_ctx; - enum mailbox_flags dir_flags; pool_t pool; - dir_flags = (list_flags & MAILBOX_LIST_SUBSCRIBED) ? - MAILBOX_PLACEHOLDER : MAILBOX_NOSELECT; - pool = pool_alloconly_create("list_mailboxes", 10240); nodes = NULL; while ((list = client->storage->list_mailbox_next(ctx)) != NULL) { list_node_update(pool, &nodes, list->name, client->storage->hierarchy_sep, - dir_flags, list->flags); + list->flags); } send_ctx.client = client; @@ -192,6 +197,7 @@ send_ctx.glob = imap_match_init(data_stack_pool, mask, TRUE, client->storage->hierarchy_sep); send_ctx.listext = listext; + send_ctx.no_placeholder = (list_flags & MAILBOX_LIST_SUBSCRIBED) == 0; list_send(&send_ctx, nodes, NULL); imap_match_deinit(send_ctx.glob); @@ -212,7 +218,8 @@ else name = str_escape(list->name); str = t_strdup_printf("* %s (%s) \"%s\" \"%s\"", reply, - mailbox_flags2str(list->flags, listext), + mailbox_flags2str(list->flags, listext, + FALSE), sep, name); client_send_line(client, str); t_pop(); Index: lib-storage/index/maildir/maildir-list.c =================================================================== RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-list.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- lib-storage/index/maildir/maildir-list.c 27 Feb 2003 14:48:01 -0000 1.20 +++ lib-storage/index/maildir/maildir-list.c 20 Mar 2003 17:38:39 -0000 1.21 @@ -242,7 +242,8 @@ continue; /* ignore inboxes */ if (match == IMAP_MATCH_PARENT) { - ctx->list.flags = MAILBOX_NOSELECT | MAILBOX_CHILDREN; + ctx->list.flags = + MAILBOX_PLACEHOLDER | MAILBOX_CHILDREN; while ((p = strrchr(fname, '.')) != NULL) { fname = t_strdup_until(fname, p); if (imap_match(ctx->glob, fname) > 0) { Index: imap-parser.c =================================================================== RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v retrieving revision 1.43 retrieving revision 1.45 diff -u -r1.43 -r1.45 --- imap-parser.c 9 Mar 2003 00:35:20 -0000 1.43 +++ imap-parser.c 20 Mar 2003 19:06:05 -0000 1.45 @@ -451,7 +451,6 @@ imap_parser_save_arg(parser, data, (size_t)parser->literal_size); parser->cur_pos = (size_t)parser->literal_size; - parser->eol = TRUE; return TRUE; } } else { @@ -560,8 +559,8 @@ { parser->flags = flags; - while (count == 0 || parser->root_list->size < count || - IS_UNFINISHED(parser)) { + while (!parser->eol && (count == 0 || parser->root_list->size < count || + IS_UNFINISHED(parser))) { if (!imap_parser_read_arg(parser)) break; @@ -580,7 +579,7 @@ } else if ((!IS_UNFINISHED(parser) && count > 0 && parser->root_list->size >= count) || parser->eol) { /* all arguments read / end of line. */ - i_stream_skip(parser->input, parser->cur_pos); + i_stream_skip(parser->input, parser->cur_pos); parser->cur_pos = 0; if (parser->list_arg != NULL) { Index: imap-fetch-body-section.c =================================================================== RCS file: /home/cvs/dovecot/src/imap/imap-fetch-body-section.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- imap-fetch-body-section.c 22 Jan 2003 20:23:12 -0000 1.5 +++ imap-fetch-body-section.c 18 Mar 2003 00:29:49 -0000 1.6 @@ -78,6 +78,7 @@ struct istream *stream; const char *str; int skip_cr; + uoff_t size; off_t ret; stream = mail->get_stream(mail, &hdr_size, &body_size); @@ -87,8 +88,13 @@ if (fetch_header) message_size_add(&body_size, &hdr_size); - str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", - ctx->prefix, body_size.virtual_size); + if (body->skip >= body_size.virtual_size) + size = 0; + else { + size = body_size.virtual_size - body->skip; + if (size > body->max_size) size = body->max_size; + } + str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", ctx->prefix, size); if (o_stream_send_str(ctx->output, str) < 0) return FALSE; @@ -96,6 +102,7 @@ &partial, stream, fetch_header ? 0 : hdr_size.physical_size, body->skip); + ret = message_send(ctx->output, stream, &body_size, skip_cr, body->max_size); if (ret > 0) { Index: src/lib-storage/index/maildir/maildir-storage.c =================================================================== RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- src/lib-storage/index/maildir/maildir-storage.c 9 Mar 2003 09:56:05 -0000 1.35 +++ src/lib-storage/index/maildir/maildir-storage.c 15 Mar 2003 00:33:47 -0000 1.36 @@ -439,7 +439,7 @@ i_assert(oldnamelen <= strlen(list->name)); t_push(); - new_listname = t_strconcat(newname, ".", + new_listname = t_strconcat(newname, list->name + oldnamelen, NULL); oldpath = maildir_get_path(storage, list->name); newpath = maildir_get_path(storage, new_listname); Thanks, -- Dominic <dom at cus.org.uk> <d.marks at student.umist.ac.uk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304101900.h3AJ0W5H037894>