Repository navigation
cf-execd: dot-stuff mailed agent output lines starting with '.' - #6411
Open
Dhanu-dynamic wants to merge 1 commit into
Open
Dhanu-dynamic wants to merge 1 commit into
Dhanu-dynamic wants to merge 1 commit into
Conversation
MailResult() copies each line of the agent output file into the SMTP DATA section as is. RFC 5321, section 4.5.2 requires the client to double a leading '.', because a line consisting of a single '.' marks the end of the message. Without it, a lone "." in the agent output, such as a continuation line of a multi-line report whose text comes from a file or command, ends the mail early. Every following output line is then read by the mail server as an SMTP command in cf-execd's session, so output containing e.g. "MAIL FROM:", "RCPT TO:" and "DATA" lines makes the relay send an arbitrary message on behalf of the host. Lines that merely start with '.' also lose their first character. Send an extra '.' before any line that starts with '.'. The new acceptance test fails before this change (the lone "." reaches the mock SMTP server unescaped) and passes after it. Changelog: Title Signed-off-by: Dhanraj E <dhanraj@labs.digiscrypt.com>
Contributor
|
@cf-bottom Jenkins please :) |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/14811/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-14811/ |
larsewi
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MailResult() in cf-execd/cf-execd-runner.c writes each line of the agent output into the SMTP DATA section without the dot-stuffing RFC 5321 section 4.5.2 requires, so a line that is just "." (e.g. a continuation line of a multi-line report whose text comes from a file or command) ends the mail early and every line after it is read by the relay as an SMTP command in cf-execd's session. output carrying MAIL FROM / RCPT TO / DATA lines can therefore send an arbitrary message through the relay on behalf of the host, and lines that merely start with "." lose their first character. a leading "." is now doubled at the one place the body is written. the new acceptance test 25_cf-execd/mail_dot_line.cf reports "CorrectString1\n.\nCorrectString2": before the change the mock SMTP server receives the bare "." line, after it receives "..". the rest of 25_cf-execd passes locally (slow/dies_in_time.cf is timing-sensitive here and passes when run on its own, with or without the patch).