+ let caff import keys from file, thanks Jon Aslund (Closes: #318744).
authorkink-guest <kink-guest@b513b33f-fedd-0310-b452-c3deb5f4c849>
Wed, 27 Jul 2005 10:14:30 +0000 (10:14 +0000)
committerkink-guest <kink-guest@b513b33f-fedd-0310-b452-c3deb5f4c849>
Wed, 27 Jul 2005 10:14:30 +0000 (10:14 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@149 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/caff
debian/changelog

index 35739f0cb8d6eaa62066f0252b8a01dd9e6e2f1a..7583720ee6fdd18bc9d2dc80cfa93ad8bf1d84c9 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -85,6 +85,10 @@ Do not sign the keys.
 
 Select the key that is used for signing, in case you have more than one key.
 
 
 Select the key that is used for signing, in case you have more than one key.
 
+=item B<--key-file> I<file>
+
+Import keys from file. Can be supplied more than once.
+
 =back
 
 =head1 FILES
 =back
 
 =head1 FILES
@@ -169,6 +173,10 @@ Keyserver to download keys from.  Default: B<subkeys.pgp.net>.
 If true, then skip the step of fetching keys from the keyserver.
 Default: B<0>.
 
 If true, then skip the step of fetching keys from the keyserver.
 Default: B<0>.
 
+=item B<key-files> [list of files]
+
+A list of files containing keys to be imported.
+
 =head2 Signing settings
 
 =item B<no-sign> [boolean]
 =head2 Signing settings
 
 =item B<no-sign> [boolean]
@@ -282,6 +290,7 @@ sub load_config() {
        $CONFIG{'secret-keyring'} = $ENV{'HOME'}.'/.gnupg/secring.gpg' unless defined $CONFIG{'secret-keyring'};
        $CONFIG{'no-download'} = 0 unless defined $CONFIG{'no-download'};
        $CONFIG{'no-sign'} = 0 unless defined $CONFIG{'no-sign'};
        $CONFIG{'secret-keyring'} = $ENV{'HOME'}.'/.gnupg/secring.gpg' unless defined $CONFIG{'secret-keyring'};
        $CONFIG{'no-download'} = 0 unless defined $CONFIG{'no-download'};
        $CONFIG{'no-sign'} = 0 unless defined $CONFIG{'no-sign'};
+       $CONFIG{'key-files'} = () unless defined $CONFIG{'key-files'};
        $CONFIG{'mail-template'} = <<'EOM' unless defined $CONFIG{'mail-template'};
 Hi,
 
        $CONFIG{'mail-template'} = <<'EOM' unless defined $CONFIG{'mail-template'};
 Hi,
 
@@ -717,6 +726,7 @@ if (!GetOptions (
        '--no-download'   =>  \$params->{'no-download'},
        '-S'              =>  \$params->{'no-sign'},
        '--no-sign'       =>  \$params->{'no-sign'},
        '--no-download'   =>  \$params->{'no-download'},
        '-S'              =>  \$params->{'no-sign'},
        '--no-sign'       =>  \$params->{'no-sign'},
+       '--key-file=s@'   =>  \$params->{'key-files'},
        )) {
        usage(\*STDERR, 1);
 };
        )) {
        usage(\*STDERR, 1);
 };
@@ -758,6 +768,7 @@ $CONFIG{'no-download'} = $params->{'no-download'} if defined $params->{'no-downl
 $CONFIG{'no-mail'}     = $params->{'no-mail'}     if defined $params->{'no-mail'};
 $CONFIG{'mail'}        = $params->{'mail'}        if defined $params->{'mail'};
 $CONFIG{'no-sign'}     = $params->{'no-sign'}     if defined $params->{'no-sign'};
 $CONFIG{'no-mail'}     = $params->{'no-mail'}     if defined $params->{'no-mail'};
 $CONFIG{'mail'}        = $params->{'mail'}        if defined $params->{'mail'};
 $CONFIG{'no-sign'}     = $params->{'no-sign'}     if defined $params->{'no-sign'};
+push @{$CONFIG{'key-files'}}, @{$params->{'key-files'}} if defined $params->{'key-files'};
 
 
 #################
 
 
 #################
@@ -793,6 +804,24 @@ for my $keyid (@{$CONFIG{'keyid'}}) {
        }
 }
 
        }
 }
 
+########################
+# import keys from files
+########################
+foreach my $keyfile (@{$CONFIG{'key-files'}}) {
+    my $gpg = GnuPG::Interface->new();
+    $gpg->call( $CONFIG{'gpg'} );
+    $gpg->options->hash_init('homedir' => $GNUPGHOME);
+    $gpg->options->meta_interactive( 0 );
+    my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds();
+    my $pid = $gpg->import_keys(handles => $handles, command_args => $keyfile);
+    my ($stdout, $stderr, $status) = readwrite_gpg('', $inputfd, $stdoutfd, $stderrfd, $statusfd);
+    info ("Importing keys from $keyfile");
+    waitpid $pid, 0;
+    if ($status !~ /^\[GNUPG:\] IMPORT_OK/m) {
+       warn $stderr;
+    }
+}
+
 #############################
 # receive keys from keyserver
 #############################
 #############################
 # receive keys from keyserver
 #############################
index e25973851901b92ffaaa5552dac2da05024616e0..0cfd10d28cdac4d67472ddb822445236974d8b5d 100644 (file)
@@ -12,9 +12,10 @@ signing-party (0.4.1-XXX) unreleased; urgency=low
      + allows to BCC the signer, thanks Joost van Baal (Closes: #316176).
      + new option to pause before continuing to the signing step,
        thanks Christof Douma (Closes: #316129).
      + allows to BCC the signer, thanks Joost van Baal (Closes: #316176).
      + new option to pause before continuing to the signing step,
        thanks Christof Douma (Closes: #316129).
-     + Create unique attachment filenames, thanks Robin H. Johnson
+     + create unique attachment filenames, thanks Robin H. Johnson
        (Closes: #318469).
        (Closes: #318469).
-     + Improve error when using xargs, thanks Lior Kaplan (Closes: #319519).
+     + improve error when using xargs, thanks Lior Kaplan (Closes: #319519).
+     + let caff import keys from file, thanks Jon �slund (Closes: #318744).
   * Depend on libtext-template-perl as caff needs it.
   * Update to Standards-Version 3.6.2, no changes necessary.
 
   * Depend on libtext-template-perl as caff needs it.
   * Update to Standards-Version 3.6.2, no changes necessary.