INN commit: trunk (doc/pod/news.pod frontends/mailpost.in)
INN Commit
rra at isc.org
Sat Jul 1 20:55:24 UTC 2017
Date: Saturday, July 1, 2017 @ 13:55:24
Author: iulius
Revision: 10156
mailpost: remove empty header fields
Also, fix a sprintf warning when using "mailpost -n" ($Sendmail
does not contain %s in that case).
Thanks to Kamil Jonca for the bug report.
Modified:
trunk/doc/pod/news.pod
trunk/frontends/mailpost.in
-----------------------+
doc/pod/news.pod | 6 ++++++
frontends/mailpost.in | 20 ++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2017-07-01 19:59:25 UTC (rev 10155)
+++ doc/pod/news.pod 2017-07-01 20:55:24 UTC (rev 10156)
@@ -15,6 +15,12 @@
The default value (I<no-laxmid>) corresponds to the legacy behaviour
(the one of S<INN 2.6.1> and earlier).
+=item *
+
+B<mailpost> now removes empty header fields before attempting to post
+articles, and keeps trace of them in the X-Mailpost-Empty-Hdrs: header
+field body. Thanks to Kamil Jonca for the bug report.
+
=back
=head1 Changes in 2.6.1
Modified: frontends/mailpost.in
===================================================================
--- frontends/mailpost.in 2017-07-01 19:59:25 UTC (rev 10155)
+++ frontends/mailpost.in 2017-07-01 20:55:24 UTC (rev 10156)
@@ -84,6 +84,8 @@
if ($debugging || $opt_n) {
$Sendmail = "cat" ;
$WhereTo = "cat" ;
+} else {
+ $Sendmail = sprintf($Sendmail, $Maintainer);
}
#
@@ -150,6 +152,8 @@
my $txt = undef;
my $message_id ;
my $subject = "(NONE)";
+my @emptyHdrs = ();
+my $emptyHdrsString;
$_ = <STDIN>;
if (!$_) {
@@ -213,6 +217,13 @@
next if /^Approved:\s/sio && defined($approved);
next if /^Distribution:\s/sio && defined($distribution);
+ # Collect empty header field names.
+ if (/^([^:]+):\s*$/) {
+ # 975 = 998 - length("X-Mailpost-Empty-Hdrs: ")
+ push(@emptyHdrs, $1) if length($1) < 975;
+ next;
+ }
+
if (/^($exclude):\s*/sio) {
$real_news_hdrs .= "$_\n";
next;
@@ -314,6 +325,11 @@
$real_news_hdrs .= "Approved: ${approved}\n" if defined($approved);
$real_news_hdrs .= "References: ${references}\n" if defined($references);
+# Keep trace of empty header fields.
+$emptyHdrsString = join("\n\t", @emptyHdrs);
+$real_news_hdrs .= "X-Mailpost-Empty-Hdrs: $emptyHdrsString\n"
+ if (length($emptyHdrsString) > 0);
+
# Remove duplicate headers.
my %headers = ();
$real_news_hdrs =~ s/((.*?:) .*?($|\n)([ \t]+.*?($|\n))*)/$headers{lc$2}++?"":"$1"/ges;
@@ -329,7 +345,7 @@
if ($use_syslog) {
syslog("err", "$msg") unless $debugging || -t STDERR;
}
- open(TMPFILE, "|" . sprintf ($Sendmail, $Maintainer)) ||
+ open(TMPFILE, "|" . $Sendmail) ||
die "die(no tmpfile): sendmail: $!\n" ;
print TMPFILE <<"EOF";
To: $Maintainer
@@ -516,7 +532,7 @@
syslog("err", "$msg") if $use_syslog;
print STDERR $msg,"\n" if -t STDERR ;
- open(SENDMAIL, "|" . sprintf ($Sendmail,$Maintainer)) ||
+ open(SENDMAIL, "|" . $Sendmail) ||
die "die($msg): sendmail: $!\n" ;
print SENDMAIL <<"EOF" ;
To: $Maintainer
More information about the inn-committers
mailing list