[Rt-commit] rt branch, 4.2/smime-gnupg-on-fastcgi, created. rt-4.2.0-15-g4ef0d83

Alex Vandiver alexmv at bestpractical.com
Fri Oct 4 13:23:47 EDT 2013


The branch, 4.2/smime-gnupg-on-fastcgi has been created
        at  4ef0d833a4dbd3dbbc219312875b93e653894ec1 (commit)

- Log -----------------------------------------------------------------
commit c62970b5b6d9e6f3f0303d9d7a54f9bf3883b6ba
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Oct 2 12:14:35 2013 -0400

    Set RejectOnUnencrypted explicitly, for fastcgi tests
    
    Fiddling the config at runtime does not propagate to the
    RT_SiteConfig.pm file on disk, which is what the fastcgi tests use.
    Using the explicit config argument to the test module properly
    configures the Crypt setting in the fastcgi child.

diff --git a/t/mail/smime/reject_on_unencrypted.t b/t/mail/smime/reject_on_unencrypted.t
index 8987a7d..f8d61ad 100644
--- a/t/mail/smime/reject_on_unencrypted.t
+++ b/t/mail/smime/reject_on_unencrypted.t
@@ -1,15 +1,13 @@
 use strict;
 use warnings;
 
-use RT::Test::SMIME tests => undef;
+use RT::Test::SMIME tests => undef, config => 'Set( %Crypt, RejectOnUnencrypted => 1 );';
 my $test = 'RT::Test::SMIME';
 
 use IPC::Run3 'run3';
 use String::ShellQuote 'shell_quote';
 use RT::Tickets;
 
-RT->Config->Get('Crypt')->{'RejectOnUnencrypted'} = 1;
-
 my ($url, $m) = RT::Test->started_ok;
 ok $m->login, "logged in";
 

commit d89e28cf61e70f70c2eae6527d6b2263e2b0a779
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Oct 2 15:45:50 2013 -0400

    Include the $PATH in the GnuPG/SMIME error message, and suggest a full path

diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 44d6518..265b48a 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -1843,8 +1843,8 @@ sub Probe {
         my $path = File::Which::which( $bin );
         unless ($path) {
             $RT::Logger->warning(
-                "Can't find gpg binary '$bin' in PATH; GnuPG support has been disabled.  ".
-                "Check the 'GnuPG' configuration in %GnuPG");
+                "Can't find gpg binary '$bin' in PATH ($ENV{PATH}); GnuPG support has been disabled.  ".
+                "You may need to specify a full path to gpg via the 'GnuPG' configuration in %GnuPG");
             return 0;
         }
         $self->GnuPGPath( $bin = $path );
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index cb05e33..ff29763 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -166,8 +166,8 @@ sub Probe {
         my $path = File::Which::which( $bin );
         unless ($path) {
             $RT::Logger->warning(
-                "Can't find openssl binary '$bin' in PATH; SMIME support has been disabled.  ".
-                "Check the 'OpenSSL' configuration in %OpenSSL");
+                "Can't find openssl binary '$bin' in PATH ($ENV{PATH}); SMIME support has been disabled.  ".
+                "You may need to specify a full path to opensssl via the 'OpenSSL' configuration in %OpenSSL");
             return 0;
         }
         $self->OpenSSLPath( $bin = $path );

commit 4ef0d833a4dbd3dbbc219312875b93e653894ec1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Oct 3 19:00:38 2013 -0400

    Provide a default PATH in cases where it is unset (mod_fastcgi)
    
    mod_fastcgi, by default, spawns fastcgi children with no environment --
    including PATH.  In such cases, it is still possible to spawn
    subprocesses without absolute paths: namely, if called via a subshell,
    /bin/sh uses a compiled-in default $PATH, which varies per OS and
    shell:
    
     Linux bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
     OS X bash:  /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
     Linux zsh:  /bin:/usr/bin:/usr/ucb:/usr/local/bin
    
    If the shell is skipped, and there is no PATH set, execvp(3) uses a
    _different_ hardcoded default:
    
      Linux: .:/bin:/usr/bin
      OS X:  /usr/bin:/bin
    
    File::Which is unaware of these two layers of varying defaults, and thus
    fails to locate gnupg or openssl, despite that system() would likely
    find them in /usr/bin.  As such, gpg or smime support is improperly
    disabled in configurations where it worked previously.
    
    To mimic the previous functionality, hard-code a default PATH in cases
    where it is unset (not just empty), using the default value taken from
    linux bash.

diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 265b48a..7a02277 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -1840,6 +1840,8 @@ sub Probe {
             return 0;
         }
     } else {
+        local $ENV{PATH} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+            unless defined $ENV{PATH};
         my $path = File::Which::which( $bin );
         unless ($path) {
             $RT::Logger->warning(
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index ff29763..7f59b14 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -163,6 +163,8 @@ sub Probe {
             return 0;
         }
     } else {
+        local $ENV{PATH} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+            unless defined $ENV{PATH};
         my $path = File::Which::which( $bin );
         unless ($path) {
             $RT::Logger->warning(

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


More information about the Rt-commit mailing list