[Pgp-tools-commit] r835 - trunk/caff

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Wed Feb 17 21:42:27 UTC 2016


Author: guilhem-guest
Date: 2016-02-17 21:42:27 +0000 (Wed, 17 Feb 2016)
New Revision: 835

Modified:
   trunk/caff/caff
Log:
wibble

Modified: trunk/caff/caff
===================================================================
--- trunk/caff/caff	2016-02-17 21:42:23 UTC (rev 834)
+++ trunk/caff/caff	2016-02-17 21:42:27 UTC (rev 835)
@@ -1287,12 +1287,13 @@
 # and in the key files specified by the user if not all of the keys have been
 # found.
 #
-sub import_keys_to_sign() {
+sub import_keys_to_sign($) {
+    my $keyids = shift;
     # Check if we can find the gpg key from our normal gnupghome, and then
     # try to import it into our working gnupghome directory
     if ($CONFIG{'keys-from-gnupg'}) {
-        my @failed = import_keys_from_gnupghome(\@KEYIDS, undef, $GNUPGHOME);
-        foreach my $keyid (@KEYIDS) {
+        my @failed = import_keys_from_gnupghome($keyids, undef, $GNUPGHOME);
+        foreach my $keyid (@$keyids) {
             info("Key $keyid imported from your normal GnuPGHOME", 1)
                 unless grep { $keyid eq $_ } @failed;
         }
@@ -1491,15 +1492,12 @@
 # import own keys and keys to sign
 ##################################
 import_keys_from_gnupghome($CONFIG{'keyid'}, undef, $GNUPGHOME);
-import_keys_to_sign();
+import_keys_to_sign(\@KEYIDS);
 
 #############################
 # receive keys from keyserver
 #############################
-my @keyids_ok;
-if ($CONFIG{'no-download'}) {
-    @keyids_ok = @KEYIDS;
-} else {
+unless ($CONFIG{'no-download'}) {
     notice("Fetching keys from a keyserver this may take a while...");
     my @args = (extra_args => ['--keyserver='.$CONFIG{'keyserver'}]) if defined $CONFIG{'keyserver'};
     my $gpg = mkGnuPG( homedir => $GNUPGHOME, @args );
@@ -1514,6 +1512,7 @@
     # [GNUPG:] IMPORT_OK 0 25FC1614B8F87B52FF2F99B962AF4031C82E0039
     my %local_keyids = map { $_ => 1 } @KEYIDS;
     my $had_v3_keys = 0;
+    @KEYIDS = ();
     while (readline $handles->{status}) {
         if (/^\[GNUPG:\] IMPORT_OK \d+ ([0-9A-F]{40})$/) {
             my $imported_key = $1;
@@ -1530,7 +1529,7 @@
             };
             debug ("Imported $imported_key for $speced_key");
             delete $local_keyids{$speced_key};
-            unshift @keyids_ok, $imported_key;
+            unshift @KEYIDS, $imported_key;
         } elsif (/^\[GNUPG:\] IMPORT_OK \d+ ([0-9A-F]{32})$/) {
             my $imported_key = $1;
             mywarn("Imported v3 key $1.  Version 3 keys are obsolete, should not be used, and are not and will not be properly supported.");
@@ -1549,7 +1548,7 @@
         } else {
             mywarn("Assuming ". (join ' ', keys %local_keyids)." are fine keyids");
         };
-        push @keyids_ok, keys %local_keyids;
+        push @KEYIDS, keys %local_keyids;
     }
 };
 
@@ -1560,7 +1559,7 @@
 @LOCAL_USER = get_local_user_keys() unless $CONFIG{'no-sign'};
 
 my %KEYS;
-for my $keyid (@keyids_ok) {
+for my $keyid (@KEYIDS) {
     # get key listing (and ensure there is no collision)
     ####################################################
     my $gpg = mkGnuPG( homedir => $GNUPGHOME, extra_args => ['--with-fingerprint', '--with-colons'] );
@@ -1622,7 +1621,7 @@
 }
 
 
-for my $keyid (@keyids_ok) {
+for my $keyid (@KEYIDS) {
     next unless exists $KEYS{$keyid};
     my $longkeyid = $KEYS{$keyid}->{longkeyid};
 
@@ -1846,7 +1845,7 @@
 #############
 # send emails
 #############
-for my $keyid (@keyids_ok) {
+for my $keyid (@KEYIDS) {
     next unless exists $KEYS{$keyid};
     my $longkeyid = $KEYS{$keyid}->{longkeyid};
     my $can_encrypt = $KEYS{$keyid}->{flags} =~ /E/;




More information about the Pgp-tools-commit mailing list