diff --git a/ChangeLog b/ChangeLog index 1500766..8851f28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ yapfaq 1.1.0 (unreleased) * --test: Force -o if -n is not set. * Add conversion script for old status files. * Accept a posting-frequency of "never", too. + * Check for illegal headers and stop posting, if found. yapfaq 1.0.1 (2025-01-24) * Add %t placeholder for Message-ID (feature parity with 0.9). diff --git a/bin/yapfaq.pl b/bin/yapfaq.pl index eebe9b7..11494cc 100755 --- a/bin/yapfaq.pl +++ b/bin/yapfaq.pl @@ -412,6 +412,17 @@ sub BuildPosting { return ''; } + # check for illegal headers + my $FoundIllegalHeader = 0; + foreach (qw/Date User-Agent X-Newsreader X-Mailer Injection-Date + Injection-Info NNTP-Posting-Date NNTP-Posting-Host X-Trace/) { + if ($Header{lc($_)}) { + warn "W: $_ header may not be set in '$HeaderFile'.\n"; + $FoundIllegalHeader = 1; + } + } + return '' if $FoundIllegalHeader; + # add Date: push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n"; # add missing Message-ID: