Check for illegal headers and stop posting.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2026-02-07 18:48:57 +01:00
parent 41d307a2fe
commit 3801b61d77
2 changed files with 12 additions and 0 deletions

View file

@ -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: