-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid generating duplicate headers in ezmlm-send
When processing a message's headers: - Make note if Reply-To was seen. - Save off and do not copy the Cc header to the output immediately. - Save off and do not copy the From header to the output immediately. At the end of the message headers, call rewrite_from(). When flagrewritefrom is set, either by the list's configuration or because a DMARC reject policy applies to the message sender's address: - The From header is rewritten as before. - If replytolist is not enabled, a Reply-To header is only added if the original message did not have one. Rationale is that the original Reply-To header indicated where the post author is interested in receiving responses, not the From header. - When replytolist is enabled and the original message had a Cc header, the From address is appended to the existing Cc header. - When replytolist is enabled and the original message did not have a Cc header, generate a new one using the From address. After rewrite_from() performs any of the applicable manipulations described above, it copies the resulting From and Cc headers to the output. Update tests/551-ezmlm-send-rewritefrom: - Confirm Reply-To and Cc headers are not duplicated. - Validate behavior when replytolist is configured.
- Loading branch information
1 parent
3252ac3
commit 70f572d
Showing
4 changed files
with
124 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
prompt "ezmlm-send: " | ||
|
||
sendfrom() { | ||
cat >"$TMP" <<EOF | ||
From: $1 | ||
Reply-To: $1 | ||
echo "From: $1" >"$TMP" | ||
if [ -n "$2" ]; then | ||
echo "Reply-To: $2" >>"$TMP" | ||
fi | ||
cat >>"$TMP" <<EOF | ||
Subject: test post | ||
X-Test-Header: one | ||
Content-Length: zip | ||
|
@@ -26,7 +28,6 @@ EOF | |
grephdr Subject: '\[PFX\] test post' | ||
grephdr X-Test-Header: one | ||
grephdr Sender: "<${LIST}@${HOST}>" | ||
grephdr Reply-To: [email protected] | ||
grephdr_empty | ||
|
||
grepbody Local: "$LOCAL" | ||
|
@@ -40,7 +41,7 @@ EOF | |
grephdr Subject: 'test post' | ||
|
||
touch "$DIR"/replytolist | ||
sendfrom [email protected] | ||
sendfrom [email protected] [email protected] | ||
|
||
grephdr_list 1 | ||
grephdr Precedence: bulk | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,46 +4,112 @@ touch "$DIR"/rewritefrom | |
|
||
sendfrom '"My Name 1" <[email protected]>' | ||
grephdr From: "\"My Name 1\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '"My Name 1" <[email protected]>' | ||
|
||
sendfrom '"My Name 2" [email protected]' | ||
grephdr From: "\"My Name 2\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '"My Name 2" [email protected]' | ||
|
||
sendfrom 'My Name 3 <[email protected]>' | ||
grephdr From: "My Name 3 via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: 'My Name 3 <[email protected]>' | ||
|
||
sendfrom '[email protected] (My Name 4)' | ||
grephdr From: "\"My Name 4\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '[email protected] \(My Name 4\)' | ||
|
||
sendfrom '[email protected]' | ||
grephdr From: "\"[email protected]\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '[email protected]' | ||
|
||
rm -f "$DIR"/rewritefrom | ||
|
||
sendfrom '[email protected]' | ||
grephdr From: "\"[email protected]\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '[email protected]' | ||
|
||
sendfrom '"My Name 7" <[email protected]>' | ||
grephdr From: "\"My Name 7\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '"My Name 7" <[email protected]>' | ||
|
||
sendfrom 'My Name 8 <[email protected]>' | ||
grephdr From: "My Name 8 via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: 'My Name 8 <[email protected]>' | ||
|
||
touch "$DIR"/rewritefrom | ||
|
||
sendfrom '=?iso-8859-1?Q?My=20N=E4m=E9=209?= <[email protected]>' | ||
grephdr From: "=\\?iso-8859-1\\?Q\\?My=20N=E4m=E9=209\\?= via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '=\?iso-8859-1\?Q\?My=20N=E4m=E9=209\?= <[email protected]>' | ||
|
||
sendfrom '=?utf-8?B?77yt772ZIMORw6ZtIDEw?= <[email protected]>' | ||
grephdr From: "=\\?utf-8\\?B\\?77yt772ZIMORw6ZtIDEw\\?= via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '=\?utf-8\?B\?77yt772ZIMORw6ZtIDEw\?= <[email protected]>' | ||
|
||
sendfrom 'My Name 11 <[email protected]>' 'Reply To 11 <[email protected]>' | ||
grephdr From: "My Name 11 via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: 'Reply To 11 <[email protected]>' | ||
|
||
sendfrom [email protected] [email protected] | ||
grephdr From: "\"[email protected]\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: '[email protected]' | ||
|
||
touch "$DIR"/replytolist | ||
|
||
sendfrom '"My Name 13" <[email protected]>' | ||
grephdr From: "\"My Name 13\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: "<${LIST}@${HOST}>" | ||
singlehdr Cc: | ||
grephdr Cc: '"My Name 13" <[email protected]>' | ||
|
||
cat >"$TMP" <<EOF | ||
From: [email protected] | ||
To: ${LIST}@${HOST} | ||
Cc: [email protected] | ||
Subject: carbon-copied test post | ||
|
||
message goes here | ||
EOF | ||
${EZBIN}/ezmlm-send "$DIR" <"$TMP" >"$ERR" 2>&1 || \ | ||
fatal "failed to produce post" | ||
unfoldhdrs | ||
grephdr From: "\"[email protected]\" via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: "<${LIST}@${HOST}>" | ||
singlehdr Cc: | ||
grephdr Cc: '[email protected], [email protected]' | ||
|
||
cat >"$TMP" <<EOF | ||
From: My Test 15 <[email protected]> | ||
To: ${LIST}@${HOST} | ||
Cc: "Carbon Copy 15" <[email protected]>, | ||
<[email protected]> | ||
Subject: carbon-copied test post | ||
|
||
message goes here | ||
EOF | ||
${EZBIN}/ezmlm-send "$DIR" <"$TMP" >"$ERR" 2>&1 || \ | ||
fatal "failed to produce post" | ||
unfoldhdrs | ||
grephdr From: "My Test 15 via ${LIST} <${LIST}@${HOST}>$" | ||
singlehdr Reply-To: | ||
grephdr Reply-To: "<${LIST}@${HOST}>" | ||
singlehdr Cc: | ||
grephdr Cc: '"Carbon Copy 15" <[email protected]>, <[email protected]>, My Test 15 <[email protected]>' | ||
|
||
rm -f "$DIR"/rewritefrom "$DIR"/replytolist | ||
|
||
echo OK |