Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic: Translate end-of-lines in email emitter by DNF #2010

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ppisar
Copy link
Contributor

@ppisar ppisar commented Jan 14, 2025

The fix in 9a5cba8 (automatic: Fix end-of-lines in messages sent by email emitter) utilized cURL library for translating LF ending to CR-LF in content of SMTP DATA command. It fixed the problem with curl-8.11.1, but broke end-of-lines in e-mail headers with old curl-8.9.1.

I was unable to find what has changed in cURL, but the cause was that automatic plugin already separated headers by CR-LF, therefore cURL probably double-encoded them and that was again rejected by sendmail 8.18.1.

This patch reverts 9a5cba8 and instead performs the end-of-line normalization fully in dnf5::EmailMessage::str() method. Now the output of the method is completely valid e-mail message.

Implementation detail: I changed dnf5::Emitter::output_stream variable from const to non-cost to be able to call getline() on it. If is a problem, I will need to come with a more complicated solution because I can only obtain a new-line delimiter used in the std::stringstream object by getline().

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2335508

The fix in 9a5cba8 (automatic: Fix
end-of-lines in messages sent by email emitter) utilized cURL library
for translating LF ending to CR-LF in content of SMTP DATA command. It
fixed the problem with curl-8.11.1, but broke end-of-lines in e-mail
headers with old curl-8.9.1.

I was unable to find what has changed in cURL, but the cause was that
automatic plugin already separated headers by CR-LF, therefore cURL
probably double-encoded them and that was again rejected by sendmail
8.18.1.

This patch reverts 9a5cba8 and
instead performs the end-of-line normalization fully in
dnf5::EmailMessage::str() method. Now the output of the method is
completely valid e-mail message.

Implementation detail: I changed dnf5::Emitter::output_stream variable
from const to non-cost to be able to call getline() on it. If is
a problem, I will need to come with a more complicated solution
because I can only obtain a new-line delimiter used in the
std::stringstream object by getline().

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2335508
@ppisar ppisar force-pushed the automatic_email_crcrlf branch from 8044a6f to 97e3c24 Compare January 14, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant