[Rt-commit] r8997 - rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt

ruz at bestpractical.com ruz at bestpractical.com
Tue Sep 11 18:41:57 EDT 2007


Author: ruz
Date: Tue Sep 11 18:41:57 2007
New Revision: 8997

Modified:
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm

Log:
* workaround gnupg's wierd behaviour, --list-keys command report calculated trust levels
  for any model except 'always', so you can change models and see changes, but not for 'always'
  we try to handle it in a simple way - we set ultimate trust for any key with trust
  level >= 0 if trust model is 'always'


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	Tue Sep 11 18:41:57 2007
@@ -1680,6 +1680,8 @@
 sub ParseKeysInfo {
     my @lines = @_;
 
+    my %gpg_opt = RT->Config->Get('GnuPGOptions');
+
     my @res = ();
     foreach my $line( @lines ) {
         chomp $line;
@@ -1692,8 +1694,21 @@
                 Created Expire Empty OwnerTrustChar
                 Empty Empty Capabilities Other
             ) } = split /:/, $line, 12;
+
+            # workaround gnupg's wierd behaviour, --list-keys command report calculated trust levels
+            # for any model except 'always', so you can change models and see changes, but not for 'always'
+            # we try to handle it in a simple way - we set ultimate trust for any key with trust
+            # level >= 0 if trust model is 'always'
+            my $always_trust;
+            $always_trust = 1 if exists $gpg_opt{'always-trust'};
+            $always_trust = 1 if exists $gpg_opt{'trust-model'} && $gpg_opt{'trust-model'} eq 'always';
             @info{qw(Trust TrustTerse TrustLevel)} = 
                 _ConvertTrustChar( $info{'TrustChar'} );
+            if ( $always_trust && $info{'TrustLevel'} >= 0 ) {
+                @info{qw(Trust TrustTerse TrustLevel)} = 
+                    _ConvertTrustChar( 'u' );
+            }
+
             @info{qw(OwnerTrust OwnerTrustTerse OwnerTrustLevel)} = 
                 _ConvertTrustChar( $info{'OwnerTrustChar'} );
             $info{ $_ } = _ParseDate( $info{ $_ } )


More information about the Rt-commit mailing list