[Rt-commit] rt branch, 3.999-trunk, updated. b15a0418eb6d16f48a07362a0aa8125760339803

sartak at bestpractical.com sartak at bestpractical.com
Mon Dec 14 12:26:23 EST 2009


The branch, 3.999-trunk has been updated
       via  b15a0418eb6d16f48a07362a0aa8125760339803 (commit)
      from  959cb6b27d2b407c6ec709072a77ef248b4c8441 (commit)

Summary of changes:
 lib/RT/Action/CreateTicket.pm |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit b15a0418eb6d16f48a07362a0aa8125760339803
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 14 12:25:20 2009 -0500

    First cut of encrypted message recipient validation

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 1eaa16f..79477fb 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -238,6 +238,35 @@ sub validate_sign_using {
     return $self->validation_ok('sign');
 }
 
+sub validate_encrypt {
+    my $self  = shift;
+    my $crypt = shift;
+
+    return if !$crypt;
+
+    # XXX: this is ugly and broken for multiple recipients
+    my @recipients = map { $self->argument_value($_) }
+                     $self->role_group_parameters;
+
+    my %seen;
+    @recipients = grep !$seen{ lc $_ }++, @recipients;
+
+    RT::Crypt::GnuPG::use_key_for_encryption(
+        map { (/^UseKey-(.*)$/)[0] => $self->argument_value($_) }
+        grep $self->argument_value($_) && /^UseKey-/,
+        keys %{ $self->arguments },
+    );
+
+    my ($ok, @issues) = RT::Crypt::GnuPG::check_recipients( @recipients );
+    push @{ $self->{'GnuPGRecipientsKeyIssues'} ||= [] }, @issues;
+    if ($ok) {
+        return $self->validation_ok('encrypt');
+    }
+    else {
+        return $self->validation_error(encrypt => 'xxx');
+    }
+}
+
 sub select_key_for_encryption {
     my $self    = shift;
     my $email   = shift;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list