Re: Putmail ignores multiple SMTP recipients
"Sergey Poznyakoff" <[email protected]> Fri, 10 Oct 2025 13:48:00 +0200
| Newsgroups | gmane.comp.gnu.mailutils.bugs |
|---|---|
| Organization | GNU.org.ua |
| Message-ID | <[email protected]> |
--1804289383-1760096880=:21688 Content-Type: text/plain Content-ID: <[email protected]> Hi Kevin, Kevin Koster via Bug reports and feature requests for GNU mailutils ha escrit: > In both Mailutils 3.17 and 3.20 (Linux OS) Putmail ignores multiple > ";to=" addresses separated by commas Thanks for reporting. Please apply the attached fix. > $ echo -e 'From: [email protected]\nTo: [email protected]\nCc: [email protected]\nSubject: Test\n\nTesting 1,2,3,4' | putmail --debug-level=all -f "[email protected]" "smtp://[email protected]:587;[email protected],[email protected]" 2>putmail_3.20_log.txt Please note that it is advised to percent-encode @ in parameters, as in: smtp://[email protected]:587;to=test%40recipient.invalid,testrecipient%40example.com Regards, Sergey --1804289383-1760096880=:21688 Content-Type: text/x-diff; name="0001-Fix-bug-in-mu_address_dup.patch" Content-ID: <[email protected]> Content-Description: Content-Transfer-Encoding: quoted-printable From e2a67ee303d86dc87219520a66c243875aa3735f Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff <[email protected]> Date: Fri, 10 Oct 2025 10:47:05 +0300 Subject: [PATCH] Fix bug in mu_address_dup * libmailutils/address/address.c (mu_address_dup): Duplicate entire address structure. --- libmailutils/address/address.c | 85 ++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/libmailutils/address/address.c b/libmailutils/address/address.c index ca942a6a8..7353caf99 100644 --- a/libmailutils/address/address.c +++ b/libmailutils/address/address.c @@ -670,7 +670,7 @@ mu_address_contains_email (mu_address_t addr, const char *email) } static int -mu_list_copy (mu_address_t dst, mu_address_t src) +_address_copy (mu_address_t dst, mu_address_t src) { /* FIXME: How about: if (src->printable) @@ -692,16 +692,46 @@ mu_list_copy (mu_address_t dst, mu_address_t src) return 0; } +static mu_address_t +first_address_dup (mu_address_t src) +{ + mu_address_t dst =3D calloc (1, sizeof (*dst)); + if (dst && _address_copy (dst, src)) + { + mu_address_destroy (&dst); + return NULL; + } + return dst; +} + mu_address_t mu_address_dup (mu_address_t src) { - mu_address_t dst =3D calloc (1, sizeof (*dst)); + mu_address_t head =3D NULL, tail =3D NULL; - if (!dst) - return NULL; - if (mu_list_copy (dst, src)) - mu_address_destroy (&dst); - return dst; + while (src) + { + mu_address_t dst =3D calloc (1, sizeof (*dst)); + if (!dst) + { + mu_address_destroy (&head); + return NULL; + } + + if (tail) + tail->next =3D dst; + else + head =3D dst; + tail =3D dst; + + if (_address_copy (dst, src)) + { + mu_address_destroy (&head); + return NULL; + } + src =3D src->next; + } + return head; } int @@ -717,41 +747,26 @@ mu_address_union (mu_address_t *a, mu_address_t b) *a =3D mu_address_dup (b); if (!*a) return ENOMEM; - last =3D *a; - b =3D b->next; + return 0; } - else + + if ((*a)->printable) { - if ((*a)->printable) - { - free ((*a)->printable); - (*a)->printable =3D NULL; - } - for (last =3D *a; last->next; last =3D last->next) - ; + free ((*a)->printable); + (*a)->printable =3D NULL; } + for (last =3D *a; last->next; last =3D last->next) + ; for (; b; b =3D b->next) if (!mu_address_contains_email (*a, b->email)) { - if (last->email) - { - mu_address_t next =3D mu_address_dup (b); - if (!next) - return ENOMEM; - last->next =3D next; - last =3D next; - } - else - { - int rc =3D mu_list_copy (last, b); - if (rc) - { - _address_free (last); - memset (last, 0, sizeof (*last)); - return rc; - } - } + mu_address_t next =3D first_address_dup (b); + if (!next) + return ENOMEM; + last->next =3D next; + last =3D next; } + return 0; } -- 2.35.1 --1804289383-1760096880=:21688--