X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=caff%2Fpgp-fixkey;h=03d126e56046b2834d56272f43a420d75a2b1894;hb=96137d78cc59f874fd894a60fe1b006bfe9aecdf;hp=5d179fe8fe5a9b7c3d7903dfff0dc6f9a6d8740f;hpb=ec0266d96dbf732c6e0c262cf1c0e2d6784c1bc9;p=pgp-tools.git diff --git a/caff/pgp-fixkey b/caff/pgp-fixkey index 5d179fe..03d126e 100755 --- a/caff/pgp-fixkey +++ b/caff/pgp-fixkey @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# pgp-clean -- remove all non-self signatures from key +# pgp-fixkey -- remove broken packets from keys # $Id$ # # Copyright (c) 2004, 2005 Peter Palfrader @@ -262,10 +262,12 @@ if (scalar @KEYIDS == 0) { if ($type eq 'pub') { $thiskey = $keyid; debug("Found key $thiskey"); + } elsif (!defined $thiskey) { + next; } elsif ($type eq 'sig' || $type eq 'rev') { - if (($keyid eq '0' x 16) && ($created == 0)) { - push @KEYIDS, $thiskey if defined $thiskey; - info("Adding $thiskey"); + if (($keyid eq '0' x 16) || ($created == 0)) { + push @KEYIDS, $thiskey; + info("Key $thiskey needs cleaning."); $thiskey = undef; }; }; @@ -353,8 +355,8 @@ for my $keyid (@KEYIDS) { if (defined $line) { # only if we found a sig here - we never remove revocation packets for instance debug("[sigremoval] doing line $line."); my (undef, undef, undef, undef, $signer, $created, undef, undef, undef) = split /:/, $line; - if ($signer eq ('0' x 16)) { - debug("[sigremoval] not interested in that sig ($signer)."); + if (($signer eq '0' x 16) || ($created == 0)) { + debug("[sigremoval] not interested in that sig ($signer, created: $created)."); $answer = "yes"; }; } else {