diff --git a/pgpverify b/pgpverify index e703ae4..92b673d 100755 --- a/pgpverify +++ b/pgpverify @@ -1,6 +1,13 @@ #! /usr/bin/perl -w -# written April 1996, tale@uunet.uu.net (David C Lawrence) -# Version 1.5 +# written April 1996, tale@isc.org (David C Lawrence) +# Version 1.6 +# +# Changes from 1.5 -> 1.6 +# -- handle articles encoded in NNTP format ('.' starting line is doubled, +# \r\n at line end) by string NNTP encoding. +# -- exit 255 with pointer to $HOME or $PGPPATH if pgp can't find key ring. +# (probably doesn't match the necessary error message with ViaCrypt PGP) +# -- failures also report message-id so the article can be looked up to retry. # # Changes from 1.4 -> 1.5 # -- force English lanugage for 'Good signature from user' by passing @@ -34,7 +41,12 @@ $0 =~ s(^.*/)(); # trim /path/to/prog to prog # this is, by design, case-sensitive with regards to the headers it checks. # it's also insistent about the colon-space rule. while (<>) { - chop; + # if a header line ends with \r\n, this article is in the encoding + # it would be in during an NNTP session. some article storage + # managers keep them this way for efficiency. + $nntp_format = /\r\n$/ if $. == 1; + s/\r?\n$//; + last if /^$/; if (/^(\S+):[ \t](.+)/) { ($label, $value) = ($1, $2); @@ -81,6 +93,12 @@ foreach $label (split(",", $signed_headers)) { $message .= "\n"; # end of headers while (<>) { # read body lines + if ($nntp_format) { + # remove NNTP encoding + s/^\.\./\./; + s/\r\n$/\n/; + } + s/^-/- -/; # pgp quote ("ASCII armor") dashes $message .= $_; # append to output string } @@ -117,6 +135,8 @@ while () { $signer = $+; } elsif (/^Bad signature /) { $ok = 3; + } elsif (/Keyring file '(.*)' does not exist/) { + &fail("$0: couldn't access $1. Bad \$HOME or \$PGPPATH?\n"); } } close(PGP) || warn "$0: closing pgp pipe returned status $?\n"; @@ -131,6 +151,8 @@ fail { unlink($tmp); print STDERR $_[0]; + print STDERR " ... while processing $header{'Message-ID'}\n" + if $header{'Message-ID'}; exit 255; }