[Rt-commit] r7585 - in rt/branches/3.7-EXPERIMENTAL: etc

clkao at bestpractical.com clkao at bestpractical.com
Fri Apr 20 12:30:02 EDT 2007


Author: clkao
Date: Fri Apr 20 12:30:01 2007
New Revision: 7585

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

Log:
Actually sign as the key associated with the queue.

Modified: rt/branches/3.7-EXPERIMENTAL/etc/RT_SiteConfig.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/etc/RT_SiteConfig.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/etc/RT_SiteConfig.pm	Fri Apr 20 12:30:01 2007
@@ -1,18 +1,22 @@
-# Any configuration directives you include  here will override 
-# RT's default configuration file, RT_Config.pm
-#
-# To include a directive here, just copy the equivalent statement
-# from RT_Config.pm and change the value. We've included a single
-# sample value below.
-#
-# This file is actually a perl module, so you can include valid
-# perl code, as well.
-#
-# The converse is also true, if this file isn't valid perl, you're
-# going to run into trouble. To check your SiteConfig file, use
-# this comamnd:
-#
-#   perl -c /path/to/your/etc/RT_SiteConfig.pm
 
 Set( $rtname, 'example.com');
+Set( $WebPort , 11235);
+Set( $WebBaseURL , "http://localhost:$WebPort");
+
+   $RTIR_CONFIG_FILE = $RT::LocalEtcPath."/IR/RTIR_Config.pm";
+
+   require $RTIR_CONFIG_FILE
+     || die ("Couldn't load RTIR config file '$RTIR_CONFIG_FILE'\n$@");
+
+Set( %GnuPG,
+    Enable => 1,
+    OutgoingMessagesFormat => 'RFC', # Inline
+);
+
+
+Set(%GnuPGOptions, homedir => '/home/clkao/.gnupg');
+Set(@MailPlugins, 'Auth::GnuPGNG');
+
+
 1;
+

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	Fri Apr 20 12:30:01 2007
@@ -98,10 +98,13 @@
     my $gnupg = new GnuPG::Interface;
     my %opt = RT->Config->Get('GnuPGOptions');
     $opt{'digest-algo'} ||= 'SHA1';
+    # address of the queue
+    my $sign_as = (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
     $gnupg->options->hash_init(
         _PrepareGnuPGOptions( %opt ),
         armor => 1,
         meta_interactive => 0,
+        default_key => $sign_as,
     );
 
     my %res;
@@ -126,7 +129,7 @@
             close $handle{'input'};
             waitpid $pid, 0;
         };
-
+	my $err = $@;
         my @signature = readline $handle{'output'};
         close $handle{'output'};
 
@@ -139,8 +142,8 @@
         $RT::Logger->debug( $res{'status'} ) if $res{'status'};
         $RT::Logger->warning( $res{'error'} ) if $res{'error'};
         $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
-        if ( $@ || $? ) {
-            $res{'message'} = $@? $@: "gpg exitted with error code ". ($? >> 8);
+        if ( $err || $res{'exit_code'} ) {
+            $res{'message'} = $err? $err : "gpg exitted with error code ". ($res{'exit_code'} >> 8);
             return %res;
         }
 


More information about the Rt-commit mailing list