Skip to content

Commit

Permalink
automatic: Fix end-of-lines in messages sent by email emitter
Browse files Browse the repository at this point in the history
Sendmail 8.18.1 started to reject e-mail messages without CRLF line
endings:

    # dnf-automatic
    libcurl error while sending e-mail: Weird server reply

    # journalctl -f
    sendmail[7095]: 508DXZbS007095: collect: relay=localhost, from=<root@localhost>, info=Bare linefeed (LF) not allowed, where=body, status=tempfail

This is a deliberate change in Sendmail 8.18.1. And the cause is that
automatic plugin composes a message body with UNIX line endings and
passes it to cURL library with CURLOPT_READDATA option.

While cURL automatically escapes leading dots in the body (".\r\n"),
it does not normalize end-of-lines
<curl/curl#15942>.

This patch fixes it by asking cURL to perform the normalization.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2335508
  • Loading branch information
ppisar authored and m-blaha committed Jan 9, 2025
1 parent f4b00fa commit 9a5cba8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dnf5-plugins/automatic_plugin/emitters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ void EmitterEmail::notify() {

curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

curl_easy_setopt(curl, CURLOPT_CRLF, 1L);

res = curl_easy_perform(curl);
fclose(payload_file);
if (res != CURLE_OK) {
Expand Down

0 comments on commit 9a5cba8

Please sign in to comment.