[Rt-commit] rt branch, 4.2/smime-v2, updated. rt-4.0.4-358-g623b66a

Jason May jasonmay at bestpractical.com
Tue Jan 10 16:52:23 EST 2012


The branch, 4.2/smime-v2 has been updated
       via  623b66aefde668a533b5327d6af2324c223185d7 (commit)
       via  241745187584d4c0d029231ebd3d531df7651b63 (commit)
      from  7d822511400bd08e5e13de699c0be872984988d8 (commit)

Summary of changes:
 lib/RT/Interface/Email/Auth/Crypt.pm |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 241745187584d4c0d029231ebd3d531df7651b63
Author: Jason May <jasonmay at bestpractical.com>
Date:   Tue Jan 10 11:17:03 2012 -0500

    Factor sending templated errors for convenient future use

diff --git a/lib/RT/Interface/Email/Auth/Crypt.pm b/lib/RT/Interface/Email/Auth/Crypt.pm
index 38cee41..5ee30fb 100644
--- a/lib/RT/Interface/Email/Auth/Crypt.pm
+++ b/lib/RT/Interface/Email/Auth/Crypt.pm
@@ -257,7 +257,6 @@ sub CheckBadData {
 }
 
 sub EmailErrorToSender {
-    my $self = shift;
     my %args = (@_);
 
     $args{'Arguments'} ||= {};
@@ -271,7 +270,7 @@ sub EmailErrorToSender {
         InReplyTo => $args{'Message'},
     );
     unless ( $status ) {
-        $RT::Logger->error("Couldn't send 'Error: bad GnuPG data'");
+        $RT::Logger->error("Couldn't send '$args{'Template'}''");
     }
     return 0;
 }

commit 623b66aefde668a533b5327d6af2324c223185d7
Author: Jason May <jasonmay at bestpractical.com>
Date:   Tue Jan 10 16:46:13 2012 -0500

    Error and abort if an unencrypted message is received in Strict mode
    
    A templated reply is sent and the ticket creation is aborted when Strict
    is set in the config.

diff --git a/lib/RT/Interface/Email/Auth/Crypt.pm b/lib/RT/Interface/Email/Auth/Crypt.pm
index 5ee30fb..3c9c957 100644
--- a/lib/RT/Interface/Email/Auth/Crypt.pm
+++ b/lib/RT/Interface/Email/Auth/Crypt.pm
@@ -133,9 +133,19 @@ sub GetCurrentUser {
         AddStatus => 1,
     );
     if ( $status && !@res ) {
-        $args{'Message'}->head->replace(
-            'X-RT-Incoming-Encryption' => 'Not encrypted'
-        );
+        if (RT->Config->Get('Crypt')->{'Strict'}) {
+            EmailErrorToSender(
+                %args,
+                Template  => 'NotEncryptedMessage',
+                Arguments => { Message  => $args{'Message'} },
+            );
+            return (-1, 'rejected because the message is unencrypted with Strict mode enabled');
+        }
+        else {
+            $args{'Message'}->head->replace(
+                'X-RT-Incoming-Encryption' => 'Not encrypted'
+            );
+        }
         return 1;
     }
 

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


More information about the Rt-commit mailing list