summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorsalo <salo@pkgsrc.org>2003-11-02 17:24:07 +0000
committersalo <salo@pkgsrc.org>2003-11-02 17:24:07 +0000
commitc037d6f58f2ea0f92db90bdb1d3d4724b9f4ea59 (patch)
treed5b5d3facf8ef7bda0dba9cfea5ebfa79b1aad64 /mail
parent36d49c7c34ba0340ff4ef3ac090ca660a78ad3c1 (diff)
downloadpkgsrc-c037d6f58f2ea0f92db90bdb1d3d4724b9f4ea59.tar.gz
PKGREVISION++
- Some partial BODY[part] fetches may have returned data incorrectly, patch-ad fixes it.
Diffstat (limited to 'mail')
-rw-r--r--mail/dovecot/distinfo3
-rw-r--r--mail/dovecot/patches/patch-ad106
2 files changed, 108 insertions, 1 deletions
diff --git a/mail/dovecot/distinfo b/mail/dovecot/distinfo
index 14069c2a2bc..2302b89f82c 100644
--- a/mail/dovecot/distinfo
+++ b/mail/dovecot/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2003/09/23 13:54:25 salo Exp $
+$NetBSD: distinfo,v 1.6 2003/11/02 17:24:07 salo Exp $
SHA1 (dovecot-0.99.10.tar.gz) = 0a1d83cbd27c3aa3e0732416a0871afc23ee5e19
Size (dovecot-0.99.10.tar.gz) = 735615 bytes
@@ -9,3 +9,4 @@ Size (bodystructure.patch) = 3010 bytes
SHA1 (patch-aa) = 6ed31ba47883903e5a7b2fcb715432e0c3e8947c
SHA1 (patch-ab) = 0aca5084186f7faa812351e83d1c9535248da2b0
SHA1 (patch-ac) = 6593c335779aacd0bf285a4faf6411150d4acdcf
+SHA1 (patch-ad) = b96fe0aa1d6d0f846624802b37b72f7213568a87
diff --git a/mail/dovecot/patches/patch-ad b/mail/dovecot/patches/patch-ad
new file mode 100644
index 00000000000..b095871c3b7
--- /dev/null
+++ b/mail/dovecot/patches/patch-ad
@@ -0,0 +1,106 @@
+$NetBSD: patch-ad,v 1.1 2003/11/02 17:24:07 salo Exp $
+
+--- src/imap/imap-fetch-body-section.c 21 Sep 2003 16:21:36 -0000 1.18
++++ src/imap/imap-fetch-body-section.c 3 Oct 2003 14:36:03 -0000
+@@ -73,6 +73,18 @@
+ return cr_skipped;
+ }
+
++static uoff_t get_send_size(const struct imap_fetch_body_data *body,
++ uoff_t max_size)
++{
++ uoff_t size;
++
++ if (body->skip >= max_size)
++ return 0;
++
++ size = max_size - body->skip;
++ return size <= body->max_size ? size : body->max_size;
++}
++
+ /* fetch BODY[] or BODY[TEXT] */
+ static int fetch_body(struct imap_fetch_context *ctx,
+ const struct imap_fetch_body_data *body,
+@@ -82,7 +94,7 @@
+ struct istream *stream;
+ const char *str;
+ int skip_cr, last_cr;
+- uoff_t size;
++ uoff_t send_size;
+ off_t ret;
+
+ stream = mail->get_stream(mail, &hdr_size, &body_size);
+@@ -92,13 +104,8 @@
+ if (fetch_header)
+ message_size_add(&body_size, &hdr_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);
++ send_size = get_send_size(body, body_size.virtual_size);
++ str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", ctx->prefix, send_size);
+ if (o_stream_send_str(ctx->output, str) < 0)
+ return FALSE;
+
+@@ -108,7 +115,7 @@
+ body->skip);
+
+ ret = message_send(ctx->output, stream, &body_size,
+- skip_cr, body->max_size, &last_cr,
++ skip_cr, send_size, &last_cr,
+ !mail->has_no_nuls);
+ if (ret > 0) {
+ partial.cr_skipped = last_cr != 0;
+@@ -297,15 +304,16 @@
+ const char *str;
+ const void *data;
+ size_t data_size;
+- uoff_t start_offset;
++ uoff_t start_offset, send_size;
+ int failed;
+
+ /* HEADER, MIME, HEADER.FIELDS (list), HEADER.FIELDS.NOT (list) */
+
+ if (strcmp(header_section, "HEADER") == 0) {
+ /* all headers */
++ send_size = get_send_size(body, size->virtual_size);
+ str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
+- ctx->prefix, size->virtual_size);
++ ctx->prefix, send_size);
+ if (o_stream_send_str(ctx->output, str) < 0)
+ return FALSE;
+ return message_send(ctx->output, input, size,
+@@ -453,16 +461,11 @@
+ {
+ const char *str;
+ int skip_cr, last_cr;
+- uoff_t size;
++ uoff_t send_size;
+ off_t ret;
+
+- if (body->skip >= part->body_size.virtual_size)
+- size = 0;
+- else {
+- size = part->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);
++ send_size = get_send_size(body, part->body_size.virtual_size);
++ str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", ctx->prefix, send_size);
+ if (o_stream_send_str(ctx->output, str) < 0)
+ return FALSE;
+
+@@ -470,8 +473,7 @@
+ &partial, stream, part->physical_pos +
+ part->header_size.physical_size, body->skip);
+ ret = message_send(ctx->output, stream, &part->body_size,
+- skip_cr, body->max_size, &last_cr,
+- !mail->has_no_nuls);
++ skip_cr, send_size, &last_cr, !mail->has_no_nuls);
+ if (ret > 0) {
+ partial.cr_skipped = last_cr != 0;
+ partial.pos.physical_size =