[Rt-commit] rt branch, 3.8/perlcritic-gnupg, updated. rt-3.8.10-191-g1547dbf
Alex Vandiver
alexmv at bestpractical.com
Thu Jul 28 21:10:50 EDT 2011
The branch, 3.8/perlcritic-gnupg has been updated
via 1547dbfce547ec10a186cdc2cc9afff4cb821430 (commit)
via 0bee65ff05e9ff1dd7090eda512ece0f18a9fcbe (commit)
via 4914847da2e5180255f1329cb3348a45de9795cf (commit)
via 251a0f60b9ebf8938d809ab567110658e861f2a0 (commit)
from 14202ebc7a27c639c217a2dce5301180cd01719a (commit)
Summary of changes:
lib/RT/Crypt/GnuPG.pm | 56 +++++++++++++++++++++++++-----------------------
lib/RT/Test.pm | 4 +-
2 files changed, 31 insertions(+), 29 deletions(-)
- Log -----------------------------------------------------------------
commit 251a0f60b9ebf8938d809ab567110658e861f2a0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jul 27 13:36:06 2011 -0400
Rename Key to Signer for clarity and consistency
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 6f410ee..81001af 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -369,7 +369,7 @@ my %supported_opt = map { $_ => 1 } qw(
sub CallGnuPG {
my %args = (
Options => undef,
- Key => undef,
+ Signer => undef,
Recipients => [],
Passphrase => undef,
@@ -404,7 +404,7 @@ sub CallGnuPG {
);
$gnupg->options->armor( 1 );
$gnupg->options->meta_interactive( 0 );
- $gnupg->options->default_key( $args{Key} );
+ $gnupg->options->default_key( $args{Signer} );
my %seen;
$gnupg->options->push_recipients( $_ ) for
@@ -414,7 +414,7 @@ sub CallGnuPG {
$args{Passphrase} = $GnuPGOptions{passphrase}
unless defined $args{'Passphrase'};
- $args{Passphrase} = GetPassphrase( Address => $args{Key} )
+ $args{Passphrase} = GetPassphrase( Address => $args{Signer} )
unless defined $args{'Passphrase'};
$gnupg->passphrase( $args{'Passphrase'} );
@@ -566,7 +566,7 @@ sub SignEncryptRFC3156 {
my @signature;
%res = CallGnuPG(
- Key => $args{'Signer'},
+ Signer => $args{'Signer'},
Method => "detach_sign",
Handles => { stdin => IO::Handle::CRLF->new },
Direct => [],
@@ -599,7 +599,7 @@ sub SignEncryptRFC3156 {
$entity->make_multipart( 'mixed', Force => 1 );
%res = CallGnuPG(
- Key => $args{'Signer'},
+ Signer => $args{'Signer'},
Recipients => \@recipients,
Method => ( $args{'Sign'} ? "sign_and_encrypt" : "encrypt" ),
Handles => { stdout => $tmp_fh },
@@ -671,7 +671,7 @@ sub _SignEncryptTextInline {
my $entity = $args{'Entity'};
my %res = CallGnuPG(
- Key => $args{'Signer'},
+ Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Method => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
@@ -712,7 +712,7 @@ sub _SignEncryptAttachmentInline {
binmode $tmp_fh, ':raw';
my %res = CallGnuPG(
- Key => $args{'Signer'},
+ Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Method => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
@@ -765,7 +765,7 @@ sub SignEncryptContent {
binmode $tmp_fh, ':raw';
my %res = CallGnuPG(
- Key => $args{'Signer'},
+ Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Method => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
commit 4914847da2e5180255f1329cb3348a45de9795cf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jul 27 13:38:09 2011 -0400
Rename Method to Command for clarity; "--foo" is not a "method"
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 81001af..8ee49ed 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -373,7 +373,7 @@ sub CallGnuPG {
Recipients => [],
Passphrase => undef,
- Method => undef,
+ Command => undef,
CommandArgs => [],
Content => undef,
@@ -390,7 +390,7 @@ sub CallGnuPG {
%handle = %$handle_list;
my $content = $args{Content};
- my $method = $args{Method};
+ my $command = $args{Command};
my %GnuPGOptions = RT->Config->Get('GnuPGOptions');
my %opt = (
@@ -421,14 +421,14 @@ sub CallGnuPG {
eval {
local $SIG{'CHLD'} = 'DEFAULT';
my $pid = safe_run_child {
- if ($method =~ /^--/) {
+ if ($command =~ /^--/) {
$gnupg->wrap_call(
handles => $handles,
- commands => [$method],
+ commands => [$command],
command_args => $args{CommandArgs},
);
} else {
- $gnupg->$method(
+ $gnupg->$command(
handles => $handles,
command_args => $args{CommandArgs},
);
@@ -567,7 +567,7 @@ sub SignEncryptRFC3156 {
my @signature;
%res = CallGnuPG(
Signer => $args{'Signer'},
- Method => "detach_sign",
+ Command => "detach_sign",
Handles => { stdin => IO::Handle::CRLF->new },
Direct => [],
Passphrase => $args{'Passphrase'},
@@ -601,7 +601,7 @@ sub SignEncryptRFC3156 {
%res = CallGnuPG(
Signer => $args{'Signer'},
Recipients => \@recipients,
- Method => ( $args{'Sign'} ? "sign_and_encrypt" : "encrypt" ),
+ Command => ( $args{'Sign'} ? "sign_and_encrypt" : "encrypt" ),
Handles => { stdout => $tmp_fh },
Passphrase => $args{'Passphrase'},
Content => $entity->parts(0),
@@ -673,7 +673,7 @@ sub _SignEncryptTextInline {
my %res = CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
- Method => ( $args{'Sign'} && $args{'Encrypt'}
+ Command => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
: ( $args{'Sign'}
? 'clearsign'
@@ -714,7 +714,7 @@ sub _SignEncryptAttachmentInline {
my %res = CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
- Method => ( $args{'Sign'} && $args{'Encrypt'}
+ Command => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
: ( $args{'Sign'}
? 'detach_sign'
@@ -767,7 +767,7 @@ sub SignEncryptContent {
my %res = CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
- Method => ( $args{'Sign'} && $args{'Encrypt'}
+ Command => ( $args{'Sign'} && $args{'Encrypt'}
? 'sign_and_encrypt'
: ( $args{'Sign'}
? 'clearsign'
@@ -1013,7 +1013,7 @@ sub VerifyAttachment {
$tmp_fh->flush;
return CallGnuPG(
- Method => "verify",
+ Command => "verify",
CommandArgs => [ '-', $tmp_fn ],
Passphrase => $args{'Passphrase'},
Content => $args{'Signature'}->bodyhandle,
@@ -1029,7 +1029,7 @@ sub VerifyRFC3156 {
$tmp_fh->flush;
return CallGnuPG(
- Method => "verify",
+ Command => "verify",
CommandArgs => [ '-', $tmp_fn ],
Passphrase => $args{'Passphrase'},
Content => $args{'Signature'}->bodyhandle,
@@ -1054,7 +1054,7 @@ sub DecryptRFC3156 {
binmode $tmp_fh, ':raw';
my %res = CallGnuPG(
- Method => "decrypt",
+ Command => "decrypt",
Handles => { stdout => $tmp_fh },
Passphrase => $args{'Passphrase'},
Content => $args{'Data'}->bodyhandle,
@@ -1178,7 +1178,7 @@ sub _DecryptInlineBlock {
binmode $tmp_fh, ':raw';
my %res = CallGnuPG(
- Method => "decrypt",
+ Command => "decrypt",
Handles => { stdout => $tmp_fh, stdin => $args{'BlockHandle'} },
Passphrase => $args{'Passphrase'},
);
@@ -1240,7 +1240,7 @@ sub DecryptContent {
binmode $tmp_fh, ':raw';
my %res = CallGnuPG(
- Method => "decrypt",
+ Command => "decrypt",
Handles => { stdout => $tmp_fh },
Passphrase => $args{'Passphrase'},
Content => $args{'Content'},
@@ -1793,7 +1793,7 @@ sub GetKeysInfo {
'fingerprint' => undef, # show fingerprint
'fixed-list-mode' => undef, # don't merge uid with keys
},
- Method => $method,
+ Command => $method,
( $email ? (CommandArgs => [$email]) : () ),
Output => \@info,
);
@@ -1957,7 +1957,7 @@ sub DeleteKey {
my $key = shift;
return CallGnuPG(
- Method => "--delete-secret-and-public-key",
+ Command => "--delete-secret-and-public-key",
CommandArgs => [$key],
Callback => sub {
my %handle = @_;
@@ -1974,7 +1974,7 @@ sub ImportKey {
my $key = shift;
return CallGnuPG(
- Method => "import_keys",
+ Command => "import_keys",
Content => $key,
);
}
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 1d685ef..91c9766 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -909,7 +909,7 @@ sub lsign_gnupg_key {
require RT::Crypt::GnuPG;
return RT::Crypt::GnuPG::CallGnuPG(
- Method => '--lsign-key',
+ Command => '--lsign-key',
CommandArgs => [$key],
Callback => sub {
my %handle = @_;
@@ -929,7 +929,7 @@ sub trust_gnupg_key {
require RT::Crypt::GnuPG;
return RT::Crypt::GnuPG::CallGnuPG(
- Method => '--edit-key',
+ Command => '--edit-key',
CommandArgs => [$key],
Callback => sub {
my %handle = @_;
commit 0bee65ff05e9ff1dd7090eda512ece0f18a9fcbe
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jul 27 14:08:02 2011 -0400
Only set the defualt key if we actually have one
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 8ee49ed..bf07b4f 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -404,7 +404,8 @@ sub CallGnuPG {
);
$gnupg->options->armor( 1 );
$gnupg->options->meta_interactive( 0 );
- $gnupg->options->default_key( $args{Signer} );
+ $gnupg->options->default_key( $args{Signer} )
+ if defined $args{Signer};
my %seen;
$gnupg->options->push_recipients( $_ ) for
commit 1547dbfce547ec10a186cdc2cc9afff4cb821430
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jul 27 14:11:29 2011 -0400
Only set the passphrase if we have one
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index bf07b4f..f6c57aa 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -417,7 +417,8 @@ sub CallGnuPG {
unless defined $args{'Passphrase'};
$args{Passphrase} = GetPassphrase( Address => $args{Signer} )
unless defined $args{'Passphrase'};
- $gnupg->passphrase( $args{'Passphrase'} );
+ $gnupg->passphrase( $args{'Passphrase'} )
+ if defined $args{Passphrase};
eval {
local $SIG{'CHLD'} = 'DEFAULT';
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list