Compare commits

..

5 commits

Author SHA1 Message Date
66435ceda0 Update POD.
Signed-off-by: Thomas Hochstein <thh@thh.name>
2026-02-07 19:21:03 +01:00
cc881f7897 Warn of unencoded 8bit characters in header or body if -d is set.
Signed-off-by: Thomas Hochstein <thh@thh.name>
2026-02-07 19:20:10 +01:00
1e7bccbbec Disabled projects must be posted, if forced.
Signed-off-by: Thomas Hochstein <thh@thh.name>
2026-02-07 18:59:38 +01:00
3801b61d77 Check for illegal headers and stop posting.
Signed-off-by: Thomas Hochstein <thh@thh.name>
2026-02-07 18:53:42 +01:00
41d307a2fe Accept a posting-frequency of "never", too.
Signed-off-by: Thomas Hochstein <thh@thh.name>
2026-02-07 18:48:27 +01:00
2 changed files with 38 additions and 4 deletions

View file

@ -2,6 +2,11 @@ yapfaq 1.1.0 (unreleased)
* --test: Set Supersedes and don't modify Message-ID if -o is set. * --test: Set Supersedes and don't modify Message-ID if -o is set.
* --test: Force -o if -n is not set. * --test: Force -o if -n is not set.
* Add conversion script for old status files. * Add conversion script for old status files.
* Accept a posting-frequency of "never", too.
* Check for illegal headers and stop posting, if found.
* Disabled projects must be posted, if forced.
* Warn of unencoded 8bit characters in header or body if -d is set.
* Update POD.
yapfaq 1.0.1 (2025-01-24) yapfaq 1.0.1 (2025-01-24)
* Add %t placeholder for Message-ID (feature parity with 0.9). * Add %t placeholder for Message-ID (feature parity with 0.9).

View file

@ -412,6 +412,17 @@ sub BuildPosting {
return ''; 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: # add Date:
push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n"; push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
# add missing Message-ID: # add missing Message-ID:
@ -419,6 +430,16 @@ sub BuildPosting {
# add User-Agent # add User-Agent
push @Headers, "User-Agent: $NAME/$VERSION\n"; push @Headers, "User-Agent: $NAME/$VERSION\n";
# check for unencoded 8bit characters in header or body in --debug mode
# taken from tinews.pl
if ($Config{'debug'}) {
print "- Raw 8-bit data in headers.\n" if (grep {/[\x80-\xff]/} @Headers);
# check for MIME headers and warn for 8bit characters in body if missing
if (!defined($Header{'mime-version'}) || !defined($Header{'content-type'})) {
print "- 8bit data in body without MIME-headers.\n" if (grep {/[\x80-\xff]/} @Body);
}
}
# parse pseudo headers from body # parse pseudo headers from body
my ($InRealBody,$LastModified,$PostingFrequency); my ($InRealBody,$LastModified,$PostingFrequency);
foreach (@Body) { foreach (@Body) {
@ -515,8 +536,8 @@ sub BuildPosting {
} }
} }
# not due if Posting-Freqency is "none" # not due if Posting-Freqency is "none" or never
if ($PostingFrequency =~ /none/) { if ($PostingFrequency =~ /none|never/ && !$OptForce) {
print "... is disabled.\n" if $Config{'verbose'} or $Config{'debug'}; print "... is disabled.\n" if $Config{'verbose'} or $Config{'debug'};
return ''; return '';
} }
@ -740,7 +761,14 @@ files need to be in B<datadir>.
Needs to have at least I<From:>, I<Subject:> and I<Newsgroups:> and Needs to have at least I<From:>, I<Subject:> and I<Newsgroups:> and
can contain all other headers that the posting should have. Headers can contain all other headers that the posting should have. Headers
must conform to RFC 5536 and RFC 5322 and use MIME encoded words for must conform to RFC 5536 and RFC 5322 and use MIME encoded words for
8bit characters. B<yapfaq> won't convert headers. 8bit characters. B<yapfaq> won't convert headers, but will warn of
unencoded 8bit characters in B<--debug> mode. Longer headers should
be folded; B<yapfaq> won't fold headers.
The headers file must not contain any of the following headers:
I<Date:>, I<User-Agent:>, I<X-Newsreader:>, I<X-Mailer:>,
I<Injection-Date:>, I<Injection-Info:>, I<NNTP-Posting-Date:>,
I<NNTP-Posting-Host:> or I<X-Trace:>.
I<Subject:> may contain a I<%LM> placeholder that will be replaced I<Subject:> may contain a I<%LM> placeholder that will be replaced
with the I<Last-modified:> pseudo-header from the text file with the I<Last-modified:> pseudo-header from the text file
@ -802,7 +830,8 @@ I<Last-modified:> and I<Posting-frequency> will be evaluated by
B<yapfaq>. B<yapfaq>.
If your content contains 8bit characters, you'll need suitable MIME If your content contains 8bit characters, you'll need suitable MIME
headers in your headers file. headers in your headers file. B<yapfaq> will warn of unencoded 8bit
characters with missung MIME headers in B<--debug> mode.
B<Example text file with pseudo-headers> B<Example text file with pseudo-headers>