aboutsummaryrefslogtreecommitdiff
path: root/mail/mailutils/files/git-018df5d
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mailutils/files/git-018df5d')
-rw-r--r--mail/mailutils/files/git-018df5d277
1 files changed, 277 insertions, 0 deletions
diff --git a/mail/mailutils/files/git-018df5d b/mail/mailutils/files/git-018df5d
new file mode 100644
index 000000000000..3174ded1f8c8
--- /dev/null
+++ b/mail/mailutils/files/git-018df5d
@@ -0,0 +1,277 @@
+From 018df5d628f4e093f7e45c00b48ffc11b234d8cf Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Tue, 23 Jul 2019 08:04:38 +0300
+Subject: Minor fix
+
+Check return from mu_message_get_num_parts
+---
+ imap4d/fetch.c | 32 ++++++++++++++++++-------------
+ imap4d/search.c | 24 ++++++++++++++---------
+ libmu_scm/tests/testsuite.at | 2 +-
+ libmu_sieve/extensions/moderator.c | 9 +++++++--
+ libmu_sieve/tests.c | 15 +++++++++++----
+ mail/decode.c | 39 ++++++++++++++++++++++----------------
+ mh/burst.c | 8 +++++++-
+ mh/mhn.c | 12 +++++++++---
+ 8 files changed, 92 insertions(+), 49 deletions(-)
+
+diff --git a/imap4d/fetch.c b/imap4d/fetch.c
+index 51921dd..fa0cea6 100644
+--- a/imap4d/fetch.c
++++ b/imap4d/fetch.c
+@@ -491,7 +491,6 @@ bodystructure (mu_message_t msg, int extension)
+ static int
+ fetch_bodystructure0 (mu_message_t message, int extension)
+ {
+- size_t nparts = 1;
+ size_t i;
+ int is_multipart = 0;
+
+@@ -500,20 +499,27 @@ fetch_bodystructure0 (mu_message_t message, int extension)
+ {
+ mu_content_type_t ct;
+ mu_header_t header = NULL;
++ size_t nparts;
+ int rc;
+
+- mu_message_get_num_parts (message, &nparts);
+-
+- /* Get all the sub messages. */
+- for (i = 1; i <= nparts; i++)
+- {
+- mu_message_t msg = NULL;
+- mu_message_get_part (message, i, &msg);
+- io_sendf ("(");
+- fetch_bodystructure0 (msg, extension);
+- io_sendf (")");
+- } /* for () */
+-
++ rc = mu_message_get_num_parts (message, &nparts);
++ if (rc)
++ {
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts", NULL, rc);
++ }
++ else
++ {
++ /* Get all the sub messages. */
++ for (i = 1; i <= nparts; i++)
++ {
++ mu_message_t msg = NULL;
++ mu_message_get_part (message, i, &msg);
++ io_sendf ("(");
++ fetch_bodystructure0 (msg, extension);
++ io_sendf (")");
++ } /* for () */
++ }
++
+ mu_message_get_header (message, &header);
+
+ /* The subtype. */
+diff --git a/imap4d/search.c b/imap4d/search.c
+index 8bc9770..0037964 100644
+--- a/imap4d/search.c
++++ b/imap4d/search.c
+@@ -1019,17 +1019,23 @@ _match_multipart (struct parsebuf *pb, mu_message_t msg, char *text)
+ {
+ size_t i, nparts;
+
+- mu_message_get_num_parts (msg, &nparts);
+-
+- for (i = 1; i <= nparts; i++)
++ rc = mu_message_get_num_parts (msg, &nparts);
++ if (rc)
+ {
+- mu_message_t submsg = NULL;
+-
+- if (mu_message_get_part (msg, i, &submsg) == 0)
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts", NULL, rc);
++ }
++ else
++ {
++ for (i = 1; i <= nparts; i++)
+ {
+- result = _match_multipart (pb, submsg, text);
+- if (result)
+- break;
++ mu_message_t submsg = NULL;
++
++ if (mu_message_get_part (msg, i, &submsg) == 0)
++ {
++ result = _match_multipart (pb, submsg, text);
++ if (result)
++ break;
++ }
+ }
+ }
+ }
+diff --git a/libmu_scm/tests/testsuite.at b/libmu_scm/tests/testsuite.at
+index 6bd1947..ba445f7 100644
+--- a/libmu_scm/tests/testsuite.at
++++ b/libmu_scm/tests/testsuite.at
+@@ -14,7 +14,7 @@ m4_define([MU_GUILE_CHECK],
+ [AT_DATA([input.scm],[dnl
+ (use-modules ((mailutils mailutils))
+ ((mailutils ancilla)))
+-(mu-register-format "mbox")
++(mu-register-format "mbox")
+ [$1]
+ ])
+ m4_if(MU_TEST_MAILBOX,,,[MUT_MBCOPY($abs_top_srcdir/testsuite/MU_TEST_MAILBOX,mbox)])
+diff --git a/libmu_sieve/extensions/moderator.c b/libmu_sieve/extensions/moderator.c
+index 3544d88..4fe2e83 100644
+--- a/libmu_sieve/extensions/moderator.c
++++ b/libmu_sieve/extensions/moderator.c
+@@ -284,8 +284,13 @@ moderator_action (mu_sieve_machine_t mach)
+ mu_sieve_abort (mach);
+ }
+
+- mu_message_get_num_parts (msg, &nparts);
+-
++ rc = mu_message_get_num_parts (msg, &nparts);
++ if (rc)
++ {
++ mu_sieve_error (mach, "mu_message_get_num_parts: %s", mu_strerror (rc));
++ mu_sieve_abort (mach);
++ }
++
+ if (nparts != 3) /* Mailman moderation requests have three parts */
+ {
+ mu_sieve_error (mach, _("expected 3 parts, but found %lu"),
+diff --git a/libmu_sieve/tests.c b/libmu_sieve/tests.c
+index da3872f..c346747 100644
+--- a/libmu_sieve/tests.c
++++ b/libmu_sieve/tests.c
+@@ -176,17 +176,24 @@ sieve_test_header (mu_sieve_machine_t mach)
+ v = mu_sieve_get_arg_untyped (mach, 1);
+
+ clos.message = mach->msg;
++ clos.nparts = 0;
+
+ if (mu_sieve_get_tag (mach, "mime", SVT_VOID, NULL))
+ {
+ int ismime = 0;
+
+- mu_message_is_multipart (mach->msg, &ismime);
++ rc = mu_message_is_multipart (mach->msg, &ismime);
++ if (rc)
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_is_multipart",
++ NULL, rc);
+ if (ismime)
+- mu_message_get_num_parts (mach->msg, &clos.nparts);
++ {
++ rc = mu_message_get_num_parts (mach->msg, &clos.nparts);
++ if (rc)
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts",
++ NULL, rc);
++ }
+ }
+- else
+- clos.nparts = 0;
+
+ rc = mu_sieve_vlist_compare (mach, h, v, retrieve_header, NULL, &clos);
+ return rc;
+diff --git a/mail/decode.c b/mail/decode.c
+index 869fe2f..647f8cf 100644
+--- a/mail/decode.c
++++ b/mail/decode.c
+@@ -172,7 +172,6 @@ mime_descend (struct mime_descend_closure *closure,
+ mime_descend_fn fun, void *data)
+ {
+ int status = 0;
+- size_t nparts = 0;
+ mu_header_t hdr = NULL;
+ char *type;
+ char *encoding;
+@@ -195,23 +194,31 @@ mime_descend (struct mime_descend_closure *closure,
+ if (ismime)
+ {
+ unsigned int j;
+-
+- mu_message_get_num_parts (closure->message, &nparts);
+-
+- for (j = 1; j <= nparts; j++)
++ size_t nparts;
++
++ status = mu_message_get_num_parts (closure->message, &nparts);
++ if (status)
+ {
+- mu_message_t message = NULL;
+-
+- if (mu_message_get_part (closure->message, j, &message) == 0)
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts", NULL,
++ status);
++ }
++ else
++ {
++ for (j = 1; j <= nparts; j++)
+ {
+- msgset_t *set = msgset_expand (msgset_dup (closure->msgset),
+- msgset_make_1 (j));
+- subclosure.msgset = set;
+- subclosure.message = message;
+- status = mime_descend (&subclosure, fun, data);
+- msgset_free (set);
+- if (status)
+- break;
++ mu_message_t message = NULL;
++
++ if (mu_message_get_part (closure->message, j, &message) == 0)
++ {
++ msgset_t *set = msgset_expand (msgset_dup (closure->msgset),
++ msgset_make_1 (j));
++ subclosure.msgset = set;
++ subclosure.message = message;
++ status = mime_descend (&subclosure, fun, data);
++ msgset_free (set);
++ if (status)
++ break;
++ }
+ }
+ }
+ }
+diff --git a/mh/burst.c b/mh/burst.c
+index b512fa0..af04317 100644
+--- a/mh/burst.c
++++ b/mh/burst.c
+@@ -75,8 +75,14 @@ int
+ burst_mime (mu_message_t msg)
+ {
+ size_t i, nparts;
++ int rc;
+
+- mu_message_get_num_parts (msg, &nparts);
++ rc = mu_message_get_num_parts (msg, &nparts);
++ if (rc)
++ {
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts", NULL, rc);
++ return rc;
++ }
+
+ for (i = 1; i <= nparts; i++)
+ {
+diff --git a/mh/mhn.c b/mh/mhn.c
+index 8559261..ebe0e75 100644
+--- a/mh/mhn.c
++++ b/mh/mhn.c
+@@ -1047,9 +1047,15 @@ handle_message (mu_message_t msg, msg_part_t part, msg_handler_t fun, void *data
+ if (ismime)
+ {
+ size_t i, nparts;
+-
+- mu_message_get_num_parts (msg, &nparts);
+-
++ int rc;
++
++ rc = mu_message_get_num_parts (msg, &nparts);
++ if (rc)
++ {
++ mu_diag_funcall (MU_DIAG_ERR, "mu_message_get_num_parts", NULL, rc);
++ return rc;
++ }
++
+ msg_part_incr (part);
+ for (i = 1; i <= nparts; i++)
+ {
+--
+cgit v1.0-41-gc330
+