[Rt-commit] r8809 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Tue Aug 28 14:48:13 EDT 2007
Author: ruz
Date: Tue Aug 28 14:48:11 2007
New Revision: 8809
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
Log:
r8760 at cubic-pc (orig r8759): sartak | 2007-08-28 21:01:28 +0400
r37480 at onn: sartak | 2007-08-28 13:01:12 -0400
Provide an easy way of checking just how trustworthy a key is
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 Aug 28 14:48:11 2007
@@ -1618,6 +1618,8 @@
) } = split /:/, $line, 12;
$info{'Trust'} = _ConvertTrustChar( $info{'TrustChar'} );
$info{'OwnerTrust'} = _ConvertTrustChar( $info{'OwnerTrustChar'} );
+ $info{'TrustLevel'} = _ConvertTrustLevel( $info{'TrustChar'} );
+ $info{'OwnerTrustLevel'} = _ConvertTrustLevel( $info{'OwnerTrustChar'} );
$info{ $_ } = _ParseDate( $info{ $_ } )
foreach qw(Created Expire);
push @res, \%info;
@@ -1630,6 +1632,7 @@
Empty Empty KeyCapabilities Other
) } = split /:/, $line, 12;
$info{'OwnerTrust'} = _ConvertTrustChar( $info{'OwnerTrustChar'} );
+ $info{'OwnerTrustLevel'} = _ConvertTrustLevel( $info{'OwnerTrustChar'} );
$info{ $_ } = _ParseDate( $info{ $_ } )
foreach qw(Created Expire);
push @res, \%info;
@@ -1664,6 +1667,23 @@
f => "The key is fully trusted", #loc
u => "The key is ultimately trusted", #loc
);
+
+ my %level = (
+ d => 0,
+ r => 0,
+ e => 0,
+ n => 0,
+
+ # err on the side of caution
+ o => 0,
+ '-' => 0,
+ q => 0,
+
+ m => 2,
+ f => 3,
+ u => 4,
+ );
+
sub _ConvertTrustChar {
my $value = shift;
return $mapping{'-'} unless $value;
@@ -1671,6 +1691,14 @@
$value = substr $value, 0, 1;
return $mapping{ $value } || $mapping{'o'};
}
+
+ sub _ConvertTrustLevel {
+ my $value = shift;
+ return $level{'-'} unless $value;
+
+ $value = substr $value, 0, 1;
+ return $level{ $value } || $level{'o'};
+ }
}
sub _ParseDate {
More information about the Rt-commit
mailing list