[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.12-158-g0329053

Shawn Moore shawn at bestpractical.com
Mon Jul 11 17:56:06 EDT 2016


The branch, 4.2-trunk has been updated
       via  03290531c157f9a26a73bc2c915e672c12e2ed80 (commit)
      from  e588dbcf58ead4345ffb6f95fec8be3b01ccf173 (commit)

Summary of changes:
 lib/RT/Interface/Email.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 03290531c157f9a26a73bc2c915e672c12e2ed80
Author: Christian Loos <cloos at netcologne.de>
Date:   Wed Jul 6 09:12:11 2016 +0200

    fix fetching user for MailCommand mbox
    
    With fastcgi deploys, %ENV doesn't have a USER key.
    Use getpwuid here to fetch the user.
    
    This fixes warnings:
    Use of uninitialized value $ENV{"USER"} in concatenation (.) or string

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 0c060d6..039c0a8 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -523,7 +523,8 @@ sub SendEmail {
         }
         my $content = $args{Entity}->stringify;
         $content =~ s/^(>*From )/>$1/mg;
-        print $fh "From $ENV{USER}\@localhost  ".localtime()."\n";
+        my $user = $ENV{USER} || getpwuid($<);
+        print $fh "From $user\@localhost  ".localtime()."\n";
         print $fh $content, "\n";
         close $fh;
     } else {

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


More information about the rt-commit mailing list