Skip to content

qmail-inject: do not parse header recipients if "-a" is given - #8

Merged
DerDakon merged 1 commit into
masterfrom
bounce-recips
Sep 3, 2019
Merged

qmail-inject: do not parse header recipients if "-a" is given#8
DerDakon merged 1 commit into
masterfrom
bounce-recips

Conversation

@DerDakon

@DerDakon DerDakon commented Jul 8, 2019

Copy link
Copy Markdown
Member

qmail-inject can parse the message header to determine the recipients of a mail. You can also pass it a list of recipients on command line so it will ignore the recipients stated in the header. This is e.g. used when you redirect a mail by a .qmail file. But even if those recipients will not be used the header fields will still be parsed and a bounce is generated on failure.

If a mail is injected from network with the broken header field

To: foo: bar, baz

then this would be delivered fine as the recipient is given in the SMTP transmission. If it could not be directly delivered but is forwarded to another user by a .qmail file or a virtualdomain alias then this mail is passed through "qmail-inject -a newrecipient". Nevertheless the header fields are parsed, the error is raised and the message is bounced. This leads to ugly bounces with the message "qmail-inject: fatal: unable to parse this line:". Since the message is of course spam the bounce will bounce again and annoy the postmaster. This patch changes qmail-inject to totally ignore the lines with recipients (To:, Cc:, Bcc) if the recipients were passed as arguments. In this case the mail will be routed to the original recipient and can there be handled.

@DerDakon DerDakon added the bug Something isn't working label Jul 12, 2019
@DerDakon DerDakon added this to the 1.08 milestone Jul 17, 2019
@DerDakon
DerDakon force-pushed the bounce-recips branch 2 times, most recently from 153e711 to a7de96e Compare August 19, 2019 22:02

@schmonz schmonz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to match qmail-inject's actual behavior to its intended behavior, as well as new-inject's that we may use later (see #88).

qmail-inject can parse the message header to determine the recipients of a mail.
You can also pass it a list of recipients on command line so it will ignore the
recipients stated in the header. This is e.g. used when you redirect a mail by
a .qmail file. But even if those recipients will not be used the header fields
will still be parsed and a bounce is generated on failure.

If a mail is injected from network with the broken header field

  To: foo: bar, baz

then this would be delivered fine as the recipient is given in the SMTP
transmission. If it could not be directly delivered but is forwarded to another
user by a .qmail file or a virtualdomain alias then this mail is passed through
"qmail-inject -a newrecipient". Nevertheless the header fields are parsed, the
error is raised and the message is bounced. This leads to ugly bounces with the
message "qmail-inject: fatal: unable to parse this line:". Since the message is
of course spam the bounce will bounce again and annoy the postmaster. This patch
changes qmail-inject to totally ignore the lines with recipients (To:, Cc:, Bcc)
if the recipients were passed as arguments. In this case the mail will be routed
to the original recipient and can there be handled.
@DerDakon
DerDakon merged commit 56e7c4a into master Sep 3, 2019
@DerDakon
DerDakon deleted the bounce-recips branch September 3, 2019 21:05
@DerDakon DerDakon modified the milestones: 1.09, 1.08 Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants