Re: PSA: nullmailer should be avoided

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 9, 2024 at 3:47 PM Konstantin Ryabitsev
<konstantin@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi, all:
>
> I know some of you use nullmailer for sending outgoing mail, but it *really*
> must be avoided, as the messages it sends are not RFC-2822 compliant. Per that
> RFC, header lines MUST NOT be longer than 998 characters in length, which is
> not something nullmailer appears to be paying any attention to.
>
> Some mailservers will outright reject messages with lines exceeding 998
> characters (Exim), and some will force-insert <CR><LF><SPACE> at exactly
> character 998, regardless of what that does to the header:
>
> https://lore.kernel.org/linux-kernel/20240109171807.GA2783042-robh@xxxxxxxxxx/raw
>
> You will notice, that the enforced line-break cuts across the email address:
>
>        Cc: [...] Sergey Shtylyov <s.shtyl
>         yov@xxxxxx>
>
> A message with such header *may* get delivered, or it may get rejected due to
> malformed headers (e.g. Exim does that by default). Anyone then attempting to
> reply to such message will likely have trouble as well.
>
> Unfortunately, nullmailer appears to always re-parse To/Cc headers, so even if
> the original email properly wrapped the recipients headers before it was fed
> to nullmailer, everything will then just be concatenated into one long line:
>
> https://github.com/bruceg/nullmailer/blob/master/src/inject.cc#L384

FWIW, I hacked up this fix. I'd really prefer that it not reformat
lines at all or wrap at 72 chars, but this was the easiest fix.
(Obviously, I'm not using it either ATM)

diff --git a/lib/address.cc b/lib/address.cc
index 43fae44cf331..4db63404f6fc 100644
--- a/lib/address.cc
+++ b/lib/address.cc
@@ -585,7 +585,7 @@ RULE(mailboxes)
     result r2 = match_mailbox(node);
     if(!r2) break;
     r1.next = r2.next;
-    r1.str = r1.str + ", " + r2.str + r2.comment;
+    r1.str = r1.str + ",\n " + r2.str + r2.comment;
     r1.addr += r2.addr;
   }
   node = skipcomment(node, r1.str);
@@ -638,7 +638,7 @@ RULE(addresses)
     result r2 = match_address(node);
     if(!r2) break;
     r1.next = r2.next;
-    r1.str = r1.str + ", " + r2.str + r2.comment;
+    r1.str = r1.str + ",\n " + r2.str + r2.comment;
     r1.addr += r2.addr;
   }
   node = skipcomment(node, r1.str);
diff --git a/src/inject.cc b/src/inject.cc
index 0a555b212fb9..851a1fda5f17 100644
--- a/src/inject.cc
+++ b/src/inject.cc
@@ -381,7 +381,7 @@ mystring make_recipient_list()
   bool first = true;
   for(slist::iter iter(recipients); iter; iter++) {
     if(!first)
-      result = result + ", " + *iter;
+      result = result + ",\n " + *iter;
     else
       result = *iter;
     first = false;
>
> I'll open an issue with nullmailer about this, but the project doesn't appear
> very alive, so your best bet is to switch to msmtp. It has
> msmtp-{enqueue,listqueue,runqueue} commands that will do everything nullmailer
> can do and won't break your mail.

My issue was the queuing is not part of msmtp, but add-on scripts of
unknown robustness and maintenance.

Rob





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux