Fix the -test switch to actually do something. Improve date generation
when logging to standard output.
This commit is contained in:
parent
84b8608d2c
commit
c7a080b58a
1 changed files with 13 additions and 3 deletions
16
pgpverify
16
pgpverify
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# written April 1996, tale@isc.org (David C Lawrence)
|
# written April 1996, tale@isc.org (David C Lawrence)
|
||||||
# Currently maintained by Russ Allbery <rra@stanford.edu>
|
# Currently maintained by Russ Allbery <rra@stanford.edu>
|
||||||
# Version 1.24, 2003-10-05
|
# Version 1.25, 2003-12-10
|
||||||
#
|
#
|
||||||
# NOTICE TO INN MAINTAINERS: The version that is shipped with INN is the
|
# NOTICE TO INN MAINTAINERS: The version that is shipped with INN is the
|
||||||
# same as the version that I make available to the rest of the world
|
# same as the version that I make available to the rest of the world
|
||||||
|
@ -16,6 +16,10 @@
|
||||||
# me about it; I want to know what old versions of Perl are still used in
|
# me about it; I want to know what old versions of Perl are still used in
|
||||||
# practice.
|
# practice.
|
||||||
#
|
#
|
||||||
|
# Changes from 1.24 -> 1.25
|
||||||
|
# -- Fix the -test switch to actually do something.
|
||||||
|
# -- Improve date generation when logging to standard output.
|
||||||
|
#
|
||||||
# Changes from 1.23 -> 1.24
|
# Changes from 1.23 -> 1.24
|
||||||
# -- Fix bug in the recognition of wire-format articles.
|
# -- Fix bug in the recognition of wire-format articles.
|
||||||
#
|
#
|
||||||
|
@ -185,9 +189,10 @@ use vars qw($gpgv $pgp $keyring $tmp $tmpdir $lockdir $syslog_method
|
||||||
use Fcntl qw(O_WRONLY O_CREAT O_EXCL);
|
use Fcntl qw(O_WRONLY O_CREAT O_EXCL);
|
||||||
use FileHandle;
|
use FileHandle;
|
||||||
use IPC::Open3 qw(open3);
|
use IPC::Open3 qw(open3);
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
# Turn on test mode if the first argument is '-test'.
|
# Turn on test mode if the first argument is '-test'.
|
||||||
if ($1 && $1 eq '-test') {
|
if (@ARGV && $ARGV[0] eq '-test') {
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
$test = 1;
|
$test = 1;
|
||||||
}
|
}
|
||||||
|
@ -224,6 +229,10 @@ my ($nntp_format, $header, $dup) = &parse_header();
|
||||||
exit 1 unless $$header{'X-PGP-Sig'};
|
exit 1 unless $$header{'X-PGP-Sig'};
|
||||||
my ($message, $signature, $version)
|
my ($message, $signature, $version)
|
||||||
= &generate_message($nntp_format, $header, $dup);
|
= &generate_message($nntp_format, $header, $dup);
|
||||||
|
if ($test) {
|
||||||
|
print "-----MESSAGE-----\n$message\n-----END MESSAGE-----\n\n";
|
||||||
|
print "-----SIGNATURE-----\n$signature\n-----SIGNATURE-----\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
# The call to pgp needs to be locked because it tries to both read and
|
# The call to pgp needs to be locked because it tries to both read and
|
||||||
# write a file named randseed.bin but doesn't do its own locking as it
|
# write a file named randseed.bin but doesn't do its own locking as it
|
||||||
|
@ -455,6 +464,7 @@ sub pgp_verify {
|
||||||
my $signer;
|
my $signer;
|
||||||
my $ok = 255;
|
my $ok = 255;
|
||||||
while (<$output>) {
|
while (<$output>) {
|
||||||
|
print if $test;
|
||||||
if ($pgpstyle eq 'GPG') {
|
if ($pgpstyle eq 'GPG') {
|
||||||
if (/\[GNUPG:\]\s+GOODSIG\s+\S+\s+(\S+)/) {
|
if (/\[GNUPG:\]\s+GOODSIG\s+\S+\s+(\S+)/) {
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
|
@ -500,7 +510,7 @@ sub errmsg {
|
||||||
|
|
||||||
my $date = '';
|
my $date = '';
|
||||||
if ($log_date) {
|
if ($log_date) {
|
||||||
($date = localtime) =~ s/\d{4}\n//;
|
$date = strftime ('%Y-%m-%d %T ', localtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($syslog_method && $] >= 5.006) {
|
if ($syslog_method && $] >= 5.006) {
|
||||||
|
|
Loading…
Reference in a new issue