Date: Wed, 31 Jul 2019 11:44:18 +0000 (UTC) From: Alexey Dokuchaev <danfe@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r507707 - in head/mail/mailutils: . files Message-ID: <201907311144.x6VBiICu083326@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: danfe Date: Wed Jul 31 11:44:17 2019 New Revision: 507707 URL: https://svnweb.freebsd.org/changeset/ports/507707 Log: Cherry-pick the following two changes from the upstream Git repository at http://git.savannah.gnu.org/cgit/mailutils.git: 018df5d628f4e093f7e45c00b48ffc11b234d8cf - Minor fix 113e144dedbebb5bc659eadc7f329450bb374606 - Fix mandatory locking Requested by: maintainer Added: head/mail/mailutils/files/git-018df5d (contents, props changed) head/mail/mailutils/files/git-113e144 (contents, props changed) Modified: head/mail/mailutils/Makefile Modified: head/mail/mailutils/Makefile ============================================================================== --- head/mail/mailutils/Makefile Wed Jul 31 11:02:19 2019 (r507706) +++ head/mail/mailutils/Makefile Wed Jul 31 11:44:17 2019 (r507707) @@ -3,9 +3,12 @@ PORTNAME= mailutils PORTVERSION= 3.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= mail MASTER_SITES= GNU GNU_ALPHA + +EXTRA_PATCHES= ${FILESDIR}/git-018df5d:-p1 \ + ${FILESDIR}/git-113e144:-p1 MAINTAINER= zeus@gnu.org.ua COMMENT= Utilities, daemons, and filters for processing e-mail Added: head/mail/mailutils/files/git-018df5d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/mailutils/files/git-018df5d Wed Jul 31 11:44:17 2019 (r507707) @@ -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 + Added: head/mail/mailutils/files/git-113e144 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/mailutils/files/git-113e144 Wed Jul 31 11:44:17 2019 (r507707) @@ -0,0 +1,38 @@ +From 113e144dedbebb5bc659eadc7f329450bb374606 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff <gray@gnu.org> +Date: Tue, 23 Jul 2019 11:08:04 +0300 +Subject: Fix mandatory locking + +* lib/manlock.c (mailbox_open_and_lock): Force proper locker if +a null locker is associated with the mailbox. +--- + lib/manlock.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/lib/manlock.c b/lib/manlock.c +index 4a3b2be..392c581 100644 +--- a/lib/manlock.c ++++ b/lib/manlock.c +@@ -126,6 +126,19 @@ mailbox_open_and_lock (mu_mailbox_t mbox, int flags) + return MU_ERR_FAILURE; + } + ++ if (lock) ++ { ++ status = mu_locker_get_flags (lock, &flags); ++ if (status) ++ { ++ mu_diag_funcall (MU_DIAG_ERROR, "mu_locker_get_flags", urlstr, ++ status); ++ return MU_ERR_FAILURE; ++ } ++ if (flags & MU_LOCKER_NULL) ++ lock = NULL; ++ } ++ + if (!lock && manlock_mandatory_locking && manlock_lock_dir) + { + char *fname = NULL; +-- +cgit v1.0-41-gc330 +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907311144.x6VBiICu083326>