[Rt-commit] r8981 - in rt/branches/3.7-EXPERIMENTAL: . lib/RT
lib/RT/Crypt t/web
sartak at bestpractical.com
sartak at bestpractical.com
Mon Sep 10 16:03:23 EDT 2007
Author: sartak
Date: Mon Sep 10 16:03:22 2007
New Revision: 8981
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey
rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
Log:
r42489 at onn: sartak | 2007-09-10 16:03:08 -0400
Use fingerprint, not key ID, as a handle on keys (fingerprints uniquely determine a key, IDs don't)
Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey Mon Sep 10 16:03:22 2007
@@ -50,7 +50,7 @@
% } else {
<select name="PreferredKey">
% foreach my $key (@keys) {
-<option value="<% $key->{'Key'} %>"><% $key->{'Key'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
+<option value="<% $key->{'Fingerprint'} %>"><% $key->{'Fingerprint'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
% }
</select>
% }
@@ -62,7 +62,7 @@
my %res = RT::Crypt::GnuPG::GetKeysInfo($EmailAddress);
# move the preferred key to the top of the list
my @keys = map {
- $_->{'Key'} eq $Default
+ $_->{'Fingerprint'} eq $Default
? do { $d = $_; () }
: $_
}
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 Mon Sep 10 16:03:22 2007
@@ -1599,8 +1599,7 @@
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$opt{'with-colons'} = undef; # parseable format
- # Not sure if we need it
- # $opt{'fingerprint'} = undef; # show fingerprint
+ $opt{'fingerprint'} = undef; # show fingerprint
$opt{'fixed-list-mode'} = undef; # don't merge uid with keys
$gnupg->options->hash_init(
_PrepareGnuPGOptions( %opt ),
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm Mon Sep 10 16:03:22 2007
@@ -1636,12 +1636,12 @@
return undef if @keys == 0;
if (@keys == 1) {
- $prefkey = $keys[0]->{'Key'};
+ $prefkey = $keys[0]->{'Fingerprint'};
}
else {
# prefer the maximally trusted key
@keys = sort { $b->{'TrustLevel'} <=> $a->{'TrustLevel'} } @keys;
- $prefkey = $keys[0]->{'Key'};
+ $prefkey = $keys[0]->{'Fingerprint'};
}
$self->SetAttribute(Name => 'PreferredKey', Content => $prefkey);
Modified: rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t (original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t Mon Sep 10 16:03:22 2007
@@ -388,32 +388,35 @@
);
# test key selection
+my $key1 = "EC1E81E7DC3DB42788FB0E4E9FA662C06DE22FC2";
+my $key2 = "75E156271DCCF02DDD4A7A8CDF651FA0632C4F50";
+
ok($user = RT::User->new($RT::SystemUser));
ok($user->Load('root'), "Loaded user 'root'");
-is($user->PreferredKey, "9FA662C06DE22FC2", "preferred key is set correctly");
+is($user->PreferredKey, $key1, "preferred key is set correctly");
$m->get("$baseurl/Prefs/Other.html");
like($m->content, qr/Preferred key/, "preferred key option shows up in preference");
# XXX: mech doesn't let us see the current value of the select, apparently
-like($m->content, qr/9FA662C06DE22FC2/, "first key shows up in preferences");
-like($m->content, qr/DF651FA0632C4F50/, "second key shows up in preferences");
-like($m->content, qr/9FA662C06DE22FC2.*?DF651FA0632C4F50/s, "first key shows up before the second");
+like($m->content, qr/$key1/, "first key shows up in preferences");
+like($m->content, qr/$key2/, "second key shows up in preferences");
+like($m->content, qr/$key1.*?$key2/s, "first key shows up before the second");
$m->form_number(3);
-$m->select("PreferredKey" => "DF651FA0632C4F50");
+$m->select("PreferredKey" => $key2);
$m->submit;
ok($user = RT::User->new($RT::SystemUser));
ok($user->Load('root'), "Loaded user 'root'");
-is($user->PreferredKey, "DF651FA0632C4F50", "preferred key is set correctly to the new value");
+is($user->PreferredKey, $key2, "preferred key is set correctly to the new value");
$m->get("$baseurl/Prefs/Other.html");
like($m->content, qr/Preferred key/, "preferred key option shows up in preference");
# XXX: mech doesn't let us see the current value of the select, apparently
-like($m->content, qr/DF651FA0632C4F50/, "second key shows up in preferences");
-like($m->content, qr/9FA662C06DE22FC2/, "first key shows up in preferences");
-like($m->content, qr/DF651FA0632C4F50.*?9FA662C06DE22FC2/s, "second key (now preferred) shows up before the first");
+like($m->content, qr/$key2/, "second key shows up in preferences");
+like($m->content, qr/$key1/, "first key shows up in preferences");
+like($m->content, qr/$key2.*?$key1/s, "second key (now preferred) shows up before the first");
# test that the new fields work
$m->get("$baseurl/Search/Simple.html?q=General");
More information about the Rt-commit
mailing list